The bitcoin wiki explains the block hashing algorithm (one of the central pieces of bitcoin) like this:
Bitcoin mining uses the hashcash proof of work function; the hashcash algorithm requires the following parameters: a service string, a nonce, and a counter. In bitcoin the service string is encoded in the block header data structure, and includes a version field, the hash of the previous block, the root hash of the merkle tree of all transactions in the block, the current time, and the difficulty. Bitcoin stores the nonce in the extraNonce field which is part of the coinbase transaction, which is stored as the left most leaf node in the merkle tree (the coinbase is the special first transaction in the block). The counter parameter is small at 32-bits so each time it wraps the extraNonce field must be incremented (or otherwise changed) to avoid repeating work. The basics of the hashcash algorithm are quite easy to understand and it is described in more detail here. When mining bitcoin, the hashcash algorithm repeatedly hashes the block header while incrementing the counter & extraNonce fields. Incrementing the extraNonce field entails recomputing the merkle tree, as the coinbase transaction is the left most leaf node. The block is also occasionally updated as you are working on it.I think this sounds a bit like computer science by way of Lewis Carroll. We'll try for a clearer picture (which the bitcoin wiki does provide elsewhere).
- How bitcoin works in 5 minutes and in 22 minutes.
- A simple explanation from the Guardian.
- An explanation of public key cryptography.
- An implementation of bitcoin mining in excel.
- Wikipedia pages for cpytographic hash functions, hashcash, and RSA encryption.
- The original paper describing how bitcoin could work.
- Description of SHA-256 from the National Institute of Standards and Technology (NIST).
Last updated Febuary 11, 2015 by Logan Axon