⛓ Blockchain & Applied Crypto

How Blockchain Works: A Technical Explanation

Blockchain is a distributed, append-only ledger in which batches of transactions are cryptographically linked into an unbroken chain of blocks. Its power comes not from any single clever trick but from the way hashing, digital signatures, and consensus combine to let mutually distrusting parties agree on one shared history without a central authority. Understanding how blockchain works at a technical level means looking past the buzzwords at the data structures and cryptographic primitives underneath.

The Blockchain Data Structure

At its core a blockchain is a linked list in which each element references its predecessor with a cryptographic hash rather than a memory pointer. Each block bundles a set of transactions together with a block header of metadata. The single most important header field is the hash of the previous block's header. Because every block commits to the one before it, the blocks form a chain that reaches all the way back to the first block ever created, called the genesis block.

A typical block header contains:

  • The previous block hash, which links the block to its parent.
  • A Merkle root, one hash that commits to every transaction in the block.
  • A timestamp recording roughly when the block was produced.
  • Consensus fields such as a nonce and a difficulty target in proof-of-work systems.

The transactions themselves are stored in the block body, while the header is the compact, hashed summary that the chain is built from.

A cryptographic hash function maps any input to a fixed-size digest in a way that is deterministic, fast to compute, and infeasible to reverse or force into collisions. Blockchains lean on these properties constantly. When a block's header is hashed, the result acts as a unique fingerprint of everything in it, including the pointer to the parent block.

This is what makes the structure tamper evident. Altering a single transaction changes the block's Merkle root, which changes the header, which changes the block's hash. That altered hash no longer matches the "previous block hash" stored in the next block, so the break is immediately visible to anyone validating the chain.

block.header = {
    prev_hash:   H(previous_block.header),
    merkle_root: merkle(transactions),
    timestamp, nonce, target
}
block.hash = H(block.header)   # any change cascades forward

Transactions and the Ledger State

Blockchains track ownership using digital signatures. A transaction is authorized by a signature from the holder of the relevant private key, and any node can verify that signature against the matching public key. There are two dominant ways to represent balances:

  • The UTXO model (used by Bitcoin) treats the ledger as a set of unspent transaction outputs. A transaction consumes existing outputs and creates new ones, and validity requires that inputs are unspent and correctly signed.
  • The account model (used by Ethereum and many others) keeps an explicit balance for each account and debits or credits it, much like a bank ledger.

Either way, nodes independently apply the same rules to the same ordered transactions and therefore compute the same resulting state.

Reaching Consensus Across Nodes

A blockchain runs on a peer-to-peer network with no central coordinator, so participants must agree on which block extends the chain next. This is the job of a consensus mechanism. Proof of work has miners repeatedly hash a block header while varying the nonce until the hash falls below a difficulty target; proof of stake selects validators in proportion to the value they have bonded. The differences between proof of work and proof of stake shape the security and performance of the whole system.

Because messages propagate at finite speed, two valid blocks can occasionally appear at the same height, creating a temporary fork. Nodes resolve forks by following a chain-selection rule, such as adopting the chain with the most accumulated work. Blocks on the losing branch become orphans, and the transactions in them typically return to the pool to be included later. This is why deeper confirmations give stronger guarantees.

Why Blockchains Are Tamper Evident

The security of the ledger is a consequence of chaining plus consensus. To rewrite history an attacker cannot simply edit an old block, because doing so invalidates every block after it. They would have to redo the consensus work for that block and all of its descendants faster than the honest network extends the legitimate chain. In a large proof-of-work network this is prohibitively expensive, which is the essence of why a 51% attack is hard to sustain.

It is important to be precise about the guarantee: a blockchain provides tamper evidence and ordering, not secrecy. The ledger is usually fully public, and privacy comes from separate techniques layered on top.

Nodes, Decentralization, and Trust

A full node downloads every block and independently checks it against the protocol rules: signatures must be valid, no coins may be spent twice, and consensus requirements must be met. Because thousands of independent nodes enforce the same rules, no single participant can quietly change them. This is the practical meaning of decentralization and the reason the community mantra is "don't trust, verify." Platforms such as K0G study exactly these mechanisms to understand where the real security boundaries lie.

Key Takeaways

  • A blockchain is an append-only, hash-linked chain of blocks, each committing to its predecessor and to its transactions through a Merkle root.
  • Cryptographic hashing makes the structure tamper evident, because any change cascades into every later block's hash.
  • Digital signatures authorize transactions, while a consensus mechanism decides which block extends the chain and resolves forks.
  • Security comes from the combination of chaining and consensus, making historical rewrites computationally expensive rather than merely forbidden.
  • Independent full nodes validating the same rules are what make a blockchain decentralized and trust-minimized.
blockchaindistributed-ledgerconsensushashingdecentralization

Frequently asked questions

How does a blockchain work?

A blockchain is a distributed, append-only ledger that groups transactions into blocks, where each block header stores the cryptographic hash of the previous block. This hash linkage chains the blocks back to the very first block, and a consensus mechanism decides which block extends the chain. Together this lets mutually distrusting parties agree on one shared history without a central authority.

What is a block header in a blockchain?

A block header is the compact, hashed summary of a block, kept separate from the transaction data stored in the block body. It typically contains the previous block's hash, a Merkle root that commits to every transaction in the block, a timestamp, and consensus fields such as a nonce and difficulty target in proof-of-work systems. Hashing the header produces the block's unique fingerprint.

Why is a blockchain considered tamper evident?

Altering a single past transaction changes that block's Merkle root, which changes its header hash, which no longer matches the previous-block-hash stored in the following block, so the break is immediately visible to anyone validating the chain. To hide it, an attacker would have to redo the consensus work for that block and every block after it, faster than the honest network extends the legitimate chain. In a large network this is prohibitively expensive.

What is the difference between the UTXO model and the account model?

The UTXO model, used by Bitcoin, treats the ledger as a set of unspent transaction outputs, so a transaction consumes existing outputs and creates new ones. The account model, used by Ethereum and many others, keeps an explicit balance for each account and debits or credits it much like a bank ledger. Either way, every node applies the same rules to the same ordered transactions and computes the same resulting state.

What is a blockchain fork and how is it resolved?

A fork happens when two valid blocks appear at the same height because network messages travel at finite speed, creating competing branches. Nodes resolve it with a chain-selection rule, such as following the chain with the most accumulated work, and blocks on the losing branch become orphans whose transactions usually return to the pool. This is why deeper confirmations give stronger settlement guarantees.

Does a blockchain keep transactions private?

No, a blockchain provides tamper evidence and an agreed ordering of transactions, not secrecy. The ledger is usually fully public so that thousands of independent full nodes can each verify signatures, check for double spends, and enforce the rules. Any privacy comes from separate techniques layered on top of the base ledger.

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 →