Advanced Bitcoin: A Technical Guide

Beyond the basics of sending and receiving, Bitcoin is a layered protocol with deep technical foundations. This guide explores the cryptography, scripting, and protocol evolution that make Bitcoin work — from key derivation and Merkle trees to Taproot, covenants, and the Liquid sidechain.


Contents


Cryptographic foundations

From seed to addresses: the derivation process

A single seed phrase generates an entire tree of keys and addresses through a deterministic process defined by BIP-32 (Hierarchical Deterministic Wallets) and BIP-44 (multi-account hierarchy).

From the seed, a master private key and chain code are derived. These are used to generate child keys in a hierarchical structure: master → purpose → coin type → account → change → address index. Each level of the hierarchy produces a new key pair without exposing the parent.

This is why a single 12- or 24-word seed phrase can back up an unlimited number of addresses across different wallets and account types — they are all mathematically derived from the same root.

Extended public keys

An extended public key (xpub) is a public key combined with a chain code that allows the derivation of all child public keys — and therefore all addresses — in a particular branch of the HD wallet tree.

Sharing an xpub with a watch-only wallet or an accounting tool allows monitoring all incoming transactions without the ability to spend. However, sharing an xpub is a significant privacy risk: anyone who obtains it can see every past and future address in that account branch.

Extended public keys come in variants — xpub, ypub, zpub — corresponding to different address types (Legacy, SegWit-compatible, Native SegWit). Understanding these is essential for wallet interoperability and recovery.

Schnorr signatures

Schnorr signatures (enabled by Taproot) represent a fundamental improvement in Bitcoin’s signature scheme. Compared to the original ECDSA:

  • Linearity: multiple signatures can be aggregated into a single signature, making multisig transactions indistinguishable from single-sig on-chain
  • Smaller size: aggregated signatures reduce transaction weight and fees
  • Provable security: Schnorr signatures have stronger mathematical security proofs than ECDSA

Key aggregation via Schnorr is what enables Taproot’s privacy improvements: a 3-of-5 multisig can look identical to a simple payment on the blockchain.

Merkle trees

A Merkle tree is the data structure that efficiently summarizes all transactions in a Bitcoin block. Each transaction is hashed, then pairs of hashes are combined and hashed again, forming a binary tree that converges to a single Merkle root stored in the block header.

This enables Simplified Payment Verification (SPV): a lightweight client can verify that a specific transaction is included in a block by checking only a small proof (the Merkle path) rather than downloading the entire block. It also means that any modification to any transaction in the block changes the Merkle root, making tampering immediately detectable.

Merkle trees appear throughout Bitcoin’s design — in blocks, in Taproot (MAST), and in proposals for post-quantum security (P2MR).


Protocol upgrades: soft forks and hard forks

What is a soft fork?

A soft fork is a backward-compatible protocol upgrade: nodes running the old software continue to recognize new blocks as valid, while upgraded nodes enforce stricter rules. This means the network does not split — old and new nodes coexist on the same chain.

Soft forks are Bitcoin’s preferred upgrade mechanism because they do not force all participants to upgrade simultaneously. They add new capabilities while maintaining compatibility with the existing network.

What is a hard fork?

A hard fork is a non-backward-compatible change: old nodes reject blocks produced under the new rules, creating a permanent chain split if not all participants upgrade. Hard forks effectively create two separate networks and currencies.

Bitcoin has experienced hard forks — Bitcoin Cash (2017) being the most notable — but the main chain has historically avoided them, preferring soft forks for upgrades. The conservatism is deliberate: in a decentralized system, coordination is expensive, and a hard fork that fragments the network undermines the properties that make Bitcoin valuable.

SegWit

Segregated Witness (SegWit, 2017) was the most significant soft fork in Bitcoin’s history. It separated (“segregated”) signature data (“witness”) from the transaction body, solving the transaction malleability problem and effectively increasing block capacity.

SegWit was the prerequisite for the Lightning Network — Lightning’s payment channels require non-malleable transaction IDs to function securely. It also introduced the concept of virtual bytes (vB) for fee calculation, leading to more efficient use of block space.

Taproot

Taproot (activated November 2021) was Bitcoin’s most recent major soft fork, combining three BIPs: Schnorr signatures (BIP-340), Taproot (BIP-341), and Tapscript (BIP-342).

The key innovation is MAST (Merkelized Abstract Syntax Tree): complex spending conditions are organized in a Merkle tree, and only the condition actually used is revealed on-chain. All other possible spending paths remain hidden.

Combined with Schnorr key aggregation, this means that a transaction using any spending path — whether a simple payment, a multisig, a timelock, or a complex script — looks identical on the blockchain. This is a fundamental privacy and efficiency improvement.

However, Taproot has not been without controversy. The upgrade inadvertently enabled inscriptions — arbitrary data embedded in witness space — leading to debates about spam, block space usage, and the boundary between intended and unintended consequences of protocol changes.


Advanced transactions

PSBT: Partially Signed Bitcoin Transactions

PSBT (BIP-174) is a standardized format for transactions that need multiple signatures or external signing. A PSBT can be created by one wallet, passed to a hardware wallet for signing, then broadcast by a third — without any of these devices needing to share private keys.

PSBT is essential infrastructure for:

  • Multisig workflows: each co-signer adds their signature to the PSBT independently
  • Hardware wallet interaction: the PSBT is created on a connected computer but signed on an air-gapped device
  • Collaborative transactions: CoinJoin, Payjoin, and other multi-party protocols use PSBT to coordinate without trust

Bitcoin scripting and smart contracts

