Unravelling the Blockchain
Bitcoin and its underlying blockchain technology have experienced an enormous boom recently. More and more online providers are accepting bitcoins as a payment method, and new blockchain-based applications are continually appearing. Nonetheless, there are still several riddles and myths about this new technology.
It’s time for an explanation: The blockchain is a distributed database that stores your information in immutable data records.
What does that mean, exactly? How can that work?
Bitcoin is fast and reliable, and functions without central authority. Its infrastructure uses a peer-to-peer network. The data are saved on thousands of peers.
How can that function in the digital world, where all data can be copied without problems? In which we simultaneously need to reckon with latency times in the network? How can we guarantee a consistent state in this distributed network? Specifically: how can we guarantee that the same amount cannot be spent twice?
Double spending is a problem in distributed accounting, because the nodes here in the system allow a vote to be made to decide which transaction is valid. We thus need to protect the consensus protocol against the danger of an attacker with many false identities (Sybil attack) trying to obtain a majority in the system and, therefore, being able to determine the validity of the transactions arbitrarily. The solution Bitcoin found for this problem is called proof-of-work (PoW). The nodes that determine the validity of the transactions need to perform work in order to be able to participate in the “vote”.
How is voting carried out in Bitcoin? The vote is carried out through the creation of new block in the Bitcoin blockchain.
Solution with references
Every block has a reference to its predecessor block. This way, all the blocks constitute a chain. The transactions are saved in the block itself. Only valid transactions are incorporated into the block. The node that creates a new block can recognise all attempts to spend a bitcoin a second time and reject them as being invalid. If the blocks are now organised in a chain, this results in a complete ordering of the transactions. If it is now also guaranteed that the sequence of the blocks cannot be changed, the sequence of the transactions is also immutable with the passage of time. That is exactly what proof-of-work accomplishes: a lot of computing capacity is required to create a block. If a large portion of the blockchain needs to be sorted again, the expenditure needed for this quickly approaches a level that makes every attempt seem useless.
From nonce to hash
What does proof-of-work look like in the blockchain? The work a block creator (block miner) must perform to find a new block consists of computing a hash from the information in the block header, and it has a certain form. More specifically, the hash must begin with a certain number of nulls. For this purpose, the block miners can vary one of the pieces of block header information, called a nonce, as they please. The work therefore consists of changing this nonce and computing the hash from the block header information changed in this manner. If the hash has the required number of nulls at the beginning, the miner can distribute this block with the saved transactions in the network. If the hash does not have the necessary form, the miner must compute another hash with a modified nonce, and so on.
The required number of nulls, referred to as the difficulty, is not written in stone. Every two weeks, an evaluation is performed to see how long the amount of time between two blocks in the block chain is. If this time interval is under 10 minutes, the difficulty is increased. The block miners must then compute a hash beginning with more nulls. This guarantees that proof-of-work does not collapse if more computers with better computing processors participate in the network. This mechanism illustrates nicely how the Bitcoin blockchain stabilises itself.
For more information (transactions, application cases, etc.)
- Slides (presentation from Thursday, 31.08.2017)
- Video of the presentation (Presentation “Unravelling the Blockchain” from Thursday, 31.08.2017)
Dr Benno Luthiger, ID WCMS, LMS & Mobile Applications, ITS Software Services, IT Services