Bitcoin Forum
December 09, 2016, 11:59:53 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Exactly how does a miner... mine?  (Read 478 times)
oko_suno
Newbie
*
Offline Offline

Activity: 6


View Profile
April 10, 2012, 04:10:31 AM
 #1

I know how to use a miner, how to use a pool and stuff like that, and I have done it before (and am right now), but I've always wondered what the actual process was to calculating hashes? What is my miner doing right now?

I've seen this:
Quote from: Pieter Wuille
Code:
doHash(block_header) {
  hasher = new SHA256();
  hasher.update(block_header[0..63]);      // update A1
  hasher.update(block_header[64..127]);  // update A2
  hash1 = hasher.getHash();
  hasher.reset();
  hasher.update(hash1);                         // update B
  hash2 = hasher.getHash();
  return hash2
}

but I have pretty much no clue what it means.
1481284793
Hero Member
*
Offline Offline

Posts: 1481284793

View Profile Personal Message (Offline)

Ignore
1481284793
Reply with quote  #2

1481284793
Report to moderator
1481284793
Hero Member
*
Offline Offline

Posts: 1481284793

View Profile Personal Message (Offline)

Ignore
1481284793
Reply with quote  #2

1481284793
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481284793
Hero Member
*
Offline Offline

Posts: 1481284793

View Profile Personal Message (Offline)

Ignore
1481284793
Reply with quote  #2

1481284793
Report to moderator
Foxpup
Legendary
*
Offline Offline

Activity: 1708



View Profile
April 10, 2012, 04:36:30 AM
 #2

I know how to use a miner, how to use a pool and stuff like that, and I have done it before (and am right now), but I've always wondered what the actual process was to calculating hashes? What is my miner doing right now?
The idea of mining is to calculate a cryptographic hash of a block (a block is basically just a list of recent transactions, a hash of the previous block (so you can't prepare fraudulent blocks in advance), and some other stuff) such that the value of the hash is lower than a predetermined target. If it is, you win: your block gets included in the block chain and you receive the block reward (currently 50 BTC) as well all the transaction fees associated with that block. If the hash doesn't come under the target, you lose, and you have to try again by changing a small piece of data in the block (called the nonce) which causes the whole hash to change in a random way. The key point about a cryptographic hash is that it's impossible to predict what effect changing the nonce (or any other part of the data) will have on the hash: the only way to get a hash that meets the target is to try every possible nonce (a typical mining system is capable of trying millions per second) until you find one that works. This is key to the security of Bitcoin: it's impossible for anyone to introduce a fraudulent block without first using a ton of computing power to find one that meets the hash target. Not only that, they'd need (on average) more computing power than the rest of the network combined, because if anyone else finds a real block first, all the effort trying to produce a fraudulent block is wasted.

I've seen this:
Quote from: Pieter Wuille
Code:
doHash(block_header) {
  hasher = new SHA256();
  hasher.update(block_header[0..63]);      // update A1
  hasher.update(block_header[64..127]);  // update A2
  hash1 = hasher.getHash();
  hasher.reset();
  hasher.update(hash1);                         // update B
  hash2 = hasher.getHash();
  return hash2
}

but I have pretty much no clue what it means.
This code just calls the hashing function on the blocks, there's nothing special about it.

Will pretend to do unverifiable things (while actually eating an enchilada-style burrito) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
oko_suno
Newbie
*
Offline Offline

Activity: 6


View Profile
April 10, 2012, 05:00:52 AM
 #3

And the target is changed every 2016 blocks so that the difficulty of mining can be changed... ok I get it now, thank you!
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!