Author

Topic: 谁了解挖矿协议?关于midstate,target,data,hash1这些字段 (Read 3524 times)

newbie
Activity: 10
Merit: 0
newbie
Activity: 10
Merit: 0
这么复杂啊。眼花缭乱
newbie
Activity: 10
Merit: 0
legendary
Activity: 1792
Merit: 1111
要討論技術問題就到技術版用英文問吧. 這裏絕大部份人只懂炒bitcoin, 炒山寨幣, 挖礦賺錢, 或灌水.
member
Activity: 98
Merit: 10
这个协议是p2pool的么,有兴趣研究一下这个
newbie
Activity: 68
Merit: 0
看上去很复杂的样子
newbie
Activity: 10
Merit: 0
学习学习再学习
newbie
Activity: 16
Merit: 0
通过调试了一天的ufasoft_bitcoin-miner,终于搞明白了

hash1字段无用, 可以无视
midstate字段是第一轮hash的abcdefgh
target字段是难度
data字段前64字节无用,后64字节变动第12个字节开始做nonce, 共32字节, hash结果符合难度就提交.

话说我也用sse2编译了, 咋速度才200kHash/s
newbie
Activity: 16
Merit: 0
从矿池拿到一个任务如下:

{"id":0,"error":null,"result":{"midstate":"adaf1ff882043d7dd777665009afb0f9f2e2faabf9026ad43e9e1ae91f2d6bef","target":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000","data":"000000012c9c355ce91cc07063ad2fc47c2349c988f6528d8d893ca50000038f000000005822ea2 8f8ae545e273d32d0874408575916520a578d2c8edeb28e451ab8ce7b4e0de6be1a0c2a12000000 0000000080000000000000000000000000000000000000000000000000000000000000000000000 0000000000080020000","hash1":"0000000000000000000000000000000000000000000000000000000000000000000000800000000 0000000000000000000000000000000000000000000010000"}}

bitcoin-miner计算出了一个结果:
{"params":["000000012C9C355CE91CC07063AD2FC47C2349C988F6528D8D893CA50000038F000000005822EA2 8F8AE545E273D32D0874408575916520A578D2C8EDEB28E451AB8CE7B4E0DE6BE1A0C2A12724427 FE00000080000000000000000000000000000000000000000000000000000000000000000000000 0000000000080020000"],"method":"getwork","id":"jsonrpc"}

请教这是怎么计算出来的, 用那些字段进行hash得出这种结果?
我翻了好久wiki也没找到, 就想知道详细的原理, 谢谢.
Jump to: