Crypto and international payments

How a blockchain actually works

A blockchain is a shared ledger that writes transactions in batches called blocks, and every block carries the digital fingerprint of the block before it inside itself. That single rule makes changing an old row require rebuilding everything that came after it, and it solves a problem that had not been solved before: agreeing on one single order with nobody in charge.

  • Lesson 2 of 8
  • Beginner
  • Free, no signup

One link of the chain, and what ties it to the last

The third link is where the whole idea fits: the hash of the previous block sits inside the next one.

  1. 1 Transactions gather

    A batch of signed instructions picked out of the waiting area.

  2. 2 The previous hash

    The fingerprint of the previous block is written inside this one. That is what makes a chain.

  3. 3 Sealing

    By work or by stake. Either way it has a cost that would have to be paid again later.

  4. 4 The next link

    The next block takes the hash of this one, and from that moment tampering with this block breaks that one too.

  5. 5 Depth

    Every new link makes the blocks below it more expensive. A confirmation is that depth count.

These five links are simplified and the details differ per network: block size, the gap between blocks and the way a block is sealed are not the same in Bitcoin and Ethereum.

Last checked: Facts and tool names in this lesson are re-checked against their sources on this date.

What problem does a blockchain solve?

One specific problem and not much more: how a crowd of strangers who do not trust each other can agree on one single order of events with nobody acting as referee. The name comes from the structure itself, because a blockchain is a ledger that writes its rows in batches, each batch carrying the fingerprint of the batch before it.

Why was that hard? Because anything digital can be copied. If money were a file, nothing would stop you sending the same file to two people, and whoever received it would have no way to tell whether it had already been spent somewhere else. The old answer was to put an institution in the middle that sees every transaction and says which arrived first. The founding document of 2008 says exactly that, and adds that the trouble with that answer is that the fate of the whole money system then depends on the company running the institution.

The solution is a shared timestamper. That same document, in its third section, says that each timestamp includes the previous timestamp in its hash, forming a chain, with each additional timestamp reinforcing the ones before it. Everything a blockchain is fits inside that one sentence.

And our position: the interesting part of the invention is not the money, it is the ordering. The real problem was never how to make a digital number, it was how to agree on one history without a referee, and wherever that second problem is not your problem, a blockchain is not the right tool. The last section of this lesson comes back to that.

A chain of glass blocks each holding a red fingerprint of the last, one green altered block breaking the chain

Where does a transaction go, from signing to confirmed?

Five stations, and none of them is the thing the advertising shows. First your wallet signs an instruction with the private key. Then that signed instruction is broadcast to however many of the network computers you can reach, and they pass it to their own neighbours. Nothing has happened yet and nothing is final.

The third station is the one most people have never heard of: a waiting area. Your transaction sits there beside thousands of others until whoever builds the next block comes for it, and this is exactly where the fee finds its meaning. A fee is not payment for network services, it is your bid to move up in that queue. When the queue is crowded the fee goes up, and when it is quiet it comes down.

The fourth station is being placed in a block. Once that block joins the chain your transaction is done, though not in the sense you might think. That is the fifth station: every block that lands on the chain after it is one confirmation, and a confirmation is not a security setting on your side, it is only a depth count. The deeper your block goes, the more expensive it becomes to change it, and the next section says by how much.

One practical point that gets lost between those five stations: a transaction still sitting in the waiting area may never enter a block at all and can drop out of the queue after a while. So sent and arrived are two different pieces of news, and somebody being paid should wait for the second, not the first.

The route of one transaction, five stations

Between sent and arrived there are three stations, and most payment misunderstandings happen in that gap.

  1. 1

    Signed

    The wallet signs the instruction with the private key. Nothing has gone anywhere yet.

  2. 2

    Broadcast

    It goes to whatever computers are reachable, and they pass it to their neighbours.

  3. 3

    The waiting area

    Beside thousands of others. The fee is your bid to move up this queue.

  4. 4

    Placed in a block

    The block builder picks it up and the block joins the chain.

  5. 5

    Confirmations

    Every new block on the chain is one confirmation. Depth, not a security setting.

A transaction stuck at the third station may never move on and can drop out of the queue. That is not rare and it is not a fault.

Why is changing the history hard?

Because every block carries the fingerprint of the block before it. A digital fingerprint, or hash, is a fixed-length string made from a text, and its important property is that changing one character changes the whole string. So if somebody tampers with a row in block one hundred, the hash of block one hundred changes, and block one hundred and one, which was carrying that old hash inside it, no longer fits, and so on to the end of the chain.

The Bitcoin document says exactly this in its fourth section: once a block has had the work spent on it, it cannot be changed without redoing that work, and because later blocks are chained after it, changing it means redoing the work of all of those too. An attacker has not only to catch up with the work already done but to surpass it, while the rest of the network keeps moving ahead without pause.

