BTQ Docs
Concepts

Blockchain Basics

How the BTQ blockchain works: the UTXO model, transaction structure, Merkle trees, block validation, and finality on a quantum-resistant chain.

Blockchain Basics

A blockchain is a distributed ledger that records transactions across many computers in a way that makes it practically impossible to alter historical records.

What is a Blockchain?

At its core, a blockchain is:

  1. A chain of blocks - Each block contains transactions and links to the previous block
  2. Distributed - Copies exist on thousands of computers worldwide
  3. Immutable - Once written, data cannot be changed without detection
  4. Trustless - No central authority needed; math provides security

The Chain Structure

┌─────────────┐    ┌─────────────┐    ┌─────────────┐
│  Block 0    │───▶│  Block 1    │───▶│  Block 2    │
│  (Genesis)  │    │             │    │             │
├─────────────┤    ├─────────────┤    ├─────────────┤
│ Hash: 0x00..│    │ Hash: 0x1a..│    │ Hash: 0x2b..│
│ Prev: 0x00..│    │ Prev: 0x00..│    │ Prev: 0x1a..│
│ Txns: [...]│    │ Txns: [...]│    │ Txns: [...]│
└─────────────┘    └─────────────┘    └─────────────┘

Each block contains:

  • Block Header: Metadata including previous block hash
  • Transactions: The actual data being recorded
  • Hash: A cryptographic fingerprint of the block

How Transactions Work

The UTXO Model

BTQ (like Bitcoin) uses the UTXO (Unspent Transaction Output) model:

  1. Outputs: When you receive coins, a UTXO is created
  2. Inputs: When you spend, you consume entire UTXOs
  3. Change: Excess goes back to you as a new UTXO

Example:

Alice has: 10 BTQ (one UTXO)
Alice sends Bob: 3 BTQ

Transaction:
  Input:  10 BTQ (Alice's UTXO) - consumed entirely
  Output: 3 BTQ to Bob (new UTXO)
  Output: 7 BTQ to Alice (change UTXO)

Transaction Structure

Transaction:
├── Version: 2
├── Inputs:
│   └── Previous TX ID + Output Index
│       └── Signature (proves ownership)
├── Outputs:
│   └── Amount + ScriptPubKey (locking script)
└── Locktime: 0

Digital Signatures

Digital signatures prove ownership without revealing private keys.

How They Work

  1. Key Generation: Create a private key (secret) and public key (shareable)
  2. Signing: Use private key to sign a message
  3. Verification: Anyone can verify using the public key
Private Key ──┬──▶ Sign(message) ──▶ Signature
              │
              └──▶ Public Key ──┬──▶ Verify(message, signature)
                                │
                                └──▶ true/false

In BTQ

  • ECDSA: Original Bitcoin signatures (33-byte public keys, ~71-byte signatures)
  • Dilithium: Quantum-resistant signatures (1,312-byte public keys, 2,420-byte signatures)

Dilithium signatures are larger but provide protection against quantum computer attacks that could break ECDSA.

Addresses

Addresses are derived from public keys and provide a destination for funds.

Address Derivation

Private Key
    │
    ▼
Public Key
    │
    ├──▶ SHA-256
    │       │
    │       ▼
    │    RIPEMD-160
    │       │
    │       ▼
    └──▶ Public Key Hash (20 bytes)
            │
            ▼
    Base58/Bech32 Encoding
            │
            ▼
        Address

BTQ Address Types

Mainnet forms shown. See Dilithium Addresses for all networks.

TypePrefixStatus
Dilithium P2MRqbtc1z…Current Dilithium receive type
ECDSA SegWit v0qbtc1q…Current ECDSA default
ECDSA Taprootqbtc1p…Witness v1
Legacy ECDSA (Base58 v75)X…Legacy
Legacy Dilithium (Base58 v76)X…Historical — no longer generated

Blocks

Blocks are containers that group transactions together.

Block Structure

Block Header (80 bytes):
├── Version (4 bytes)
├── Previous Block Hash (32 bytes)
├── Merkle Root (32 bytes)
├── Timestamp (4 bytes)
├── Difficulty Target (4 bytes)
└── Nonce (4 bytes)

Block Body:
└── Transactions (variable)

The Merkle Tree

Transactions are organized into a Merkle tree:

              Root Hash
             /        \
        Hash01        Hash23
        /    \        /    \
    Hash0  Hash1  Hash2  Hash3
      │      │      │      │
    Tx0    Tx1    Tx2    Tx3

This allows:

  • Efficient verification of transaction inclusion
  • Light clients to verify without downloading entire blocks
  • Tamper detection (any change alters the root hash)

The Peer-to-Peer Network

BTQ operates as a decentralized network:

Node Types

TypeDescription
Full NodeStores entire blockchain, validates all transactions
Mining NodeFull node that also creates new blocks
Light ClientOnly stores headers, relies on full nodes

Network Communication

Nodes communicate via a gossip protocol:

  1. Transaction Broadcast: New transactions spread across the network
  2. Block Propagation: New blocks are relayed to all nodes
  3. Peer Discovery: Nodes find each other via DNS seeds and peer exchange

Validation Rules

Every node independently validates:

Transaction Validation

  • Inputs exist and are unspent
  • Signatures are valid
  • Input amounts >= output amounts
  • Scripts execute successfully

Block Validation

  • Block header hash meets difficulty target
  • Previous block exists and is valid
  • All transactions are valid
  • Block size within limits
  • Timestamp reasonable

Invalid blocks and transactions are rejected. Nodes that repeatedly send invalid data may be disconnected.

Finality

Blockchain transactions become increasingly final over time:

ConfirmationsStatusSecurity
0 (mempool)UnconfirmedCan be double-spent
1Included in block~50% attack possible
3Lightly confirmedUnlikely to reverse
6Standard confirmationVery secure
100+Deeply buriedPractically irreversible

Why This Matters for BTQ

BTQ inherits all of Bitcoin's blockchain properties:

  • Decentralization: No single point of failure
  • Transparency: All transactions publicly verifiable
  • Immutability: History cannot be rewritten
  • Security: Cryptographic guarantees

The only change is upgrading the signature algorithm to resist quantum attacks.

Learn More

On this page