As following answer for How can I find out what the highest block is? guided: we can get the latest mined block's number and its hash inside geth
as follows.
> eth.syncing.currentBlock
569367
> eth.getBlock(eth.syncing.currentBlock).hash
"0xac51e27c3fe38af1a0aeb2867a741ba6aa16780e435a586d934ccea3a71874b1"
[Q] Inside a smart contract, is it possible to get the latest mined block's number and its hash? or should I keep an array inside my contract and when new block is mined, externally (my_contract.addNewHash(<some_hash>)
) should I put its hash into my array for my contract to read from?
I have tried following keywords from Solidity's website: https://github.com/iurimatias/embark-framework/wiki/Solidity on Solidity Browser and Populus, for example: block.number, block.blockhash
, but I do face with following error:
Untitled:6:17: Error: Expected identifier, got 'Semicolon'
block.number;
Thank you for your valuable time and help.