Blockchain

So, what is a blockchain?

this page is a work in progress, as I learn more about what a blockchain is, I'm going to write it down here, maybe it will save you time.


A blockchain is a distributed, decentralized and immutable digital ledger that records transactions across a peer-to-peer network.

Transactions are recorded in a block, which is a basically a container for data.

Each block is cryptographically linked to the previous, recording all transactions and making hacking almost impossible. The sequence of blocks is referred to as the chain.

Each participant in the blockchain network holds a copy of the entire ledger, so no single entity owns it.

Having no central authority controlling the ledger is what makes a blockchain appealing and gives it additional trust and authority.

The first block on the bitcoin blockchain was the genesis block.

Blocks

Each block contains:

Chain

Blocks are linked together in a linear, chronological order. Once a block is added, it cannot be altered without changing all subsequent blocks, ensuring data integrity.

Nodes

Computers in the blockchain network are known as nodes. Each node has a full copy of the blockchain. Nodes work together to validate new blocks.

Consensus mechanism

Blockchain networks use different methods for participants to agree on the validity of new blocks, ensuring they are legitimate. Common consensus mechanisms include:

How Blockchain Works

  1. A transaction occurs: Let's say Alice sends Bob some cryptocurrency. This transaction is represented as data and broadcast to the blockchain network.
  2. Transaction verification: Nodes (computers) in the network verify the transaction using cryptographic algorithms to ensure that Alice has enough balance and that the transaction follows the network's rules.
  3. Transaction added to a block: After verification, the transaction is bundled with other transactions into a new block.
  4. Consensus: The network's nodes use a consensus mechanism (e.g., PoW or PoS) to agree that the new block is valid. Once a consensus is reached, the block is added to the blockchain.
  5. Block added to the chain: The newly validated block is permanently added to the blockchain. Each block has a reference (hash) to the previous block, forming a chain.
  6. Transaction confirmed: The transaction between Alice and Bob is now part of the blockchain, and both can see it on the ledger. This record cannot be altered.

Questions

How does a participant or node join a blockchain?

Basically any computer on the internet can become a node. The easiest way is to download the bitcoin core software, which would first download a full copy of the blockchain, which at the time of writing stands around 600 GB and is then ready to start receiving transactions and validating blocks. Here is a good resource explaining the steps: learnmeabitcoin.com.

A node is connected to some other nodes, how is the nodes it is assigned to decided?

There are three options that Bitcoin Core uses to find other nodes:

Where is bitcoin (and others) source code?

Who is the creator of Bitcoin

No one really knows who the creator is, there are some theories but many of them deny being Satoshi Nakamoto, here is a good article from cointelegraph.

How does someone get an address on the blockchain

An address on the blockchain is derived from a private key, a private key is a randomly generated 256-bit number https://learnmeabitcoin.com/beginners/guide/keys-addresses/

What is the 12 or 24 word mnemonic seed?

In a series of steps the mnemonic seed can be converted to the private key, so remembering the 12 word mnemonic is as good as remembering the private key. The steps are:

  1. Convert the mnemonic to a 512-bit seed using a key derivation function, such as PBKDF2 or BIP39
  2. Convert the seed to a 256-bit master key using an HD key generation algorithm, such as BIP32
  3. Convert the master Key to private key using an HD key derivation algorithm, such as BIP32 or BIP44

It is worth noting that it's not possible to use a private key to generate a 12-word mnemonic. Either you generate a private key or a generator will provide you with a 12-word mnemonic.

What is mining?

A competition across the network to hash a candidate block so the resulting hash is below a target number. The target number can change to control how quickly/slowly (or how hard it is) to find a hash.

If a node successfully finds a hash first, they submit it to the rest of the network and can claim a reward for their efforts.

How do transactions make it into the block?

When a transaction is created it is submitted to a node and then gets propagated throughout the network from node-to-node. The transactions are stored in each node's memory pool, ready to be included in the candidates block and eventually a block on the blockchain.

The network resolves conflicting transactions by rejecting any transactions in a memory pool that conflicts with one already written into a block.

Transactions in the memory pool can be removed for other reasons as well:

The maximum size of a block is 4,000,000 weight units.

What are layers

Today, in 2024, the blockchain/crypto industry is maturing and multiple layers of the technology have formed to allow improved experiences and reduce issues with scalability and transaction fees:

What is custodial vs non-custodial wallet?

A custodial wallet holds your private keys, which is okay for small transactions or quick exchange, but not really recommended for storing value long term.

A non-custodial (or self-custodial) wallet on the other hand requires you to keep control over your private keys.

There can be software-based or hardware-based self-custodial wallets and generally speak a hardware is considered more secure but requires more of an investment.

An example of a non-custodial wallet: Blockstream Green

What are rollups?

A rollup is a Layer-2 scaling solution designed to increase the throughput of a blockchain network like Ethereum. It does this by batching or "rolling up" multiple transactions and then submitting them to the main blockchain as a single transaction. The two most common types are ZK-Rollups and Optimistic Rollups

What is a 51% attack?

A 51% attack is the unlikely event that a group will acquire more than 50% of the hashing power of a cryptocurrency network. These attacks happen on smaller crypto networks, but tend to fail on larger ones like Bitcoin because they are more secure

What is an on-ramp?

An on-ramp allows users to convert their fiat currency into cryptocurrency. These on-ramps can take various forms, such as centralized exchanges, decentralized platforms, or physical locations like crypto ATMs

NOTES / future research:

general-purpose infrastructure networks: ethereum, solana, optimism, polygon
defi networks: aave, compound, uniswap
smart contracts - recurring payments using smart contacts?