Under the Hood: Blockchain for Beginners | FTX.com
By Donald Gray
Originally published by FTX.com on March 18, 2022
Blockchain technology has reshaped the world we live in. From how we interact with our devices to how we conduct business and manage our finances, this revolutionary technology has the potential to upend the way we transact in the digital age.
Whether you're hearing about this tech for the first time or you've been trading crypto for years, let's look under the hood of the technology behind Bitcoin, Ethereum, and the next generation of the internet.
What is blockchain technology?
Though the term 'blockchain' has garnered an air of mystique in recent years, the basic concept of blockchain technology is quite simple. Blockchain technology is a new way to store and manage data.
Unlike traditional databases, which are centrally located and managed by a single entity, blockchain databases are distributed across a network of computers, and anyone on the network can add or verify data.
This decentralized structure has several advantages. First, it makes data more secure. Because there is no central point of failure, it is much harder for hackers to access data stored on a blockchain. Second, it makes data more transparent.
All the data stored on a blockchain is public, and anyone on the network can view it. This transparency can help prevent fraud and ensure everyone follows the same rules.
Finally, blockchain technology has the potential to make data more efficient. Because there is no need for a central authority to manage data, blockchain-based systems can be faster and more flexible than traditional systems.
Types of blockchains
The first blockchain to come into existence is still running strong today. Since Bitcoin was launched in 2009, it has handled over 700 million transactions and changed how the world thinks about money.
Bitcoin was the first blockchain, but blockchain technology has come a long way in the past decade. There are over 18,000 blockchain-based projects, each with unique features and use cases.
There are now four main types of blockchains: public, private, consortium, and hybrid.
Public blockchains are decentralized and permissionless. This means that anyone can join the network, and no central authority controls the data. Most of the cryptocurrencies that you've heard of, like Bitcoin and Ethereum, are examples of public blockchains.
Some key benefits of public blockchains are that they are censorship-resistant and very secure. This makes them very well suited to carry out financial transactions and establish ownership of assets.
As the name suggests, private blockchains, also known as permissioned or managed blockchains, are controlled by a single entity or organization. This central authority controls who can join the network and what data is added to the blockchain.
Private blockchains are usually faster and more scalable than public blockchains because they don't have to deal with the same level of security concerns. These protocols are well suited to applications where data needs to be kept private, the healthcare or finance industries.
Private blockchains have their drawbacks, however. Because they are centrally controlled, they are more susceptible to censorship and less secure than public blockchains.
Consortium Blockchains are permissioned blockchains jointly managed by a group of organizations. This allows for greater control over who can join the network while maintaining some of the advantages of a decentralized network.
Consortium blockchains are well suited to applications where multiple organizations must cooperate, such as in the banking or energy industries.
One notable consortium blockchain is RSCoin, developed by the Bank of England and the University of Edinburgh. RSCoin was designed to help the banking industry reduce costs and speed up transactions.
Lastly, a hybrid blockchain is a permissioned blockchain that combines features of both public and private protocols. They are typically controlled by a single entity but allow some public participation.
Hybrid blockchains are well suited to applications where privacy and security are essential, such as in the military or intelligence communities.
One notable hybrid blockchain is Dragonchain, developed by the Walt Disney Company. Dragonchain was designed to allow for the secure sharing of sensitive data while maintaining some degree of transparency.
History of blockchaiBlockchainn
The first blockchain was created in 2009 as part of the Bitcoin protocol. Satoshi Nakamoto, the anonymous creator of Bitcoin, designed the blockchain to address the long-standing double-spend issue in digital currency.
Double-spend refers to the ability of a digital currency to be spent twice. As digital currencies are merely bits of data stored on a network, it could be possible to copy and paste them and pay the same currency multiple times. The potential for this to happen undermines the trust in the currency and ultimately defeats the entire purpose of having a currency at all.
Satoshi Nakamoto solved this problem by creating the blockchain: a decentralized and secure database of all Bitcoin transactions that would be publicly visible to anyone on the network. This meant it was no longer possible to spend the same Bitcoin twice. Any attempt to do so would require changing the blockchain's entire history and would be easily spotted by the distributed computers on the network.
This was an elegant solution to a problem that had plagued programmers and cryptographers for decades.
After creating a censorship-resistant, borderless currency, the next innovation that Bitcoin spurred came from the realization that its underlying technology could have far broader applications than basic financial transactions. This led to an explosion of blockchain-based projects and protocols, such as Ethereum, Litecoin, and Monero.
These projects built upon the foundation outlined in Satoshi Nakamoto's Bitcoin whitepaper and added more advanced functionality on top of the underlying protocol.
One of the most profound innovations that resulted from this came from the Ethereum network and the development of smart contracts.
Smart contracts are self-executing contracts written in code and stored on a blockchain. They can be used to automate a wide variety of transactions, such as the exchange of money, property, or shares.
Cryptographer Nick Szabo first proposed smart contracts in 1996. Still, it was not until Vitalik Buterin developed the Ethereum network in 2015 that they could be implemented in a trustless and decentralized manner.
The code for a smart contract is stored on the blockchain and is executed by the Ethereum Virtual Machine (EVM). The EVM is a decentralized computer that runs on every node in the Ethereum network.
This allows smart contracts to be executed in a trustless and tamper-proof manner, as the code is stored on the blockchain and can not be changed.
The potential applications of smart contracts are vast and only limited by developers' imagination. Some examples of where smart contracts could be used include:
- Voting systems
- Supply chain management
- Identity management
- Insurance contracts
- Wills and trusts
- Decentralized exchanges
The development of smart contracts has led to the creation of a new class of decentralized applications and birthed the entire Decentralized Finance industry. This is one of the reasons that people often refer to Ethereum as the world's computer. The possibility for future applications is endless.
How Blockchain Technology Works
We've established that blockchains are computer protocols that maintain a secure and decentralized data record. There are different types of blockchains and many uses for them, but how do they work?
Here's a quick breakdown of the technical side of blockchain for beginners.
A blockchain can be considered a linked list of blocks, where each block contains a set of data. The data in each block is hashed, and the previous block’s hash is stored in the current block. In the blockchain, the word 'hash' refers to a unique identifier generated from a piece of data. Hash values are typically generated using a cryptographic algorithm, such as SHA-256.
Once a block is hashed, it's added at the end of a chain of previously hashed blocks, hence the name blockchain. The data stored in each block can be anything but has often been transaction data.
The hash of each block links the blocks together and ensures that the data in the blockchain can not be tampered with. If even one bit of data in a block is changed, the entire hash of that block will change.
This is because hashes are generated using a one-way function, so it is impossible to reverse the hash back to the original data. This makes it only possible to change the data in a blockchain by changing the hashes of all subsequent blocks, which would be immediately apparent to everyone on the network.
In practical terms, once data is added to a blockchain, it can not be changed or deleted. This is one of the key features that make blockchains secure.
We've established that a blockchain is a distributed ledger managed by a network of computers, but how do the computers add data to the chain? Before making changes to the protocol's immutable ledger, the network's nodes must achieve consensus.
Blockchain Consensus Mechanisms
When programmers develop a blockchain protocol, they aim to strike a balance between 3 factors that will significantly affect the functionality of the chain. These factors are decentralization, security, and scalability.
Ethereum creator Vitalik Buterin has posited that the current generation of blockchains can only provide 2 of these three essential components at the expense of the third. He refers to this as “The Blockchain Trilemma.”
One of the essential features that will affect how a blockchain will perform on this scale is called its consensus mechanism. A consensus mechanism is a set of rules that dictate how the computers on the network reach agreement on the state of the chain.
Proof of Work (PoW) and Proof of Stake (PoS) are the two most common consensus mechanisms.
Proof of Work
Proof of Work (PoW) blockchains, like Bitcoin and Ethereum, reach consensus by having computers compete to solve a cryptographic puzzle. This is where the word cryptocurrency comes from.
Solving the puzzle is called mining, and the computers that engage in this activity are called miners.
The key thing to understand about PoW is that it is a competition. For a malicious actor to change the data in a blockchain, they would need to control more than 50% of the mining power in the network. This is called a 51% attack and is incredibly difficult to achieve.
Proof of Stake
Proof of Stake (PoS) blockchains reach consensus by having computers stake their coins to validate data blocks. The computer that validates a block is chosen at random proportionally to the number of coins the computer has staked.
The critical difference between PoW and PoS is that PoW blockchains are secured by computation, while Economic incentives secure poS blockchains.
PoW consensus is more secure than PoS because an attacker can't control more than 50% of the mining power in a network. However, PoS consensus is more scalable because it requires less computing power.
The computing power required for PoS blockchains is proportional to the number of staked coins. In contrast, the computing power needed for PoW blockchains is proportional to the total number of transactions. This makes Proof of Work blockchains more secure, expensive, and energy-intensive.
Ethereum is transitioning from a PoW to a PoS consensus mechanism and is expected to complete the transition in 2022.
Now that we understand consensus mechanisms, we can better understand how blockchains achieve security.
Security Through Transparency
Blockchains are said to be among the most secure computer protocols. We've examined how blockchains use decentralization, transparency cryptography, and consensus, but how do these all come together to form security?
To understand the security of a blockchain, we need to understand what an attacker's goals would be. An attacker's goal would be to either:
- Modify data that has already been added to the blockchain
- Add data to the blockchain that is not valid
The first goal, modifying data that has already been added to the blockchain, is incredibly difficult. This is because each block in a blockchain is linked to the previous block in the chain.
For an attacker to modify a block, they would need to control more than 50% of the network and redo the work that has been done since the block was added.
The second goal, adding data to the blockchain that is not valid, is also tough to achieve. This is because each block in a blockchain contains a cryptographic hash of the data added to the blockchain.
For an attacker to add invalid data to the blockchain, they would need to control more than 50% of the network and find a way to generate a valid cryptographic hash for the invalid data.
These goals are incredibly difficult to achieve, which is why blockchains are said to be so secure.
Of course, no computer system is perfect, and blockchain systems are no exception. While blockchains are incredibly secure, they are not infallible.
The 2016 Ethereum DAO Hack
The most notable example of a blockchain security breach is the Ethereum DAO hack, which took place in 2016.
The DAO was a decentralized autonomous organization built on the Ethereum blockchain. DAO had raised over $150 million from investors to support the development of Ethereum-based projects.
In June 2016, an attacker exploited a flaw in the DAO's code and siphoned off $50 million worth of Ether. Though clues point to a specific individual who is widely thought to be responsible for the hack, no one has been brought to justice for the heist.
The DAO hack was a significant setback for Ethereum. The decision over how to handle the hack is still a controversial subject today and drove such a rift in the community that the only option was initiated a hard fork of the Ethereum blockchain.
A hard fork occurs when a cryptocurrency's blockchain splits into two chains. This can happen for various reasons, but the most common reason is that the community disagrees with changing the network.
Ethereum had a hard fork after the DAO hack because a large faction of the Ethereum community decided that the best way to deal with the hack was to change to blockchain's history and refund the investors who lost money in it.
But I thought that blockchains were immutable? How did the Ethereum community decide to turn back the clock and refund the investors?
The answer is that while blockchains are immutable, they are not unchangeable. Blockchains can be changed if the majority of the network agrees to the change.
Investing in projects with a large and diverse community is essential. If the community agrees on a change, the change will likely be made.
The DAO hack was a significant event in the history of blockchain and serves as a reminder that while there have been leaps and bounds in network security over the past decade, no computer system is perfect.
Now that we've established blockchains' different attributes let's look at the benefits and disadvantages of blockchain technology.
Benefits of the Block
Here are some of the top benefits that blockchain technology provides:
Decentralization in blockchains comes from the fact that there is no central authority overseeing the network. Instead, the network is run by a decentralized network of nodes. This decentralization benefits users by providing them with more control over their data.
The best thing about trust in the blockchain space is that you don’t need it! Trust in this industry refers to the trustless nature of blockchains. Because blockchains are decentralized, users do not need to trust a central authority or each other. Rather than relying on middlemen and 'trusted parties' to complete a transaction, blockchain users place their trust in user-agnostic computer code.
Transparency is a crucial tenet of blockchain technology. Bitcoin, LiteCoin, Ethereum, and Solana are robust protocols supporting millions of transactions daily. These global networks achieve this feat by maintaining a transparent, public ledger of every transaction that has ever taken place.
This means that you can go back in time all the way to January 2009 and view the first-ever Bitcoin transactions for yourself.
Here are some of the disadvantages of blockchains: