Down in the Weeds. Mining and the Bitcoin Network: (Explain Like I’m 5)
…continued from: What is a Wallet and How Does A Crypto Payment Work (Explain Like I’m 5)
So last time, you tried to explain the Bitcoin network and failed abysmally. Care to try again?
OK RookieBoy, it’s a “gossip network.”
It’s called a gossip network because everyone (every node in the network) gets to hear everything (every message) that any other node relays. But in reality there are only two things a node ever hears:
- Hey, here’s a new Bitcoin transaction.
- Hey, here’s a newly completed Bitcoin block.
How does the network know that the message is new and not just a duplicate of a previous message?
It’s clever how this works. Nodes do not send the whole message. Instead, they calculate a hash from the message and they send that.
Remind me again what a hash is. I can’t remember.
That’s because I never told you. I just said its a mathematical way of creating a short unique reference from a record or block. This of it as a kind of abbreviation.
So they send unique abbreviations?
The hash will be unique whether it represents a new transaction or a new block. If the mining node receiving that message and it does not have a copy of the transaction or the block, it asks for one and gets it. In this way, every mining node knows the exact status of the blockchain at any time.
Mining nodes are insanely focused. They do nothing except receive transaction data, try to work out the next block and receive completed blocks. That’s it. That everything.
How do they know the addresses of the other mining nodes?
They keep a copy of all the node addresses, and when they have something to say, they tell everyone they know.
What about the wallets? Don’t wallets need to know the addresses of the mining nodes?
Well, yes. But a wallet only needs to know one address, because when a mining node gets a transaction, it tells the other nodes. Wallets generally keep a list of nodes from their previous contacts with the network. However, it could happen that none of the nodes on their list exist any more.
So what then?
There is a fallback — DNS seeds. These are DNS hosts (such as dnsseed.bluematt.me) that provide a list of IP addresses known to be running Bitcoin mining nodes. Once a wallet makes a connection, it begins to receive lists of IP addresses of mining nodes and known clients.
Tell me more about attempts to hack the Bitcoin network. What’s the 51% attack I keep hearing about?
It’s complicated. Do you really want to know?
I’m in the mood.
OK, let’s begin with the possibility 51% of the mining power of a blockchain network could come under the control of one organization. If that happened that organization would control the mining consensus which determines the validity of the next block.
What do you mean “mining power”?
Technically, it is called “the hashrate.” As you surely know, some computers are more powerful than others. The ability of a computer to solve the Bitcoin “proof of work” problem is called its hashrate. It’s a measurement of compute power. More powerful computers (nodes) have higher hashrates. So if an organization controls the majority of the hashrate it may be able to control the mining consensus and subvert the blockchain.
Could I become a miner and use my PC to mine the blockchain?
I suppose you could, but if you are thinking of mining Bitcoin it probably wouldn’t be worth it.
Well, you can run the “proof of work” algorithm on any computer. You could even try to work the next block out using a calculator. It’s possible. But mining aims to make a profit. Mining costs money. The cost is mainly the cost of the electricity you use to run the computer that does the mining. When the mining profit doesn’t pay the electricity bill, it’s time to turn the computer off.
So would I need to buy a powerful computer to mine Bitcoin?
The Bitcoin mining market has moved way beyond normal PCs and servers. They use way too much electricity. Nowadays miners use purpose-designed computers, called ASICs, to mine Bitcoin.
What does ASIC stand for?
Application-Specific Integrated Circuit.
And that means?
An ASIC is a computer that runs only one program — a program that is burned into the silicon. Bitcoin ASICs only run proof of work and the necessary networking functions. ASICs use far less electricity when mining Bitcoin. New models appear every now and then, which run better than previous ones.
So, should I buy one and put it in the attic, next to the room where we lock away my crazy aunt?
Unless you can think of a way of getting your crazy aunt to generate cheap electricity, I’d give it a miss. Miners also put their ASICs in places where the electricity is really cheap. Profit is everything.
Where is it cheapest to mine Bitcoin?
A good deal of Bitcoin mining is done in China (perhaps about 60%) because in some provincial areas both land and electricity is dirt cheap. But China, for reasons I do not understand, has decided it doesn’t like crypto. Last year, it started aggressively regulating crypto exchanges and encouraging Bitcoin mining groups to emigrate. So the popular Bitcoin mining countries now are Canada, Georgia and Switzerland — countries with very cheap hydroelectricity — and also Iceland, with its geothermal electricity.
OK I’ve heard enough. I need to buy a giant hamster wheel for my crazy aunt. Speak to you again soon.
The next posting in this serial conversation is: Tales from the Crypto: Double Spending and the 51% (Explain Like I’m 5)