How Bitcoin Uses Cryptography
Bitcoin is often described as a cryptocurrency, but from an engineering standpoint it is better understood as an applied cryptography system. Every core function, from proving ownership of coins to linking blocks together, is built on two well-studied primitives: cryptographic hash functions and digital signatures. Understanding how Bitcoin uses cryptography reveals why the network can secure enormous value with no central operator and no privileged administrators.
Two Cryptographic Building Blocks
Bitcoin relies on exactly two families of cryptographic tools:
- Cryptographic hash functions, primarily SHA-256, which compress arbitrary data into a fixed 256-bit fingerprint. These link blocks, drive proof of work, and derive addresses.
- Digital signatures over the secp256k1 elliptic curve, which prove control of a private key without revealing it.
Almost every security property of Bitcoin can be traced back to one of these two mechanisms. Notably, Bitcoin uses no encryption for its ledger at all; the blockchain is entirely public, and cryptography is used for integrity and authentication rather than secrecy.
SHA-256 and Double Hashing
SHA-256 appears throughout the protocol. Bitcoin frequently applies it twice in a row, a construction written as SHA256d or double SHA-256. Hashing the hash mitigates length-extension weaknesses inherent in the underlying Merkle-Damgard design and adds a modest safety margin.
Hashing is used to:
- Compute a transaction identifier (txid) as the hash of the transaction data.
- Link each block to its parent by including the previous block header hash.
- Power proof of work, where miners search for a header hash below the difficulty target.
- Derive addresses in combination with RIPEMD-160, a second, shorter hash function.
For a deeper look at these properties, see cryptographic hash functions in blockchain.
Digital Signatures on secp256k1
Ownership of bitcoin means control of a private key, a 256-bit secret number. From it, elliptic-curve multiplication derives a public key. To spend coins, the owner produces a digital signature over the transaction using their private key; any node can verify it against the public key.
Bitcoin originally used the Elliptic Curve Digital Signature Algorithm (ECDSA) and later added Schnorr signatures, which offer cleaner security proofs, linearity that enables key and signature aggregation, and better privacy for multi-signature arrangements. Both operate over the same curve, secp256k1, whose specific structure makes these operations efficient.
Crucially, a signature commits to the exact transaction contents. Changing any signed field invalidates the signature, so signatures provide both authentication (only the key holder could sign) and integrity (the transaction cannot be altered after signing).
From Keys to Bitcoin Addresses
A Bitcoin address is not the public key itself but a hash of it, which shortens it and adds a layer of protection. The legacy pay-to-public-key-hash derivation is:
pubkey_hash = RIPEMD160(SHA256(public_key))
address = Base58Check(version_byte || pubkey_hash)
The Base58Check encoding appends a checksum, itself computed with double SHA-256, so that mistyped addresses are detected before funds are sent. Newer addresses use Bech32 encoding, which has stronger error detection, but the principle is the same: hash the public key, add a checksum, and present a compact string. Because the address is a hash, the full public key is only revealed when coins are spent, which historically provided a small hedge against weaknesses in elliptic-curve cryptography.
Proof of Work Anchored in Hashing
Bitcoin's consensus is pure hashing. Miners assemble a block and repeatedly alter a nonce (and other fields) so that the double SHA-256 of the header is below a target value. Because the hash output is effectively unpredictable, the only strategy is brute-force trial, which is why mining consumes real computational effort. This sits at the heart of the debate over proof of work as a consensus design. The difficulty target automatically re-tunes so that blocks are found at a steady average interval as total mining power changes.
Merkle Trees and Block Integrity
Every block summarizes all of its transactions in a single hash called the Merkle root, stored in the header. This structure, covered in Merkle trees explained, lets a lightweight client verify that a specific transaction is included in a block by checking a short path of hashes rather than downloading every transaction. It also means any change to any transaction alters the Merkle root and therefore the block hash, tying transaction integrity directly to the proof-of-work-secured header.
Key Takeaways
- Bitcoin is built almost entirely from hash functions and digital signatures, using cryptography for integrity and authentication rather than secrecy.
- SHA-256, often applied twice as SHA256d, links blocks, forms transaction identifiers, and drives proof of work.
- ECDSA and Schnorr signatures over secp256k1 prove ownership of coins and bind each spend to exact transaction data.
- Addresses are hashes of public keys (SHA-256 then RIPEMD-160) with checksums to catch typos, not the public keys themselves.
- Merkle roots commit every transaction into the header, connecting transaction integrity to the proof of work that secures each block.