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:
- A chain of blocks - Each block contains transactions and links to the previous block
- Distributed - Copies exist on thousands of computers worldwide
- Immutable - Once written, data cannot be changed without detection
- 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:
- Outputs: When you receive coins, a UTXO is created
- Inputs: When you spend, you consume entire UTXOs
- 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: 0Digital Signatures
Digital signatures prove ownership without revealing private keys.
How They Work
- Key Generation: Create a private key (secret) and public key (shareable)
- Signing: Use private key to sign a message
- Verification: Anyone can verify using the public key
Private Key ──┬──▶ Sign(message) ──▶ Signature
│
└──▶ Public Key ──┬──▶ Verify(message, signature)
│
└──▶ true/falseIn 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
│
▼
AddressBTQ Address Types
Mainnet forms shown. See Dilithium Addresses for all networks.
| Type | Prefix | Status |
|---|---|---|
| Dilithium P2MR | qbtc1z… | Current Dilithium receive type |
| ECDSA SegWit v0 | qbtc1q… | Current ECDSA default |
| ECDSA Taproot | qbtc1p… | 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 Tx3This 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
| Type | Description |
|---|---|
| Full Node | Stores entire blockchain, validates all transactions |
| Mining Node | Full node that also creates new blocks |
| Light Client | Only stores headers, relies on full nodes |
Network Communication
Nodes communicate via a gossip protocol:
- Transaction Broadcast: New transactions spread across the network
- Block Propagation: New blocks are relayed to all nodes
- 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:
| Confirmations | Status | Security |
|---|---|---|
| 0 (mempool) | Unconfirmed | Can be double-spent |
| 1 | Included in block | ~50% attack possible |
| 3 | Lightly confirmed | Unlikely to reverse |
| 6 | Standard confirmation | Very secure |
| 100+ | Deeply buried | Practically 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
- Consensus & Proof of Work - How agreement is reached
- The Quantum Threat - Why quantum resistance matters
- BTQ Architecture - Technical deep dive