The integrity of the Bitcoin Blockchain goes a long way in determining the security of Bitcoin. Despite the fact that each bitcoin transaction can be verified by simply perusing the chain, preventing double-spending and other illicit activities, on the other hand, requires that there is only a single append-only ledger. Blockchain integrity is ensured via the mining process. This serves a dual function:
- Maintaining the Blockchain
- Requiring the participant to provide and execute a proof-of-work algorithm – helps in generating new Bitcoin.
A miner in a Bitcoin system performs the role of grouping new legitimate transactions that have been received through the peer-to-peer network into several blocks that comprise a set of transactions and a header that consists of a hash of the previous block and a nonce (any value that can only be used once).
The miner will then compute an SHA-256 hash value of the block. Once the binary representation of the hash value has an acceptable number of leading zeroes, then the miner ensures the dissemination of the newly mined blocks to other users through the peer-to-peer network, and each peer confirms the legitimacy of the new block by computing the SHA-256 hash value of the block and confirming that it, at least, contains the appropriate number of leading zeroes. This effectively verifies the transaction and shields them from tampering.
Furthermore, this new block consists of a special transaction – called the coinbase, which serves the role of an additional nonce – a comment field, and a unique transaction that pays all the transaction fees and the block reward – initially this was 50 BTC and promises to keep halving every four years – to the miner’s wallet.
However, what happens many times is that the choice of nonce often results in an SHA-256 hash value without a sufficient number of leading zeroes. Then, the miner follows this up by repeating the process with a different nonce value until a particular miner finds a block with the appropriate hash value and shares it through the peer-to-peer network. Immediately after the discovery of a new block, all the miners exclude the newly verified transaction from their pool of work and continue with a different set of transactions.
What makes mining competitive is its unpredictable nature and fixed block-creation rate. The odds of a miner discovering a valid block is a function of both the number of SHA-256 calculations it can compute in a second – often measured in millions, billions, or trillions of hashes per second – and the general Bitcoin network hash rate. On average, a desktop PC can perform between 2 to 10 million hashes per second (MH/s). On the other hand, a dedicated ASIC mining system can attain 500 billion hashes per second (BH/s) or more.
As of the time of this writing, a desktop computer mining at the rate of 10MH/s will mine for over 420 years before discovering a winning block. Indeed, mining becomes a lottery even with a supreme GPU that is capable of 500 to 1,000 MH/s. However, there is a specific process through which miners overcome this difficulty.
They can join a mining pool, which effectively combines the mining power of a great number of individual miners but pays a relatively small amount for every unit of work performed to mine a block. For a mining pool, the amount of reward each miner receives is dependent on his hashing power.
The ability of Botmasters to turn computation into money has given them a new way to monetize the uncharted computational capacity of their compromised hosts and the increasing value of Bitcoin provides a strong incentive to do so.
The first Bitcoin-mining malware was observed in the wild in June 2011. However, since then, multiple families of malware have taken up Bitcoin mining.
The first family that was identified with mining capability was NGRBot, a malware kit that has been available for many years. NGRBot is a generic malware platform with many capabilities, including stealing personal details, automatic spreading on USB and network, and lots more.
There are three distinct botnet mining pool structures: Direct pool mining, proxied-pool mining, and dark pool mining. Bitcoin mining performs the role of maintaining the ledger of transactions upon which Bitcoin is based and miners have become more sophisticated over the past few years, with a complex machine.
Interesting related article: “What is a Cryptocurrency?“