013: Mining Pt 2
Liam tackles the technical aspects of mining. What is actually in a block?
Please leave a comment and let us know what you think about this episode. You can find Candid Crypto on all your favorite podcast platforms, so please like and subscribe to stay up to date on everything crypto!
In addition, every Candid Crypto episode is transcribed so you can easily understand everything that was discussed.
Episode 13 Transcription – Mining Part 2
Liam 00:01
Welcome to Candid Crypto, a place where anyone can learn about Blockchain Tech.
Michael 00:08
We are two friends who love cryptocurrency and have acted as retail investors and researchers for years. I’m Michael.
Liam 00:16
And I’m Liam.
Our goal is to create a community where listeners can build their knowledge and meet like-minded people in the digital asset space.
What’s up everybody? It’s Liam. So you might have noticed, hey, Candid Crypto, you didn’t have an episode last week? Yep, we’re switching to doing an episode every two weeks. That gives us a little more time to prepare content, and also put out extra goodies. So stay tuned. We’re doing episodes every other week now.
Today’s episode, Episode 13 is about Bitcoin Mining. How does it really work? In our last episode, we glossed over how mining works at a high level. But that didn’t really explain the underlying mechanics. And those underlying mechanics can be daunting to understand. And there might be some terminology, in this episode you’re not familiar with.
Relax, take a deep breath and Google it.
So Bitcoin is often championed as this Blockchain system whose database is secure, and immutable. What that really means is that no one can tamper with it if you send money to somebody that is forever. So how exactly is that achieved? There is a technology known as cryptographic Hashing that accomplishes this goal. Before the dawn of Bitcoin Hashes are typically employed to keep passwords secure. With Bitcoin, they’re used to keep the Blocks secure.
What’s the common denominator here? Why does it work for both of these things?
In Bitcoins case, the technology used to create Hashes is known as SHA-256. Feel free to look up SHA-256 online, in order to follow the example I’m about to illustrate.
So let’s say we have a value, A, B, C, D, a single string, that’s just ABCD. When you feed that into this SHA-256 function, it will produce a unique output that can only be generated if the input is ABCD. If you input 1, 2, 3, 4, you’ll get a different output. So the complexity of creating that unique output relative to the input is super simple if you know the input, you can think of the input as say your password, it’s really simple to take your password, run it through SHA-256, and yield a unique output. But in order to get the original input string, with just the output, just the SHA-256 representation of it, you would have to guess every single possible unique input until you found the one that yielded that Hash. This is why we refer to SHA-256 as a one-way function, it only goes one way.
So we know that with SHA-256. a given string produces a unique output that is only reproducible if you have that original string.
So how does that all relates to creating a decentralized currency? Prior to Bitcoin, only a bank or financial authority could tell you whether or not you had money in your accounts. The reason we operated like this for so long, is because there was no way to come to a consensus about money without a central authority. But the Proof of Work model that Satoshi Nakamoto proposed in 2009, in his Bitcoin white paper, changed the game forever. Why?
Because in his paper, he wrote that using these hashes in this grand overarching technology of proof of work, would eliminate the need for a central authority to validate transactions because we’re going to use SHA-256 and a clever way to validate transactions through people who want to expend computational energy and incentivize them to do so. If you secure the network, you’re going to get paid. This competition enables decentralization to emerge and thrive organic within the ecosystem. So, Blockchain, Blockchain, Blockchain, what the hell is a Block like what’s actually in it? What information does it contain? That allows the Blockchain to work?
Well, first of all, it contains transactions. So every time a transaction is sent on the Bitcoin network that is added to the current Block. When mining computers are running, they are taking transactions and bundling them into one value known as a Merkle tree. Merkle trees work like this; transactions lie at the bottom of the tree as leaves and are Hashed using the SHA-256 function. If you take two leaf transactions, Hash them, you get a parents, the parent is continuously Hashed upward until a single root is created.
So let’s say we have 1000 transactions in a Block, we can represent every single transaction using just 1 Merkle tree, aka 1 SHA-256 Hash input for a Hash function produces an entirely unique output. So the roots of the Merkle tree acts as an unchangeable summary of all the transactions that given Block. So if a malicious actor were to try and change the contents of a transaction in a Block, its Hash will be changed. These Merkle trees or summaries of all the transactions in a Block allow the Blockchain to function quickly. So that’s not the only part of a Block. Merkle tree is one component. There’s also the Block header. The header contains more information that includes the timestamp of the Block the Merkel route, the Hash of the Block prior to the current Block, the nonce and the targets the Hash of the previous Block before it allows the network to place the Blocks in chronological order. That’s why we call it a Blockchain. Each Block is changed the previous Block. The nonce and the target are what make mining work. They’re the basis for solving the SHA-256 puzzles that miners expend their computational energy from.
So what miners are really doing is guessing and checking millions, billions trillions, quadrillions of times per second, they get some check as many inputs as they possibly can. In order to find a solution for the network. This solution is completely arbitrary. This solution or golden ticket is what ultimately stamps the network’s approval onto a Block. And then miners begin their activity on the next Block. The miner who found the solution is rewarded in Bitcoin. That reward is currently at 6.25.
Miners don’t work in isolation. If you were to Solo Mine, you would almost never find the solution that would grant you that 6.25 Bitcoin reward. Rather, miners collaborate their efforts into what are called mining pools. mining pools comprise a very large share of the Bitcoin network in such that they are consistently rewarded across all of their efforts periodically. That means if you run a big mining operation, you can get consistent payouts by participating in a mining pool, rather than mining alone, where you might go days, weeks, or even years without finding a solution.
In a nutshell, this is how Bitcoin mining came to be. A clever tie together of different technologies that no one had ever envisioned, created this proof of work Blockchain.
Thank you for tuning in to this week’s episode of Candid Crypto. You might be wondering, Hey, where’s Michael? We decided to do this episode as a solo episode, starring me. Largely due to the disjointed dialogue, we had over these technical topics. They’re hard to understand and I’ve had to relearn this stuff multiple times throughout my life. I attached a few different links that I used to create this episode and I highly recommend checking them out if this has piqued your interest. Our next episode is scheduled two weeks out. Michael will be back. So stay tuned. Peace out everybody.
Sources: https://www.freecodecamp.org/news/how-bitcoin-mining-really-works-38563ec38c87/ https://www.investopedia.com/terms/b/bitcoin-mining.asp https://en.bitcoin.it/wiki/Block