Bitcoin and Blockchain Technology Explained

In this guide, we will first take a quick overview of what Bitcoin is before going a little deeper into what is needed to make a working bitcoin network, how the customer’s transaction is written to a ledger and how the system protects itself from errors.

At the end of this article is some background information about the 2008 financial crisis, which is thought to be related to the timing of the release of the whitepaper detailing Bitcoin’s software design and reference material.

Bitcoin and blockchain explained
Bitcoin is a cryptocurrency that uses distributed copies of a blockchain as a ledger

An Overview of Bitcoin

It can be difficult to get a feel for what bitcoin is in one go, so this article has broken the process down into three main stages – an overview, the parts needed to make it work and the process these parts execute. But even the overview might seem a little complicated, so a useful simplification in a few sentences might be this:

Bitcoin is just like every other currency in that it works if enough people agree to use it. The difference is that Bitcoin is controlled and validated entirely by a computer program, not by a bank.

That was a very short description that left a lot hidden – here is a more detailed version of the same thing.

What is Bitcoin?

Bitcoin is an entirely digital currency with no physical representation. Customer transactions are managed by secure fault-tolerant open source software driven by competition to win Bitcoin in return for guarding, validating and extending copies of the blockchain transaction ledger.

By the year 2140, there will be 21 million bitcoins in circulation and that will be the maximum. The smallest bitcoin unit is called the Satoshi and it is a one hundred millionth of a single bitcoin: 0.00000001 BTC.

What Gives the Bitcoin value?

The value of bitcoin is controlled by supply and demand, ease of use and legal requirements. Some currencies, like gold, have value because they are used as a commodity but most modern paper currencies have no intrinsic value and are used solely as a means of payment. These are called fiat currencies. Because fiat money is not a scarce resource like gold, banks have control over its supply, which gives them the power to manage credit supply, liquidity, interest rates and money velocity.

Where Do Individual Bitcoins Come From?

Bitcoins are earned from the system by a miner when a block of transactions is successfully added to a blockchain. The reward is decreasing slowly over time, but there is a provision for customers to provide micropayments for each transaction to the miners as their incentive.

The Components Needed for Bitcoin

This section breaks down some of the main parts of the system so you can see how they contribute to the whole.

The diagram shows two people making a monetary transaction. They supply a digital key for their accounts and the agreed sum to transfer to a payment gateway. The payment gateway is not shown here, but it will have a user interface, some processing capability and access to the mining network. The payment gateway distributes the user-generated transaction to all of the miners, one of whom will successfully record the transaction in the blockchain. After the blockchain has been verified by other miners, the payment is secure and binding. The verification process is not instant, so some time will elapse before the transaction becomes immutable.

An overview of the bitcoin process
Bitcoin transactions are secured into groups by miners that are in competition with each other to win coins from the system.

A Network of Bitcoin Miners

A pool of miners is needed in order to process transactions and verify each other’s work securely.

The bitcoin protocol is fault-tolerant, self-correcting and is made of an exclusive peer to peer (P2P) decentralised network. All of the nodes that participate in the network are equal and all nodes have to provide network routing functions to be able to participate. Nodes may optionally provide mining tasks:

  • Routing currency transactions
  • Routing solved blocks
  • Maintaining a blockchain transaction ledger (mining for bitcoins)

Miners can interact successfully with the bitcoin network if they have the correct bitcoin protocol and make valid exchanges which are constantly being checked by other miners. New bitcoin miners will request the elements of the current blockchain and verify it. It contains all the transactions made since Bitcoin’s inception in 2009 and is currently 149 GB in size.

Cryptography

Cryptography is used to secure transactions and hide their contents. Bitcoin uses SHA256 cryptography to secure the elements of its data. Users requiring transactions use private and public keys. The public key is used as the identifier for each account holder. No personal information is stored, so if a user loses his or her key, the value of the account cannot be recovered.

A hash value is a single value that acts like a unique fingerprint for any amount of data. In this case, there are 256 binary digits making up the fingerprint – equivalent to a decimal number containing 77 digits.