The number is in that same document and is worth seeing, because it shows this is a probability and not a guarantee. If an attacker holds one tenth of the network power, the probability of ever overtaking the honest chain is 0.0002428 after six blocks and 0.0000012 after ten. The habit of waiting for a few confirmations comes from that table, and what it means is that with each block the probability drains away fast but never reaches zero.

In practice every service taking money picks its own number, and that number is a decision about risk rather than a property of the network. Two things also tend to be understood backwards: a confirmation count on one network is not comparable to one on another, because the gap between blocks is not the same and five confirmations on one can be shorter than a single confirmation on another; and some networks have no stage of seen but still shallow at all, so what they show you is final from the start. The real numbers per network, and how long each confirmation takes, are opened up with sources in the networks and fees lesson of this path. Why networks differ this much comes down to their consensus method, and that is the next section.

What consensus means: proof of work versus proof of stake

Consensus means how the network decides who writes the next block, when thousands want to write it and there is no boss. Both of the common methods do the same job: they bring something scarce into the game so that voting is not free, because on the internet creating a thousand fake identities costs nothing at all.

In proof of work, the scarce thing is electricity. Hardware searches for a number that makes the hash of the block come out in a particular shape, and finding it is possible only through a great deal of trial and error while checking it takes a single calculation. The Bitcoin document calls this one CPU one vote and says the majority decision is represented by the chain with the greatest work invested in it. In proof of stake, the scarce thing is capital: a participant locks up an amount of the coin and loses that locked amount if they misbehave. The location of the cost changed, not its existence.

The difference in energy use between the two is large and the number can be had from its own source. Ethereum moved from proof of work to proof of stake on 15 September 2022, and Ethereum own energy page publishes the CCRI estimate that the change cut the network annualized electricity consumption by more than 99.988%, putting the current figure at about 0.0026 TWh per year.

Now the boundary that usually goes unsaid. That number is one network statement about itself and says nothing about any other; Bitcoin still runs on proof of work, so the figure has no bearing on it. And the two methods are not old and new: each makes a different trade, and the argument about which is more resistant to attack is still open. We have no expertise in that argument and take no side in it; all we are saying is that both solve one problem, at two different costs.

Two ways to make voting cost something

Both do the same job: they bring something scarce into the game. They differ in what the scarce thing is.

Proof of work

  • The scarce thing is electricity; hardware guesses numbers until one answers.
  • The Bitcoin document calls it one CPU one vote.
  • The cost of an attack is real electricity and real hardware.
  • Bitcoin still runs on this today.

Proof of stake

  • The scarce thing is capital; coin is locked up and misbehaviour burns it.
  • It takes electricity largely out of the equation.
  • Ethereum moved to it on 15 September 2022.
  • The cost of an attack is locked capital that gets lost.

Neither column wins here and we take no side. The argument about which resists attack better is still open and is not our field.

What does a blockchain not solve?

The chain guarantees that a row was not changed after it was written. About whether that row was true when it was written it guarantees nothing, and it cannot. If you write the sentence this certificate is genuine onto a blockchain, the chain proves that sentence has not been edited; about the certificate itself it says not one word.

This is our position and we state it plainly, because this is where most of the misunderstanding in the field lives: bad data on a chain stays bad data, and now it stays forever as well. Any project claiming that a blockchain guarantees the authenticity of a physical good or the correctness of a piece of information has really moved the problem one step back: you now have to trust whoever entered that information, and that trust is exactly where it was before.

One more common belief is worth correcting: the ledger is public so anybody can read the whole history is true in principle and costs money in practice. Our watcher on BNB Smart Chain connects to a free public node, and that node keeps no archive. We measured it ourselves: a five thousand block window answers, and a thirty thousand block window is refused with a message saying archive requests require a personal token. That is why our code always keeps its cursor within four thousand blocks of the tip of the chain and advances in windows of two thousand.

And what we do with a gap is the part we learned on the way: a payment that fell into one is collected by a second route, fetching the receipt of that one transaction by its id, which has no range limit at all. The next lesson of this path goes to the thing most real payments are actually made with, and it has an argument of its own: a token that claims to be one dollar and to stay there.

What the chain proves and what it does not

What is above the water is true, and it is small. Most of what gets attributed to a blockchain is below it.

One thing, and genuinely true

This row has not been changed since it was written.

What the chain does not prove
  • That the record was true

    Bad data on a chain stays bad, and now it stays forever as well.

  • Who the other party is

    A signature proves somebody held the key, not who that somebody was.

  • That a mistake can be undone

    The same immutability that gets celebrated also makes reversal impossible.

  • That reading it is free

    Public in principle; in practice reading deep history needs an archive node, and that is not free.

This list is about the technology and passes judgment on no particular project or company. Each project has to be measured against its own claim.

The fast path, with AI

