A lot of data in the public domain details how blockchain and associated technologies (such as bitcoin) work and the concepts associated with them (such as mining, forking and wallets).  This is a complex area of study, combining computer science, hardcore maths and economic theory - not always the easiest blend of subjects.  But stick with it, because it is interesting and likely to be increasingly valued in the future.

Blockchain’ is a digital encryption process developed for the decentralised, virtual currency known as ‘Bitcoin’.  The ‘blockchain’ itself is a database architecture based on transactions. Essentially, this is a chain of ‘nodes’ (or ‘blocks’) that run together in a system, that when all combined form a bitcoin.  A full list of all the nodes in a block chain provides a full copy of a currency’s history.  This ‘ledger’ can be very valuable as it provides a full list of every transaction a particular bitcoin has ever been involved in.  

Such a system works on the following principles: Within each ‘block’ there is something called a ‘hash’ made of the previous block.  A hash is an algorithm that turns a large amount of data, into a fixed length hash-code.  For bitcoin, there is a distinct algorithm called SHA-256 that generates random numbers that serve as unique codes for each hash.  This process (known as ‘hashing’) is applied every time there is a transaction, so, each time a new transaction occurs a new block is made and the previous block is ‘hashed’ and stored in the new block.  When this happens, the starting block is known as the ‘genesis’ block, as it is used as the start point to make the next, new block.

One powerful aspect of block-chain coding is that each time a new block is made, the data in the genesis block effectively remembers the initial start data (the hash retains the previous store of data and it is this that makes the ‘chain’ in block chain).  This means using blockchain for bitcoin transactions allows you to work back to determine how much value belonged to each address in the chain at any point in history.  This can be done because each block is guaranteed to come after the previous block chronologically because the previous block's hash would otherwise not be known and stored in the block. As the blockchain gets longer it also becomes harder to modify, as every previous block in the chain would also have to be regenerated.

What happens when a blockchain forks?

Sometimes, something called a ‘fork’ can occur in the blockchain.  This happens when two blocks are formed at the same time.  In bitcoin, when this occurs two separate chains start to form as new blocks are generated around each node. These two chains with a shared genesis are identical until the point the chain ‘forked’, after which these chains then exist in parallel and two separate networks have been created.

 

In the case of bitcoin if a blockchain does fork, it is possible that the coins owned by users on one side of the chain won’t be recognised by those on the other side.  However, if someone owned the coins before the split - they will find that they own the coins on both sides of the split, but they will need different wallets to access and spend each set.  Such forks tend to occur when part of the wider network is not fully compatible with the rest of the blockchain network and transactions have not been accepted by the other users.  Bugs and software compatibility issues can also lead to forks occurring.  When forks do occur they are generally resolved by users abandoning the weaker side of the fork (the shorter side) and re-engaging with the rest of the network.

What is a wallet?

A wallet is a specific, private key assigned to each user to access the blockchain. With bitcoin, a wallet is an encrypted private key that allows access to the specific balance and transactions made by that user.  The private key provided from the wallet is used to sign transactions and provide signatures (mathematical proofs) that they came from the owner of the wallet, they also prevent transactions being altered once they have been issued.  Once a transaction occurs it is broadcast between users in the network and will then be confirmed by miners, who go on to maintain the integrity of the distributed ledger.

What is mining?

 

Mining is the process through which users of currencies like bitcoin keep track of transactions.  Using the blockchain as a distributed ledger, all transactions are stored and recorded around the network of users holding the currency.  However, it is important to confirm transactions and store them in a general ledger so they can be tracked and recorded and this is done by miners.

Miners maintain the blockchain by maintaining the ledger of all the data it contains.  This is important as it can be used to explore any transaction made between any addresses using the blockchain.  Additionally, whenever a new block is created it is added to the increasingly long blockchain, and whenever it is added, a constantly updated copy of the block is given to everyone that participates in the network.

To ensure the integrity of the ledger can be trusted and the blockchain is not tampered with, miners ensure blocks are ‘hashed’ - this means that a mathematical formula is applied and a code that consists of a mixture of letters and numbers are applied and stored with the block at that specific point in time.  Across the whole network, each hash is unique and generated to reflect the data within the block, so if one character is changed in a block the whole hash will change.  Additionally, each hash itself contains all the previous hash information in the chain, enabling the full transaction and encryption history of the block to be retained all the chain.  Such a process maintains the integrity of the chain because each hash is linked to the chain content.  As a result, any tampering or modification generates a new hash and all users along the network can see that the chain has been accessed and a new hash generated.  

Miners work to provide the hashes required to ‘seal’ blocks.  To do this they compete in an open marketplace using specially generated software that hashes blocks.  They are motivated to this with rewards, for example, with bitcoin, every time a miner creates a hash they receive a reward of 25 bitcoins and the blockchain is updated.  However, to reduce inflation of the bitcoin price and devaluing the process of hashing the bitcoin uses something called ‘proof of work’ to make the process of mining harder to achieve.

What does ‘Proof of work’ mean?

Bitcoin relies on something called ‘proof of work’ to ensure the hashes used to seal blocks are of sufficient quality and standard.  Hashes for bitcoin need to have a specific format (for example, a certain number of zeroes are required at the start of each hash).  Additionally, although miners need to change the hash in a blockchain, they are not supposed to access the data contained in the chain.  To modify this they use a piece of data called a cryptographic nonce (an arbitrary number that can only be used once), this is combined with the transaction data to create the hash.  Once created this is assessed to see if the hash fits the required format - if it doesn’t the nonce is changed and the process is repeated until the hash is of the appropriate standard.  Such a process can take some time and all miners in a network are trying to simultaneously find a nonce that works for that specific hash and they are all, essentially competing for the same reward and this is how they ‘earn’ their coins when they form a successful hash.

Understanding how blockchain works, is very useful.  In the next post, we look at how the technology could be vulnerable.

Blockchain Security

Comment