Blog / Blockchain and Mining

How Does a Blockchain Actually Work?

Cointechies

You already know that a blockchain is a shared record. Now let’s see what happens under the hood, from the moment you press send to the moment your transaction becomes part of history.

Step 1: A transaction is created and signed

When you send crypto, your wallet creates a message that says, in effect, move this amount from my address to that address. It signs the message with your private key, producing a digital signature. Anyone can check that the signature matches your public address, but nobody can forge it without your key.

Step 2: It is broadcast and checked

Your wallet sends the transaction to a node, which relays it to its peers, and within seconds most of the network has seen it. Each node verifies that the signature is valid and that you have enough funds. Invalid transactions are dropped.

Step 3: Transactions wait in the mempool

Valid but unconfirmed transactions sit in a waiting area called the mempool. Those that pay higher fees are generally picked first, which is why fees rise when the network is busy.

Step 4: A block is assembled

A miner or validator selects transactions and builds a block. Besides the list of transactions, the block’s header contains:

  • the hash of the previous block, which links the chain;
  • a Merkle root, a single fingerprint summarising all the transactions;
  • a timestamp; and
  • on proof-of-work chains, a nonce, the number miners change in their search.
Bar chart of the relative size of the parts of a block
The header is tiny. Nearly all of a block’s data is the list of transactions.

Step 5: Consensus decides

The network must agree whose block comes next. In proof of work, whoever finds a valid hash first wins. In proof of stake, a validator is selected and others attest to the block. Other nodes check the block against the rules, and accept it only if every rule is met.

Step 6: The block joins the chain

Once accepted, the block is added and the transactions in it are confirmed. Each new block that follows makes the earlier ones harder to alter, which is why exchanges often wait for several confirmations before crediting large deposits.

What about disagreements?

Sometimes two valid blocks appear at nearly the same time. Nodes temporarily keep both, then follow the chain that grows longer or heavier. The losing block is dropped and its transactions return to the mempool.

Why this is secure

Changing history would require redoing the work, or controlling a large share of the stake, faster than the rest of the network, while thousands of nodes check everything independently.

The bottom line

A blockchain works through signed transactions, a shared waiting room, blocks linked by hashes and a consensus process that decides what to add. Each piece is simple, and together they produce a record that is very hard to cheat.

This article is for educational purposes only and is not financial advice. Crypto assets are volatile and you can lose some or all of your investment.

Follow the market in real time on the live crypto prices page, or go back to all articles.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

More from the blog

All articles