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.
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/