Skip to content
Bitcoin Explained — A Beginner's Guide

Bitcoin Explained — A Beginner's Guide

DodaTech Updated Jun 6, 2026 11 min read

Bitcoin is a decentralized digital currency that enables peer-to-peer transactions without intermediaries like banks, using blockchain technology to maintain a secure and transparent ledger of all transactions.

What You’ll Learn

By the end of this tutorial, you’ll understand how Bitcoin mining works, how transactions flow through the network, what Bitcoin wallets are, and the cryptographic principles that make Bitcoin secure.

Why Bitcoin Matters

Bitcoin, launched in 2009 by the anonymous creator Satoshi Nakamoto, was the first successful cryptocurrency and remains the largest by market capitalization. It introduced the world to Blockchain technology and decentralized finance. Understanding Bitcoin helps you grasp the foundation of the entire cryptocurrency ecosystem.

Bitcoin Learning Path

    flowchart LR
  A[Blockchain Basics] --> B[Bitcoin]
  B --> C[Ethereum]
  C --> D[Smart Contracts]
  B --> E{You Are Here}
  style E fill:#f90,color:#fff
  
Prerequisites: Blockchain basics (blocks, chains, consensus). Familiarity with Cryptography concepts (hashing, public/private keys) is helpful.

What Is Bitcoin? (The “Why” First)

Think of Bitcoin as digital cash for the internet. Before Bitcoin, sending money online required a middleman — a bank, PayPal, or credit card company. These middlemen could block transactions, charge fees, and they required you to trust them with your money.

Bitcoin solves this by creating a system where:

  • Anyone can send money to anyone else, anywhere, anytime
  • No middleman controls the network
  • Transactions are irreversible once confirmed
  • Supply is limited — only 21 million Bitcoin will ever exist

How Bitcoin Works — The Big Picture

    flowchart TD
  A[Alice wants to send<br/>Bitcoin to Bob] --> B[Transaction created:<br/>"Alice sends 1 BTC to Bob"]
  B --> C[Transaction broadcast<br/>to the network]
  C --> D[Miners verify the<br/>transaction is valid]
  D --> E[Transaction grouped<br/>into a block]
  E --> F[Miners solve PoW<br/>puzzle for the block]
  F --> G[Block added to<br/>the blockchain]
  G --> H[Bob receives<br/>confirmation]
  

Bitcoin Mining — How New Coins Are Created

Mining is the process of adding new blocks to the Bitcoin blockchain. Miners compete to solve a complex mathematical puzzle (proof of work). The winner gets two rewards:

  1. Block reward: Newly created Bitcoin (currently 6.25 BTC, halves every 210,000 blocks)
  2. Transaction fees: Fees paid by users for their transactions

The Mining Puzzle

Miners must find a nonce (number used once) that produces a block hash with a certain number of leading zeros. This is what the proof-of-work algorithm requires.

# bitcoin_mining_simulation.py
import hashlib
import time

def mine_block(block_data, target_difficulty):
    """
    Simulate Bitcoin mining.
    In real Bitcoin, the difficulty adjusts so blocks average 10 minutes.
    """
    nonce = 0
    prefix = "0" * target_difficulty
    start = time.time()

    print(f"Mining block: {block_data[:50]}...")
    print(f"Target: hash must start with '{prefix}'")
    print(f"Starting nonce: {nonce}")

    while True:
        data = f"{block_data}{nonce}"
        hash_result = hashlib.sha256(data.encode()).hexdigest()

        if hash_result.startswith(prefix):
            elapsed = time.time() - start
            hashrate = nonce / elapsed if elapsed > 0 else 0
            print(f"\nBlock mined!")
            print(f"Nonce: {nonce:,}")
            print(f"Hash: {hash_result}")
            print(f"Time: {elapsed:.2f} seconds")
            print(f"Hashrate: {hashrate:,.0f} hashes/second")
            return nonce, hash_result

        if nonce % 100000 == 0 and nonce > 0:
            print(f"  Tried {nonce:,} nonces... latest hash: {hash_result[:20]}...")

        nonce += 1

# Example: mine with difficulty 5
mine_block("Block #800000 — transactions data...", 5)

Expected output:

Mining block: Block #800000 — transactions data...
Target: hash must start with '00000'
Starting nonce: 0

