web3.eth.getTransaction returned null

cronus17cronus17 Posts: 1Member

I'm testing Javascript web3 API and facing some possibly strange results.

FYI, my node info is as below.
api: "0.13.0",
client: "Geth/v1.3.6/windows/go1.5.1",
ethereum: "63",
network: "1",

Some of web3.eth.getTransaction call returns null. Anyone has the same problems?
I would really appreciate if you let me know you know the any reason behind?

1) Normal case
> web3.eth.getBlockTransactionCount(1491825)
> web3.eth.getTransaction('0x1f76a95f4aec92042e9d9444d5f63a9fdc280d1dd3974b2ab17dae58af5e0125')
blockHash: "0x3ee0d0c993b075e7808bea233b5204c8ae8b4ef8094170ff1af2da89aeb08329",
blockNumber: 1491825,
from: "0x4c9aacb6d5169d014e5e300c5d246ce5a3c6b246",
gas: 172566,
gasPrice: 20000000000,
hash: "0x1f76a95f4aec92042e9d9444d5f63a9fdc280d1dd3974b2ab17dae58af5e0125",
input: "0xb61d27f6000000000000000000000000bb9bc244d798123fde783fcc1c72d3bb8c1894130000000000000000
nonce: 15,
to: "0xe76563eb8413ede9b4a1a3c1f3280a95c4b60a33",
transactionIndex: 6,
value: 0
2) abnormal case
> web3.eth.getBlockTransactionCount(1055687)
> web3.eth.getTransaction('0x9166e7a03d96dc9cf1fad6dd1e68a8501e255cefd3f74593b7735c85db236c10')


  • pnagpalpnagpal Posts: 7Member
    I think if the transaction is in pending state (not mined yet), getTransaction (txHash) will return null as a receipt. Once it gets mined, the you should be able to get the receipt. i think its better that you use a callback asynch method on getTransaction wherein you can check if the receipt is null or not.
Sign In or Register to comment.