Here’s a real quick, yet accurate explanation of how Bitcoin works.
If you run bitcoin node compatible software, like Bitcoin Core, on a computer it connects to other random instances of Bitcoin Core, forming a worldwide network of interconnected nodes. Anyone can do this. The software is free and its code is open source.
Every new Bitcoin Core node is seeded with the first ever piece of data in Bitcoin called the “Genesis block”. It contains the details of the first piece of data upon which all the rest of Bitcoin’s history is built. Each new node then polls the other nodes for the next block. The node then uses Bitcoin’s math based rules to check if that next block meets those rules. The rules check to see that every single Bitcoin transaction in the block is valid and that it contains a valid proof of work (explained later) for creating that block.
It keeps retrieving new blocks until it catches up to the present. At that point it is in synchronization with every other Bitcoin node in the whole world. Each Bitcoin node has verified the accuracy and truth of every single transaction and block and Bitcoin’s history. They don’t just copy data — they verify every single bit of it.
A Bitcoin transaction is a text message. To be valid it has to strictly adhere to specific rules though:
- It can only spend bitcoin that haven’t been spent.
- It must provide a cryptographic signature which can be used to verify that the sender is in possession of the correct secret, randomly generated, astronomically large number called a ‘private key’.
- It is also advisable that the addresses of the recipients of the transaction’s funds are specified. (If they’re not then the entire transaction becomes a fee paid to miners.)
That’s it. It can include other data, like the date or time at which the transaction will be valid (like post-dating a check), but it doesn’t have to.
There’s one other type of transaction, called a coinbase transaction (nothing to do with the company of that name — that company stole its name from this term). That transaction is explained in the Bitcoin Blocks section of this article.
Bitcoin addresses are weird looking strings like:
bc1qtxsjjjgupnccn2czvwaj5x3szc4hw75nc53hm8 or 16t8xf4MG1mHoKU1AbpT5QGKDfj5UYg1W5 or 3CwT3oXQVtwYwBGnsRVd1Juj2gqBxsfNpv
But they’re not arbitrary and you don’t make them up. They are cryptographic fingerprints of either ‘public keys’ or of entire scripts of code. When it comes time to spend coins from those addresses the spender will have to provide the digital signature associated with the private key that corresponds to the public key or script.
A bitcoin block contains a bunch of data:
- It contains a whole bunch of transactions, each of which is verified to be a valid one. The first transaction in it is called the coinbase transaction. The coinbase transaction rewards newly issued coins and fees paid in all the other transactions in that block to the discoverer of the block. People who discover blocks are referred to colloquially as ‘miners.’ All bitcoins in circulation come into circulation by being rewarded to miners. No other bitcoins exist.
- It also contains a verifiable cryptographic fingerprint or digest of all these transactions (called a merkle root).
- It contains the cryptographic fingerprint of the previous block — to prove that it was created only after the previous block was created. This is what chains this block to the previous block to create the famous “blockchain”.
- It contains a current date and time.
- It contains a couple of other small pieces of data (a version number and a target).
- Finally, it contains a special number called a ‘nonce’. Nonce is short for “number used once”. This nonce is used to prove that this block meets the proof-of-work requirements at the time of its creation. Every node can run this block through the fingerprinting algorithm (called SHA256) and check that the resulting number is smaller than the maximum allowed at the time (the target), thus making the block valid according to the rules of Bitcoin.
Miners work to discover nonces that satisfy the proof of work requirements for the newest block to be added to the blockchain. This is basically just guesswork like guessing numbers in a giant lottery. The harder they try — that is, the more guesses they make — the sooner they’ll discover valid nonces to blocks and the faster they’ll produce blocks and be rewarded. However, Bitcoin is designed to keep the pace of blocks coming in at one every ten minutes on average, so roughly every two weeks (or precisely every 2,016 blocks) the difficulty associated with finding a valid block (also known as the target) is recalculated with a precise formula, by every node, to make it harder (or sometimes easier, if necessary). Because every node uses the same formula on the same data, every node ends up agreeing on what the new difficulty target is. Miners then need to work as hard as the new difficulty demands to be able to earn the rewards of discovering new valid blocks.
That’s (just about) all folks:
With just the above mechanisms, Bitcoin runs.
People who have bitcoins, or fractions of them, can send them to anyone else who provides them an address. They prepare a valid transaction and send it to any other node on the network and that node sends it out to others and it quickly ends up on every node, where each one ensures that it is in fact valid.
Miners take these new valid transactions that haven’t been added to a block yet and try to guess the nonce to a new block containing those transactions (and everything else a block must have). Sooner or later, one of them finds a valid nonce and shares the whole block with other nodes who then send it out to others and it quickly ends up on every node, where each one ensures that it is in fact valid. Everybody adds this block to their identical copy of the blockchain as soon as they verify its validity.
New coins get introduced into the system with the coinbase transaction of each block, although the number of new coins per block keeps getting cut in half roughly every four years (or precisely every 210,000 blocks). This formula ensures that there will only ever be 21 million full bitcoins.
Nobody can fake anything because everyone checks everything all the time. Any nodes that attempt to misreport any data are unable to get away with any deception because the math behind every transaction and block is what determines the true state of things,
And that’s how Bitcoin really works.
This blog offers thoughts and opinions on Bitcoin from the Swan Bitcoin team and friends. Swan Bitcoin is the easiest way to buy Bitcoin using your bank account automatically every week or month, starting with as little as $10. Sign up or learn more here.