author_submitExtrinsic
Descriptionā
Broadcasts a signed extrinsic to the node's transaction pool. The node validates the payload before gossiping it to peers.
Parametersā
Position | Type | Description |
---|---|---|
0 | string | SCALE-encoded, signed extrinsic hex |
Returnsā
Type | Description |
---|---|
string | Extrinsic hash if accepted |
Request Exampleā
{
"jsonrpc": "2.0",
"method": "author_submitExtrinsic",
"params": ["0x...signed extrinsic..."],
"id": 1
}
Response Exampleā
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1f6dā¦"
}
Code Examplesā
JavaScript (polkadot.js)ā
const tx = api.tx.balances.transferKeepAlive(dest, amount);
const hash = await tx.signAndSend(signer);
console.log('Submitted with hash', hash.toHex());
Python (py-substrate-interface)ā
substrate = SubstrateInterface(url="wss://api-astar.n.dwellir.com/YOUR_API_KEY", ss58_format=5)
keypair = Keypair.create_from_uri('//Alice')
call = substrate.compose_call(call_module='Balances', call_function='transfer_keep_alive', call_params={'dest': dest, 'value': amount})
extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)
receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
print(receipt.extrinsic_hash)
Tip: For fee estimation before broadcasting, call
payment_queryInfo
with the same hex payload.