Nakamoto Notes: An Introduction to Bitcoin and Its Architecture

Nakamoto Notes: An Introduction to Bitcoin and Its Architecture

Welcome to the first edition of Nakamoto Notes, a series where we dive deep into all things Bitcoin. These articles aim to decode the core technical concepts and internal machinery that power Bitcoin.

Bitcoin is a decentralized digital currency that was created in 2008 by an unknown person or group using the name Satoshi Nakamoto. It was the first successful cryptocurrency and remains the most popular and valuable one.

Some key points in Bitcoin's history:

  • 2008 - Satoshi Nakamoto published the Bitcoin whitepaper describing the technology behind Bitcoin. This outlined how peer-to-peer digital cash could work without a central trusted authority.
  • 2009 - The first version of the Bitcoin software was released and mining of the genesis block occurred. The first Bitcoin transaction took place between Satoshi and Hal Finney.
  • 2010 - The first real-world Bitcoin transaction took place when programmer Laszlo Hanyecz bought two pizzas for 10,000 BTC.
  • 2011 - Bitcoin reached parity with the US dollar, meaning 1 BTC was equal to $1. Mainstream media coverage increased greatly.
  • 2012 - The first Bitcoin halving occurred, reducing the block reward from 50 to 25 BTC.
  • 2017 - Bitcoin price surpassed $10,000 for the first time and later reached nearly $20,000, bringing huge mainstream attention.

Bitcoin was created as a form of money that can be sent peer-to-peer without the need for a trusted third party. It aims to provide the following benefits:

  • Decentralization - No single entity controls the network. It is maintained by a distributed network of users.
  • Transparency - All transactions are publicly verifiable on the blockchain.
  • Irreversibility - Transactions cannot be reversed once confirmed on the blockchain.
  • Pseudonymity - Wallet addresses are not linked to real-world identities.

Bitcoin's Architecture

At a high level, Bitcoin consists of users sending Bitcoin payments to each other over a decentralized network. Transactions are recorded on a public ledger known as the blockchain. The system is secured through cryptographic proofs instead of trust.

Bitcoin's architecture includes the following primary components:

Blockchain

The blockchain is a public, distributed ledger that records all Bitcoin transactions. It is constantly growing as new blocks of transactions are added to it. All participants in the network have a copy of the blockchain. This provides transparency as anyone can verify transactions.

New transactions are added to new blocks which are attached to the end of the blockchain. This forms a chain of blocks, giving the technology its name.

Blocks

The Bitcoin blockchain consists of a sequence of blocks that hold batches of transactions. Each block contains the hash of the previous block, linking the blocks together in an ordered chain.

New blocks are created through the mining process approximately every 10 minutes. Each block also records a timestamp and other metadata.

Here is the structure of a Bitcoin block:

Block:
  
  Block Header:
  
    Version no - The Bitcoin protocol version
  
    Prev block hash - Hash of the previous block in the chain
    
    Merkle root - Hash of all the transactions in the block
  
    Timestamp - When the block was created 
    
    Difficulty target - The mining difficulty target for this block
  
    Nonce - A counter used for mining proof of work
  
  Transactions: 
  
    Transaction 1 - First transaction in the block
    
    Transaction 2 - Second transaction in the block
    
    ...
    
    Transaction n - Last transaction in the block

The block header contains metadata and a hash of the previous block. The body contains the transactions being confirmed in that block.

Mining

Mining is the process where users (miners) work to add new blocks to the blockchain. It involves solving complex math problems to validate transactions and create new blocks. This provides security and prevents double-spends.

When a miner successfully creates a block, they are rewarded with newly minted Bitcoin. This provides an incentive to secure the network. The block reward is currently 6.25 BTC per block and halves every 210,000 blocks.

Here are the steps for a miner to mine a new block:

  1. Collect new transactions into a block
  2. Add a coinbase transaction (to pay themselves the block reward)
  3. Add block header including nonce and previous block hash
  4. Calculate the block hash by hashing all its data
  5. If hash starts with enough zeros (meets difficulty target), block is valid
  6. Else, increment nonce and repeat steps 4 & 5
  7. Broadcast valid block to the network

Mining requires specialized hardware called ASICs to attempt quadrillions of hash calculations per second. As more miners join the network, the difficulty automatically adjusts to maintain ~10 minute block times.

Transactions

Transactions are signed cryptographically to transfer ownership of Bitcoin from one wallet address to another. They are collected together in blocks and recorded on the blockchain.

Here is the structure of a Bitcoin transaction:

Transaction:

  Version no - Transaction version 
  
  Input: 
  
    Transaction hash - Hash of the transaction being spent
    
    Index - Output number in the previous transaction
    
    Signature - Owner's signature to authorize spending
    
    Unlocking script - Script that satisfies spending conditions

  Output:
    
    Value - Amount of bitcoin being transferred  
    
    Locking script - Script that sets ownership conditions

The input points to the previous transaction's output being spent. The output specifies the new owner's address and amount transferred. The unlocking and locking scripts enable the owner to prove ownership and spend funds later.

Transactions must be validated to prevent double-spending and alteration. Once recorded in a block, transactions are very difficult to modify.

Wallets

Bitcoin wallets allow users to manage the ownership of Bitcoin. Wallets can generate private/public keypairs to receive funds and use signatures to spend them. They provide the user with a Bitcoin address to share for receiving payments. Many types of wallets exist, including hardware, software, and custodial wallets.

Here are some key responsibilities of a Bitcoin wallet:

  • Generate and store private keys securely
  • Display account balance from tracked transactions
  • Create and sign new transactions to spend Bitcoin
  • Broadcast transactions to the network
  • Scan the blockchain for incoming payments

Overall, wallets enable users to interact with the core Bitcoin network and use the digital currency.

Conclusion

Bitcoin pioneered decentralized digital currency and has grown into a valuable financial system. At its core are innovative technologies like proof-of-work, mining, and the blockchain ledger. These provide transparency, security, and decentralization without centralized control. Fifteen years after its creation, Bitcoin continues to evolve and inspire financial innovation.

Read more