I was trying to submit items (extrinsics) to my Substrate blockchain instance, but it keeps getting rejected. I use the key pair I generate using from_string function from sp_core::crypto::Pair, but the extrinsics I signed using this key pair does not get submitted to the chain. The key pair that gets generated is the same type from Substrate's/Parity's AccountKeyRing module, but I keep getting InvalidHexString error.

I was able to submit extrinsics signed by AccountKeyring::Bob.pair(). I'm confident the Key Pair I generated is the same type as AccountKeyring::Bob.pair(), but it's not working for me for some reason. The secret phrase I provide to the from_string should be valid because it came from subkey tool

Anyways, I get this error in my external client:

thread 'tokio-runtime-worker' panicked at 'called Result::unwrap() on an Err value: InvalidHexString(InvalidStringLength)', src/services/route_actions/extrinsic_submitters.rs:25:73

The secret phrase I provided to the from_string function are valid since this is generated from subkey tool (NOT USED IN PROD). This is my code snippet

  let priv_key: String = "endorse doctor arch helmet master dragon wild favorite property mercy vault maze".to_owned();
  let from = Pair::from_string(&priv_key[..], None).unwrap();
  //let from = AccountKeyring::Bob.pair();
  let api = Api::new(client).map(|api| api.set_signer(from)).unwrap();
  extrinsic_submitters::submit_to_save_item(api, incoming_item, now, datetime);

This is the code for the submission of the extrinsic I have:

    let xt: UncheckedExtrinsicV4<_> = compose_extrinsic!(
    println!("[+] Composed Extrinsic:\n {:?}\n", xt);
    // send and watch extrinsic until finalized
    let blockh = api.send_extrinsic(xt.hex_encode(), XtStatus::InBlock).unwrap();

the error is thrown at:

let blockh = api.send_extrinsic(xt.hex_encode(), XtStatus::InBlock).unwrap();

This is the subkey tool cmd I used: subkey generate

Secret phrase:       endorse doctor arch helmet master dragon wild favorite property mercy vault maze
  Network ID:        substrate
  Secret seed:       0x78b8fbbbea218509c00d3531e72128d4eae54089f15deb24d721e30b351733ad
  Public key (hex):  0x14e121f6e6cc2891cbbd5f6692e3724672d13e93a3562e3905d4310c2ba1c510
  Account ID:        0x14e121f6e6cc2891cbbd5f6692e3724672d13e93a3562e3905d4310c2ba1c510
  Public key (SS58): 5CY5hAGkTB7RZrouimGJ3S7zTDtnE6yg7z41DHrQeBcoc1PN
  SS58 Address:      5CY5hAGkTB7RZrouimGJ3S7zTDtnE6yg7z41DHrQeBcoc1PN

This is the error I get from my node:

Failed to submit extrinsic: Transaction pool error: Invalid transaction validity: InvalidTransaction::Payment

It looks like there may be multiple reasons why the transaction is invalid, such as too high nonce, not enough funds in the account, and signature is invalid. I generated the keypair item via the info provided by subkey, and the signature should be valid, but I am not certain for sure since the error message is pretty general. My dispatchable function shouldn't cost anything because it has #[pallet::weight(0)]. Any tips how to expand on this InvalidTransaction::Payment error?

  • 1
    AFAIK, you need to pay a transaction fee for signed transactions. Try funding the account you created and see if you get an error.
    – Burak
    Commented Apr 30, 2022 at 17:47
  • Why are you using UncheckedExtrinsicV4? Where are you calling this code? Having the complete source helps with answering this. Commented May 2, 2022 at 11:12
  • @Burak - adding funds to the newly generated key-pair/account worked for me. If you put this comment as the answer, I will accept it. Thank you Commented May 2, 2022 at 18:22
  • @OliverTale-Yazdi - I will try to add more relevant info next time. Sorry about that Commented May 2, 2022 at 18:23

1 Answer 1


As mentioned in the comments, Signed Transactions require transaction fees.

Substrate docs also mentions this.

The transaction pool checks for transaction validity. Note that validity of the transaction is not hard-wired to the transaction pool, but is defined by the runtime. Example validity checks are:

  • Checking if the Transaction Index (nonce) is correct.
  • Checking if the account has enough funds to pay for the associated fees.
  • Checking if the signature is valid.

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.