Hash functions create the hash value and they have outputs that are very sensitive to the order of their inputs, so even changing the order of the data in a block will invalidate it.

The Bitcoin Block

The purpose of a block is to encapsulate and secure a list of transactions. The transaction list is preceded by a header that describes the following data and this part is also secured by a hash key.

In order to make this block valid for the bitcoin protocol, there is an arbitrary test that it must also pass which is referred to as proof-of-work. This extra step is intended by design to take on average 10 minutes to execute. Refer also to Block Time.

Block Time

Controlling the Solution Time

A feedback mechanism in the Bitcoin software monitors and adjusts the time it takes to solve individual transactions to keep it constant even though the number of miners and the capabilities of the processors will vary.

The difficulty level is recalculated after 2016 blocks have been processed. This will occur every 14 days since there is only one valid ledger and only one block can be successfully added at a time and each block takes 10 minutes on average to solve.

This controls the influx of bitcoins created by mining and also reduces the possibility of two blocks being solved at the same time.

Solving the Transaction Key

The header for the block of transactions contains a field called bits which is a short form encoding of a ‘level of difficulty’ value. It is referred to as the block time and is the time taken to find a block hash value below the current level of difficulty.

Finding the required hash value to seal a transaction is an unpredictable process – it is not possible to directly calculate the required result. The only option is to calculate a new value one at a time to see if it fits. The program simply sets the nonce field to one and combines it with a hash value of the header to see if the result is below the required difficulty level. If that fails the nonce value is incremented and the calculation is run again and so on.

When a hash value appears that is below the level of difficulty the block has been solved and can be connected to the local copy of the blockchain and sent on to the other miners in the network. The block creator automatically gains the bitcoin mining value + the sum of the transaction fees if there are any.

The hash value required to seal a transaction depends on which set of recent transactions are being sealed in a block. Because the solution is different, the time taken to solve it will also be different.

Since Bitcoin was created, the number of processors and the speed of individual processors has been increasing dramatically. Consequently, the likelihood of finding the required key to seal new transactions has been reducing reciprocally. The result is that a lot of processors will be wasting a lot of electricity in the rush to win Bitcoin.

The Block Header

The Bitcoin block header is a data structure that describes and secures the list of transactions that follow.

FieldDescription
VersionThe version of the block.
Previous Block IDThe hash value of the previous block that this block will be connected to if successful.
Merkle RootA Merkle Tree is a way of combining all the hash values of the transactions in this block in a specific way to provide a single verifiable value. The root value is the result.
TimeThe Unix time at which the block becomes valid according to the protocol.
BitsA short form of a value representing a maximum hash value for the block
NonceA field used by miners to create a new hash of the header to be tested against the Bits field.

The website Blockchain.info can provide a summary of any of the blocks that are encoded in the blockchain. Although there are multiple copies of the Blockchain across thousands of computers, all but the latest blocks are guaranteed to be identical for all of them.

Here is a snapshot of the summary information that they present for the randomly selected block 506956:

Summary information for a block in Bitcoin's blockchain.
A screenshot of summary information for a randomly selected block in Bitcoin’s blockchain – refer to the website: Blockchain.info.

The Blockchain

The first blockchain database was introduced with Bitcoin. A blockchain is used as a ledger to record and secure customer transactions. Copies of the blockchain are distributed among thousands of miners for independent verification and maintenance.

A blockchain is a copy of the entire sequence of transaction that has been recorded since 2009. In February 2018 the blockchain size was 149 gigabytes and is growing continually. A new miner must fetch and verify a copy of the blockchain from the network which can take 24 hours or more. After that only subsequent blocks need be verified.

Miners receive blocks made by other miners as well as make their own. Valid blocks are assembled onto the local blockchain. If 2 (or more) arrive at the same time, a tie-break length is waited for. This is known as an accidental fork.

The Bitcoin Transaction Sequence

In this section, we will trace the steps a transaction goes through in order to be binding. It makes use of the knowledge you gained in the preceding section that explains the main parts of the system.

A Transaction is Sent to Miners

