

Ask HN: Pseudocode for the Bitcoin Mining Algorithm? - nighthawk

I get the general gist of what problem must be solved for bitcoin mining, namely wanting to find a nonce that pairs with your data to result in a hash with x leading zeros where x is the current difficulty level.<p>However, I&#x27;m having trouble finding the exact algorithm, which uses double SHA-256 encryption, etc.<p>Can someone give or point me to the full pseudo code for the mining algorithm?
======
assliquor
The source code is here:
[https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp](https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp)

Basically, the ScanHash_CryptoPP(..) function does the actual hashing, and is
called by the BitcoinMiner(..) function, which checks if the returned hash has
the appropriate number of 0 bits.

