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#
- Python
- JavaScript
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_queryInfowith the same hex payload.
const tx = api.tx.balances.transferKeepAlive(dest, amount);
const hash = await tx.signAndSend(signer);
console.log('Submitted with hash', hash.toHex());