Pay With Lightning pill shaped image with orange Bitcoin Lightning logo.

Bitcoin T-shirts

Pay With Bitcoin pill shaped image with orange Bitcoin logo.

Bitcoin T-shirts

Pay With Lightning pill shaped image with orange Bitcoin Lightning logo.
Pay With Bitcoin pill shaped image with orange Bitcoin logo.

What Is Bitcoin Proof-of-Work?

Hash function

In regards to Bitcoin, The first thing you need to understand is what a hashing function is. A hashing function takes an input which could be absolutely anything, a string of characters, a number, file contents, etc. and then it takes that input and generates a fixed length output. Examples below are MD5 which which isn’t commonly used today because there are better alternatives but for the sake of the explanation:

if you input ‘hello’ your output is: 5d41402abc4b2a76b9719d911017c592

if you input ‘Hello’ your output is 8b1a9953c4611296a827abf8c47804d7

and if I input some random word document currently sat in my downloads (containing 1 million+ characters) the output is 76B50A0B1271DBEF365171A19B253722

hashes themselves are in hex, this is a base 16 numbering system just to make them shorter but they’re actually just massive numbers.

There are a few things you’ll notice about the above. 1: A slight change (i.e capitalisation of a letter) makes a huge difference, this is because hashes are unpredictable and one minor change has an avalanche effect. 2: You’ll notice they’re always the same length, even when my input was 1 million characters long – obviously you can’t just ‘reverse’ the function and get my document back from that output – hashes are irreversible – the only way you can work out what the input of a hash is, is to just try millions/billions of inputs until the output matches what you’re looking for. Both of these are important factors.


A block is basically a data structure (or you could think of it as a list).. it contains fields of information like block number, a list of transactions, time the block was found but also the hash of the previous block (making it a ‘linked list’ or a ‘block chain’). this important because it means nobody can know what block 456 looks like until block 455 is found, its also important because as we saw earlier if somebody makes a minor change to a hash input it has catastrophic effects on the output. so if anyone alters the data at any point, the entire list from that point becomes invalid because the previous hash fields of the blocks wont match the actual hash output of the previous blocks themselves.

The bit you actually care about

When a miner adds a block to the chain, they include themselves into a section called the coinbase transaction (not to be confused with Coinbase exchange which named itself after this) which basically rewards themselves some bitcoin. But in order to add a block – it must meet a certain criteria including but not limited to: the transactions in the block data must be valid, the block must contain the hash of the previous block and the hash of the block itself must have a hash value lower than whatever the ‘current target’ is. That last one is where adding blocks becomes difficult. You can’t just ‘create a block with a hash value below X’ because as we know they’re too unpredictable. The only thing a miner can do is try creating a block, checking if its a winner (i.e is its hash below the target?) and if its not, make a minor change to block and then try again (there is a field called the ‘nonce’ where random data can be added to make altering the block easier).

if its a winning block (valid and within the target) you broadcast your winning block across the network. the other miners, nodes, users, etc. can all check if you really did at that work by very quickly looking at your block, hashing it themselves and checking its valid.. this is PROOF OF WORK. It is the concept of having to do a lot of work but then it being very easy to prove you have done it.

It may take you a billion or more attempts to find the valid block, but once you find it and broadcast it, it takes milliseconds and a single attempt for everyone else to check it.

(the ‘target’ changes every 2016 blocks (about every 2 weeks) by taking time passed and blocks mined. to ensure that it always takes on average 10 minutes per block.)

What a transaction is, how transactions are signed, verified, etc. is a major subject in itself.

Source: Yakelo on Reddit

Leave a Comment

Bitcoin Resources

The Bitcoin Standard

by Saifedean Ammous

Bitcoin Whitepaper

by Satoshi Nakamoto

Not Your Keys, Not Your Coins

by Andreas M. Antonopoulos

Pay With Lightning pill shaped image with orange Bitcoin Lightning logo.
Pay With Bitcoin pill shaped image with orange Bitcoin logo.