Friday, April 12, 2013

The blockchain

Now we can move on to the central feature of Bitcoin - the blockchain. The best way to imagine it is as a digital ledger - a book where each page contains the transactions that took place. You see, your Bitcoins don't actually reside in your Bitcoin address. It's the fact that the blockchain, a digital file which records all the transactions that have taken place, says that your Bitcoin address has a number of Bitcoins associated with it. Without the blockchain, your Bitcoin address is just a large meaningless number.

Just as a ledger has pages recording incoming money and outgoing payments, the blockchain has blocks - each block is like a page. The first page was created by Satoshi Nakamoto to kick the whole thing off. But there is a difference between a ledger and the blockchain - each block has been validated, and is linked to the previous blocks.

So how does this validation of the transactions in each block work? Well, remember the hash functions I talked about in the previous post? Each valid block consists of three things: the transaction list, the hash of the previous block, and an extra bit of data added to the transaction list called a "salt" (a kind of padding) that together when hashed give a result that is below a certain number that is smaller than "the difficulty" (we'll talk about that later) - in practice this means that the hash number starts with a lot of zeros. It takes many many hashing goes with different "salts" before a suitably small resulting hash number is obtained. This means that to rewrite history requires recalculating block after block to generate a blockchain that is valid. That's a lot of work.

Next post: why would anyone spend valuable electricity and computing power on validating blocks?

1 comment:

  1. What about fragmentation, is it a problem? I mean eventually all the Bitcoins will be split down into cup-of-coffee sized pieces, right? So if I want to buy a house the transaction is going to involve potentially millions of hashes. Will that slow the transaction down?

    ReplyDelete