TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Pseudocode for the Bitcoin Mining Algorithm?

9 点作者 nighthawk超过 11 年前
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?

1 comment

assliquor超过 11 年前
The source code is here: <a href="https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bitcoin&#x2F;blob&#x2F;master&#x2F;src&#x2F;miner.cpp</a><p>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.