Experiments · Nobody Owns Money · Chapter 3

A Hashcash stamp

SHA-256 and Hashcash proof of work

Theme
Try itA Hashcash stamp
Adam Back’s puzzle in the browser. The browser itself computes the letter’s SHA-256. Mining runs through counters until the hash starts with enough zeros. Checking the stamp takes one hash.

Everything is computed in your browser; nothing is sent anywhere.

About this experiment

What is SHA-256?

SHA-256 is a cryptographic hash function from the SHA-2 family, standardised by the US National Institute of Standards and Technology in 2002. It turns any input, a word or a whole file, into a 256-bit number, usually written as 64 hexadecimal characters. The same input always gives the same hash, changing one letter gives a completely different one, and there is no known way to work back from a hash to the input. Bitcoin uses SHA-256 for its proof of work: miners change a counter until the hash of a block falls below a target.

Hashcash was invented by the British cryptographer Adam Back in 1997, against spam. Before a letter went out, the sender’s computer spent a few seconds on a pointless puzzle and attached the solution. A few seconds per letter cost an ordinary person nothing; for someone sending millions of letters the work would have taken a whole farm of computers. The recipient could check the solution instantly.

Eleven years later Satoshi Nakamoto took the puzzle. In his nine pages proof of work came from Hashcash, and he cited it, only for bitcoin the puzzle is far heavier: the network as a whole finds a solution about once every ten minutes.

Here you can do it by hand. Your browser computes the SHA-256 of the letter plus a counter as you type, on your own computer, and sends the text nowhere. Mining runs through counters until the hash starts with the chosen number of zero bits. Each extra bit doubles the work, and checking stays one hash. Change one letter and the stamp stops fitting.

From the book

Nobody Owns Money · Chapter 3

The Idle God

Next to this experiment in the chapter
There was almost nothing new in the nine pages. Proof of work came from Adam Back’s Hashcash, the idea of money kept by the whole network from Wei Dai’s b-money, and Satoshi honestly cited both. Digital signatures, hash functions and peer-to-peer networks were by then studied from textbooks. What was new was the way of putting these parts together so that strangers who don’t trust one another could agree among themselves which version of the shared record was correct.

The first chapters are free →