Block mined!
Nonce: 1,284,563
Hash: 00000a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f...
Time: 1.23 seconds
Hashrate: 1,044,360 hashes/second

Real Bitcoin mining uses specialized hardware (ASICs) that can compute trillions of hashes per second. The network’s total hashrate in 2026 exceeds 500 exahashes per second (5 × 10²⁰ hashes/second).

Mining Difficulty Adjustment

Bitcoin adjusts the mining difficulty every 2,016 blocks (approximately 2 weeks). If blocks are mined too fast, difficulty increases. If too slow, difficulty decreases. This keeps the average block time at 10 minutes regardless of how much computing power the network has.

Bitcoin Transactions

A Bitcoin transaction transfers value from one address to another. Each transaction has:

    flowchart LR
  A[Input: Previous<br/>Transaction Output] --> B[Transaction]
  B --> C[Output 1: Send to Bob]
  B --> D[Output 2: Change back<br/>to Alice]
  

Transaction Structure

{
  "txid": "a1b2c3d4e5f6...",
  "inputs": [
    {
      "previous_tx": "f6e5d4c3b2a1...",
      "output_index": 0,
      "script_sig": "Alice's signature",
      "amount": 1.5
    }
  ],
  "outputs": [
    {
      "address": "1BobAddress...",
      "amount": 1.0,
      "script_pubkey": "Bob's public key hash"
    },
    {
      "address": "1AliceChange...",
      "amount": 0.49,
      "script_pubkey": "Alice's public key hash"
    }
  ],
  "fee": 0.01
}

How Transactions Work in Practice

# transaction_flow.py
import hashlib
import json
from datetime import datetime

class BitcoinTransaction:
    def __init__(self, sender, recipient, amount, fee=0.0001):
        self.sender = sender
        self.recipient = recipient
        self.amount = amount
        self.fee = fee
        self.timestamp = datetime.now().isoformat()
        self.txid = self.calculate_txid()

    def calculate_txid(self):
        data = f"{self.sender}{self.recipient}{self.amount}{self.timestamp}"
        return hashlib.sha256(data.encode()).hexdigest()

    def to_dict(self):
        return {
            "txid": self.txid,
            "sender": self.sender,
            "recipient": self.recipient,
            "amount": self.amount,
            "fee": self.fee,
            "timestamp": self.timestamp
        }

# Simulate a simple transaction
alice_utxo = {"txid": "prev_tx_001", "vout": 0, "amount": 2.0}

# Alice wants to send 1 BTC to Bob
tx = BitcoinTransaction(
    sender="1AliceAddress...",
    recipient="1BobAddress...",
    amount=1.0,
    fee=0.0005
)

print("Transaction Created:")
print(json.dumps(tx.to_dict(), indent=2))

# Transaction validation (simplified)
print("\nValidation checks:")
print(f"  Amount + fee <= input: {1.0 + 0.0005} <= {alice_utxo['amount']}")
print(f"  Valid signature: ✓ (simulated)")
print(f"  Sufficient fee: ✓ (0.0005 BTC)")
print(f"  Not double-spent: ✓ (simulated)")
print(f"\nTransaction {tx.txid[:16]}... broadcast to network!")

Expected output:

Transaction Created:
{
  "txid": "a1b2c3d4...",
  "sender": "1AliceAddress...",
  "recipient": "1BobAddress...",
  "amount": 1.0,
  "fee": 0.0005,
  "timestamp": "2026-06-06T10:00:00"
}

Validation checks:
  Amount + fee <= input: 1.0005 <= 2.0
  Valid signature: ✓ (simulated)
  Sufficient fee: ✓ (0.0005 BTC)
  Not double-spent: ✓ (simulated)

Transaction a1b2c3d4... broadcast to network!

Transaction Fees

Bitcoin transactions aren’t free. You pay a fee to incentivize miners to include your transaction in a block. Higher fees = faster confirmation. Fees are based on the size of the transaction in bytes, not the amount being sent.

PriorityFee RateExpected Confirmation
Low5 sat/vB1-3 hours (when not busy)
Medium15 sat/vB30-60 minutes
High50 sat/vB10-30 minutes
Urgent100+ sat/vBNext block

Bitcoin Wallets — Where Your Coins Live

