I am bit confused by the value of "root" I get in transaction receipt
according to my understanding root is the value which points to previous block in block chian,
but when I try to track that block by the value of root it shows null or not found
I have tried following two ways
debug.traceBlockByHash("hash(value of root)")
AND
eth.getTransactionReceipt("hash(value of root)")
but cant track the root block
For reference:-
my transaction receipt
{
blockHash: "0x38745b73aaca70ae40dd4f89e039dd4afb90cf606308701548200d8a757e69be",
blockNumber: 10897,
contractAddress: null,
cumulativeGasUsed: 73966,
from: "0xf0606aab9ed3f89a4167b43ce4eed4ff8f4cc195",
gasUsed: 32855,
logs: [],
logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000",
root: "0x25eba79d41fbe9d11c8a82a2b1629784e80e7c5322832f5386d13b5bd211c8e2",
to: "0x742c8105ba6cfd99ff20ffc19332a9782caecb8a",
transactionHash: "0xb3645970eecb8b2b1e00d2b2f4bff5bab90bbdcb36300ad44348a0e954073f22",
transactionIndex: 1
}
following are the outputs I received
> debug.traceBlockByHash("0x25eba79d41fbe9d11c8a82a2b1629784e80e7c5322832f5386d13b5bd211c8e2")
{
error: "block #25eba79d41fbe9d11c8a82a2b1629784e80e7c5322832f5386d13b5bd211c8e2 not found",
structLogs: null,
validated: false
}
AND
> eth.getTransactionReceipt("0x25eba79d41fbe9d11c8a82a2b1629784e80e7c5322832f5386d13b5bd211c8e2")
null
one more confusing thing is the block number which I see in transaction receipt are not consecutive for consecutive transactions,
ie. If my first transaction receipt has
Block Number: 10849
then the
next one is 10853
next is 10865
how this block number is generated??
Best Answer
You identify a block with either
blockHash
, which is the hash of the block, orblockNumber
, which is the position of the block in the chain. Blocks can contain multiple transactions and are generated even if there are no transactions in them, so they should not be expected to increase in series with your transactions.blockNumber
is sometimes referred to as "height". Watch the console or log output of a node if you want to see blocks getting generated.You can get block information with
eth.getBlock()
. Pass it a block hash or block number.You can get transaction information with
eth.getTransaction()
. Pass it the transaction hash of the transaction you are interested in.eth.getTransactionReceipt()
also expects a transaction hash.You don't need
root
for any of the purposes you mention, but if you're curious what it is, see: What is the 'root' of a transaction receipt?