Skip to main content

How to Query Transaction State

Upon broadcasting a transaction using the send_transaction RPC, you will receive a transaction hash (txhash), which only indicates that the transaction has been sent to the network, NOT necessarily that it has been verified on-chain.

To query the transaction state, use the get_transaction RPC. Remember, send_transaction operates asynchronously.

For more details on the CKB JSON-RPC send_transaction method, visit the list of CKB RPC methods.

Example: Query With JSON-RPC

{
"id": 42,
"jsonrpc": "2.0",
"method": "get_transaction",
"params": [
"0xa0ef4eb5f4ceeb08a4c8524d84c5da95dce2f608e0ca2ec8091191b0f330c6e3"
]
}

Example: Query With Lumos JavaScript SDK

const txHash = await rpc.sendTransaction(tx, "passthrough");
const state = await rpc.getTransaction(txHash);