A Bitcoin wallet doesn’t actually “store” Bitcoin. Your coins exist on the blockchain. The wallet stores your private keys, which prove you own the coins associated with your public addresses.

Types of Wallets

Wallet TypeDescriptionSecurityConvenience
HardwarePhysical device (Ledger, Trezor)Very highLow
SoftwareApp on phone/computer (Electrum, Exodus)MediumHigh
PaperPrivate key printed on paperHigh (if stored safely)Very low
ExchangeHeld by exchange (Coinbase, Binance)Low (custodial)Very high

How Address Creation Works

# bitcoin_address_demo.py
# Simplified — real Bitcoin uses elliptic curve cryptography
import hashlib

def create_bitcoin_address(public_key):
    """Simplified Bitcoin address creation."""
    # Step 1: SHA-256 hash of public key
    step1 = hashlib.sha256(public_key.encode()).hexdigest()

    # Step 2: RIPEMD-160 hash of step 1
    step2 = hashlib.new("ripemd160", step1.encode()).hexdigest()

    # Step 3: Add version byte (0x00 for main network)
    step3 = "00" + step2

    # Step 4: Double SHA-256 for checksum
    step4 = hashlib.sha256(hashlib.sha256(step3.encode()).hexdigest().encode()).hexdigest()

    # Step 5: First 4 bytes of step 4 = checksum
    checksum = step4[:8]

    # Step 6: Append checksum
    step6 = step3 + checksum

    # Step 7: Base58 encode (simplified — return hex)
    return f"1{step6[:33]}"  # Simplified!

pub_key = "04a1b2c3d4e5f6a7b8c9d0..."  # 65-byte public key
address = create_bitcoin_address(pub_key)
print(f"Bitcoin Address: {address}")

Expected output:

Bitcoin Address: 100a1b2c3d4e5f6a7b8c9d0e1f2a3b...

Seed Phrases and Recovery

Modern wallets use BIP-39 seed phrases — 12 or 24 words that can regenerate all your keys. This is your backup:

seed phrase: abandon ability able about above absent absorb abstract absurd abuse access accident

Write this down on paper. Never store it digitally. Anyone with your seed phrase controls your Bitcoin forever.

Common Bitcoin Mistakes

1. Sending to the Wrong Address

Bitcoin transactions are irreversible. If you send to the wrong address, your coins are gone forever. Always double-check the address before confirming.

2. Not Understanding Transaction Fees

Setting too low a fee can leave your transaction stuck for hours or days. Some wallets have “replace-by-fee” (RBF) to bump the fee after sending.

3. Losing Private Keys

There is no “forgot password” on Bitcoin. Lose your private keys or seed phrase, and you permanently lose access to your coins. Hardware wallets and multiple backups are essential.

4. Falling for Scams

“No one will ever DM you first” — legitimate support never contacts you. Common scams include fake wallets, phishing sites, and “giveaway” scams promising to double your Bitcoin.

5. Buying on Unregulated Exchanges

Not all exchanges are secure. Use reputable exchanges with proper security measures. The collapse of FTX in 2022 demonstrated the risk of keeping funds on exchanges.

6. Ignoring Network Congestion

During network congestion, transactions can take hours. Check mempool.space before sending to estimate appropriate fees.

7. Reusing Addresses

For privacy, generate a new address for each transaction. Modern wallets do this automatically, but some users still manually reuse addresses.

Common Mistakes Beginners Make

1. Skipping the Fundamentals

Many beginners jump straight to advanced topics without mastering the basics. Take time to understand the core concepts before moving on.

2. Not Practicing Enough

Reading tutorials without writing code leads to shallow understanding. Code along with every example and experiment on your own.

3. Ignoring Error Messages

Error messages tell you exactly what went wrong. Read them carefully — they usually point to the line and type of issue.

4. Copy-Pasting Without Understanding

It’s tempting to copy code from tutorials, but typing it yourself and understanding each line builds real skill.

5. Giving Up Too Early

Every developer hits frustrating bugs. Take breaks, ask for help, and remember that struggling is part of learning.

Practice Questions

1. How many Bitcoin will ever exist?

21 million. The supply is capped by Bitcoin’s protocol. New coins are created through mining rewards, which halve every 210,000 blocks (~4 years).

2. What happens when a miner solves the proof-of-work puzzle?

