I'm new to block chain technology. I'm trying to store and read blocks using testRPC along web3.js. I'm able to get the latest block data but not able to fetch previous blocks data. Please some one tell me how can I get it.


You can use:

web3.eth.getBlock(blockHashOrBlockNumber [, returnTransactionObjects] [, callback])

checkout web3 documentation: https://web3js.readthedocs.io/en/1.0/web3-eth.html#getblock

  • I've already tried this. This gives the details of the block with hashes but not the actual data. – vijayraj34 Sep 26 '18 at 12:23

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.