The single most useful thing you can do with a blockchain and a language model together, and almost nobody does it: instead of taking somebody word for it, check their payment claim yourself in two minutes. A client says they sent it and hands you a transaction id; that id is not a claim, it is an address anybody can go and look at.

  1. Open the transaction id on that network explorer. Take the explorer address from the network own documentation and not from a link the sender gave you; that one habit removes a whole class of fraud.
  2. Copy the text of the page, not a screenshot of it. A model works on exact text, and on a picture of a page full of hex strings any slip is possible.
  3. Ask for four things: how many confirmations it has, what moved and on which contract, which address received it, and whether anything on this page fails to match what you were told.
  4. A fast, cheap class of model is enough here; you are only reading a page and no judgment is involved. We keep the current pick in <a class="text-link" href="/en/ai/">the RGB AI reference</a>.

Copy-ready recipe

The text below is exactly the page of a block explorer that I opened and copied myself.

Network: {for example Tron or BNB Smart Chain}
Explorer: {name of the explorer}
What I was told: {for example one hundred Tether on Tron sent to my address}

{paste the explorer page text here}

Answer only from this text, and where something is not in the text write not in the text:
1. How many confirmations it has.
2. How much of what moved, and on which contract.
3. The receiving address, exactly as it appears in the text.
4. Whether anything in this text fails to match what I was told.

Do not write any number and any address that is not in the text above.

Before you trust the output: The model reads only what you pasted and cannot open the explorer itself. So if the answer contains a number or an address that was not in your text, it invented it and the whole answer becomes suspect. And one last step only you can take: the receiving address written on that page has to be exactly your own address, and that has to be compared character by character against your own wallet, not against your memory.

AI in this kind of work

A language model does one thing genuinely well here: it unpacks a page you pasted in yourself and tells you what each field means. That is all. Anything you ask of it whose answer is a string of characters standing for money or for the identity of a transaction falls outside the range we trust it in.

Tools that actually help

  • Claude It works well on the raw text of an explorer page and separates the fields correctly. Iran is on neither of Anthropic two supported-countries lists, and we read that on Anthropic own page rather than measuring it.
  • Gemini The same job, and smoother at rendering chain vocabulary into Persian. Google own page says the Gemini web app runs in over 230 countries and territories, and Iran is not on that list.

Where it backfires

Two risks, both specific to this subject. First, a transaction id, an address and a block height have exactly the shape a language model produces fluently and has no way to verify: a transaction id is sixty-four hex characters, and a model will produce one effortlessly that is perfectly well formed and points at nothing. The rule that works is simple: a model may tell you what a field on a page you pasted means, but it is never the source of an id, an address, a balance or a current fee. Second, a model picture of a network is a snapshot of its training text, and networks change; Ethereum changed its consensus mechanism in 2022, and that is the classic case where an old snapshot gives a confident wrong answer. So date-anchor anything time-sensitive in the question itself and check the answer against the network own documentation.

Sources: Anthropic: supported countries Google: where you can use the Gemini web app Ethereum: The Merge, 15 September 2022

Where this advice stops

This lesson explains the mechanism, not the current rules of any particular network. Block intervals, fees, confirmation policies and even the consensus method itself differ from network to network and also change; nothing here is a security review of any specific chain, and we have not carried out such a review. Two things are also deliberately left out because each is a subject of its own: smart contracts beyond the point of what a token is, and the economics of mining and validation rewards.

From our own work

We run a payment watcher on this very server that reads incoming transactions off the chain itself, and the most expensive thing we learned building it is something we have never seen in a tutorial: a public ledger does not mean a readable one. The free public node we use for BNB Smart Chain keeps no archive, and we measured ourselves that a five thousand block window answers while a thirty thousand block one is refused with a message saying archive requests require a personal token. Which means the chain everybody calls open to all is, past a certain depth, open only to whoever paid for it. Our code has made its peace with that: the cursor is always kept within four thousand blocks of the tip and advances in windows of two thousand, and on a range error it snaps back to the tip once and carries on. A payment that fell into a gap is collected by a second route, fetching the receipt of that one transaction by its id, which has no range limit at all. We had not written that second route for this reason; it was added after we saw the node behave that way.

Real follow-up questions

Is a blockchain the same thing as Bitcoin?

No. Bitcoin is a blockchain, the first one that worked. Blockchain is the name of the structure, and a great many networks use that structure with different rules: block intervals, the consensus method and even what gets written on the chain at all differ from one network to another.

How many confirmations are enough?

It depends on the network and on the amount, and the answer is a decision about risk rather than a correct number. The general rule is that the larger the amount the longer you wait, because the probability of a reversal shrinks with every block but never reaches zero. The real numbers per network, and how long each confirmation takes, are in the networks and fees lesson of this path, because a count only means anything beside that network block time.

What does it mean when somebody says a blockchain was hacked?

It almost never means the chain itself was rewritten, and separating those three things is the most useful move a reader can make. Usually somebody private key was stolen, or a contract running on the chain had a flaw, or a service sitting in the middle failed. In all three the chain did exactly what it was supposed to do and the problem was somewhere else.