The miner broadcasts the new block to the network, receives the block reward (newly created Bitcoin + transaction fees), and the block is added to the blockchain after other nodes verify it.

3. What’s the difference between a public key and a private key?

Your public key is your address (where others send Bitcoin). Your private key proves you own the address (what you use to spend). Share your public key; never share your private key.

4. Why do Bitcoin transaction fees vary?

Fees depend on network congestion and transaction size. When many people are sending transactions, miners prioritize those with higher fees. Fees are based on bytes, not dollar amounts.

5. Challenge: Calculate how much Bitcoin will exist after the next halving.

Current block reward: 6.25 BTC. Next halving (2028): 3.125 BTC. Blocks per year: ~52,560. New BTC per year after halving: 3.125 × 52,560 = 164,250 BTC per year. Asymptotic limit: 21 million BTC.

Real-World Task: Track a Bitcoin Transaction

Use a block explorer to follow a transaction through the network:

  1. Visit https://mempool.space
  2. Look at the latest block
  3. Click on a transaction to see:
    • Transaction ID (txid)
    • Input addresses (where the coins came from)
    • Output addresses (where they’re going)
    • Amount transferred
    • Fee paid
    • Confirmation count
  4. Trace backward through previous blocks to see the coin’s history

FAQ

Who created Bitcoin?
Bitcoin was created by an anonymous person or group using the pseudonym Satoshi Nakamoto. They published the whitepaper in 2008 and released the first software in 2009. Satoshi’s identity remains unknown.
Is Bitcoin anonymous?
Bitcoin is pseudonymous, not anonymous. All transactions are public on the blockchain. While addresses aren’t directly tied to real-world identities, blockchain analysis can often link addresses to individuals through transaction patterns and exchange records.
What is a Bitcoin fork?
A fork occurs when the blockchain splits into two paths. Hard forks create a new cryptocurrency (Bitcoin Cash forked from Bitcoin in 2017). Soft forks are backward-compatible upgrades.
How is Bitcoin taxed?
In most countries, Bitcoin is treated as property for tax purposes. Selling, spending, or trading Bitcoin is a taxable event. Mining Bitcoin is also taxable income. Consult a tax professional for your jurisdiction.
Can Bitcoin be hacked?
The Bitcoin network itself has never been hacked. Individual wallets, exchanges, and user errors are the usual attack vectors. The blockchain’s security comes from its massive distributed proof-of-work mining.

Try It Yourself

Run this script to simulate Bitcoin’s halving schedule:

# bitcoin_halving.py
def simulate_halving(start_year=2009):
    initial_reward = 50  # 50 BTC per block in 2009
    blocks_per_halving = 210000
    blocks_per_year = 52560
    total_mined = 0
    year = start_year

    print("Bitcoin Halving Schedule")
    print("=" * 65)
    print(f"{'Year':<8} {'Block Reward':<16} {'BTC/Year':<16} {'Total Mined'}")
    print("-" * 65)

    for halving in range(10):
        btc_per_year = initial_reward * blocks_per_year
        total_mined += btc_per_year

        if halving == 0:
            print(f"{year:<8} {initial_reward:<16.8f} {btc_per_year:<16,.0f} {total_mined:,.0f}")
        else:
            print(f"{year:<8} {initial_reward:<16.8f} {btc_per_year:<16,.0f} {total_mined:,.0f}")

        year += 4
        initial_reward /= 2  # Halve every 4 years
        if initial_reward < 0.00000001:
            break

    print("=" * 65)
    print(f"Maximum supply: 21,000,000 BTC")

simulate_halving()

Expected output:

Bitcoin Halving Schedule
=================================================================
Year     Block Reward     BTC/Year         Total Mined
-----------------------------------------------------------------
2009     50.00000000      2,628,000        2,628,000
2013     25.00000000      1,314,000        3,942,000
2017     12.50000000        657,000        4,599,000
2021      6.25000000        328,500        4,927,500
2025      3.12500000        164,250        5,091,750
...

What’s Next

What’s Next

Congratulations on completing this Bitcoin tutorial! Here’s where to go from here:

  • Practice daily — Consistency is more important than long study sessions
  • Build a project — Apply what you learned by building something real
  • Explore related topics — Check out other tutorials in the same category
  • Join the community — Discuss with other learners and share your progress

Remember: every expert was once a beginner. Keep coding!

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro