When it comes to technology, we rarely ask about the nuts and bolts cranking within the machine. Yet, with cryptocurrency and the blockchains they are built upon, it’s important to understand the machinery behind the hype.
Cryptocurrencies are still in their nascent stages. The protocols shaping the blockchains will one day have a significant impact on how we transact, how our finances are secured, and even how our information is exchanged. In the future, blockchains will have wider reaching implications than today, which will effect our privacy, equality, governance and of course—our prosperity.
When the internet first became mainstream, the cypherpunks believed that it could become a new platform where our human rights would flourish. Unfortunately, as corporate centralization became dominant… this original vision never came to fruition.
We are at another internet crossroads in history with blockchains. Call it another chance to create a new internet protective of our human rights and freedoms. It’s imperative that we are able to examine and support the right projects, the right blockchains—as these seedling blockchains will become the powerhouses of our future. Without the proper blockchain protocols, such nascent seeds will lead us into same internet of surveillance capitalism and centralization that we have today.
There are many educational pieces out there on blockchains. Most tend to be either over-simplistic in their explanations or presented in such a way that they are beyond the reach of our understanding. Here, it is my hope to take an intermediary approach by providing you with enough information to be able to grasp what blockchains are, yet not to overwhelm you with code and unnecessary information useful only to programmers. Even so, some of the words here are technical. But they actually have become common language to crypto enthusiasts. Knowing the rudiments of blockchains will put you in a much better position than the vast majority of newcomers plunging into crypto based solely on hype and FOMO.
Providing even a middling knowledge of blockchains can be quite complex though. Therefore, I will break this down into bite sized chunks and use some popular analogies to help explain. My hope is that you will find it useful to bookmark this page and refer back to it anytime you need help in evaluating a new crypto project or just need a refresher. Be sure to use the glossary feature as well, where you can hover your pointer over a word and get an instant definition. Bitcoin will be the template to examine blockchains through, as it provides the foundational and breakthrough knowledge that is key understanding blockchains, which began with the publication of the Bitcoin whitepaper Satoshi Nakamoto.
The Bitcoin Blockchain Train
Transactions on the Bitcoin blockchain take place peer-to-peer, which not does not simply mean person to person. It can be a computer-to-person, or a person-to-computer, or even a computer-to-computer. The best analogy I have seen so far to help people to understand such blockchain transactions is the Bitcoin Blockchain Train.
Imagine this special kind of train for storing cargo. Once a transaction takes place, it is locked into a container and then placed into a boxcar one after the other. But all of these stored transactions are not considered confirmed and secured until the boxcar door closes. And even once the boxcar’s door is closed and locked, even more security is added. In fact, with the Bitcoin blockchain train… it is only after many sequential boxcars are lined up and locked that the security is finalized, which is why the Bitcoin blockchain train has never been robbed (or hacked).
A blockchain works just like the above. You have the transaction (the cargo), which is a peer-to-peer exchange of bitcoin. In our analogy, the blocks are the boxcars on the train, inside the boxcars are all the containers of transactions. And as the blocks are filled up (each block has a 10-megabyte capacity), the block’s doors are closed and locked. As the blocks are lined up on the track, they become more and more secure with every new block that is appended.
In this regard, Bitcoin is an accounting ledger system. A ledger can simply be a record of transactions. The boxcar would represent one page of the accounting ledger containing a single list of transactions. The entire train is the blockchain representative of the entire accounting book.
Thus, there are two systems at work: the transactions themselves, or the peer-to-peer exchanges—and the blockchain (the ledger), which stores the entirety of all these transactions.
The blockchain is an immutable ledger—meaning once a block is formed, it becomes part of the record of transactions that cannot be changed. It is also referred to as an append only ledger, meaning that blocks can only be added to the blockchain ledger and never taken away. Any alteration of data within a block would transform the entire block.
If the Bitcoin blockchain is the entirety of all the blocks, and each block contains a separate set of recorded transactions, then why is it considered a decentralized distributed ledger?
When we speak of a decentralized distributed ledger, it is considered such because the entire immutable blockchain is stored and distributed across thousands of data nodes all across the world. Full node operators collect the transactions in what is known as a gossip protocol. It is a way to distribute a vast amount of information to the entire Bitcoin network for validation. But this is just one component. To establish network stability, the miners then validate the accuracy of these transactions.
This is a pertinent point, because a public blockchain is decentralized—meaning it is not closed off to an exclusive group or corporation, and to maintain that definition it must be an open-source protocol validated by a network of node operators rather than any one particular source. A blockchain that is not fully accessible to the public is known as a private blockchain—and private blockchains are centralized.
Now that we understand that there are two distinct information channels in blockchains: the transactions themselves and the blockchain ledger, we’ll take closer look at each of these categories starting first with the encryption of the transactions.
Blockchain Explained: Transactions on Bitcoin
“If I have seen further, it is by standing on the shoulders of giants.”—Sir Isaac Newton
Satoshi Nakamoto truly stood on the shoulders of giants with invention of a decentralized blockchain. As we shall see, he was a great aggregator of many technologies which all came together to form a reliable means of transacting peer-to-peer without the need of a middleperson. Terminology such as hashing, digital signatures, random number generators, are all technologies used in the Bitcoin protocol discovered by other cryptographers throughout history.
The best place to begin understanding how peer-to-peer transactions work is with the first Bitcoin transaction ever sent. This was from Satoshi Nakamoto to Hal Finney on Jan 12, 2009.
One of the problems that Satoshi wanted to solve with Bitcoin is how to send a transaction securely, privately, and without the need for middleperson.
Before the Bitcoin can be sent, it would first have to be generated into existence. In reference to the first transaction to Hal Finney, Satoshi already completed the genesis block—thereby creating the first 50 Bitcoins—on Jan. 3rd, 2009—so Bitcoin had already been born and owned by Satoshi. To complete a transaction to Hal, Satoshi then sent Bitcoin from his wallet to Hal’s wallet address.
When we think of a wallet address in Bitcoin, an easy way to understand it is by thinking of a checking account. The checking account number has 10-12 digits where the money is stored. Checking accounts, however, are not decentralized. You need a bank or third-party to be the middle person and control the flow of funds into and out of the account. Also, whereas checking accounts keep track of the balances within the account, Bitcoin instead tracks the transactions themselves. In this regard, it is a transaction ledger of inputs and outputs.
When Satoshi sent Hal the first 10 Bitcoins, the Bitcoin flowed out of Satoshi’s wallet (as a transaction output) and into Hal’s Finney’s wallet address (an input). The input of 10 Bitcoin to Hal is now the current amount of Bitcoin that he holds; Satoshi is left with 40 Bitcoin (assuming he began with 50 Bitcoin). You can think of this of this in terms of double entry-bookkeeping: Debits are the inputs. They increase an asset’s value. Credits are the outputs; they diminish the value of the asset. Hal’s Bitcoin asset increased, while Satoshi’s asset decreased.
Note: Hal had already downloaded the Bitcoin protocol stack and therefore had a wallet address for Satoshi Nakamoto to send the Bitcoin to.
Hash Functions
To solve the problem of privacy and security within transactions, Satoshi used a hash function. A hash is a conversion of information into a unique digital fingerprint consisting of a set length of characters. The fingerprint no longer resembles the data it represents but allows the data to be accessed. Hashes therefore are a one-way function.
Hashes act as an identifier for the Bitcoin network to verify the authenticity of transaction. Check out this MIT link for a demonstration on how data is converted into a hash. Just type into the empty box and you can see hashes being created.
Hashes look like the following:
d69682034cd523267c024334674513e4992066a5814f89e1e05b62e53ee5360c
Getting back to the blockchain train metaphor: The transactions (the cargo) are protected by a hash. Picture each piece of cargo being stored on our train being placed into a locked box. The locked box is the hash; the cargo locked inside the cargo box is the Bitcoin transaction information. These hash locks also play a role in forming the cryptographic puzzle that miners will eventually solve to receive a reward in Bitcoin (more on this later). They also help create transaction identifiers. And you can check on any Bitcoin transaction here on a block explorer using a transaction the hash as an identifier.
In our transaction from Satoshi to Hal—this transaction contains a certain finite set of data. Once Satoshi sends the Bitcoin—the transaction finite dataset is hashed. This representative fingerprint of a fixed length of digits is now tied to the data in the transaction. If any of the data within the transaction is altered, the hash is no longer tied to it… it becomes a new hash.
Hashes Secure the Blockchain
The immutability of the blockchain is partly accomplished through hashing the data as described. And because hashes are securely linked to the data, the data contained within the transaction can be accessed only by inputting the exact match to the hash. If one were to attempt to change any of the transaction data, such as how much Bitcoin was sent, the hash too would change… whenever a hash changes, the entire blockchain is effected. It would invalidate the block and all then subsequent blocks appended to it. It would fork the chain. (More on this later when Bitcoin mining is discussed).
This feature is part of the discovery which helped to solve what is known as the double spend problem with digital currencies. Since full nodes contain a complete copy of all the Bitcoin transactions, including the new transactions presented for validation, when a transaction is announced to the Bitcoin network, the transactions are crossed referenced against the entire blockchain ledger. At this point, any attempt to double spend the Bitcoin would be invalidated.
Note: The specific hash function Bitcoin uses to secure transactions is the SHA-256 hash. SHA stands for secure hash algorithm. As discussed earlier, the same hash data or hash input will generate the same exact output. The 256 refers to the length of the highly secure algorithm–256 bits (or 32 bytes).
One last thing to point out went it comes to Bitcoin hashing is that there is a difference between transaction hashes and mining hashes. Transaction hashes convert the input data of transactions into a hash, whereas mining hashes convert the data of an entire block. The transaction hash can be used to find information about a particular transaction, whereas a mining hash can find information for the entire block.
Digital Signatures
Getting back to Satoshi Nakamoto’s and Hal Finney’s first transaction, we have covered how the data itself is locked, or encrypted through a hash function. But for these transactions to maintain a level of privacy and security, there is another cryptographic primitive at work is known as the private keys, the public keys and addresses by which Bitcoin can be sent and received.
The way that private keys and public keys are generated securely is through two steps. First a 256-bit random number is generated to create the private key. The private key random number that is created is 1077 (all the atoms in the known universe are estimated to be 1080). From this private key, an elliptic curve digital signature algorithm (ECDSA) is applied to private key, which is essentially another random number generator used to create the public key. Through this process these two keys are paired together in such a way that the private key will only be known to the wallet holder, while the public key is linked to an accessible public address. The public address can be made known and is the address that we are able to share and receive Bitcoin through.
Note: The Bitcoin addresses that we may be familiar with are not actually the publics keys; these addresses are only generated from the public keys just discussed by way of further cryptographic hashing. I’m sure you’re beginning to get the sense as to why the Bitcoin network is highly secure and hasn’t yet been hacked. It would take a quantum computer to be able feasibly break these encryptions (and should quantum computing ever come to such fruition, full node operators verifying transaction and miners together can then agree to update the Bitcoin protocol–its code–through a BIP, or Bitcoin Improvement Proposal. In other words, they can implement an upgrade to make the Bitcoin network quantum resistance. And I’ll digress even more. If a quantum computer was created, all the worlds infrastructure is in jeopardy. Because Bitcoin could have an across the board solution implemented as I just described, it could actually be a safe haven to transfer wealth into while the world roils from quantum computing shock).
Now back to our transaction: For Satoshi to send the Bitcoin, he is able to do so from his Bitcoin wallet. He is the only one that can transfer these funds from his Bitcoin wallet since he is the sole holder of the private key (provided he has not shared his private key with anyone). On Hal’s end, when the Bitcoin is received into his wallet address derived from his public key… Hal is the only one that can receive this Bitcoin (as long as Hal too hasn’t shared his highly secure private known only to him). This is how Bitcoin is transacted securely. Mining nodes then validate these transactions and add them to the memory pool (mem pool). Miners are incentivized to validate transactions honestly because in doing so they can win the block reward.
Bitcoin Mining, Proof of Work and Consensus
Now that we understand the security behind transactions through hash function and digital signatures, we’re ready to explore how Bitcoin is mined and how the miners contribute to the overall stability, security and decentralization of the Bitcoin network.
Block Headers, Nonces, and the Merkle Tree
Proof-of-work is completed through a system of validation. Bitcoin blocks contain many transactions. These transactions in a block are organized through Merkle trees by the miners. The base layer of the Merkle tree contains about 500 or so transactions. A Merkle tree is built up from the base of these transactions by rehashing 2 transactions into one hash, and rehashing again, until there is only on hash left called a Merkle root. See chart labeled Bitcoin Block below. By organizing transactions in such a way, the transactions within the block become compressed and allow the miners to more easily manage the information. Miners structure the Merkle tree within the block based on the transactions in the memory pool (or mem pool), which consists of the current transactions validated by the miners.
As discussed earlier—hashes are one-way. The same is the case for the Merkle tree. Changing any of the data within the Merkle tree will cause a cascading affect invalidating all the subsequent branches and will impact the Merkle root at the top of the tree. This MIT video shows how this cascading effect takes place. Because the Merkle root is fixed based on validated transactions, when miners search for the block header, this hash is also part of the validation. Therefore, alternations along any part of the Merkle tree (to the transactions themselves or the hashes they are built upon) will impact the Merkle root. It will show up as an invalid block to the other miners that are comparing it to the transaction ledger.
The block header contains the following information: the version number of the Bitcoin, the Merkle root, the hash of the previous block, a timestamp, the target and the nonce. Apart from the Merkle root, the nonce too is especially important. The nonce standards for number used once (N stands for number plus the word once = nonce). In data format, the block header looks like the following and contains all of the above information:
When we hear about hash power and miners competing to solve a cryptographic puzzle, the nonce (contained within the block header) is the random puzzle that they are referring to—and the hash power is the computing power needed to mine a block based on the current difficulty level. For those of you who have played role playing games with dice, imagine that you are attempting to role below a certain number to activate a healing potion. The nonce can be visualized in a similar fashion where a mega computer rolls a set of dice over and over in attempt to roll below a certain extremely large number, and in doing so—they will win the reward. The size of nonce they will be searching for is set by the target—this is the targeted difficulty which determines size of the number threshold to be guessed below. Having a target allows the nonce to fluctuate based on the current activity of the network. This target keeps the creation of new blocks at about 10 minutes per block. The miner who finds the nonce (the random number below the threshold) with their computing power first wins.
Once a miner solves the cryptographic puzzle, meaning their mining rig guessed the nonce, the block that they have created is published to the network. The miner lucky enough to solve the puzzle is eligible to receive the coinbase transaction. This is a transaction to the miner that contains the block reward—the 6.25 Bitcoin plus the transaction fees included in the block. Satoshi programmed into the Bitcoin protocol a rule that even though the miner has received the block reward—the coinbase—it cannot be spent until 100 blocks are mined. This ensures that it is only received by the miner after it has been fully validated through the consensus of other miners.
Mining does a few things supportive of the Bitcoin network. First, systematically incentivizes the miners to secure transactions on network in a decentralized manner; secondly, it allows for a consensus system to be developed that maintain the integrity of the network; thirdly, the reward mechanism itself builds value by way of a networking effect and scarcity of the Bitcoin
Consensus
Since the blockchain is an immutable, append-only ledger—blocks can only be added to the blockchain, and once added they cannot be removed. By competing to solve the nonce, the miners are both validating the Blockchain while searching for the answer to the cryptographic puzzle to receive the block reward.
If data was to be manipulated or changed, the hash would never be discovered by the miners validating the block. If a miner falsified a block, it would sit as a stand-alone block and the miner would never receive the block reward even if they successfully mined the block. This is because the block will not be confirmed by the other miners.
If you recall, within the block header, the hash of the previous block was included. So even if the transaction data were to change within that block—the previous block header would change as well. The miners would recognize this and build on the longer chain instead. They do not what to waste computing power on an invalid chain. Even if they were to validate a block that is faulty. At least one hundred blocks subsequent blocks would have to agree on the faulty block for the miner to receive the reward, an infeasible scenario unless done through a 51% attack.
Note: Infeasible scenarios are scenarios in cryptography that have such a low probability of occurrence that for our understanding they may as well be impossible.
To accomplish and attack the miner would have to control 51% of the mining hash power, they would then mine a sidechain making attempting to make it the main chain (they may even change the protocol of Bitcoin in such an attack). Though this has played out in the past when the Bitcoin network was much small, currently this is an unlikely scenario as no single entity controls more than 51% of the Bitcoin network. The overall topic of forks, however, is prolonged and nuanced and will not be discussed here.
Who controls the Bitcoin Network?
Bitcoin is not controlled by any miner, full node operator, corporation, developer, wealthy individual, or coterie of wealthy individuals. Bitcoin is designed to keep power in the hands of the many. The protocol or software which runs Bitcoin is accessible to anyone with a decent computer capable of holding more than 280 gigabytes of data (based on the latest size of the Bitcoin blockchain). A full node operator must also have some tech know-how to install and run the software.
The full node operators must be in full agreement before any major changes to the protocol can take place. (And there are tens of thousands of Bitcoin full node operators currently). Developers must also create the upgrade and let it be known the community through a BIP. Collectively, the community controls the future direction of the network.
A good way to know if a project is truly decentralized is to find out who controls the protocol (the software). Because who controls the protocol controls the blockchains future.
Soft forks may occur by way of Bitcoin miners; however, soft forks must be backward compatible with the existing Bitcoin protocol, which essentially means that major changes to Bitcoin cannot take place through the miners alone.
This means that the protocol running Bitcoin cannot be gamed by wealth. Wealthy individuals, wealthy miners, and corporations cannot buy influence. Which is what makes Bitcoin decentralized. It’s accessibility to anyone with a decent computer and some tech savvy.
Thus, Satoshi created a system to ensure power is disseminated to We the People.
Currency controlled by the people and for the people is an advancement unlike the world has ever seen. The only criticism one may have is that now, to be a miner, it costs a lot in electricity and equipment; however, remember that being a miner does not allow you to make any major changes to the Bitcoin protocol… the software running Bitcoin is ultimately controlled by the many through full node operators.
Scarcity
We’ll conclude this analysis with a discussion on the scarcity of Bitcoin. By design, Satoshi capped the amount of Bitcoin that could ever be mined at 21 million. As mentioned earlier, the current block reward is set at 6.25 Bitcoin. In four years, it will drop to 3.125. The 10-minute time frame to create new blocks ensures that this halving will take place every four years until about 2140 when the last Bitcoin will be mined. In fact, over 19 million have already been mined leaving less than 2 million available.
Thus far, the demand for Bitcoin has outweighed the supply. Its monetary policy is built right into the protocol. This is evidenced by the ever-increasing price of Bitcoin since its inception. Unlike central bank currencies, governments cannot create Bitcoin at will. Bitcoin’s creation is pre-determined by design, which is why many see Bitcoin as digital gold.
As a currency, many believe Bitcoin’s qualities are far superior to gold. Bitcoin is weightless. It has a fixed supply. Its mining is predictable. It can be transacted digitally, peer-to-peer, without the need for a central authority.
The argument often sited against Bitcoin is that it is not backed by anything. But this is not true… the whole system of security, decentralization, privacy, and consensus that we just examined is what Bitcoin is backed by—mathematical codes and protocols ensuring the safety of transactions.
The same criticism could be landed against government currencies. What is fiat backed by?
Government currencies are heavily reliant upon the faith that people have within the government’s ability to pay back its debt. Fiat is typically backed by military power, which leads to trade wars and even outright wars (for example, wars fought to keep the petrol dollar dominant). As national deficits continue to increase for central banks around the world, and as people are suffering from inflation as a result of central Bank money printing (or loss of credit when central banks tighten policy)… Bitcoin, with its transparent monetary policy built right into its code, is becoming more and more appealing to many.
Disclosure: Long Bitcoin
If you wish to purchase Bitcoin, you can do so by signing up through our affiliate Swan Bitcoin and receive $10 in free Bitcoin for doing so.