<p>You can search through a file on disk, it's just slower. However, whether it's in memory or on disk isn't as important as whether it's indexed. There is a list of transaction id's (aka: txid) and their corresponding block numbers, called the <em>unspent transaction output database</em>. It's not in the blockchain because it doesn't need to be - every node can come up with it individually.</p>

<p>The reason why transaction inputs don't have the block that contained them is that there might be a block reorganization, putting transactions in different blocks, and you want other transactions that depend on those to still be valid.</p>

<p>The downside of indexes is that they take up space. This is one of those space-vs-time tradeoffs you have to make.</p>

CC BY-SA 3.0
2013-05-21T20:34:50.307Z
Technically, the unspent transaction output database maintained by 0.8+ clients is not an index: it doesn't point to other data in the block chain. It's just an independent copy of just the bits and pieces of transactions needed for validation.
Pieter Wuille
CC BY-SA 3.0
2013-05-21T19:30:04.357Z
2013-05-21T19:30:04.357Z
Nick ODell
<p>Miners do not operate on the whole blockchain; only a part of it.  The whole chain is known to have been verified, and not all by one miner.  This distributed responsibility removes all possibility of a single computer getting burgled or nuked from making much of a difference to the rest of the bitcoin network.</p>

CC BY-SA 3.0
2013-05-21T20:17:09.117Z
But old blocks are needed for new transactions verification. Miners need those blocks to check that the input is valid.
summerbulb
CC BY-SA 3.0
2013-05-21T19:32:57.517Z
2013-05-21T19:32:57.517Z
whizz511
<p>No, miners do not need the entire block chain to be accessible. Technically, they don't even need it at all. The blocks themself are only needed for rescanning wallets, reorganisations, and serving blocks to other nodes. That is why pruning them away will likely become viable in the future.</p>

<p>What you need for validating blocks and transactions (a fundamental demand from miners), is the database of unspent transaction outputs. 0.8+ clients maintain this database explicitly in a compact form (around 200 MB now, as of May 2013).</p>

<p>In addition to that, a miner needs to maintain a memory pool: a set of transactions that are validated against the current best chain, to choose transactions for the next candidate block from.</p>

CC BY-SA 3.0
2013-05-23T17:31:37.747Z
Would you explain it elaborately. I am very new to mining and I would like to know how to mine without downloading blockchain. Also what are 0.8+ clients that you mentioned? It would be really helpful to name a few!
Ashutosh Dave
CC BY-SA 3.0
2013-05-23T17:48:13.177Z
I was talking hypothetically. No client exists that effectively does block pruning today, so you will need all blocks. It's just a fact that this is not necessary in theory. By 0.8+ clients I refer to the reference client bitcoind/Bitcoin-Qt version 0.8 and above.
Pieter Wuille
CC BY-SA 3.0
2013-05-23T18:03:13.113Z
Ok I got it. But if I want to just start mining rather than wait for entire blockchain to download, how should I do it?
Ashutosh Dave
CC BY-SA 3.0
2013-05-23T18:07:20.987Z
You can't, and pruning won't change that. As a miner you're required to validate the block chain, which can't happen well... without validating it. Of course you can donate your hashing power to another instance (a pool) and be paid for it, but then you're not mining yourself.
Pieter Wuille
CC BY-SA 3.0
2013-05-23T23:20:42.243Z
Just to be clear: I answered your question with a clear no, as it is not necessary that miners hold entire blocks in memory (or even on disk); that doesn't mean they don't need to validate it. Pruning generally refers to downloading + fully verifying the entire chain, but not keeping all historic blocks around after they are validated.
Pieter Wuille
CC BY-SA 3.0
2013-05-21T20:40:52.487Z
2013-05-21T20:40:52.487Z
Pieter Wuille
<p>Running a miner node, one would have to verify transactions. This includes checking all the inputs of all the transactions.</p>

<p>Does this mean that a miner must hold all the block-chain in memory (currently about 8.7 GB)? If not, how can a miner find previous transaction (a transaction input does not have an indication to the block containing it)?</p>

<transaction-verification><utxo><mining-technical-details><mempool>
Do miners have to hold all the blocks in memory?
summerbulb
# Do miners have to hold all the blocks in memory?

(Asked by: username_0 on 2013-05-21)

Running a miner node, one would have to verify transactions. This includes checking all the inputs of all the transactions.

Does this mean that a miner must hold all the block-chain in memory (currently about 8.7 GB)? If not, how can a miner find previous transaction (a transaction input does not have an indication to the block containing it)?

**Tags:** transaction-verification, utxo, mining-technical-details, mempool


---

## 3 answers

### Answer by username_2 on 2013-05-21. Score: 7 | Accepted answer

No, miners do not need the entire block chain to be accessible. Technically, they don't even need it at all. The blocks themself are only needed for rescanning wallets, reorganisations, and serving blocks to other nodes. That is why pruning them away will likely become viable in the future.

What you need for validating blocks and transactions (a fundamental demand from miners), is the database of unspent transaction outputs. 0.8+ clients maintain this database explicitly in a compact form (around 200 MB now, as of May 2013).

In addition to that, a miner needs to maintain a memory pool: a set of transactions that are validated against the current best chain, to choose transactions for the next candidate block from.

> **Comments:**
> **username_4**: Would you explain it elaborately. I am very new to mining and I would like to know how to mine without downloading blockchain. Also what are 0.8+ clients that you mentioned? It would be really helpful to name a few!  
> **username_2**: I was talking hypothetically. No client exists that effectively does block pruning today, so you will need all blocks. It's just a fact that this is not necessary in theory. By 0.8+ clients I refer to the reference client bitcoind/Bitcoin-Qt version 0.8 and above.  
> **username_4**: Ok I got it. But if I want to just start mining rather than wait for entire blockchain to download, how should I do it?  
> **username_2**: You can't, and pruning won't change that. As a miner you're required to validate the block chain, which can't happen well... without validating it. Of course you can donate your hashing power to another instance (a pool) and be paid for it, but then you're not mining yourself.  
> **username_2**: Just to be clear: I answered your question with a clear no, as it is not necessary that miners hold entire blocks in memory (or even on disk); that doesn't mean they don't need to validate it. Pruning generally refers to downloading + fully verifying the entire chain, but not keeping all historic blocks around after they are validated.  

---

### Answer by username_1 on 2013-05-21. Score: 2

You can search through a file on disk, it's just slower. However, whether it's in memory or on disk isn't as important as whether it's indexed. There is a list of transaction id's (aka: txid) and their corresponding block numbers, called the *unspent transaction output database*. It's not in the blockchain because it doesn't need to be - every node can come up with it individually.

The reason why transaction inputs don't have the block that contained them is that there might be a block reorganization, putting transactions in different blocks, and you want other transactions that depend on those to still be valid.

The downside of indexes is that they take up space. This is one of those space-vs-time tradeoffs you have to make.

> **Comments:**
> **username_2**: Technically, the unspent transaction output database maintained by 0.8+ clients is not an index: it doesn't point to other data in the block chain. It's just an independent copy of just the bits and pieces of transactions needed for validation.  

---

### Answer by username_3 on 2013-05-21. Score: 0

Miners do not operate on the whole blockchain; only a part of it. The whole chain is known to have been verified, and not all by one miner. This distributed responsibility removes all possibility of a single computer getting burgled or nuked from making much of a difference to the rest of the bitcoin network.

> **Comments:**
> **username_0**: But old blocks are needed for new transactions verification. Miners need those blocks to check that the input is valid.  

---

