This question already has an answer here:

I kept on learning how miner hash | decrypt | calculate all those infos that was given to them by the pool but I can't find how they do it, maybe there's a function something like:

int hashThis( param1, param2, param3 )
{
  ..
  .. 
  return somthingCanBeUsedToInformThePoolOfSucces
}

int Submit()
{
  param = hashThis(param1, param2, param3 )
  submitTothePool(param)
}

That is how know mining is, but I don't know how to implement the function hashThis(), that's why I asked maybe you have a goal to reach, and return it when you reached it

marked as duplicate by Nate Eldredge, pebwindkraft, alcio, Adam, Willtech Mar 6 at 9:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Basically, you are solving a puzzle. A puzzle is to come with a nounce(number) which when added with the block header and hashed, hash should start with some number of zeros.

Higher the number of zeros, difficult it is to come with the nouce for the given block header. According to the current hash power in the network, network adjusts the difficulty.

Implementation would look something like this:

1) Generate block header for the given set of transactions
2) Get the current network difficulty level ( number of zeros hash should start with )
3) Plug in random numbers so that : hash( nounce + blockheader ) starts with given number of zeros
4) Form a block and include nounce in the blockheader ( So that other node can verify your work )

Not the answer you're looking for? Browse other questions tagged or ask your own question.