Bitcoin Forum
June 30, 2024, 05:50:30 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is Mining? (not what you think)  (Read 486 times)
Ifiht (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
November 19, 2013, 07:26:02 PM
 #1

Hey all, just a dumb Computer Engineer here looking for answers. Any of my fellow wire guys know what happens when you mine? And not just the "Oh you're bruteforcing a SHA encryption!" ok I get that, but how does that affect the bitnet, and how do you generate coins from it?
Yours truly,
Ifiht
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4681



View Profile
November 20, 2013, 11:17:19 PM
 #2

  • Step one: Verify that all bunch of unconfirmed transactions meet the rules of the protocol
  • Step two: Create a special transaction that doesn't get its funds from anywhere, but pays 25 BTC to an address (or addresses) you control
  • Step three: Calculate a merkle root for this set of transactions
  • Step four: Build a block header using the merkle root
  • Step five: Calculate a double SHA256 hash of the header
  • Step six:  modify the block header (such as by incrementing a nonce) and repeat step five until you find a suitable hash
  • Step seven: broadcast your solved block to all connected peers
  • Step eight: add the block to your blockchain
  • Step nine: return to step one.

That's a bit simplified, but essentially that's all there is to it.  The faster you can repeat step five with new input values, the better your odds of finding a block with a low enough hash value to be accepted by the network before anyone else does.

The coins are "generated" in step two.
electronrancher
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
November 20, 2013, 11:25:13 PM
 #3

Step 4/5 is where you spend most of your time.  Billions of checks before any worthwhile solution is found. 
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
November 20, 2013, 11:31:20 PM
Last edit: November 20, 2013, 11:47:03 PM by DeathAndTaxes
 #4

Danny as usual is always right. Smiley


BTW "Oh you're bruteforcing a SHA encryption"  SHA isn't encryption.  It is a hashing algorithm, the output of a hashing algorithm is essentially random.  It is a number between 0 and 2^256-1.  Bitcoin just uses it as a "proof" that a certain amount of work has been attempted.  We can do this because if you have a provably random event which occurs for example one in 1 billion attempts while someone may get lucky or unlucky over the long run (thousands of events) we can prove that it took on average 1 billion attempts of work per event.  The difficulty for solving a block however isn't static, the network sets a target which is simply a number between 0 and 2^256-1.  To solve a block the output hash has to be smaller than the target.   The lower the target number the harder it is to "solve" a block and on average it will take more attempts.  As the network gets faster (more attempts per second) the network makes the target smaller (more attempts needed to "win"), when the network gets slower, the network makes the target higher (less attempts needed to "win").   This target balances the computing power on the network with the goal of on average 600 seconds between blocks.  No matter how slow or fast the network becomes the blocks will be find in a relatively consistent manner because the computing power is balanced with difficulty.

If the network combined is able to produce 10x as many hashes per second, then it takes on average 10x as many hash attempts to solve a block.
If the network combined is able to produce 1,000,000 as many hashes per second, then it takes on average 1,000,000 times as many hashes to solve a block.
Right now the network difficulty is roughly 700 million so it takes on average 700,000,000 times as many hashes to solve a block as it did when Bitcoin first started (the actual number is difficulty * 2^32 because the starting difficulty of 1 requires 2^32 attempts).


If you want an analogy, imagine a game where you randomly generate a number between 1 and 100 (say using a pair of ten sided dice).  You get 1 roll per minute and on average I only want a winner every 10 minutes.  I would make the target 10 or less.  There are 10 numbers below the target and 90 above it, your chance of winning on each roll is 10%. You might get lucky or unlucky in the short term but on average you will win once every 10 minutes.  If you have won 100 times we have been playing for 1000 minutes and there is "proof of the work" we know that it would have taken you roughly 1000 rolls to win 100 times.  Now imagine a second player joins but I still only want 1 winner every 10 minutes.  I could simply reduce the target to 5.  The chance of winning is now 5% per roll and there are 20 rolls per minute so there is still only one winner every 10 minutes.  Now imagine a third player joins but he gets is able to roll three times a minute.   In total there will be 5 rolls per minute and I want one winner every 10 minutes (50 total rolls) so the chance should be 2% per roll and I lower the target to 2.   Regardless of how many players join or leave, or how fast or slow they can roll (maybe some people have more than 1 set of dice) I can set a target so there is on average only one "winner" every 10 minutes.

Rather than roll dice we use SHA-256 to be the source for random values because it is provable and compare them to the target.
imamanandyou
Full Member
***
Offline Offline

Activity: 147
Merit: 100


View Profile
November 20, 2013, 11:33:56 PM
 #5

Step 4/5 is where you spend most of your time.  Billions of checks before any worthwhile solution is found. 

with 1 difficulty it is 2^32 checks (4.294.967.296) on average

Current difficulty is 609.482.688, so 609.482.688 * 4.294.967.296 checks on average to find new block  Shocked

electronrancher
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
November 20, 2013, 11:55:53 PM
 #6

Step 4/5 is where you spend most of your time.  Billions of checks before any worthwhile solution is found. 

with 1 difficulty it is 2^32 checks (4.294.967.296) on average

Current difficulty is 609.482.688, so 609.482.688 * 4.294.967.296 checks on average to find new block  Shocked

Cool, I had not known the diff calculation was that simple.  TIL.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4681



View Profile
November 21, 2013, 12:56:33 PM
 #7

a whole bunch of copy-pasta

Why copy and paste the entire contents of a wiki page instead of just linking to the page?

https://en.bitcoin.it/wiki/Mining#Introduction
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!