Skip to content

Instantly share code, notes, and snippets.

@psycalc
Created January 2, 2018 00:21
Show Gist options
  • Save psycalc/9d4ebd5a460d79959341a899bed21f1a to your computer and use it in GitHub Desktop.
Save psycalc/9d4ebd5a460d79959341a899bed21f1a to your computer and use it in GitHub Desktop.
What is Mining Baby don't heart me no more....))))
do { //just repetance until condition Not (!) will be true
//just object of class with field Nonce this is integer type can be 1..2 ..3 -1.. -3.. -5.. -1000 ... 100.. 999 and so on
block.Nonce++; //Mining by incremention
block.Hash = BlockChainLibrary.Crypto.Sha256.CalcHash(block.ToHashString());
//method just return concatenated string Index+PreviousHash+Timestapm+Data+Nonce $"{Index}{PrevHash}{Timestamp}{Data}{Nonce}";
} while (!BlockChainLibrary.Crypto.Sha256.IsValidHash(block.Hash));
Blocks.Add(block);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment