As the title asks, how do we abstract the raw payload of a transaction created with Polkadot JS?

// set up a tx, e.g. join a nomination pool
const tx = api.tx.nominationPools.join(bond, poolId);

// get raw payload data to sign elsewhere
// tx.???

I guess it should return something similar to the createSigningPayload mentioned in this wiki (very outdated): https://wiki.polkadot.network/docs/build-transaction-construction

so far...

Doing the following creates a bare-bones extrinsic with empty block hash / genesis, and has incomplete data compared to a payload submitted on JS Apps:

const extrinsicPayload = api.registry.createType('ExtrinsicPayload', tx, {
   version: tx.version,

I've determined that each payload property needs to be injected into the above example. I will update to a working example shortly.

1 Answer 1


Solution: The payload needs to be populated and formatted manually. Here is a complete example:


  • era is immortal, meaning the tx will always be valid.
  • method just requires a Call type of your api.query...
  • from is the signer / sender address.
  • Haven't tested this with batching.

const lastHeader = await api.rpc.chain.getHeader();

const nonce = (await api.query.system.account(from)).nonce.toNumber()

const payload = {
  specVersion: api.runtimeVersion.specVersion.toHex(),
  transactionVersion: api.runtimeVersion.transactionVersion.toHex(),
  address: from,
  blockHash: lastHeader.hash.toHex(),
  blockNumber: lastHeader.number.toHex(),
  era: tx.era,
  genesisHash: api.genesisHash.toHex(),
  method: api.createType('Call', tx).toHex(),
  signedExtensions: Object.values(
    api.registry.metadata.extrinsic.signedExtensions.toHuman() || {}
  )?.map((e: any) => e.identifier),
  tip: tx.tip.toHex(),
  version: tx.version,

const raw = api.registry.createType('ExtrinsicPayload', payload);

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.