Bitcoin mining is not a representation of people digging through dirt in search of Bitcoin instead of gold. The term “mining” is only a visualization of how Bitcoins are introduced to circulation. The way resources are expended to mine gold into circulation is analogous to how electricity and computing power are expended to mine Bitcoin into circulation.
Bitcoin miners’ are machines programmed to work together as a global peer-to-peer network and verify the legitimacy of all Bitcoin transactions. Pooled mining is a strategy used by almost every Bitcoin miner. It involves combining machines from around the globe to form a stronger group in hopes of solving more blocks and earning more Bitcoin. The strength of a pool is measured in hash rate. The hash rate is simply a measure of the processing power that a machine, or pool, contributes to the network.
Currently miners are rewarded with 25 newly minted Bitcoins roughly every 10 minutes (or after a block is solved). A block refers to a list of transactions within a targeted 10 minute period. The network is programmed to attempt to solve a block every 10 minutes; however, this time can vary all the way from 2 to 20 minutes. After a block is solved, the transactions within are recorded in the Bitcoin public ledger where they can be referenced and tracked in the future.
People commonly state that Bitcoin miners are competing against each other to solve blocks. The statement is accurate in that not all miners will be rewarded with Bitcoin when every block is solved. Only the pool, or machine, that solved the block is rewarded with Bitcoin. However, the statement is wrong because the network will always balance out the rewards according to the amount of processing power contributed to the network.
For example, say the Bitcoin network was running at 100 ph/s (ph/s is a measure of computing power). Pool’s A, B and C make up the total network. Pool A is contributing 50 ph/s, Pool B is contributing 40 ph/s, and Pool C is contributing 10 ph/s. If the Bitcoin miners were constantly competing against each other, Pool A would win every time since it has the most power. However, the network strives to reward contributors according to their hash rate. Therefore, overtime Pool A will receive 50% of the Bitcoin mined, Pool B will receive 40%, and Pool C will receive 10%.
Introduction to Bitcoin Transactions
A top level view of a bitcoin transaction shows how digital money changes hands, or to be more precise, how a transaction decrements bitcoins from the sender’s account and increments it in the recipient’s balance, in the following steps. Let us go back to the customer paying for a meal at a restaurant in bitcoins.
1. The restaurant displays the amount owed by the customer and the receiving public address. The public address can be displayed either as a string of numerals and characters or as a QR code.
2. The customer uses a payment device, most commonly a smartphone, to scan the address and presses ‘send’ after entering the amount in bitcoins to be sent to the restaurant’s account.
3. The digital information is sent over the network, waiting for confirmation from bitcoin nodes, or computers running specialized bitcoin software, to declare the issue of bitcoins as legitimate. It is important that the nodes confirm that the bitcoins are not counterfeit or malicious attempts at spending bitcoins have already been spent.
4. The nodes across the network try to solve a math puzzle based on cryptography to confirm the transaction. The first one to do so announces the confirmation, which is rechecked by other nodes. A transaction with at least six confirmations is considered secure.
5. If the cost of the meal is 0.02 BTC, the sender notices that the balance has been reduced by that amount, and the restaurant’s balance has increased by that amount. The transaction fees are marginal, and a very tiny fraction of what it would have cost if a credit card or other money transfer tools were used.
To appreciate how a transaction takes place, understanding the following terms are useful:
1. Digital signatures
2. Public key cryptography
3. Cryptographic hashing
A transaction can be thought of having two points, one for the entry of value and the other for transferring value to the next owner. The addition of value which is the result of the exit value of another transaction is called an input. The value that is transferred from a transaction is known as output.
In the case of the customer paying the restaurant, the output of the transaction initiated by the customer is 0.02 BTC, which in turn is the input for the restaurant’s transaction. For certain types of transactions, the output might be slightly smaller than the input if miner transaction fee is applicable.
When the restaurant needs to send the bitcoins to a new owner, it needs to direct it to a public address issued by the new owner, but has to necessarily use its private key to make the value transfer possible.
The transfer of value during transactions depends on the value of bitcoins already in the sender’s wallet. Say the customer has a balance of 0.05 BTC in her wallet as input from a previous transaction.She owes the restaurant 0.02 BTC. The bitcoin client software that manages the wallet funds does not pick up only 0.02 BTC from the balance and send it across the network. The entire 0.05 BTC is sent. A separate transaction is created and the change is sent back to the customer’s wallet by creating a new transaction.
If the customer receives another input of 1 BTC from elsewhere, the change of 0.03 BTC that comes back from the restaurant transaction does not ‘fuse’ with the 1 BTC. They remain as separate inputs in the wallet and are spent to cover the expense of the next transaction in the best way possible. Expenditure of 0.9 BTC would be taken from 1 BTC and 0.03 BTC would be spent for an appropriately smaller expenditure. For equal value of bitcoins, inputs that have been in the wallet longer than the others are spent first. Higher values of bitcoin inputs take priority over the sum values of smaller value bitcoins. An input of 0.5 BTC is used before five 0.1 BTC inputs in the wallet.
Public key cryptography
Bitcoin transactions are made secure by the use of public key cryptography. The algorithms based on this stream of cryptography require two mathematically linked keys, one called the private key and the other, the public key. A large random number is passed through a program that generates the public-private key pair. Mathematically, it is infeasible to guess the private key based on the shared public key. The public key encrypts a digital message with the private key and the private key is used to decrypt the message.
The public-private key pair is used in the algorithm for creating and verifying a digital signature. A digital signature is a system that lets the recipient of a digital document to be sure of the identity of the sender and be assured that the sender who knows the private key had knowledge of the digital transfer that has taken place. A digital signature also indicates that the digital transfer was in its entirety, or that the integrity of the message was preserved during the transfer.
Creating a digital signature uses a signing algorithm that takes in the message and private key as inputs and puts forth a valid digital signature. This means the signing algorithm has cryptographically tied digital information to an electronic document in a manner that cannot be replicated.
Verifying a digital signature involves feeding the message, the public key and the signature to a signature verifying algorithm. The algorithm verifies the authenticity of the inputs and either accepts or rejects the validity of the digital signature.