Blockchain Fundamentals: Introduction

Blockchain Fundamentals: Introduction

Wednesday Feb 21, 2024

Blockchain Fundamentals: Introduction

What is a blockchain?

By a more formal definition, a blockchain is a distributed database that maintains a growing list of ordered records called blocks. Each block contains a hash of the previous block, which acts as the link between the blocks. The blocks also contain a timestamp and transaction data.

Another way you can think of the blockchain is one big linked list. While there are key differences between the blockchain and a linked list, visualising it like one can help you grasp what it technically looks like.

What is a block?

Blocks refer to a place or a chunk where data is stored. In this case, the blocks store transactional data. The data here refers to things like:

  1. Timestamp
  2. Status
  3. Transactions
  4. Difficulty
  5. Size
  6. Gas info

We will go more into depth about what each of these things is later because we need some more info on how the blockchain works exactly to understand some of these data points.

What are nodes?

Nodes are computers connected to other computers which follow and enforce specific rules set out by the network. They can thus be communication hubs, a storage system and an information relayer.

What are miners?

Miners are computers that provide computational power to the network to validate transactions, maintain consensus and secure the network. Any computer may become a miner, and for their services, they get paid a reward.

Now you might wonder - if miners are responsible for adding new transactions to the network and anyone could become one, couldn’t you just broadcast fake transactions to the network and potentially give yourself funds?

While this answer is more complex than just saying yes or no, this leads me to the next section - consensus mechanisms.

Consensus Mechanisms

These mechanisms ensure that all participants in the blockchain agree on the state of the blockchain - more specifically, the order of the transactions.

Consensus differs from transaction validation in that some transactions may be deemed “valid”, but the network does not agree that it belongs in the chain of transactions.

The mechanism also determines the rules that the validators will follow to determine if a block should be in the chain or not.

Let’s explore some common consensus mechanisms:

Proof of Work (POW)

Proof of work was the original crypto consensus mechanism first used by the Bitcoin network. The reason for the name ‘proof of work’ is that computers compete against each other to solve cryptographic math problems. The first one to complete the problem gets to update the blockchain with the latest verified transactions. They are also rewarded for their efforts in the form of cryptocurrency.

If we zoom out a little, this essentially means that if we can solve the problem first, we can broadcast any valid transaction.

Maybe you’re starting to see how it’s possible to attack a network now - if you can solve the problem first, you can give yourself some Bitcoin, right?

Not entirely. You see, networks like Bitcoin have an incredible amount of hashing power behind them. Hashing power, in layman’s terms, refers to how much processing power you have in your computer (yours probably has around 15 Kilohashes per second).

A bunch of miners come together to form something called a pool. These miners then solve the problem together and share the reward between themselves according to their hashing power.

For reference, the top 3 mining pools at the time of preparation of this document are:

  1. Foundry USA with ~123 Exahashes per second (~30% of total Bitcoin network hash rate)
  2. AntPool with ~87 EH/s (22% of total)
  3. F2Pool with ~78 EH/s (20% of total) So, for you to successfully attack the Bitcoin network, you’d just need to own 51% of the hashing power because then you would solve the problem first, and you can broadcast a transaction to the network.

So, let’s plan what we would need:

  1. A (few) bitcoin miners. The best one at the moment is called the Bitmain S19 XP Hydro. New ones cost around $8,400, and they have a hash rate of 257 terahashes per second.
  2. To match the top 3 pools, we need just over 1.1 million XP Hydros, which would put us back only $9.2B.
  3. Now, let’s talk about the electricity cost… I think it’s clear that it’s just not really a sensible thing to try and do. Of course, there are smaller chains, and they often are the target for these kinds of attacks, which we call 51% attacks.

Blockchains that use this mechanism are:

  1. Bitcoin (BTC)
  2. Dogecoin (DOGE)
  3. Litecoin (LTC)
  4. Bitcoin Cash (BCH)

Proof of Stake (POS)

As more and more transactions started flooding the networks and the complexity of transactions started increasing (think smart contract executions), developers noticed that it was becoming increasingly more challenging to maintain fast execution times.

So, to combat this, they decided to create a new consensus mechanism that allows “stakers” or “validators” to become part of a group that will randomly be selected from to validate a new transaction and update the blockchain.

Staking is when you provide your own cryptocurrency in exchange for something. In this case, validators provide their own cryptocurrency in exchange for a chance to validate a new transaction and update the blockchain. They will also receive a reward.

The network selects the most invested staker - that is - the participant who has staked the most amount of funds. The decision of the staker is then attested to by other validators. Once a certain threshold has been reached, the network updates the blockchain.

If a staker validates bad blocks (maybe they wanted to give themself funds, for example) and other validators do not agree, the network will execute something called “slashing”.

Slashing is a mechanism to combat attacks on the network by ”slashing” some of the funds that the validator staked.

If we look at how to attack this network, you would have to, at one single point in time, own all the validators randomly selected by the network, which is not really possible since there are hundreds of thousands of validators. On ETH2 (Beacon), for example, there are over 500,000 validators, each staking at least 32 ETH.

Fundamentally, this is a significant upgrade in resource consumption since POS validators require virtually no computational power. There is no race to compute anything. They are just randomly selected.

Blockchains that use this mechanism are:

  1. Ethereum (ETH)
  2. Cardano (ADA)
  3. Solana (SOL)
  4. Polygon (MATIC)

Other Mechanisms

There are many variants of these mechanisms, like the Proof of Authority (POA) mechanism. The POA mechanism is a variant of Proof of Stake (POS) whereby validators essentially “stake” their identities. Not literally, but they apply to become a validator by verifying their physical identities. So, for instance, if something goes wrong or something malicious happens, they can easily trace it back to one validator and, more specifically, one person. The rules around who can become a validator vary by project, so it’s hard to say precisely what you must comply with to become one.

Some chains that use this consensus mechanism are:

  1. VeChain (VET)
  2. Bitgert (BRISE)
  3. Xodex (XODEX)