1

Could it be possible to submit and extrinsic using JSON-RPC methods.

  1. Say submit a balance_transfer along with its parameters using curl or postman as a JSON-RPC

1 Answer 1

7

Yes, with the RPC request author_submitExtrinsic https://polkadot.js.org/docs/substrate/rpc/#submitextrinsicextrinsic-extrinsic-hash

You have to get the balance_transfer extrinsic signed and you can submit it using the RPC author_submitExtrinsic like this:

curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_submitExtrinsic", "params": ["0xbd0284007e56c7cbacdc5c990244cbf948bf75bd7826b381ba27cb13992f1dbc1d89a905011e7fc91d60f775573b34458da2c1f70d1853b396398e37c446660e7bd2b13a646f37f0a69e4b7aed97e3f7bec342f622d3997ad49acc4ba9c72edd7c2c312988c5012c001e000004d611d9bfe81218fbb6a46c8220c110878ae2c51b98147a8f6ec3134bc76f32000400007e56c7cbacdc5c990244cbf948bf75bd7826b381ba27cb13992f1dbc1d89a90528]}' http://localhost:9933/

You can get the signed extrinsic with PolkadotJS UI.

Go to Developer-> Extrinsic -> balance -> transfer(). Unselect the Sign and Submit option and you will be able to see the signed transaction you will have to use in the RPC. enter image description here

or with the @polkadot/apps library:

const transferBalance = api.tx.balances.transfer(BOB, 10);
const signedExtrinsic = await transferBalance.signAsync(alice).toJSON();

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