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.
1 Answer
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. Sep 26, 2018 at 12:23