Bitcoin has a scripting language — a stack-based, intentionally limited programming language that defines the conditions under which bitcoin can be spent. Every Bitcoin transaction includes a script that specifies how the output can be unlocked.

Common scripts include: pay-to-public-key-hash (standard payments), multisig (M-of-N keys), time-locked outputs (funds that cannot be spent before a certain block height or time), and hash-locked outputs (used in HTLCs for Lightning).

The scripting language is deliberately not Turing-complete — it cannot loop, and its operations are limited. This is a feature, not a limitation: it makes transactions predictable, auditable, and resistant to the infinite-loop bugs and unexpected behaviors that plague more expressive smart contract platforms.

BitVM

BitVM introduces a model for arbitrary computation verification on Bitcoin without requiring a protocol change. It uses a fraud-proof mechanism: an off-chain computation can be challenged on-chain, and the dispute is resolved by the Bitcoin script.

BitVM does not put smart contracts on Bitcoin in the Ethereum sense. Instead, it creates a verification game where one party claims a computation result, and any challenger can prove it incorrect. This is sufficient for bridging, oracles, and other applications that require trustless computation verification.


Covenants: the next frontier

What are covenants?

A covenant is a spending condition that restricts not just who can spend bitcoin, but how they can spend it. Current Bitcoin scripts can require specific keys or timelocks, but they cannot restrict the destination of the spent funds.

Covenants would enable:

  • Vaults: funds that can only be moved to a predetermined address after a time delay, allowing the owner to cancel a theft in progress
  • Congestion control: many users can share a single UTXO and “peel off” their share independently
  • More efficient Lightning channels and other layer-2 protocols
  • Decaying multisig: security that degrades gracefully over time (useful for inheritance)

CTV, OP_CAT, and the debate

The most prominent covenant proposals are CTV (CheckTemplateVerify, BIP-119) and the re-enabling of OP_CAT (a concatenation opcode that was disabled early in Bitcoin’s history).

CTV is the most conservative approach: it allows a transaction to commit to a specific template for how the outputs can be spent. Peter Todd has called it “the best compromise to enable covenants on Bitcoin.”

OP_CAT is more general-purpose but also more controversial, as it enables a wider range of applications — including some that the community has not fully analyzed.

The covenant debate reflects a fundamental tension in Bitcoin governance: the desire for new capabilities versus the risk of unintended consequences. BIP-444, a proposal for a temporary soft fork, has further divided developers and the community on how to approach protocol upgrades.


Sidechains and extended protocols

Liquid Network

The Liquid Network is a federated sidechain operated by a consortium of functionaries (exchanges, trading desks, infrastructure providers). It offers faster settlement (1-minute blocks), Confidential Transactions (hidden amounts), and the ability to issue assets (L-BTC, stablecoins, security tokens).

Liquid is not trustless like Bitcoin’s base layer — it relies on a federation of known entities. But it offers a practical tradeoff: faster, more private, and more flexible transactions for users who accept the federation model.

RGB protocol

The RGB protocol enables the issuance and transfer of assets on Bitcoin and Lightning using client-side validation. Unlike blockchain-based tokens, RGB data is stored off-chain by the parties involved — only a cryptographic commitment is anchored to the Bitcoin blockchain.

This approach preserves Bitcoin’s scalability and privacy: the base chain is not burdened with token data, and asset transfers are invisible to observers. RGB is now live, with Tether (USDT) as its most prominent integration.

Simplicity

Simplicity is a new smart contract language developed by Blockstream, designed from the ground up for formal verification — meaning that the behavior of a Simplicity program can be mathematically proven before deployment.

Simplicity is currently live on the Liquid Network and could eventually be proposed for Bitcoin’s base layer. It offers expressive smart contracts without the security risks of Turing-complete languages.


The testnet

The testnet is a parallel Bitcoin network used for testing and development. Testnet coins have no value, allowing developers to experiment with transactions, smart contracts, and protocol changes without risking real funds.

Bitcoin has had multiple testnets (testnet3, testnet4, and signet). Signet is a controlled testnet where blocks are produced by designated signers, providing a more predictable testing environment.


Bitcoin development: history and governance

The spam problem

Bitcoin’s block space is a shared, limited resource. Throughout its history, the blockchain has been subject to deliberate spam — transactions designed to consume block space without genuine economic purpose.

The history of spam attacks reveals recurring tensions: what constitutes legitimate use of block space? Who decides? The inscription debate following Taproot’s activation is the latest chapter in this ongoing discussion.

BIP-324: encrypted P2P connections

BIP-324 encrypts the communication between Bitcoin nodes, preventing ISPs and network-level adversaries from observing which transactions a node sends or receives. This is a network-layer privacy improvement that complements on-chain privacy tools.

Bitcoin vs gold

Bitcoin is often called “digital gold” — but the comparison reveals both parallels and fundamental differences. Both are scarce, durable, and fungible. But Bitcoin is divisible to eight decimal places, transferable across the globe in minutes, and verifiable by anyone with a computer. Gold requires physical custody, assay, and trusted intermediaries for transfer.

The Gold Exchange Standard and Bitcoin’s role

The end of the Gold Exchange Standard in 1971 created the monetary environment that Bitcoin was designed to address. Understanding this history — from Bretton Woods to the Nixon Shock to the era of unlimited fiat — contextualizes Bitcoin’s fixed supply as a deliberate response to decades of monetary debasement.


Further reading

Cryptographic foundations

Protocol upgrades

Advanced transactions and smart contracts

Covenants

Sidechains and protocols

Context and history