getrawtransaction
Look up a transaction by its txid.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 0 | txid |
string (64-char hex) | yes | Transaction identifier. |
| 1 | verbose |
boolean or integer | no | false/0 (default) → raw hex; true/1 → decoded JSON object. |
| 2 | blockhash |
string (64-char hex) | no | Restrict the lookup to a specific block. Useful if the node is pruned. |
Returns
- When
verboseis false: a hex string — the serialized transaction bytes. - When
verboseis true: an object with the decoded transaction (txid, hash, version, locktime, vin / vout arrays, size, sigops count, plusconfirmations/blockhash/blocktimewhen the transaction is mined).
Example — hex return
curl https://solidpeer.io/bchn/mainnet/<token> \
-H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"getrawtransaction","params":["<txid>"]}'
{ "jsonrpc": "2.0", "id": 1, "result": "0100000001..." }
Example — decoded return
curl https://solidpeer.io/bchn/mainnet/<token> \
-H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"getrawtransaction","params":["<txid>", true]}'
{
"jsonrpc": "2.0", "id": 1,
"result": {
"txid": "...", "hash": "...", "version": 2, "size": 226, "locktime": 0,
"vin": [ ... ],
"vout": [ ... ],
"blockhash": "...", "confirmations": 12, "time": 1709000000, "blocktime": 1709000000
}
}
Notes
- Without a
blockhashargument, lookup is limited to mempool + the node's transaction index. The gateway's upstream nodes run with full transaction indexing enabled, so mined-and-pruned-from-mempool txs are still reachable. - If the txid doesn't exist, the response is
error: { code: -5, message: "No such mempool or blockchain transaction. ..." }.
Cost
200 CC on mainnet; 100 CC on testnets/regtest. Verbose form costs the same as the hex form.