Before we start deciphering the complexity of Bitcoin mining, I feel it is imperative to have a quick understanding of the below mentioned terminologies:
hashing : It is the process of converting an input of any length into a fixed size string or a number using an algorithm
Proof of Work : It is the original consensus algorithm in Blockchain network. The algorithm is used to confirm the transaction and create a new block to the chain. In this algorithm, minors compete against each other to confirm the transaction on the network
nonce : In cryptography, a nonce is an arbitrary number that can be used just once in a cryptographic communication. It is often a random or pseudo-random number issued in an authentication protocol to ensure that old communications cannot be reused in replay attacks.
SHA 256 : SHA-256 is a patented cryptographic hash function that outputs a value that is 256 bits long.
Bitcoin Core : It is a software used for running the computers/nodes which are managing the Bitcoin blockchain. It has the ability to perform the following tasks which as mentioned below :
- Connect with other participants in the Bitcoin network
- Download the blockchain from other participants
- Store the blockchain
- Listen for new transactions
- Validate & Store those transactions
- Relay valid transactions to other nodes
- Listen & validate new blocks
- Store those blocks as part of its blockchain
- Relay valid blocks
- Mine new blocks
- Manage addresses
- Create & send transactions
Blocks : Blocks are nothing but bundle or batches of transactions which helps in addressing the transaction ordering problem. The block creation slows down the “data entry” process of the bookkeeping system, thus minors/bookkeepers around the world have more time to agree to the ordering of blocks of transactions. Because there is more time to agree on the order of blocks, there are fewer differences in opinion about block ordering, and so a greater chance of network wide consensus.
In Bitcoin, blocks are created evert 10 minutes on average. Different cryptocurrencies have different block creation target times.
Alright, now let’s deep dive and try to understand how Bitcoin actually works. Bitcoin mining is nothing but a game of chance, where the entire network participates for creating the blocks and earning their rewards for the block creation. It ensures that all the block creators get equal chance/opportunity to create the blocks within the below mentioned parameters :
- The game must give all block creators equal chance of winning(block creation)
- The game must not have shortcuts
- The game must have publicly displayable proof so that the winner can prove they have won
- The game must not be cheatable
This game of chance is called “Proof-of-work”. Each block creator takes a bunch of transactions that they know about, but which have not been included in any previous blocks, and builds a block out of them, in a specific format. The creator then calculates a cryptographic hash from the block’s data. Remember that hash is just a number.
The rule of Bitcoin’s proof-of-work game of chance says, if the hash of the block is smaller than a target number, then this block is considered a valid block which all bookkeepers should accept.
What if the hash of the block is bigger than this Target number?
It’s simple, the block creator needs to alter the data going in to the hash function and try hashing the block again. They could do this by removing, adding or changing the order of transaction in the block, but these are not elegant and eventually you might run out of permutations. Plus, you don’t really want to mess around with the transactions in block.
The solution to this is that every Bitcoin block has special part that block-creators can populate with an arbitrary number. Its only purpose is to allow block creators to fill it with a number, and change the number if the hash block doesn’t meet the “hash is smaller than a target number” rule. So if the 1st attempt doesn’t result in a winning hash, then they can just change the number in this part of the block. This number is called the “nonce” and is completely separate from the financial transactions in the block. Its only job is to change the input data for the hash function.
So each block-creator puts together a block and fills the nonce field with the number and hashes the block. If the result meets the “hash is less than a target number” rule for valid blocks, then they have crated a valid block, and can send it to the bookkeepers, and get to work on the next block. If the result doesn’t fit the rule, then they change the nonce and hash again. They do this repeatedly until they find a valid block. This is a process known as mining.
The authority to create a valid block is not given by a third party but is self-assigned by repeating some tedious mathematical algorithms, which all computers can do. Note that mining is a tedious, repetitive job. Take some transactions with the nonce, hash it, see if the hash is smaller than a certain number, and if not repeat with a different nonce. “It is not solving complex mathematical problems” as is widely described in the media.
That’s all Folks!
Credits : The basics of Bitcoins & Blockchains by Antony Lewis
Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing
- Godex.io Review | Invity Review | BitForex Review
- Binance Fees | Botcrypto Review | Crypto.com Alternatives
- What are the Trading Signals? | Bitstamp vs Coinbase | Buy Solana
- ProfitFarmers Review | How to use Cornix Trading Bot
- MXC Exchange Review | Pionex vs Binance | Pionex Arbitrage Bot
- My Experience with Crypto Copy Trading | Coinbase Review
- CoinFLEX Review | AEX Exchange Review | UPbit Review
- AscendEx Margin Trading | Bitfinex Staking | bitFlyer Review
- Sparrow Exchange Review | Nash Exchange Review
- Uphold Card Review | Trust Wallet vs MetaMask
- Exness Review | MoonXBT Vs Bitget Vs Bingbon
- How to Start Earning Passive Income With Crypto Lending
- Cryptocurrency Savings Accounts | Crypto Trading Bots
- BigONE Exchange Review | CEX.IO Review | Swapzone Review
- Best Bitcoin Margin Trading| Bityard Margin Trading
- Crypto Margin Trading Exchanges | Earn Bitcoin | Mudrex Invest
- WazirX vs CoinDCX vs Bitbns | BlockFi vs CoinLoan vs Nexo
- BlockFi Credit Card | How to buy Bitcoin on Binance
- Huobi Trading Bot | How to buy ADA | Geco.One Review
- Crypto Copy Trading Platforms | Top 5 BlockFi Alternatives
- CoinLoan Review | Crypto.com Review | Huobi Margin Trading
- Bybit vs Binance | StealthEX Review | Probit Review
Complex Puzzle in Bitcoin mining ain’t Complex, NO More! was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.