I understand that to mine bitcoins you need the hash of the previous block, and in order to resolve possible forks. But why not just have the last 100 blocks (or more whatever is appropriate) and keep a sliding window of the last blocks?
To mine a valid block, you need to ensure that every Bitcoin transaction in your block is valid. Because each transaction (except for coinbase transactions) spends the output from a previous transaction, you need to have processed every previous transaction in the blockchain.
This has a couple implications:
- You need to download and process the whole blockchain before you can start mining (provided you only want to produce valid blocks).
- You can create a database of just the information you need to validate future transactions and only store that, allowing you to get rid of the rest of the blockchain data you downloaded and processed. Bitcoin Core 0.11.0 began supporting this blockchain data pruning feature for mining with the
- You can outsource validation of transactions to someone else and only mine the transactions they say are valid. This way you don't need to store any blockchain data at all. This is what most pool miners do.