I'm currently trying to make a transaction using subxt tool.

I could generate tx with test sr25519 keyring (Alice, Bob, ...), but I'm not sure I can do this with my account on rococo testnet.

I made my account and got a faucet for testing, but I'm stuck making PairSigner.

From this example https://github.com/paritytech/subxt/blob/master/examples/examples/balance_transfer.rs, I'm trying to make a signer with the account.

I've searched all possible ways (from_string, from_phrase, ...) but they didn't work for me. (Maybe I misused them)

Below code is my example to make a signer. (account_seed is 12 words seed)

let pair = crypto::Pair::from_string(&config.account_seed, Some(&config.account_password)).unwrap();
let signer = PairSigner::new(pair);

Thank you for any advice or solutions.

3 Answers 3


Have a look at How to generate a new account with seed using rust?, which talks about generating a new Pair from a seed.

When that's been generated, you can do let signer = PairSigner::new(pair); as you have done to make use of it in Subxt!


I recommend you use from_seed or from_seed_slice.


  1. from_seed takes a [u8; 32].
  2. from_seed_slice takes a &[u8] (but you should make sure it is 32 bytes-length).

The seed is the private key to your account.

Let's use subkey:

subkey generate
Secret phrase:       palm clinic heavy fat saddle trophy right twenty deputy deal cotton enact
  Network ID:        substrate
  Secret seed:       0x9e963df48eb2aeb329ff7a03991ac20a93130e619130a8431ce02bbee2b0a4ea
  Public key (hex):  0xe64810dc55abb26dafcca141c4766f87a0fa532e0a18beac1dc7290d2c3dd57e
  Account ID:        0xe64810dc55abb26dafcca141c4766f87a0fa532e0a18beac1dc7290d2c3dd57e
  Public key (SS58): 5HGeH7iX1xqiRm5tsgyz1uU6haS2VqvstGJfj15p4fWduyN3
  SS58 Address:      5HGeH7iX1xqiRm5tsgyz1uU6haS2VqvstGJfj15p4fWduyN3

0x9e963df48eb2aeb329ff7a03991ac20a93130e619130a8431ce02bbee2b0a4ea is what you need here.


If you are still having issues, I got a compiling implementation after a long time of searching for an example using a hex-encoded seed.

I posted it as an answer to another issue here, but what I did was simply use the re-exported structs from subxt as seen below:

use subxt::ext::sp_core::Pair;
use subxt::tx::PairSigner;


pub async fn something() -> Result<(), Box<dyn Error>> {


    let pair = subxt::ext::sp_core::sr25519::Pair::from_string_with_seed(<'0x'-PREFIXED PRIVATE SEED>, Some(<PASSWORD>)).unwrap();
    let signer: PairSigner<SubstrateConfig, subxt::ext::sp_core::sr25519::Pair> = PairSigner::<SubstrateConfig, subxt::ext::sp_core::sr25519::Pair>::new(pair.0);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.