A customer transaction between two parties anywhere across the world is created by a node that offers transaction services. The transaction node propagates the transaction across the Bitcoin network so that all miners have access to it. The transaction enters local pools of transactions that are waiting to be encapsulated into a block.

A Block is Created

The miner assembles the transaction into a block provided that it meets a set of conditions. For example, there is no concept of credit and a user is not allowed to spend more than they have in their account. This might depend on the correct transaction order though the timestamp of the transaction is not a trusted value.

Mining nodes assemble up to 2400 transactions into a block along with the key of the miner so that a reward can be collected if it is successful. The block includes a hash code for the previous block, a list of transactions a difficulty level and a nonce value that will combine together with the block hash value to meet a target maximum. This usually takes a long time to find, one step at a time.

After the block has been assembled a nonce value is applied and a new hash value is calculated. The block becomes valid when the hash value is less than the current target value. This is an arbitrarily difficult task that is intended to take on average 10 minutes to complete. The resultant hash value is sometimes referred to as ‘proof of work’.

A New Block is Added to the Blockchain

Once the block satisfies the target value it is attached to the local blockchain and then transmitted to the mining network as a solution.

The mining node wins a predetermined value of Bitcoins for the valid block and potentially a small incentive from each of the transactions. The automated mining incentive provided by the bitcoin protocol is falling gradually as time goes by and this will be replaced by micropayments provided by each transaction.

The Blockchain is Verified

New blocks received from other miners are verified and attached to the local copy of the blockchain which becomes the new ledger. In the normal course of events that will be the end of the sequence, but there are a number of situations that are catered for by the Bitcoin protocol to ensure that anomalies are ironed out quickly so that after a short period of time, all parties are in agreement that the data is correct and secure.

Security and Fault Tolerance

Some of the non-standard situations that can arise in the system are described here. They have been predicted and catered for by the design of the bitcoin software that can repair errors in the ledger be they deliberate fraud attempts or temporary differences.

You can trust new blocks the deeper that they are incorporated into the chain because competing miners prevent fraudulent data from surviving. When a competitor provides a longer valid blockchain, the block or blocks are accepted, the fraudulent chain is discarded and subsequent transactions are correct.

Various forms of fraud would require inconsistent data to be encoded into the blockchain, and in order for that to work, the fraudulent data would have to be in the hands of a significant majority of miners. This becomes impractical where there are thousands of miners who are distributing valid blocks in competition with each other. As soon as a longer valid blockchain is detected, the old chain is disregarded, potential fraud ceases to exist and accounts contain the correct value.

Protection from Alteration

Any changes to an accepted block will result in invalid hash values that will cause the block to be ignored by the rest of the system. When that happens the fraudulent data will be bypassed and replaced.

Accidental Forks

A fork occurs when two miners find a valid hash for the same block number within a short space of time. Both miners will spread their block across the network for verification by other miners and since both blocks are valid and both are accepted by a proportion of the miners, causing the network will split into two. One set of miners will have used one of the new blocks and the remaining miners are using another, but all miners will now have to blocks to choose from.

This problem is will normally be resolved when a third new block arrives. It will have been attached to one of the blocks at the same height (the offset of the block from the start of the chain) and also be valid, and the protocol states that the longest chain will be selected in preference to the shorter one. The removal of the fork is called blockchain reconvergence. The block that was pushed out of the chain is stored in a pool as an orphan block.

Orphaned Blocks

Orphaned can be formed as a result of accidental forking, but they used to be caused by a flaw in the original protocol. They were blocks that are received out of chronological order, leaving one or more missing links in the blockchain to be filled in. The Bitcoin protocol was modified in version v0.10, and the sharing mechanism now prevents this condition.

Stale Blocks

As soon as a miner creates a valid solution for the next block, all of the candidate blocks being worked on by other miners are said to have become stale. Its header will no longer be valid and some of the transactions may already be accounted for. The mine must abandon that block and build a new block from the remaining transactions and start again.

Protection from Fake Blocks

One or more faked blocks introduced into the system may be accepted for a period of time, but as soon as a fake block is capped by a miner using valid transactions, the faked blocks will be replaced by the missing sequence of valid blocks in much the same way as an accidental fork will correct itself.

