Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Imaguyk on May 24, 2017, 07:15:29 PM



Title: Processing power?
Post by: Imaguyk on May 24, 2017, 07:15:29 PM
Im a huge rookie, when it comes to Bitcoin and i apologize if this had been posted previously. What is all of the processing power thats lended to mine BitCoin used for ultimately? I understand you provide the machinery needed to mine and it breaks down code, but what exactly is the code were all mining?


Title: Re: Processing power?
Post by: DannyHamilton on May 24, 2017, 08:00:31 PM
What is all of the processing power thats lended to mine BitCoin used for ultimately?

Bitcoin isn't actually "mined".  That's just a word that has caught on because when you look at it from a non-technical viewpoint, it has some similarities (You spend money and effort and time, and you get access to new value that nobody else ever had before).

At the technical level what is actually happening is that the blockchain is being secured against modification with an additional block of "work", and in exchange for spending time, and resources on this security task, the person (or group of people) doing the work are being compensated with a subsidy of brand new value that nobody else had before (effectively inflation) PLUS the sum of all the transaction fees from all the transactions that are included by that person (or group of people) in the block that they add to the blockchain.

I understand you provide the machinery needed to mine and it breaks down code, but what exactly is the code were all mining?

Nothing is being "broken down".  There is no "code" that is being mined.

Each participant is collecting a list of valid unconfirmed transactions and assembling them into a 1 megabyte block of data.  Then they are building an 80 byte header for that block of data.  Then they are calculating the SHA256 hash of that 80 byte header.  Then they are calculating the SHA256 hash of the result of that first SHA256 hash.

A SHA256 hash results in a numeric value between 0 and 1.158 X 1077.

If the result of all that is less than the current target difficulty, then the block is successfully "mined" and it gets broadcast to all other nodes.

If the result is not less than the current target difficulty, then the block is not valid.  The block header is modified and the process is repeated.

That process is just repeated over and over VERY fast.

There are a few ways to modify a block.  The easiest is the "nonce".  The block includes 4 bytes that exist only so they can be modified in order to generate a different SHA256 hash value.  Once all 4294967296 possible nonce values have been tried, the block can be modified by changing the timestamp in the block header, or by changing which transactions are included in the block, or by changing the order of the transactions in the block, or by modifying the transaction that the miner uses to pay themselves their reward.