Demistifying Blockchain: A Detailed Step-by-Step Explanation – Info News
Demistifying Blockchain: A Detailed Step-by-Step Explanation
- What is Blockchain?
There is no standard definition of the Blockchain. However, almost in every definition there are some common elements:
i. Blockchain is a type of ledger under which the data is stored in blocks.
ii. In a Blockchain, the data is storage is distributed in the sense that it can be accessed by anyone from anywhere provided that the necessary hardware, mostly a computer with internet connection, is available.
iii. There is no central authority in the traditional sense which oversees the operation of the blockchain.
iv. These blocks are connected to each other via cryptographic algorithms, which makes the system secure.
v. Blockchain is an append-only database. Allegedly, it cannot be modified, and it is immutable.
There are some main features commonly-cited features when discussing Blockchain, which can be classified under 4 main groups:
i. Distributed ledger system
These features are not taken for granted for every single Blockchain and we will examine the differences later. However, for the purposes of this paper, we can define the Blockchain as a type of append-only distributed ledger under which the data is stored in blocks that are connected to each other with cryptographic algorithms.
In this part, I will try to explain these features in more detail. However, there are some remarks that must be made before advancing to that part.
1.1 Terminological Chaos
The terminology of Blockchain is literally chaotic. The Blockchain technology is applied by coders coming from a world full of technical and functional terminology. As the purpose of this terminology is to be able to communicate with others in the sector, this is not a formal convention but a functional one, which might not even be consistent. You can see expressions such as ‘cryptocurrency’, ‘digital money’, ‘virtual currency’, ‘coin’, ‘token’ used to indicate Bitcoin and its progeny.
The problem becomes much more complex when the Blockchain meets the law. Coders can call an application as money or contract, but this does not automatically make it money or contract in the legal sense. In the world of law and regulation, terms and definitions are not merely functional, but they come with legal implications. Therefore, there is a need for clarification regarding the terminology used in this paper.
The main purpose of this story is, firstly, to explain the mechanisms underlying the Blockchain technology and, secondly, to understand its potential applications in the social world. I am of the opinion that formal definitions are helpful only if they are settled and well-recognised. However, there is no uniformity neither among computer scientists nor among regulators on the terminology of the Blockchain. Therefore, for each term, I will provide a general and superficial definition in order to maintain the integrity of the story.
1.2 The Rise of Blockchain: Bitcoin
Bitcoin has been introduced under the name of Satoshi Nakamoto, whose real identity is still not known to this day, along with its so-called white paper. According to this whitepaper, it was built as a solution to weaknesses of the trust-based system, mainly the requirement of intermediaries. The whitepaper argues that the current system works well for most transactions but not for all of them since the intermediaries increase transactions costs and make it possible for financial institutions to modify or reverse transactions as they are the ones who keep records.
What is Bitcoin? Bitcoin was introduced as a decentralised peer-to-peer payment system relying not on the governments or counter-parties but on the computer codes and cryptography. Essentially, a Bitcoin is a piece of data created and managed by a computer code. It does not have an intrinsic value, but its value is speculative. It is valuable only because it is believed by the people that it has value and it can be used as a medium of exchange. It is not regulated or controlled by a central authority and, therefore, its value can be extremely volatile. Having a Bitcoin means having access to an address to which a Bitcoin is linked. Transferring a Bitcoin is not actually a transfer of a tangible asset, rather changing the address which the data representing the Bitcoin is linked.
Bitcoin remained known by only a small group of for a while. During this period, due to its pseudo-anonymous nature, it is used mainly by people transacting through online black-market platforms such as the Silk Road. However, it gained public attention especially after the price boom which created Bitcoin millionaires overnight. The exponential increase at Bitcoin’s price made not only Bitcoin but also the technology behind it, the Blockchain, popular.
Although they are often quoted together, the distinction between Bitcoin and the Blockchain is quite important. Bitcoin is only a specific application, probably the most popular one, of the Blockchain technology and it has its own blockchain to which we will refer as the Bitcoin blockchain. Each Bitcoin transaction so far is registered on the Bitcoin blockchain. Due to this historical connection, the discussion around the Blockchain became inextricably intertwined with the Bitcoin blockchain. Hence, it must be borne in mind that the commonly-cited features mentioned above are mostly explained with the example of the Bitcoin blockchain.
There is no uniformly accepted classification of different types of Blockchain. One classification is made depending on the public access to that Blockchain. Blockchains that can be accessed by anyone without restrictions are called as ‘Permissionless Blockchains’ whereas Blockchains involving only a selected group of participants are called as ‘Permissioned Blockchains’. Permissioned and permissionless blockchains come with different features and problems, which will be mentioned separately below.
1.3 Uncompressing a Block
Before examining the features in detail, I believe that an explanation regarding the structure of a blockchain and a block will be helpful. A block is essentially a bundle of data. It can be considered as a fixed-size box containing different elements, including but not limited to block size, timestamp, hash of the previous block and a set of transactions. Blocks are connected to each other via hashing. The content and structure of the block depends on the initial construction of that blockchain.
The general structure of a block looks as follows:
In its simplest form, a block contains data and a link connecting that block to the previous one. The data might be numbers or letters containing any type of information depending on the desired function of a blockchain. This is why we will refer it as ‘the data’ in general, which must be interpreted differently for each blockchain. The link is the hash of the previous block. A hash is a fixed-length output created by using hash algorithms functions on data of any length. Regardless of the length of the input, the output always will be a 64-character long string.
Why is this necessary? The size of each part in a block is limited and fixed whereas the content of each block is different. In order to make sure that the size of the link does not exceed the allocated space, the content of a block gets hashed, and this hash is stored in the next block. Hash functions are designed to be collision-resistant meaning that different inputs cannot create the same output. Therefore, for the sake of simplicity, a hash can be considered as a blurry photo of the content of a particular block at a particular moment by which you could see that the content is there but you would not be able to reveal the exact content. Every block contains a photo of the previous block. The important point here is that in each photo, there will be another photo that belongs to the prior block. By this logic, the hash, aka the photo, at the last block will always be connected to the content of the first block as it contains its photo somewhere in itself. Accordingly, a change in any block would require the change of the photo in all following blocks.
This is just a general structure. However, there might be additional elements in a block depending on the structure of the blockchain. The application might require the track of timestamps or the way transactions are stored might be different in one blockchain compared to others. As a more practical example, the block structure in the Bitcoin blockchain is as follows:
The diagram might look complicated for now, but it will become clearer as we explain the features. However, at this point, a block can be considered as a box that contains transactions made through the network and its header can be considered as a tag put onto it, containing information for that block to be identified and verified by other participants in the network. What we have in the box and what are the information put into the tag vary from one Blockchain to another.
1.4 Properties of Blockchain
1.4.1 Distributed Ledger
A blockchain is a distributed ledger in the sense that the data is not stored at a central location, but it is distributed among participants. The nature of the distribution depends on the type of the Blockchain. In permissionless ledgers, the data is publicly accessible by anyone who wants, regardless of being a participant or not. You can simply download the blockchain’s data and see all transactions stored in that blockchain.
The major advantage of a distributed system is that there is no single point of failure meaning that the whole data is not stored by a single participant, or more commonly named as a single node, and, therefore, the system is resistant against attacks addressed to one node. In traditional systems, the fact that the data is stored at a central location makes the whole system vulnerable since a successful attack to the central data storage might make the whole system collapse.
On the other hand, a distributed ledger comes with its own difficulties. The ledger has evidential function, and for such an evident to be reliable, it must be ensured that the all participants in the network have the identical copy of the ledger. This means that the nodes must be informed of new transactions and all copies must be updated once a new block is added to the chain. Additionally, given that all transactions starting from the genesis block are stored on the blockchain, requiring all nodes to store all the data might be impractical. For example, the size of the complete Bitcoin blockchain is larger than 150 GB which exceeds the total capacity of most tablets, smartphones and portable storage devices.
Blockchain’s answer to the first problem is hidden in the consensus protocols. Having multiple nodes to store the data and allowing them to add new data creates the question of how whose data will be accepted as valid. Consensus protocols are the set of rules by which the participants agree on the single valid version of the data. Everyone can propose addition of new data but only the data who survived through the consensus mechanism will be added into the chain, hence will be considered as valid by other participants. Different consensus mechanisms are implemented for different blockchains.
Regarding the increasing storage problem, again, there are different solutions adopted by different blockchains. A straightforward solution would be not requiring all participants to store all the data, but we also know that the whole data must be stored at least by some of the participants, which leads us to the diversification of nodes. Some nodes store all the data, which are commonly known as ‘full nodes’, whereas others just store the data necessary for them and refer back to the full-nodes every time a new piece of data is required. Additionally, depending on the function of a given blockchain, different type of nodes might require access to different parts of the data stored in the blockchain for transaction or verification purposes. For this, we also need mechanisms that would allow these nodes to explore the data on the blockchain without storing it.
The focus of this story is not the specific structure of the Bitcoin blockchain. However, considering that it is most widely-used application of the Blockchain technology, we will now examine the solutions provided by the Bitcoin to the problems mentioned above in order to facilitate understanding and solving these problems.
22.214.171.124 Diversification of nodes
There are different actors with different capabilities in the Bitcoin network. One might choose to participate directly in the network or use third-party services. Participating actors are called ‘nodes’ by convention. There are two main types of nodes, which are full-nodes and light or SPV (Simplified Payment Verification) nodes. Full-nodes typically store all data of a Blockchain and can perform different functions such as mining, storing public-private keys and network routing. Light nodes, or SPV nodes, download only a part of the data and perform verification and make it possible for anyone to verify a transaction without downloading the whole data.
126.96.36.199 Merkle Tree
In the general block structure mentioned above, to decide whether a transaction is on the blockchain or not, one must look through all transactions on the chain one by one, which naturally requires storing all transactions. However, for the Bitcoin, or similarly the Ethereum, to function as a payment system, it must be convenient for non-technical people to check whether a transaction is actually on the blockchain. This is the reason why we have the Merkle Tree structure in the Bitcoin and Ethereum blockchains. To facilitate this control in the Bitcoin blockchain, in addition to storing transactions in a block, the hash of transactions is recorded in a binary tree which is called the hash tree or, more specifically, Merkle Tree, and the root hash of this Merkle Tree is stored in the block header. Now we need to demystify this sentence.
There are different transactions in each block. Firstly, we hash each transaction and put that hash in a separate data space, which are called ‘nodes’. These initial nodes are placed at the bottom and they do not have any sub-odes, aka child. Therefore, these are called ‘leaf nodes’. Then we split these leaf nodes into groups of two, combine these hashes by adding one after another and re-hash this combination. We put this new hash into a new node at the upper level of the tree where these two transactions are connected. Then the process starts again and goes to the up until there is only one, which is ‘the root’. The whole structure looks like an up-side-down tree. Trees are data structures used in computer science to store and process more efficiently for specific purposes, such as sorting or searching. A binary tree under which leaf nodes contain the hash of some data and non-leaf nodes contain the hash of its children is called ‘the Merkle Tree’ which is named after Ralph Merkle who patented this structure. For a block containing eight transactions (A to H), the Merkle Tree would look as follows:
As explained above, hashing is actually transforming data at any length to a fixed-size output. However, this transformation is not two-sided and hash functions are not reversible, meaning that you cannot reverse the calculation and reveal the original input string even if you know the hashed version. Therefore, the Merkle Tree cannot be used to reveal the content of the transaction but only to verify whether a specific transaction is present on the blockchain or not.
How does the Merkle Tree facilitate things? Let’s assume that we want to check whether transaction D is on the blockchain. In order to determine that, we would have to look at all eight transactions one by one but, thanks to the Merkle Tree, we need only three values, HC, HAB and HEFGH. In a block containing sixteen transactions, we would need to know four values, one value at each stage. Similarly, in a block containing 1024 transactions, we would need to know only ten values. To formulate, in a block containing X transactions, we would need to know only log2X values, which makes the Merkle Tree more efficient larger the block gets.
However, a check made through the Merkle Tree is not identical to a check made by searching all transactions in the blockchain. Firstly, as mentioned before, you cannot check the content of a transaction, but you can only check whether that transaction exists on the blockchain or not. Secondly, branches of the Merkle Tree are not stored in the block header. The node doing the check must obtain the missing information either from other nodes in the network or from other parties involved into that transaction.
The Merkle Tree is a powerful tool as it allows SPV nodes to verify whether a transaction is on the Blockchain or not without requiring storing all transactions. But, at the same time, it makes these nodes vulnerable to temporary misinformation due to the fact that it relies on the information provided by other nodes. If an SPV node requests information from an adversary node, it might get misinformed. However, this is not a significant problem in practice since, by convention, the participants verify transaction not only once but for several times before relying on that confirmation. Considering that the Bitcoin blockchain runs as a gossip protocol between participants, it is not likely that all these confirmations would be made through adversaries.
1.4.2 Decentralisation and consensus
I established that the Blockchain technology allows us to distribute the data among the participants. However, we also need a mechanism to determine what this data comprised of. As mentioned above, the type of this data changes from one blockchain to another. In the Bitcoin blockchain, the data is a set of transactions.
In a distributed system all nodes are free to broadcast their transactions but, until now, we have not touched upon the selection of information that would end up registered on the blockchain. In traditional systems, the information is created and verified by central authorities or ‘trusted’ third parties.
Blockchain is advertised to be decentralised, meaning that there is no central authority to confirm the information stored on the blockchain. Being decentralised is different than being distributed. To put it more accurately, a blockchain can be constructed as a decentralised network. Decentralisation is not a common property for all blockchains and it is a matter of choice made according to the underlying purpose of any given blockchain. The core feature of the Blockchain technology that affects the decentralisation is the consensus mechanisms (or protocols).
The methods by which the question of “how a new block is added to the blockchain” are called as consensus mechanisms. In other words, the consensus mechanism creates the single valid version of the record that would be agreed on and stored by the participants of the network. Design of the consensus mechanism is a functional problem. You can create a blockchain in which a new block is added when it started raining in London provided that you have a server from which you can get the rain forecast. Similarly, you can choose a voting system in any type. However, it must be borne in mind that the power of the Blockchain comes from its distributed nature and the distributed nature can keep working properly if and only there are nodes willing to participate as well as a consensus mechanism that would allow participants to agree.
In permissioned blockchains, consensus mechanism might have central characteristics as the participants are determined through a selection and ‘trusted’ to some extent. The incentive in permissioned blockchains might be provided by commercial and/or professional arrangements. However, in permissionless blockchains, the consensus mechanism must be constructed in a way that would incentivise the public to participate.
In this part, I will examine some of the commonly recognised consensus mechanisms starting with the one used on the Bitcoin blockchain.
188.8.131.52 Alternative consensus mechanisms
184.108.40.206.1 The Proof-of-Work
The consensus mechanism behind the Bitcoin blockchain, also known as the proof-of-work, is the reason why it is considered revolutionary. As explained before, the Bitcoin is introduced as a reaction to the failure of the centralised financial institutions during the 2008 Financial Crisis. It is designed to function as a decentralised payment system relying not on the intermediaries but on the cryptography. The proof-of-work concept is how Bitcoin tries to replace the intermediaries.
The proof-of-work mechanism gives the power of determining the next block to the participants who can provide a computational proof that they spent resources and solved a computational puzzle. Computational proof can be obtained only after a series of intensive computational calculations which requires a certain amount of hardware and electricity investment. By requiring such a proof and rewarding the one who managed to present the proof, the proof-of-work mechanism not only prevents the entrance of non-dedicated participants but also incentivised participants who have already invested to keep the system functional so that they could profit.
220.127.116.11.1.1 Bitcoin mining
Looking for the proof is essentially trying different hashes until you find the one that meets the conditions. It is similar to the mining in the sense that you cannot know whether you are aiming at the right spot until you actually hit the rock and reveal what underlies it. Hence, this process of looking for the proof is called ‘mining’ and the participants who are trying to find it are called ‘miners’.
Why do we need the mining? As explained above, a block needs to contain the hash of the previous block. However, if this was enough, anyone could create a block since the Bitcoin blockchain is publicly available, which would destroy the integrity of the blockchain. To prevent this, we need a mechanism to determine the node that will get to choose the next block to be added to the main chain. In addition to hashes, the blocks in the Bitcoin blockchain are connected to each other also with a cryptographic puzzle and who solves the puzzle first gets both the right to choose next block and the reward linked to the creation of a block.
How does the mining work? Firstly, miners need to get the hash of the last block of the blockchain. Secondly, they need to collect transactions that they would like to put into the next block. Then the mining begins. Before advancing further, it must be stated that the process we are about to explain has been built in the core code of the Bitcoin blockchain by the initial coders as a matter of choice. In other words, there is not a single correct way of mining. What is important here is to have a system that would incentivise people to participate and discourage adversaries at the same time.
The puzzle here is connected to the complicated block structure of the Bitcoin. As it might be recalled, there were different parts in the block header we have not explained before. Now we will see how the nonce and the difficulty target in the block header come into play. Miners start double hashing the block header using SHA-256 output of which is called ‘the block hash’. Nonce and difficulty are essentially numbers. Since they are parts of the block header, the block hash changes as they change. Nonce is the arbitrary number the miners change continuously in order to find the correct block hash. Miners are completely free at determining their starting value of nonce. Difficulty, on the other hand, is recalculated periodically by the number of blocks added in a certain time. If there are too many miners working and blocks are being added quickly, the difficulty is increased. According to the Bitcoin’s initial code, the difficulty is recalculated in order to keep the time between two blocks at ten minutes in average.
The block hash of the Bitcoin genesis block is as follows:
As it can be seen, block hashes start with a set of zeros. Solving the puzzle means finding a nonce that, when the block header is double hashed, produces a hash value small enough to satisfy the difficulty target, which is calculated with the variables of ‘difficulty’ and ‘bits’. The block hash must be smaller as the difficulty increases, meaning that there will be more zeros at the beginning.
However, there is no single nonce that is correct for all miners. Since miners select different transactions for the next block and they include their own addresses for the reward, the hash is different for every miner and every miner looks for a nonce that satisfies the difficulty requirement with his/her own block.
This search for the nonce requires an immense amount of electricity, especially since the difficulty has been increased. This triggered a separated debate regarding the sustainability of the Bitcoin.
Who are these miners? In case of the Bitcoin, it can be anyone, at least in theory, since the Bitcoin blockchain is a permissionless blockchain that allows anyone to join at any point. In principle, you can be a miner just by downloading the all data and running a full-node on your computer. However, in practice, due to the fact that the Bitcoin blockchain is the most popular one gained the biggest attraction, the difficulty level is significantly higher compared to other mining-based cryptocurrencies and, therefore, it is not easy to afford the necessary hardware.
Why are miners interested in spending resources to find the next block? In each new block, there is one specific transaction, which is the coinbase transaction. The coinbase transaction does not have a sender address but only a receiver address. When bundling transactions in a block, miners can determine the receiver’s address for this coinbase transaction. However, it becomes meaningful only if their block is added to the longest blockchain, where other transactions are made.
What happens when a miner finds a correct nonce? It means finding a new block. The miner broadcasts that information on the network. Validating whether this new block’s header satisfies the difficulty requirement is easy and requires just one hashing. Other nodes run this validation, but they are free at accept or rejecting the block. At any point a miner can arbitrarily ignore this new block and keep working on its own block, but it would be risking wasting his/her resources. Why? In the Bitcoin blockchain, the longest chain is considered as the valid chain. In other words, a Bitcoin is valuable only if it registered on the longest chain. Miners are driven by the idea of getting a reward which is possible only if their block gets added to the longest blockchain. In principle, miners do not care about the identity of the people who find the block but the verification of the block and transactions in it. As long as the nonce satisfies the difficulty requirement and transactions pass the automated validation test, miners are inclined to accept the block and start working on the next one, with the idea that the earlier they start on working, the sooner they can find a block.
Taking the function of the Bitcoin into account as a payment system, there are three commonly-cited attacks two of which could damage the Bitcoin network to some extent.
Double-spending attack is a general concern at all types of digital payment systems. However, Bitcoin has an answer to this problem. The proof-of-work mechanism solves the problem partially as each transaction includes the track record of the Bitcoin that would be spent. Miners run full nodes storing the all transaction history. Before putting a transaction, they can check whether Bitcoins in that transaction have been spent previously by the same sender or not. Therefore, if an adversary broadcasts a transaction trying to spend a Bitcoin that has already been spent, it gets rejected by the other honest miners. However, there is still one possible scenario where double spending might occur.
Let’s assume that miner Alice puts a transaction sending 1 BTC to Bob in a block and manages to get it on the longest chain. This will be broadcasted to the other participants but not all of them will get the message simultaneously. Right after doing that, Alice puts another transaction sending the same Bitcoin to Charlie this time on another block and tries to attach this block not to her latest block but to the block before it. If she manages to do it before someone else attaches a new block to her latest one, there will be two chains with the same length whose latest blocks are different. This is how a fork in the chain arises and, if it is not a planned fork, this would create a confusion since the miners follow the longest chain by convention. To prevent risks that could arise from such scenario, there is a solution based on convention. In the Bitcoin blockchain, a transaction is considered valid only after five more blocks are added following that transaction. Each new block makes it more difficult to tamper with the previous ones since changing a block would require changing all blocks following it due to the connection created by hashes between blocks.
18.104.22.168.1.2.2 %51 Attack
As explained above, under the proof-of-work regime, the truth is determined by miners, which might involve adversaries. As Nakamoto stated in the whitepaper:
“The system is secure as long as honest nodes collectively control more CPU power than any cooperating group of attacker nodes.”
%51 attack indicates a scenario where more than %51 of the overall hashing power is controlled by a group of adversaries. By controlling more than %51 of the hashing power, adversaries might amend the transaction history and control the future transactions.
However, “%51 Attack” is a misleading tag for two main reasons. Firstly, there is a very common logical error. The idea here is to control more than half of the hashing power and any value exceeding the %50 would do the work. More appropriate name would be “%50+ Attack” or “Majority Attack”. Secondly, and more importantly, even controlling less than half of the hashing power might be enough perform such an attack considering that new blocks are broadcasted not from a central authority but between participants.
Although such an attack is theoretically possible, due to the scale of the Bitcoin network, it is almost impossible to perform it on the Bitcoin blockchain. Werbach argues that necessary processing power required to perform it would be “equivalent to several hundreds of the world’s fastest supercomputers, running non-stop”.
22.214.171.124.1.2.3 Sybil Attack
Sybil attack indicates the scenario where adversaries create multiple identities and run multiple nodes. Bitcoin network is resistant to Sybil attacks since what matters under the Bitcoin’s proof-of-work mechanism is not the number of identities, but the amount of the hashing power controlled.
126.96.36.199.2 Proof of Stake
Under this consensus regime, determination and validation of the next block is given to the participants who has a stake in the blockchain. The nature of the stake and the method of proof depend on the design. The stake is usually the possession of certain amount of coin circulating on that blockchain whereas the common method of proof is to facilitate mining for participants in proportion to share in the stake.
Instead of just possession, the stake might be proven based on other models, such as the duration of possession (proof of coinage), the deposit of coins (proof of deposit) and the burn of coins (proof of burn).
There are two main benefits of this system compared to the proof-of-work. Firstly, as coins are more spread than the computational power, controlling a certain proportion of the stake is more difficult than the computational power. Secondly, by changing the difficulty of mining, it saves computational resources.
Proof-of-state is used by Peercoin. More importantly, as announced by its founder Vitalik Buterin, the Ethereum blockchain is planning to shift to proof-of-stake. The shift will take place gradually, involving a transition phase where proof-of-work and proof-of-stake mechanisms co-exist.
188.8.131.52.3 Proof of Elapsed Time
This is a relatively new consensus mechanism introduced by Intel for a specific project called ‘Sawtooth Lake’. Under the proof-of-elapsed-time, the node that would propose the next block is selected according to the time that nodes waited before proposing a new block. The proof-of-elapsed-time is, in fact, a different type of the proof-of-work. Instead of requiring immense amount of electricity and computing power, it relies on a different type of proof, which is the elapsed time.
184.108.40.206.4 Federated Consensus
This is a voting-based consensus mechanism under which new blocks are added only when they are voted for by a specified quorum of trusted nodes. This is used in the Stellar consensus protocol and Chain.
Another commonly claimed feature of the Blockchain technology is immutability. Immutability indicates that once a bit of information is stored on the blockchain, it cannot be modified or reversed. There are two problems with the immutability. Firstly, there is no truly immutable blockchain. As explained above, the ‘truth’ in a blockchain is determined by the consensus mechanism and, theoretically, it is possible to reverse the ‘truth’ by the agreement of participants of the consensus protocol. Secondly, even in blockchains where the immutability is a much-desired property, such as the Bitcoin or Ethereum blockchain, the best we can achieve is to design a consensus mechanism which makes modifying the blockchain as impractical as possible.
220.127.116.11 Immutability of the Bitcoin blockchain
The Bitcoin blockchain uses the proof-of-work as the consensus mechanism and new blocks are added by miners. Modification of previous blocks is not wanted as the Bitcoin blockchain tracks the record of transactions in a cumulative manner. In theory, it is possible for a group of miners controlling a significant amount of mining power come together and modify the history. However, they are not incentivised to do so. On the contrary, as they benefit from the well-functioning of the Bitcoin network, they are incentivised to keep its integrity. Additionally, the increase of nodes in the Bitcoin network makes it more difficult to control a meaningful proportion of computing power.
The Bitcoin blockchain is not immutable but it is very difficult to change the history. As explained above, each block contains the hash of the previous block. Changing a previous block would change the hash of that block, and that would change the hash of all following blocks, which is called as the avalanche effect. In addition to that, other miners will be working on the next block, meaning that the gap will be getting wider and it would be wasting resources. This is how the Bitcoin’s proof-of-work system not only incentivises participants to play by the rules but also discourages individuals from attacking the integrity of the blockchain.
Blockchains are, by nature, branched. You can choose to add a new block not to the longest branch but to a shorter one, or, you can create your own branch. In these cases, the question would be how other participants would react. Consensus mechanisms are put in place to ensure that a significant proportion of participants would agree on a particular version of the truth, the longest branch in the Bitcoin’s case.
A block is meaningful only if there are nodes following its reality. Let’s assume that Alice sends 10 BTC to Bob and puts this transaction into a block. In order for Bob to use this 10 BTC, other nodes must agree on working on the branch where this transaction is put. The longest-branch rule gives nodes a guideline to choose which branch, at least to some extent. However, establishing an agreement between the nodes might not be this easy all the time. For some reason, such as an update to the protocol or existence of a suspicious transaction, different groups in the network might choose to continue with alternative branches and each of these branches might end up becoming a different longest branch or a different truth. This is what we call as a fork.
Forks are exceptions to the Blockchain’s so-called immutability. Each fork is an attempt to create an alternative longest chain, separate from the main branch. Now I will explain two different forks that occurred on the two major cryptocurrencies’ blockchain.
18.104.22.168.1 Bitcoin Fork
In March 2013, a version update came for the Bitcoin software. Not all participants updated immediately and there was a period when different participants used different versions. There was a single block, the block #225430, which was read by the newer version but not by the older one. Thus, at some point, miners using different versions ended up following different branches. This was not an intentional fork, but one caused by the incompatibility between these versions.
It was extremely dangerous for the future of a payment system to follow different branches for the same currency and major developers came together to solve the crisis. Newer version’s fork was being followed by more miners, it had more hashing power and it had more blocks. However, following the newer version’s fork would force all participants to upgrade since it had an unreadable block. On the other hand, such an update would not be required if the older version’s block was followed. As a result, the major developers agreed on the older version’s block and they downgraded their versions. The network was notified about this and the older version’s fork caught up with that of the newer version, eventually took over.
This is not the only fork Bitcoin went through but it was the most problematic one. The other forks were planned and voted by the community. The Bitcoin blockchain forked into two other cryptocurrencies, the Bitcoin Cash and the Bitcoin Gold, respectively. There is also a discussion of another fork over the block size, which could not be performed since it had not been accepted by the majority in the network.
22.214.171.124.2 Ethereum Fork and the DAO Theft
Ethereum’s blockchain is structurally different than that of Bitcoin. It has a Turing-complete virtual machine built-in meaning that it can run programs solving computational problems. One of these programs are decentralized autonomous organizations (DAO) which are comprised of smart contracts automating governance and business logic.
The most infamous DAO project was the DAO created by the Slock.it. The DAO raised more than 150 million USD and became the biggest crowdfunding project until its time. It was a virtual venture capital fund that is governed by the investors of the DAO. However, the DAO got hacked due to a bug in its code and one third of the funds were transferred to a child DAO controlled by the hacker. The proposed solution was a hard-fork that means modifying the history and reversing the theft, and this triggered a very interesting debate among the community.
Those who argued against the fork mainly relied on the philosophical foundations of the Ethereum blockchain. They argued that the code is the law and everything the code allowed is legitimate. Additionally, they claimed that the data on the blockchain is immutable, it should be kept that way, and doing the contrary would harm the Ethereum blockchain in the long term. On the other hand, those who supported the fork focused on the disastrous outcome of the theft. According to them, the hack was too big to let go and the community should be the final decision makers. By doing so, the funds would be returned, and regulators would be kept out. The hard fork proposal was voted and accepted by 89% majority of the people. Ironically, victims of the hack were able to get their funds back since the so-called immutability was not absolute.
The Ethereum hard-fork did not prevent all participants from following the old main branch. Thus, the branch created with the hard-fork continued as the Ethereum whereas the old branch kept going as the Ethereum Classic.
The data on a blockchain is not associated with real-life information such as names or ID numbers. Rather, nodes participate in a blockchain by using key pairs comprised of one private and one public key. Using keys maintains the security of the network. Depending on the design of the blockchain, both the data and the participant’s identity can be kept secret.
In the Bitcoin blockchain, transactions are publicly available. However, the only information regarding the sender and receiver(s) is the hash of their public keys, aka addresses. In a Bitcoin transaction, sender signs the message saying that he wants to send a Bitcoin to the receiver and signs this message with a private key in addition to providing a public key to show that he/she owns that Bitcoin. To be more precise, a private key is a randomly generated number. A public key is a number generated from a private key. In order to spend Bitcoins, the amount to be sent is entered as input. Input can be divided into different outputs if necessary. The hash of the receiver’s public key is entered as the output address. Then the transaction is signed by the sender with his/her own private key. This Bitcoin can be spent only by a person who has access to the receiver’s private key.
Although transactions are not formally associated with the real-life identities, the Bitcoin blockchain is not completely anonymous, rather, its pseudonymous meaning that a Bitcoin address might be linked to a person after an examination of transactions despite the lack of a formal connection. For additional privacy, it is advised that a separate key pair should be used for each transaction, or use coinjoin transactions under which transactions are bundled in a single transactions with mixed addresses in order to reduce the traceability.
Finally, it must be remembered that the wallet services make it even more difficult to stay anonymous. There is no additional data stored in the blockchain when wallet services are involved. However, these services are mostly subject to anti-money laundering and know-your-customer rules, and to comply with these rules, the wallet services ask for very detailed information and use confirmation mechanism before letting people register for their services, which means that they know which transaction made by which user.
 Pinna & Ruttenberg (2016), p. 9. Rohr & Wright (2017), p. 8. Trautman (2016), p. 237.
 Catalini & Gans (2017), p. 1. Paech (2015), p. 24.
 Wright & De Filippi (2015), p. 6. Paech (2015), p. 24.
 In general, cryptographic algorithms are set of instructions to be followed in order to ensure that an action is completed securely. More specifically, in the case of data management, the idea is to store and transfer the data as securely as possible. Accordingly, the data is not stored and transferred in its original form but, mostly, it is encrypted using cryptographic algorithms, which take an input and transform it to something else according to pre-determined rules. A famous and simple example of such algorithms is the Caesar Cipher, a text encryption algorithm under which each letter in the input is substituted with another letter that is a determined step down or up in the alphabet. Unlike the Caesar Cipher, which can be cracked due to very limited possibilities of the shifting step, the algorithms used in a Blockchain is much more complicated and difficult to crack.
 Pinna & Ruttenberg (2016), p. 9. Catalini & Gans (2017), p. 1.
 The term ‘Distributed Ledger Technology’ or ‘DLT’ is sometimes used interchangeably with the term ‘Blockchain’, which is wrong. DLT is a broader concept than the Blockchain as using blocks is not necessarily mandatory in all distributed ledger systems.
 For a detailed analysis on the terminology see, Walch, Lexicon.
 Nakamoto, S. (2008). Bitcoin: A Peer-to-Peer Electronic Cash System. Available at https://bitcoin.org/bitcoin.pdf (Accessed on 18 Jan 2018).
 Nakamoto (2008), p. 1.
 Bitcoin’s first block, the block 0 or the genesis block by convention, was mined on 3 Jan 2009. The genesis block’s data can be seen at https://blockchain.info/block-index/14849. As Bitcoin did not have any official circulation platform, it took some time for the market to put a price on it. The earlier date for which the Coindesk can show a price for Bitcoin is 18 Jul 2010 and the price is 0.06 USD per Bitcoin. It hit 100 USD in March 2013, 500 USD in May 2016, 1000 USD in February 2017, 2000 USD in May 2017, 5000 USD in October 2017, 10000 USD in November 2017 and 15000 USD in December, https://www.coindesk.com/price (Accessed on 20 Jan 2018).
 Permissionless-permissioned blockchains are sometimes referred to as public-private blockchains, respectively. See, Walch, Operational Risk, p. 1.
 New blocks are added to a blockchain by mining. For a detailed information on mining see below p. 14.
 Bashir (2017), p. 87. The Bitcoin blockchain uses SHA-256 algorithm which produce 64-character long strings as output. You can visit http://www.timestampgenerator.com/tools/sha256-generator/ for an online converter.
 Hash functions create a fixed-sized output meaning that there are fixed number of possible outcomes whereas there are indefinite number of possible inputs. Hence, collisions are possible in hash functions by their nature. The possibility of a collision is dependent on the length of the outcome of the hash function. However, in reliable hash functions, it is computationally infeasible to find these collisions. See, Bashir (2017), p. 89.
 For detailed information see Bashir (2017), p. 127; Nakamoto (2008), p. 4.
 The terminological difference between the terms ‘centralized’, ‘decentralized’ and ‘distributed’ is not standardized. See, Baran (1963), p. 3. For the purposes of this paper, distributed nature indicates that the data is not stored at one single location whereas decentralisation means that there is no single authority to make decisions about the ‘truth’ in a given blockchain.
 Werbach, Trust, p. 3. Rasjun & Yermack (2017), p. 4.
 Walch, Operational Risk, p. 5.
 https://blockchain.info/charts/blocks-size .
 Nakamoto (2008), p. 5. Bashir (2017), p. 138.
 [This reference is omitted]
 For detailed information on public-private key pairs see below, p. 21.
 Nakamoto (2008), p. 5. Bashir (2017), p. 138.
 Nakamoto (2008), p. 4. Bashir (2017), p. 95.
 Mainelli & Milne (2016), p. 46. Paech (2017), p. 7.
 Peters et al. (2015), p. 2.
 Bashir (2017), p. 28.
 Mainelli & Milne (2016), p. 56. Paech (2017), p. 12.
 Evans (2014), p. 11.
 Cong & Ze (2018), p. 9.
 SHA stands for ‘Secure Hash Algorithm’. SHA-256 is a part of the SHA-2 set, which is a set of cryptographic hash functions designed by the U.S. National Security Agency.
 The difficulty of the genesis block is “1” and the bits value of it is “1d00ffff”.
 It is argued that the energy required for the Bitcoin mining is relatively small compared to the costs of capital and labour required to secure transactions under the traditional regime. See Catalini & Gans (2017), p. 6.
 Rohr & Wright (2017), p. 9. Werbach, Trust, p. 15.
 Nakamoto (2008), p. 3. Aggarval et al. (2017), p. 3.
 This is the so-called ‘six confirmations’ rule. Due to the fact that each block contains a reference to the previous blocks, each block is also a confirmation of transactions in previous blocks.
 Nakamoto (2008), p. 1.
 Atzori (2015), p. 17.
 Werbach, Trust, p. 24.
 Werbach, Trust, p. 12.
 Cong & Ze (2018), p. 9. Bashir (2017), p. 166.
 The security and randomness of the proof-of-elapsed-time mechanism is provided by Intel’s ‘Trusted Execution Environment’ and ‘Software Guard Extensions’.
 Bashir (2017), p. 370.
 Bashir (2017), p. 30.
 Walch, Operational Risk, p. 4.
 [This reference is omitted]
 Aggarval et al. (2017), p. 3.
 Walch, Operational Risk, p. 14.
 Walch, Operational Risk, p. 15.
 Rohr & Wright (2017), p. 10.
 Bashir (2017), p. 44. Cong & Ze (2018), p. 11. For more information on smart contracts see Raskin (2016).
 Walch, Operational Risk, p. 17.
 Werbach, Trust, p. 6.
 Initially it was possible to use public keys as addresses but the Bitcoin protocol has been modified over time. Now, the hash of the public key is used as address for both security reasons and to save space. See Aggarval et al. (2017), p. 3.
 Aggarval et al. (2017), p. 3.
 Bashir (2017), p. 69.
 Pilkington (2015), p. 5.
 Nakamoto (2008), p. 6.
 Tasca (2015), p. 19.
Article Prepared by Ollala Corp