Use the simplest way to show you how Bitcoin mining works
Bitcoin mining refers to the process of digital verification of Bitcoin transactions through Bitcoin network. Once the transaction is resolved and verified, the block will be updated on the decentralized ledger of Bitcoin. For this reason, miners earned Bitcoin. This complete process is called bitcoin mining. The purpose of Bitcoin mining is mainly two things: to produce new Bitcoin by solving complex mathematical problems and to maintain the security and credibility of Bitcoin network by verifying transactions.Bitcoin network is based on blockchain technology, which uses encrypted hashes and time stamps of each block that must be added in chronological order to ensure the security of the entire ledger. Each block has information about verified transactions. Once verified, this information will be added to the blockchain. Since then, due to the unique function of blockchain technology, tampering with transactions has become almost impossible. The following is how Bitcoin mining works.
Before miners start mining with Bitcoin, they need specific tools and come up with effective solutions to complex problems. Nakamoto, the creator of Bitcoin, designed this network to mine a block every 10 minutes. Therefore, miners need to follow the 10-minute rhythm. When more miners with more computing power join in mining, the difficulty will even increase.
Mining Bitcoin requires advanced tools and a lot of computing resources. So Bitcoin miners will prepare these things:
1. Mining hardware: Over the years, the hardware of mining Bitcoin has changed. Before using graphics processing units (GPUs) and advanced graphics cards, field programmable gate arrays (FPGAs) or special integrated circuits (ASICs) for effective mining, bitcoin miners first use CPU, but in terms of consumption, the latter is the most efficient.
2. Mine pool: miners can choose whether they want to mine alone or join in mining
3. Software and electronic wallet: mining software such as BeMine, Kryptex Miner and ECOS can implement protocols defined for Bitcoin networks. Miners also need an electronic wallet to collect and store their Bitcoin rewards.
When a person sends Bitcoin to someone, it is a transaction. These transactions are added to a block. The node or computer must verify the block to connect to the Bitcoin blockchain that everyone in the network can see. In essence, when someone initiates a transaction in the Bitcoin network, it involves three elements: transaction input, output and amount.
For each transaction as input, the mining software creates a unique and complex encrypted hash. Next, the software will generate the transaction groups required by the block. The grouping is represented as a Merkle tree or a hash tree, where each leaf node has a hash of a block, and the non-leaf node has a hash of its child nodes. In addition, the Merkle tree has a summary of each transaction in the block, which is essentially a data structure. In this case, use encryption SHA-256 to pair the transaction hash.
The hash that can identify the entire Merkle tree is called the root hash or Merkle root, and is stored in the block header. The block header contains block data and attributes, such as bitcoin software version, hash of the previous block, timestamp, root hash, target and encrypted random number (any number used only once during encrypted communication).
Bitcoin miners use this information to solve the hash problem to verify transactions. To this end, they find the hash value of the specified target after analyzing the difficulty. One target is the 67-digit number stored in the block, which determines the mining difficulty of Bitcoin based on the total number of miners participating in the problem solving. The difficulty is also automatically adjusted according to the time taken by miners to solve the problems in the previous 2016 blocks.
In addition, bitcoin miners solve the problem by continuously adding a random number to the target block to calculate the hash of the block until they obtain a value smaller than the target. Once they solve this problem, a new block will be generated and verified by the network node.
For the block to be verified, most nodes must verify the block, and it should contain proof of work (PoW). The block's chronological link and PoW make the blockchain unmodified. Next, the block is added to the Bitcoin network. Because there will be a large number of miners involved, the first miner to solve the hash problem will be rewarded with Bitcoin.
Bitcoin mining began in 2009, and 50 Bitcoins were produced from the creation block of Bitcoin. Since then, more Bitcoins have been mined and issued for circulation. However, there is an upper limit; Based on its source code, only 21 million bitcoins can be mined.