Bitcoin and other cryptocurrencies only work if there is a distributed network of people willing to verify transactions.
Maintenance is upheld by those willing to lend their computing power to the network, known collectively as “miners.” Here we’ll discuss the process of mining, the incentives for doing so, and the basics of how the system maintains network security. We’ll take a deeper dive into the mathematics of cryptographic security measures in the Security section.
Let’s walk through a blockchain transaction. I agree to send you 1 bitcoin in exchange for one Double Chocolatey Sprinkle ConeTM. You give me your public address, and I “announce” the transaction to the blockchain.
My announcement includes how much money I’ll be sending, your public address, and my digital signature
(which proves that it’s really me sending you a bitcoin). The first two parts are self-explanatory, but the digital signature requires some digging to fully understand. After all, how can you sign something digitally in the first place? Couldn’t you forge a signature by simply copy and pasting?
Pause. Before we dig deeper, we need to define the cryptographic hash function. These functions are complicated math-y instructions designed to produce outputs that are seemingly unrelated to their inputs, making it impossible to determine the input from the output.
For example, if you enter the number “1” into a hash function, it would return a seemingly random output of 1's and 0's. The same would happen if you entered “3”–and importantly, the hash output from “1” bears no correspondence to the output from “3.” The outputs mirror randomness.
Any by the way, Bitcoin uses a hashing algorithm called SHA-256, meaning that the output is made up of 256 1’s or 0’s. This means that the odds of luckily guessing the input from the output are unfathomably low. If you still aren’t convinced, visit our section on Security & Cryptography.
So, how do hashing functions relate to digital signatures? The answer is, we use hashing functions to create complicated digital signatures that cannot be faked. Signatures are created by feeding your private key and transaction information into the hashing function, so an entirely new digital signature is created for each transaction.
I need to send you a bitcoin for the Double Chocolatey Sprinkle ConeTM. So, I input to a hashing function the amount of crypto I want to send you, your address, and my private key. Out pops my signature for the transaction (in the form of a bunch of 1’s and 0’s). I include this with the transaction itself when I broadcast it to the network.