f2pool
telnet stratum.f2pool.com 3333
---> send
{"id": 1, "method": "mining.subscribe", "params": []}
---> receive
{"id":1,"result":[[["mining.notify","mining.notify"],["mining.set_difficulty","mining.set_difficulty"]],"00",8],"error":null}
---> send
{"id": 2, "method": "mining.authorize", "params": ["user", "password"]}
---> receive
{"id":null, "method":"mining.set_difficulty","params":[8192]}
---> receive
{
"id":null,
"method":"mining.notify",
"params":[
"B9OwZ1S45VrRdA68xCxngG",
"e39dc0f699f5bf79b23a35801a0a1671679730f00013003b0000000000000000",
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff640308c8082cfabe6d6d59958fc389ffe84f8de80adef133f4877c91c42d1b756e1010b2f736273afdbe10000000f09f909f000d4d696e6564206279207573657200000000000000000000000000000000000000000000000000000000000005",
"032b48d04f000000001976a914c825a1ecf2a6830c4401620c3a16f1995057c2ab88ac00000000000000002f6a24aa21a9ed993f69ddd8c50685546580c8113d40b7a21ccc17e732526509e4bd27c4c2d9d608000000000000000000000000000000002c6a4c2952534b424c4f434b3a99a95af280c7ba1ef071f96a8223a55ac1f4620a7fb6a705f02dd39580e8817e85800238", [ "1cb14b15ad78009fea8ef638ac2e81236bf0c973c485541284385c4e5f3e7b67", "7a6252c0ce8fec6d7703de7226aa0448e4377e9a3fe3c8cc0889ea12bb48143a", "7c6dfe82ce417f79d20c45ed00c83220058da34888b4896f2a685e2ed89dbc85", "21bc8c3b360cd73d2e2c00b47a2f3298c3233c7e8f515633d78551dbdf69f2b1", "64ec37e39297c602d9ebf8d52f5bcaba337619e90d672f5642daba0f372ede8f", "1d7655bd14c4a4cda74553fab127e2bf191409f7a9278d58a0653d3256c92046", "c0f44808ea765496520f2475afb33c7930c9c64a10aff1ebb4a80f80a3fae634", "921a9fb324d88f1f2e4a70a197158e7db71cc4de136826da92d5caee01d8cfd1", "bbf71595776349a4934c43dde29b2e4a2913266b79a2bad62d23b1df6e518998",
"d3bbf2b07b6cd269d0ac21fd606d824b120a655e6e6fe9621cf91a4470cc8a45", "ffb56fff2e4020e6b018a6f2db5520724920227afb4d8fdfe143cbbae5bab840",
"4a7825dcc1cbdc35d42dd26e981a616b224ccbd77007c5b66c387f9e13064513"
],
"20000000",
"1729ff38",
"5cd64e36",
false
]
}
poolin
telnet btc.ss.poolin.com 443
{"id": 1, "method": "mining.subscribe", "params": []}
{"id": 2, "method": "mining.authorize", "params": ["user", "password"]}
---> receive
{
"id":null,
"method":"mining.notify",
"params":[
"0rDDRrGgEqI-NR[.PO([7{p&2Hb(j=DTEx71Da-co5b)o",
"99796469c24811de787cdd924d8cef33c38b59d5001097650000000000000000",
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5f0309c808048d55d65c2f706f6f6c696e2e636f6d2ffabe6d6d9c5496e662f7ce02877e9d34dda9fffc5562f5055fbfa765ab5c1312f5f78d9e0100000000000000a38ec2cba86b18aec5758639a92e7b600fc6048b29",
"ffffffff02b6740b51000000001976a9142b0c6a29dbf71c6dab00639c17c5010b707c9df588ac0000000000000000266a24aa21a9edcf880eadcdf18acdfbdb8a03a66816610183cedc6559329744aa53bc7952926dfd4adc9b",
[
"6eec11d83bc7212adaedfe3f705b0b96e4546889d02e125cd53b7b36e1a2d282",
"cd6e5b0ec9e9c7cbef1e25e18815adfed80b3c3b4b153cb61c224c914688cb37",
"b8133eed5cd409f3f2dd29559b717f86c25e03479bc5af14dba9af19919ebc9d",
"2e093a6e029724e8402851949216234d38dba971267a1064fd462eb7405be8a5",
"af66a3a25996904ee91187f28b02ddfb9a2db3bc3c8a8ce03db5257234ed8ff8",
"0f2c1f3aae955a283f2416e894d1c44b20234ba343861f383891b1bef685f65e",
"e34f3663b0a4cf60d4decb4477b61b25d6ecec39d3d1775d6701a94f5ad606cd",
"e0086bab0f4197dd94ed101ef3a0970dad189db590a2da9871e6f66ba7a2b00b",
"5bfecd86dcc9cd03c92e81b0ed6656ba5fdefa67d5db0f70a88f7154fa8369d8",
"bc81e6330426ecda7ba9ea5e5bdfa3affa716b32f33c0662afaa9d1355a619fb",
"7f8f63f202120482a7e0aab623506728b2332d323852d004cecafec1119a2943",
"e9c40ef8d6395ecac1d0d9e7892cc558973becf4a18670470dab8d061c047848"
],
"20000000",
"1729ff38",
"5cd6558c",
false
]
}
flypool
telnet cn1-zcash.flypool.org 3333
---> send
{"id": 0, "method": "mining.subscribe", "params": ["zec.f2pool.com", 3357, "zcash/1.0", "1"]}
{"id": 0, "method": "mining.subscribe", "params": ["cn1-zcash.flypool.org", 3333, "zcash/1.0", "1"]}
---> result
{"id":0,"result":["3476b2b74c", "3476b2b74c"], "error": null}
---> send
{"id": 1, "method": "mining.authorize", "params": ["t1WSHqAC7Zi5XmCeS4RJozUSVxvzFZ3Gruc", "shooter01"]}
---> result
{"id":null,"method":"mining.notify","params":["65ce77a81d2156427a61","04000000","0adb71f7df928dda4a0c3cf433cf4e237f504204a8effd60cbec755900000000","59be4ec49e49cd416bb0d0b980748847aa2f4aa8e41cc3b7384da8413b140118","0000000000000000000000000000000000000000000000000000000000000000","4a3f0c59","f24a6f1c",true]}
{"id": null, "method": "mining.notify","params": ["JOB_ID", "VERSION", "PREVHASH", "MERKLEROOT", "RESERVED", "TIME", "BITS", CLEAN_JOBS]}
slushpool
telnet stratum.slushpool.com 3333
python code
def each_slice(arr, n):
return [arr[i:i + n] for i in range(0, len(arr), n)]
def getprevhash(prev):
items = each_slice(prev, 8)
items.reverse() # 直接修改items,没有返回值
prevhash = "".join(items)
print("prevhash: " + prevhash)
raw_prev = "e39dc0f699f5bf79b23a35801a0a1671679730f00013003b0000000000000000"
getprevhash(raw_prev) # 00000000000000000013003b679730f01a0a1671b23a358099f5bf79e39dc0f6
参考:
https://en.bitcoin.it/wiki/Stratum_mining_protocol
https://bitcoin.stackexchange.com/a/23112
https://www.f2pool.com/help
https://github.com/slush0/stratum-mining
https://github.com/sumory/BTC
https://github.com/btccom/btcpool
https://gist.github.com/YihaoPeng/254d9daf3a5a80131507f32be6ed92df
https://www.jianshu.com/p/797401d8a80e