Blockchain technology is based on the peer-to-peer distributed network with no central authority figure, where each peer or node gives a contribution to maintaining the net safe. It is an architectural change because there is no more a central system that preserves all data but we have distributed peers which have the same copy of the data. This architecture limits the risks of errors but also attacks on the system. The main purpose of the network is to achieve a “distributed consensus”. In a central system, all decisions are taken by the leader or a few superior actors. In the blockchain, anyone does not prevail on another because all nodes have the same role and network needs to obtain a global consensus. Any participants that receive a valid transaction which has not seen before use the technique known as flooding for propagating the data, it forwards the transaction immediately to all other participants to which it is connected. Consensus implies that an agreement is reached using a decision-making process which brings benefit to the entire group. Reaching a consensus on a distributed system faces a problem knows as “Byzantine Generals’ Problem.” It consists of trying to agree on a course of action or the state of a system by exchanging information over an unreliable and potentially compromised network. There is a lot of different consensus algorithms such a Proof of-Stake or Proof-of-Elapsed-Time but the most widely used is the Proof-of-Work, which is used in Bitcoin Blockchain. What is required to make the network safe is process called mining – cryptocurrency mining.
The blockchain records the transactions in units of blocks. Each block includes a unique ID, and the ID of the preceding block. The first block, dubbed the genesis block, is defined as part of the protocol. A valid block contains a solution to a crypto puzzle involving the hash of the previous block, the hash of the transactions in the current block, and a Bitcoin address which is to be credited with a reward for solving the crypto puzzle. This process is called mining, and, by slight abuse of terminology, we refer to the creation of blocks as block mining. The specific crypto puzzle is a double-hash whose result has to be smaller than a set value. The problem difficulty, set by this value, is dynamically adjusted such that blocks are generated at an average rate of one every ten minutes. Any miner may add a valid block to the chain by simply publishing it over an overlay network to all other miners. If two miners create two blocks with the same preceding block, the chain is forked into two branches, forming a tree. Other miners may subsequently add new valid blocks to either branch. When a miner tries to add a new block after an existing block, we say it mines on the existing block. This existing block may be the head of a branch, in which case we say the miner mines on the head of the branch, or simply on the branch. The formation of branches is undesirable since the miners have to maintain a globally-agreed totally ordered a set of transactions. To resolve forks, the protocol prescribes miners to adopt and mine on the longest chain. All miners add blocks to the longest chain they know of or the first one they heard of if there are branches of equal length. This causes forked branches to be pruned; transactions in pruned blocks are ignored and may be resubmitted by clients. We note that block dissemination over the overlay network takes seconds, whereas the average cryptocurrency mining interval for Bitcoin is 10min. Accidental bifurcation is therefore rare and occurs on average once about every 60 blocks. When a miner creates a block, it is compensated for its efforts with reward in mined cryptocurrency. This compensation includes a per transaction fee paid by the users whose transactions are included, as well as an amount of new Bitcoins that did not exist before. As a result of this opportunity, many organizations are building their hardware to continue cryptocurrency mining and earn revenue through successful mining. Every participant of the network could be a miner and each of them competes to be the first to create a new block.
The Bitcoin protocol as example, allows a transaction to leave a “transaction fee” for the miner. If the value paid out of a transaction (in Bitcoins) is less than the amount put in, the difference is treated as a transaction fee that can be collected by whoever manages to mine a block containing that transaction. A transaction fee is like a tip or gratuity left for the miner. A miner’s incentive is to include in their mined block any transaction that offers a nonzero transaction fee. All else being equal, the miner is better off accepting even a tiny transaction fee, rather than passing up the fee by refusing to mine the transaction. Although the miner might wish the transaction fee were larger, every miner knows that if they refuse to process a transaction, another miner can process it and collect the fee. If miners try to make an agreement to boycott users who leave small transaction fees, the agreement will not hold—individual miners will be able to defect from the agreement, by mining under anonymous identities. Such an agreement can be modeled as a prisoner’s dilemma: the miners would benefit from cooperation but cannot agree not to defect; users may wish to leave a tiny transaction fee to make sure the miners will process a transaction, but the user gets no benefit from offering a larger fee—doing so simply gives up value without any compensating gain. As a result, we can expect an equilibrium in which users leave small, nonzero transaction fees, and miners collect those fees. Indeed, this is what we observe, the expected total mining reward is mulitiple times higher than daily fees. However, that the reference Bitcoin client leaves a small, nonzero transaction fee by default. Users may override this default and opt to send transactions without fees. Many (but not all) users do exactly this, but the default may lead to higher-than-equilibrium fees. Fee mechanism is similar to the classic ultimatum game, and thus one might initially think that a norm for leaving nonzero transaction fees could evolve. It is unlikely thant Bitcoin player proffering a very small fee transaction is not giving an ultimatum to a specific miner, but rather offering any successful miner in the future an opportunity to collect the fee by including the transaction in the log. As long as any miner is willing to accept such transactions, fees will be bid down. We, therefore, do not expect transaction fees to play a significant long-term role in the economics of the Bitcoin system, under the current rules. Probably rules change would be necessary before transactions fees can play any major role in the Bitcoin economy. The difficulty level is dynamically tuned by the network protocol and its value is crucial to maintaining steadily that one block is produced. Proof-of-Work in blockchain has a key role because it proves that you consumed power to create a new block introducing an economic barrier to protect the network.
There is one more term that needs to be explained when defining cryptocurrency mining that is mining pools. Mining Pool is a set of miners which contribute together to the find a new block, and then split the block reward according to the contributed processing power. Generally, in the competition of finding new block the miner works alone but when he is not well equipped, in terms of hardware for PoW, this search seems to a lottery. Rising of difficulty network over time makes increasingly difficult creating new block and obtaining the reward. It means that a miner who invests a part of own budget on mining could not return the investment at the end. Mining Pool is the right compromise to reduce the enormous risk and amortizing the cost of equipment. Participating in a mining pool, it is able to earn a regular payouts over that period. Peers who take part to a cryptocurrency mining pool are coordinated by pool server which uses a specialized pool-mining protocols. The pool server synchronizes the effort of miners’ equipment to search a solution for the candidate block. Once find new block, it will share the reward among peers who belong to a mining pool based on their cryptocurrency mining contribution.