1

I'm wondering whether anyone has already made a contract and corresponding off-chain service which, once every 30 minutes or so, triggers the contract to record all the block hashes which have gone by since the last time it was called. Seems like it would be useful for a variety of purposes, and cost about $5/day to run, if you only kept the last week or so of hashes and overwrote the stale ones.

1 Answer 1

1

A smart contract doesn't see the network state. It has no knowledge about anything besides the information which is given to it in transactions. Furthermore it can't do anything "on its own" but performs operations only when a transaction triggers them.

So such a service has to be off-chain. There are various services out there which offer (at least) related services but I'm not sure whether they offer exactly what you're looking for. Check for example https://etherscan.io/ and https://www.etherchain.org/

2
  • There's nothing stopping a contract from storing state when it's triggered, though, and the most recent 256 block hashes are available through the blockhash function. When I said "...corresponding off-chain service which, once every 30 minutes or so, records all the block hashes which have gone by...", I meant there should be an off-chain service which triggers the contract to store the hashes. Commented Mar 25, 2019 at 4:18
  • I have edited the question to hopefully make that clearer. Thanks for the feedback. Commented Mar 25, 2019 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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