Paid to put a block on a chain — Block chain
In my “I want a Bitcoin” post, I talked about how miners provide proof of work to authenticate your transaction and add it to a “Digital ledger” being the Blockchain in the Bitcoin world. And whoever is the first to provide this gets rewarded by getting paid in Bitcoins. But what exactly is the Block chain, how does it record your transaction and is it secure?
A Block chain is just a really a ledger but online, so it’s a “digital ledger”. Whenever a transaction happens it is recorded on this “digital ledger” permanently and that transaction cannot be edited or removed.
So if I send 1.2 Bitcoins to Bob, this transaction will be added to the “digital ledger”. This stops me from sending more Bitcoins then I actually have. Lets take the following scenario — Bob, Amy and Yusuf are all selling a different pairs of trainers and each one cost 1 Bitcoin. Now I buy a pair from bob for 1 Bitcoin, but what is stopping me from using the same transaction to send the Bitcoin to Amy and Yusuf to get buy more trainers with Bitcoins I don’t have, the Block chain is whats stopping me from using the same transaction.
When I send 1 Bitcoin to Bob, that transaction is authenticated by the Bitcoin miners using Cryptography (more on this below) and whoever authenticates it first by providing proof of work will have that transaction added into a block and that block is then added to a chain of blocks which sits on the network. Now if try sending the same transaction to Yusuf, the miners won’t be able to authenticate it because it already exists on the network and that will stop the transaction from going through. So the miners have to finish their job first before the transaction is complete. So speed and accuracy is key, no one wants to wait 20 minutes to see if they have been paid or not! This creates major competition for the miners if they want to be the first, cause if you’re not first then you’re not getting paid.
This creates the whole scenario of why it may cost so much to become a miner.(See “I want a bitcoin” post for more detail)
Now the network is made up of Bitnodes that have a record of the Block chain, so when a miner provides the next block it is distributed across the network and recorded on the Bitnode. This is where the Blockchain data is recorded. Now anyone can become a Bitnode, my computer, your computer etc, by simply installing the correct Bitnode software on your device and then you’ll become part of the network. You will now have the Blocks added to your node. This adds to the security to stop people from tampering with the Blockchain. Currently their are about 7000 Bitnodes and it’s not easy to tamper with each and every single one. This is what leads to having a decentralized autonomous organization, a DAO (Another post on this in the future).
Please note I’ll be doing a more in-depth post about cryptography in the future. So if you see words you’re not familiar with don’t worry too much.
Now this is the juicy where we talk about how miners authenticate the transaction using cryptography.
In my “I want a bitcoin” post, I spoke about how you have a public address when you set up a Bitcoin wallet, but you also get a private key. What happens is, when you set up a wallet you’ll be given a key pair. A private key and public key. You never give the private key to anyone, it’s only for you! Be cautions if a cryptocurreny wallet provider states that they will have access to you’re private key.
Lets go back to the above scenario, for me to pay Bob 1 Bitcoin for the trainers I’ll have to have his public key address — you may have seen this already, it goes along the lines of “Xomci3dm237c734d3847” (yes that was me typing random stuff :) ), but you get the idea, it’s made up of alpha-numeric sequences and they are made extremely complex calculations.
So, when Bob gives me his public address, I’ll have somewhere to send it to. I’ll sign the transaction of 1 Bitcoin with his public key, which means that he can only open it with his private key. His wallet address is where I sent it to.
Once signed the transaction now will be authenticated by the miners to ensure I’m not scamming Bob, re-using a transaction ID and the process the miners go through is hashing the transaction, Merkle tree process and these processes contain some seriously complex calculations which I will be touching on another time. But In all honesty, this is where the fun is at!
Once the miner has completed his work, he will have a proof of work by using the hascash function, this too is another complex process. But a good way to put it is, when you provide proof of work, add your public address to it so you can get paid for doing all this hard work.
Now all this happens in the background when you’re using Bitcoins and computers today are extremely fast to compute these calculations but as time goes on they do get more complex and the computers requires more power!
This is what leads to people building mining farms for themselves or as a business for people to buy their power, also known as hash power.
Here is a nice diagram to help visualize how this whole process happens:
I pray this has helped you to understand a little more of what happens under the hood when it comes to mining and blockcahins. This is once again just a touch on the surface, it’s not something you need to go into full depth if you just want to use bitcoins but I think it’ important to understand for security reasons.
I’ll be doing a more in-depth cryptography post next time to go into detail about the calculations behind the transactions and miners. (This should be fun).
As always, good and bad words are recommended and feel free to ask questions if you want any further information..