This article explains Bitcoin mining in details, right bitcoin mining pc setup to the hex data and network traffic. If you’ve ever wondered what really happens in Bitcoin mining, you’ve come to the right place.
I manually created a Bitcoin transaction and sent it into the system. In this article, I show what happens next: how a transaction gets mined into a block. Bitcoin mining is often thought of as the way to create new bitcoins. But that’s really just a secondary purpose.
The primary importance of mining is to ensure that all participants have a consistent view of the Bitcoin data. Because Bitcoin is a distributed peer-to-peer system, there is no central database that keeps track of who owns bitcoins. Instead, the log of all transactions is distributed across the network. The main problem with a distributed transaction log is how to avoid inconsistencies that could allow someone to spend the same bitcoins twice. 10 minutes, which makes them official. Conflicting or invalid transactions aren’t allowed into a block, so the double spend problem is avoided.
Although mining transactions into blocks avoid double-spending, it raises new problems: What stops people from randomly mining blocks? How do you decide who gets to mine a block? How does the network agree on which blocks are valid? It takes an insanely huge amount of computational effort to mine a block, but it is easy for peers on the network to verify that a block has been successfully mined. Each mined block references the previous block, forming an unbroken chain back to the first Bitcoin block.
This blockchain ensures that everyone agrees on the transaction record. It also ensures that nobody can tamper with blocks in the chain since re-mining all the following blocks would be computationally infeasible. As long as nobody has more than half the computational resources, mining remains competitive and nobody can control the blockchain. As a side-effect, mining adds new bitcoins to the system. 15,000 every 10 minutes, there is a lot of money in mining. Mining requires a task that is very difficult to perform, but easy to verify.
With a cryptographic hash, there’s no way to get a hash value you want without trying a whole lot of inputs. But once you find an input that gives the value you want, it’s easy for anyone to verify the hash. Thus, cryptographic hashing becomes a good way to implement the Bitcoin “proof-of-work”. In more detail, to mine a block, you first collect the new transactions into a block. Then you hash the block to form a 256-bit block hash value. Bitcoin network and the hash becomes the identifier for the block. Most of the time the hash isn’t successful, so you modify the block slightly and try again, over and over billions of times.
About every 10 minutes someone will successfully mine a block, and the process starts over. The diagram below shows the structure of a specific block, and how it is hashed. The yellow part is the block header, and it is followed by the transactions that go into the block. The remaining transactions are standard Bitcoin transactions moving bitcoins around. The block header contains a handful of fields that describe the block. The first field in the block is the protocol version. It is followed by the hash of the previous block in the blockchain, which ensures all the blocks form an unbroken sequence in the blockchain.