The newest blocks are not risk-free but become increasingly more reliable as new blocks are added since errors become increasingly hard to maintain. In August 2013 a pool of mining nodes known as the BTC Guild was able to legitimately mine 6 blocks in a row, which indicated that a fraud of that length was also a possibility. A group called Ghash.io had 51% of the mining nodes for more than 12 hours in June 2014, which also lends weight to this type of fraud.

The only way to be sure is to calculate the number of leading blocks are required to eliminate the risk and wait for that length of time (10 minutes x number of blocks approximately) before using the money that is encoded in it.

The Negative Side Effects of Bitcoin

There are a few negative side effects that are driven directly by the bitcoin rules. It is a competitive system, so there is an advantage in having more and faster processors than other miners. In turn, the competitors must increase their processing power in order to keep the same or a better proportion of the rewards.

Graphics cards have a GPU which is similar to a CPU and is programmable. They have been utilised in large numbers to mine for Bitcoin block rewards because they are cheaper than complete rigs and there is no need for the card to be fully supported by an operating system.

However, the central mechanism to control the bitcoin currency is time-based. No matter how many computers are used and no matter how fast they are, the design of the Bitcoin management software regulates the difficulty of mining a block such that on average an individual block will be solved every 10 minutes. It does this by setting a target range for a block verification number that is arbitrarily difficult to find. There is no reason for this other than to keep the block production average steady, which is something that a successful currency needs in order to operate correctly.

The competitive drive for ever more powerful processing has lead to:

  1. A shortage of graphics cards that would normally be installed in gaming-grade computers and has pushed the cost up significantly worldwide.
  2. Hundreds of thousands of processors being tied up to make a computation that has little use.
  3. The needless expenditure of a lot of electricity.

Bitcoin is driving miners to use resources inefficiently, but since this is the first mainstream cryptocurrency, we can be sure there will be many others. I suspect that the one that survives long-term will be one that can be of benefit to a government somehow. All it takes is a bit of imagination to come up with an acceptable mechanism.

The Benefits of Bitcoin

Detractors will attempt to undermine Bitcoin by citing its ability to cloak criminals, and its inefficient energy use. These things are true, but it’s a tool that can be improved and like all other tools it can be used for good or bad purposes.

The bigger picture is that Bitcoin has introduced the Blockchain as a database that can be public, secure and verifiable. This is a very useful idea and Microsoft have already announced plans to use blockchain tech to store data.

The Blockchain concept will survive Bitcoin and will now be subject to a myriad of improvements and novel applications from all sectors.

The Financial Crisis and Launch of Bitcoin

There have been several attempts to popularise digital currencies in the past but Bitcoin is the first to become mainstream. Its appearance appears to have been a reaction to the 2008 financial crisis.

The foundation of the crisis was created in the US sub-prime mortgage market — people who are more likely to have difficulty maintaining repayments. The weakness in the success of this practice was masked by Adjustable Rate Mortgages (ARMS) that had low-interest rates for the first two or three years, followed by significant increases.

Although this practice may seem nonsensical retrospectively, there was a strong incentive for individuals to make a lot of money in the short term without a need to consider or be held responsible for the repayment difficulties that would become visible just a few years later on.

In due course, an overwhelming number of sub-prime mortgages were defaulted and considered to be almost worthless because of the lack of monitoring of creditworthiness on the borrowers culminating in the collapse of the Lehman Brothers in September 2008. Banks around the world had bought collateralised debt bundled into CDOs and had exposure to the defaulting mortgage loans. Globally, banks became reluctant to lend, confidence and stock markets fell, leading to a recession.

A few weeks after the collapse of the Lehman Brothers a white paper was published on Halloweens Day under the pseudonym Satoshi Nakamoto outlining the Bitcoin technology with reference software proving the model. This is thought not to be merely a coincidence. The key tenet of the design was that a third party (eg: a bank) would not be needed to verify transactions – trust was not a requirement of the protocol.

References

Disclaimer

Care has been taken to keep the information in this article as accurate as possible but errors are possible, so be aware of the full disclaimer here.

Related Posts