Bitcoin mining

Mining Concept


14076666895_c357f14666_o
Securing the Blockchain

The mining process works to taper out the controlled distribution of the 21 million bitcoin and to secure the blockchain. “Mining” is a poor analogy by describing how new bitcoin is generated because the primary goal of Bitcoin mining is to secure the blockchain. The only relation between bitcoin and gold mining is that the amount being “mined” decreases over time.

There is a finite amount of gold available (even this is debatable), similarly, Bitcoin will only ever generate 21,000,000 new bitcoin and is mathematically guaranteed by the protocol code. The rate at which these 21 million bitcoin are distributed is predictable due to a dynamic algorithm that is coded at the protocol level. The algorithm adjusts the mining difficulty based on how quickly or slowly miners are being awarded with the block rewards in such a way that the last new bitcoin will be generated in the year 2140.

Other Resources: Mining (Wiki), How Bitcoin Mining Works (CoinDesk), View Mining Statistics (tradeblock)

Goals and rewards

The goals of mining are to taper out the 21 million bitcoin, validate transactions and to secure the blockchain in a trustless and decentralized manner.

The rewards in mining come in the form of block rewards and transaction fees. Block rewards are shared between all the miners that participated in the solving of a block. Transaction fees come from the senders of each transaction submitted into a block.

How it Begins


iccxy1vo7ort5-1024x6401-150x150When Someone Sends Bitcoin

The mining process is initiated with a “send” transaction from a user and is broadcast to all the miners and bitcoin core nodes on the network. All of these broadcasts are considered unconfirmed and get collected in something called the mempool. Miners sort the collected transactions in the mempool into space-limited blocks based mainly on the included transaction fee value (also transaction size and coin age). Senders that include high transaction fees are prioritized over those with lower transaction fees when miners decide which transactions are included into these space-limited blocks.

Updating the Connected Nodes

Once a miner solve a block, they broadcast it to the bitcoin core nodes so that the nodes can record and propagate the change to their connected nodes and so on. Additionally, the nodes remove the mempool transactions that were included in the block that was just solved.

This is the peer-to-peer aspect of Bitcoin. Each Bitcoin Core node has 8 or more other Bitcoin Core nodes connected to them and those nodes will also have 8+ connected nodes and so on. Think of a solved block being broadcast in the peer-to-peer network like how a rumor spreads. It starts with 1-2 people and they each tell their 8+ friends and those 16+ friends each tell their friends and so on. This broadcast occurs instantaneously.

Hashing Hashes


13890045689_9b041d4002_o
A Hash

A hash is the output generated from the process of hashing. The output is 256-bit number. In Bitcoin, the generated hash has to have a value less than or equal to the current target value to solve a block.

Hashing

Hashing is the action of using computational processing resources to generate “X” amount of hashes per second in hopes of being the first to find one that satisfies certain mathematical characteristics. In Bitcoin, miners need to generate a hash with a value that is equal to or less than the current target value to solve a block.

1 hash per second is equivalent to one attempt per second at brute forcing a hash value that is less than or equal to the current target value.

We will take a deeper look at the hashing process in the next section, “BLOCKS” under the “Proof-of-Work” tab.

Speeds

The speed at which hardware hashes are measured using the SI unit prefixes.

1 kH/s = 1,000 (one thousand) hashes per second
1 MH/s = 1,000,000 (one million) hashes per second.
1 GH/s = 1,000,000,000 (one billion) hashes per second.
1 TH/s = 1,000,000,000,000 (one trillion) hashes per second.
1 PH/s = 1,000,000,000,000,000 (one quadrillion) hashes per second.
1 EH/s = 1,000,000,000,000,000,000 (one quintillion) hashes per second.

SHA-256

Bitcoin uses SHA-256 as the underlying cryptographic hash function. This cryptographic hash function is capable of generating/outputting a 256-bit number from inputted data of the miners when they try to solve a block. The outputted 256-bit number is very large and serves as both the ID and the integrity verification of each solved block in a blockchain.

What is needed to hash?

Miners are hashing using specialized hardware that are able to hash SHA-256. The speed at which a miner hashes depends on their hardware – devices that are specifically designed to only hash SHA-256 are the most effective.

You can participate in hashing (a.k.a mining) with pretty much any computer with a CPU – but it will be extremely inefficient. A typical CPU will hash at the rate of x kH/s (1 kH = 1,000 hashes per second) and mining is at a point where you have to be in the x TH/s (1 trillion hashes/sec) zone to be profitable in mining. To mine, you will need expensive devices called ASICs (application-specific integrated circuit) where their sole purpose is to hash SHA-256 functions.

Defining a Block


xzm2xyv-imgurBlocks

An solved block contains data that includes active transactions from the mempool, transaction fees and block header data such as the sha-256 hash of the current block and of the previous block. Below, we’ll take a look at some important data included in a block.





