⛓ Blockchain & Applied Crypto

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.
bitcoincryptographysha-256ecdsadigital-signatures

Frequently asked questions

How does Bitcoin use cryptography?

Bitcoin is best understood as an applied cryptography system built on two primitives: cryptographic hash functions and digital signatures. Hash functions, mainly SHA-256, link blocks, form transaction identifiers, and drive proof of work, while digital signatures over the secp256k1 elliptic curve prove control of coins. Notably Bitcoin uses no encryption for its ledger, since the blockchain is public and cryptography provides integrity and authentication rather than secrecy.

What hash function does Bitcoin use?

Bitcoin primarily uses SHA-256, and it frequently applies it twice in a row, a construction called SHA256d or double SHA-256. Hashing the hash mitigates the length-extension weakness inherent in SHA-256's underlying Merkle-Damgard design and adds a modest safety margin. A shorter hash, RIPEMD-160, is combined with SHA-256 to derive compact addresses.

How does Bitcoin prove ownership of coins?

Owning bitcoin means controlling a private key, a 256-bit secret from which elliptic-curve multiplication derives a public key. To spend coins the owner produces a digital signature over the transaction with their private key, and any node can verify it against the public key. Because the signature commits to the exact transaction contents, it proves both authenticity and that nothing was altered after signing.

What is a Bitcoin address and how is it derived?

A Bitcoin address is not the public key itself but a hash of it, which shortens the identifier and adds a protective layer. The legacy derivation hashes the public key with SHA-256 and then RIPEMD-160, then applies a checksum encoding so mistyped addresses are caught before funds are sent. Because the address is a hash, the full public key is only revealed when the coins are actually spent.

What signature algorithms does Bitcoin use?

Bitcoin originally used the Elliptic Curve Digital Signature Algorithm (ECDSA) and later added Schnorr signatures. Both operate over the same secp256k1 curve, but Schnorr offers cleaner security proofs, linearity that enables key and signature aggregation, and better privacy for multi-signature arrangements. In each case a valid signature proves the signer holds the private key and binds the signature to the exact transaction data.

Does Bitcoin encrypt its blockchain?

No, Bitcoin uses cryptography for integrity and authentication rather than secrecy, and the ledger itself is entirely public. Hash functions make the chain tamper evident and power proof of work, while digital signatures authorize spending, but no part of the transaction ledger is encrypted. Anyone can download and independently verify the full history.

Try it hands-on

K0G is an open toolkit of browser-based security utilities — hashing, encoding, JWT, certificates, crypto and more, all running locally in your browser.

Explore the tools →