Optimism — eth (2/2)
API reference for Optimism. All methods ->
Part 2 of 2: 1 · 2
eth_getTransactionByHash
Retrieves preconfirmed transactions by hash.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<string>(required): the hash of the transaction to retrieve.
Returns
The transaction object if found (including when present in a Flashblock preconfirmation); null if the transaction is unknown.
Request example
curl -X POST https://rpc.ankr.com/optimism/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0xd309dcddf89e471a710094cc28be86f66566ae5cd7162ce1f7a3c45df65772d4"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"type": "0x2",
"chainId": "0xaa37dc",
"nonce": "0x34c",
"gas": "0x28e07",
"maxFeePerGas": "0x596830f4",
"maxPriorityFeePerGas": "0x59682f00",
"to": "0xa374602fdccb9807d834598f0b2e2fa9c14646f7",
"value": "0x2386f26fc10000",
"accessList": [],
"input": "0xa28d34940000000000000000000000000000000000000000000000000000000000000140082cee98f9a18608826f76ecfbf227b79cd652eb44572300b9880260b9ed137e00000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000009d4b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000b64db3a171752f235e7156ba6590771c4a9358fb29aabec29925d19149012125ce17d62a67fcac8d5950f9dd33cb615b3470d059000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000000510100000000000000ca00009d4b000000000000000000000000000000000000000000000000000000000000000100009d28000000000000000000000000b64db3a171752f235e7156ba6590771c4a9358fb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412fb2113f9109b2fb642f4e25acab3f5b3faf03b291c24d3cc7901169eb8e198e67944d2f1e00932877505a9202b40a79f0cd175d30b3c670bf0adbef4a99294f1c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000f0970f5bb0968746d77fb3dcecf480bd414e06ed00000000000013880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"r": "0x659374c64f58415582526fa3ad1d0ea977b3a7852c3d22a139a50b548db02230",
"s": "0x7b64cfcfa0cc294f6ba90a0779f3c15bb0375acf73dfbaeec116e4915eddee1c",
"yParity": "0x0",
"v": "0x0",
"hash": "0xd309dcddf89e471a710094cc28be86f66566ae5cd7162ce1f7a3c45df65772d4",
"blockHash": "0xe6c8a925882b5e982909257ec838d202d14dba64489420a1db09a33966c134e2",
"blockNumber": "0x1ec2753",
"transactionIndex": "0x1",
"from": "0xf0970f5bb0968746d77fb3dcecf480bd414e06ed",
"gasPrice": "0x59682ffa"
}
}