0

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??

1

You identify a block with either blockHash, which is the hash of the block, or blockNumber, 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?

  • "are generated even if there are no transactions in them" Why this happens?? I mean what is the reason behind creation of empty blocks and is there any use of them – SwapnilKumbhar May 10 '17 at 8:03
  • 1
    It's probably mostly because these systems are ported from public blockchains. In a public blockchain empty blocks help by extending the number of confirmations of transactions in previous blocks, making them less likely to be reversed. And there are nearly always transactions in any case, and even if there weren't the miner would still want their block reward. On private blockchains they're arguably less useful - I know of one implementation, Hydrachain, that only makes blocks if there are transactions. – Edmund Edgar May 10 '17 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.