5

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)?

7

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.

  • 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 May 23 '13 at 17:31
  • 1
    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 May 23 '13 at 17:48
  • 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 May 23 '13 at 18:03
  • 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. – Pieter Wuille May 23 '13 at 18:07
  • 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 May 23 '13 at 23:20
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.

  • 1
    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 May 21 '13 at 20:34
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.

  • But old blocks are needed for new transactions verification. Miners need those blocks to check that the input is valid. – summerbulb May 21 '13 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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