I'd like to check a timestamp in a contract against the timestamp of the most recent block via JavaScript in AlethZero.
Is it possible to query the most recent block's timestamp at present? If not is there any strategy for checking this indirectly?
0 ·
Comments
lastBlock
, but that isn't exposed through the JavaScript API.You can use
eth.getTransactions
(POC5) orget.getMessages
to get the most recent block that contained any transactions, but it doesn't seem to return any that don't.An alternative might be to register a callback with
eth.newBlock
and use the javascript timestamp when it gets called. In POC6 this would beeth.watchChain
I'll try eth.newBlock().
Can lastBlock be exposed through the POC6 JS API or is that now frozen?