Field: Purpose: Updated When: Size (Bytes):
Version Block version number for client signaling Miner upgrades their client to a different version 4
hashPrevBlock A 256-bit hash from the previous block A new block is solved 32
hashMerkleRoot A 256-bit hash based on all transactions in the block A new transaction is accepted 32
Time Current timestamp Every few seconds 4
Bits Current target in compact format (representing mining difficulty) The difficulty is adjusted every 2016 blocks 4
Nonce 32-bit number (starts at 0) A hash is attempted (increments each failed attempt) 4

Your block ≠ my block

A block is solved and recorded into the blockchain by miners every ~10 minutes. Miners solve a block by generating a proof-of-work hash that satisfies a certain mathematical requirement.

But all blocks are not equal. They differ in different ways but one meaningful difference is the amount of work put into generating the proof-of-work hash. If blocks are solved at the same time by different miners, the one that had the most work put into it will be recorded into the blockchain.
Block Confirmations

A block confirmation can be described as the process of adding a solved block on-top of the previously solved block. Each solved block added on-top of a block is considered one confirmation for all previous blocks.

A bitcoin transaction can have between 0 confirmations (unconfirmed) to infinity. Every additional confirmation exponentially increases the security of the data in that block.

It’s getting harder!


iizdbvx-imgurMining difficulty

A 256-bit number called the target value dictates the mining difficulty. The target dictates the difficulty because the miners need to find a 256-bit hash that is equal to or smaller than the target number. A smaller target value results in a lower probability of finding a 256-bit hash lower than the target.

Bitcoin re-targets the mining difficulty based on how fast the previous set of 2016 blocks were solved. If miners are solving the 2016 blocks too fast, the target value decreases to make it harder to generate a hash with a value equal to or less than the current target value. Too slow, and the target value increases. Mining Difficulty ensures that exactly 21,000,000 bitcoin have been generated by 2140.
The Mining Process


iizdbvx-imgurSolving a block

Step 1

Special mining software grabs active transactions from the mempool and puts them into a summary view called a merkle root represented by a a 256-bit hash.

Step 2

The same mining software adds this piece of data from step 1 into a block, specifically the block header.

Step 3

The miner hardware changes a piece of data called the “nonce” in the block header.

Step 4

The block header is hashed and compared to the Target to check if the hashed value is less than that of the target value. The target is stored in each block under the field called bits.

You can guesstimate the target by counting the leading sequential zeros – more leading zeros translates to a smaller target (i.e more difficult mining). Example:

0000000000000075et00000000000000000000000000000000000000000000000

In this sample on BlockChain.info you can see the block’s hash, the previous block’s hash and merkle root hash among other data:

Hash 0000000000000000a48f0e25d8305c39594aa576f6b8f5d471998270c6dfd0ba
Previous Block 0000000000000000d866bc09a25ee6901534ccd83387f2ac898a40d0fa6e87e5
Next Block(s) 00000000000000005fae1aee762e3a8507b6b2d2ed9ddde1244b90987e013343
Merkle Root cb17b392893e552376e187afe98f040abe699baf03c8ddb9c56cc8c0652ca9a1

The hash has 16 leading zeroes.

Let’s compare that to what was needed in 2013: 8 leading zeros: 00000000a8ed5e960dccdf309f2ee2132badcc9247755c32a4b7081422d51899
You can mine too..


12795733984_bf2348b893_o
Participate

Anyone can participate in mining but to be profitable, you will need a powerful ASIC device. The mining network is made up of all the miners running the mining software and mining devices all around the world.


Requirements to mine:

1. Electricity,
2. Internet,
3. Mining device,
4. Mining software.

Evolution

A miner’s mining speed is measured in hashes. In 2009, mining started off by utilizing CPU processing power to hash but as mining became more popular the difficulty to mine increased. This resulted in multiple evolutions of mining equipment for faster hashing equipment.

Each advancement has rendered the previous technology obsolete for bitcoin mining:

1. CPU mining (khash)
2. GPU mining (mhash & ghash)
3. FPGA mining (ghash)
4. ASIC mining (ghash & terahash & beyond?)



“It’s gold for nerds.”

Stephen Colbert | Host of “The Colbert Report”

donate to muchbitcoin.org
1H2dyX62kEVvskWwZETur6mgPxUUey3A4M

TOP
X
*Oct 27, 2016: Bitcoin Core v0.13.1 released. 95% of miner hashing power must upgrade for SegWit activation. | What's New? | Download Update | % blocks mined w/ Segwit | % Running v.0.13.1+
¤
Login Q&A Contact Stats Price Share
Thank you! Your message has been submitted to us.
 
×
×
×
×
737507
Visit Today : 206
Visit Yesterday : 333
This Month : 4965
This Year : 24091
Total Visit : 737507
Hits Today : 729
Total Hits : 1983034
Who's Online : 2
Server Time: 17-03-15
×

Recently Asked:

×