Portal
Search…
eth_getTransaction
Get transaction by its hash
1
web3.eth.getTransaction(transactionHash [, callback])
Copied!

Parameters

    1.
    The transaction hash.
    2.
    (optional) Optional callback, returns an error object as first parameter and the result as second.

Returns

A transaction object its hash transactionHash:
    hash: Hash of the transaction.
    nonce: The number of transactions made by the sender prior to this one.
    blockHash: Hash of the block where this transaction was in. null if pending.
    blockNumber: Block number where this transaction was in. null if pending.
    transactionIndex: Integer of the transactions index position in the block. null if pending.
    from: Address of the sender.
    to: Address of the receiver. null if it’s a contract creation transaction.
    value: Value transferred in wei.
    gasPrice: Gas price provided by the sender in wei.
    gas : Gas provided by the sender.
    input : The data sent along with the transaction.
    chainId : chain ID of the current connected node
    creates
    piblicKey
    r: First 32 bytes of the signature
    rawThe RLP encoded transaction
    s: Next 32 bytes of the signature
    standardV
    v: Recovery value + 27

Example

1
web3.eth.getTransaction('0xe4cb9e145ecefdcccdb033989cef9f371f146a6e3a884b97f4766cc9e7a9d6fe').then(console.log)
2
> {
3
blockHash: '0xad92691ed2094fcd96d8b7c9afbf5f0516afe786ef3682f40c175bc3038dc04b',
4
blockNumber: 73198,
5
chainId: '0x539',
6
creates: '0x2b6c183c31235f64d954f21105fef3e451a1c57b',
7
from: '0x063eBCD1dB02320814Acc0721e65f14b8755Ff41',
8
gas: 246904,
9
gasPrice: '1000000000',
10
hash: '0xe4cb9e145ecefdcccdb033989cef9f371f146a6e3a884b97f4766cc9e7a9d6fe',
11
input: '0x608060405234801561001057600080fd5b506040518060400160405280600781526020017f6d7956616c7565000000000000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b61030f806101166000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80634ed3885e1461003b5780636d4ce63c146100f6575b600080fd5b6100f46004803603602081101561005157600080fd5b810190808035906020019064010000000081111561006e57600080fd5b82018360208201111561008057600080fd5b803590602001918460018302840111640100000000831117156100a257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610179565b005b6100fe610193565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806000908051906020019061018f929190610235565b5050565b606060008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561022b5780601f106102005761010080835404028352916020019161022b565b820191906000526020600020905b81548152906001019060200180831161020e57829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061027657805160ff19168380011785556102a4565b828001600101855582156102a4579182015b828111156102a3578251825591602001919060010190610288565b5b5090506102b191906102b5565b5090565b6102d791905b808211156102d35760008160009055506001016102bb565b5090565b9056fea265627a7a723158209f9d9ab8ca3378404a8af028da3bb61aa36dd8b9e4847ae0c51ce64fbb32b8b164736f6c63430005110032',
12
nonce: 10,
13
publicKey: '0xcddc4fbba9625085aa0facaa028c31b8d78cb554848d18c3d946328b60af60e8a77813a41bde38217bb5745c157e6bc10cd40f41358902e1b916549952f746db',
14
r: '0x5723a09fa84a50d5caa4bb995bc22cca68d1fc680bdb46f6d8e500a5e3464587',
15
raw: '0xf904790a843b9aca008303c4788080b90425608060405234801561001057600080fd5b506040518060400160405280600781526020017f6d7956616c7565000000000000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b61030f806101166000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80634ed3885e1461003b5780636d4ce63c146100f6575b600080fd5b6100f46004803603602081101561005157600080fd5b810190808035906020019064010000000081111561006e57600080fd5b82018360208201111561008057600080fd5b803590602001918460018302840111640100000000831117156100a257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610179565b005b6100fe610193565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b806000908051906020019061018f929190610235565b5050565b606060008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561022b5780601f106102005761010080835404028352916020019161022b565b820191906000526020600020905b81548152906001019060200180831161020e57829003601f168201915b5050505050905090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061027657805160ff19168380011785556102a4565b828001600101855582156102a4579182015b828111156102a3578251825591602001919060010190610288565b5b5090506102b191906102b5565b5090565b6102d791905b808211156102d35760008160009055506001016102bb565b5090565b9056fea265627a7a723158209f9d9ab8ca3378404a8af028da3bb61aa36dd8b9e4847ae0c51ce64fbb32b8b164736f6c63430005110032820a96a05723a09fa84a50d5caa4bb995bc22cca68d1fc680bdb46f6d8e500a5e3464587a05bd5d104e1b22f0b34f428996a22d5cd2050d14b6772bec2573c88a6ddc42d81',
16
s: '0x5bd5d104e1b22f0b34f428996a22d5cd2050d14b6772bec2573c88a6ddc42d81',
17
standardV: '0x1',
18
to: null,
19
transactionIndex: 0,
20
v: '0xa96',
21
value: '0'
22
}
Copied!
Last modified 9mo ago
Copy link