This endpoint allows you to retrieve a transaction identified by its ID. If the pending
parameter is set to true, the response may include a pending transaction with a null meta
field. Use this option when you want to retrieve pending transactions, providing flexibility in accessing real-time transaction data.
If no transaction is found, the response will be be a 200
with a null
body.
/transactions/{id}
The transaction ID
0xb6b5b47a5eee8b14e5222ac1bb957c0bbdc3d489850b033e3e544d9ca0cef934
Whether the response should include a raw transaction represented in hexadecimal format.
false
Explicitly define the ID of the head block. Best block is assumed if omitted.
Allows you to indicate whether the response should include transactions that are still pending
false
This endpoint allows you to send a transaction to the blockchain. The transaction must be signed and RLP encoded.
The below is a TypeScript example of how to sign and RLP encode a transaction using the thor-devkit
library:
import { Transaction, secp256k1 } from 'thor-devkit'
const clauses = [{
to: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed',
value: 10000,
data: '0x'
}]
let body: Transaction.Body = {
chainTag: '0x4a',
blockRef: '0x0000000000000000',
expiration: 32,
clauses: clauses,
gasPriceCoef: 128,
gas: Transaction.intrinsicGas(clauses),
dependsOn: null,
nonce: 12345678
}
const tx = new Transaction(body)
const signingHash = tx.signingHash()
tx.signature = secp256k1.sign(signingHash, Buffer.from("99f0500549792796c14fed62011a51081dc5b5e68fe8bd8a13b86be829c4fd36", "hex"))
const raw = tx.encode()
const decoded = Transaction.decode(raw)
axios.post('http://localhost:8669/transactions', {
raw: '0x' + raw.toString('hex')
})
/transactions
The raw RLP encoded transaction.
0xf901854a880104c9cf34b0f5701ef8e7f8e594058d4c951aa24ca012cef3408b259ac1c69d1258890254beb02d1dcc0000b8c469ff936b00000000000000000000000000000000000000000000000000000000ee6c7f95000000000000000000000000167f6cc1e67a615b51b5a2deaba6b9feca7069df000000000000000000000000000000000000000000000000000000000000136a00000000000000000000000000000000000000000000000254beb02d1dcc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080830469978084cb6b32c5c101b88272da83429a49a354f566dd8c85ba288a7c86d1d3161c0aad6a276a7c9f8e69c14df3d76f0d3442a4f4a2a13d016c32c45e82d5010f27386eeb384dee3d8390c0006adead8b8ce8823c583e1ac15facef8f1cc665a707ade82b3c956a53a2b24e0c03d80504bc4b276b5d067b72636d8e88d2ffc65528f868df2cadc716962978a000
^0x[0-9a-f]*$