jtoomim / p2pool

Peer-to-peer Bitcoin mining pool
https://github.com/jtoomim/p2pool/
GNU General Public License v3.0
38 stars 46 forks source link

Add AsicBoost support for S9s #17

Closed jtoomim closed 5 years ago

jtoomim commented 6 years ago

Bitmain recently released firmware which makes Overt AsicBoost available on S9s for compatible pools. Unfortunately, Bitmain has not specified the "multiversion" stratum extension that they're using, so this needs to be reverse engineered or determined based on the bmminer source code.

https://medium.com/@braiins_systems/bitmain-antminer-s9-asicboost-capability-verified-by-braiins-13-in-energy-savings-and-planned-da67c290152c

For Dragonmint machines, but not for S9s and for S9s with the newest firmware:

https://github.com/slushpool/stratumprotocol/blob/master/stratum-extensions.mediawiki#Extension_versionrolling

I am offering a 3 BCH bounty for the implementation of multiversion support for Antminer S9s for p2pool. Edit: I'm changing the bounty to $1500 worth of crypto, given the recent price drops.

zquestz commented 6 years ago

The implementation can be found at https://github.com/bitmaintech/bmminer-mix/blob/master/driver-btm-c5.c.

jtoomim commented 6 years ago

It looks like Bitmain has added support to their firmware for BIP310:

https://twitter.com/Antminer_main/status/1054611067496591360

https://github.com/bitcoin/bips/blob/master/bip-0310.mediawiki

kr1z1s commented 6 years ago

Adding VMASK support from ckpool https://bitbucket.org/ckolivas/ckpool-splns/commits/f2ced78ac3b53ffec119479e18abb4c51843889b

jtoomim commented 5 years ago

Full Cycle Mining has taken on this task and has made a lot of progress. So far, he's mined a block on testnet with AB.

https://www.blocktrail.com/tBCC/block/0000000001cefc9de0bc33238d56450d8aa6644bad1dec4a0f527e4aeef238af

kr1z1s commented 5 years ago

I made support AsicBoost on my nodes

On BCH mainnet many blocks have already been found with AsicBoost support 1 - http://p2p-spb.xyz:9338/static/classic/share.html#000000000000000004ac93df397e4d5aad1140d46717b538d5dc86ea1aafcd6e 2 - http://p2p-spb.xyz:9338/static/classic/share.html#00000000000000000036966f1ce3f8f57e169df27d906471731946d28348936a 3 - http://p2p-spb.xyz:9338/static/classic/share.html#0000000000000000046834739dac3fe237038dbf027a32f2a1b5722be2ceb39c

Logs from my BTC node - http://p2p-south.xyz:9334/static/ 2018-12-08 03:18:11.512942 {u'id': 1, u'method': u'mining.configure', u'params': [[u'version-rolling'], {u'version-rolling.mask': u'00c00000', u'version-rolling.min-bit-count': 2}]} 2018-12-08 03:18:11.555286 {u'id': 4, u'method': u'mining.subscribe', u'params': [u'cgminer/4.11.1']} 2018-12-08 03:18:11.613645 {u'id': 6, u'method': u'mining.authorize', u'params': [u'18CPCHjc1ERndHhozgSuSVeRJ6VvTvqa7Y', u'x']}

This request.

Here work submit {u'params': [u'18CPCHjc1ERndHhozgSuSVeRJ6VvTvqa7Y', u'52811523657648948989442545752904397177', u'32100000', u'5c0b0fec', u'1b6a9b0c', u'00400000'], u'id': 10153, u'method': u'mining.submit'}

Here u'00400000' - mask from miner

The code works on all sha256 coin.

I can give you my code for the test.

Give me you e-mail. I send my code to you.

kr1z1s commented 5 years ago

I send e-mail to orders@toom.im with my code for you.

staiki commented 5 years ago

Dear jtoomim. The P2P miner community is waiting for your decision on AsicBoost. When can we expect a positive response? Thank.

dfoderick commented 5 years ago

Anyone who is currently mining and is able to help test my asicboost code, please contact me.

Secifically, if they can compare debug output (--debug) I would appreciate it.

Contact me for link to the code.

jtoomim commented 5 years ago

I'm in Japan right now on vacation. I'll be able to check out the two submissions starting Monday.

Celebrimbot commented 5 years ago

I'm mining with S9, Dave. I might be able to help.

dfoderick commented 5 years ago

@Celebrimbot Send me an email at dfoderick@gmail.com and I will send instructions.

jtoomim commented 5 years ago

Tests of dfoderick's code on BCH testnet went well. I'm testing @dfoderick's code on mainnet now in branch https://github.com/jtoomim/p2pool/commits/with_df_ab. Assuming it goes well, I will soon merge it into 1mb_segwit.

@dfoderick was the first to submit code to me for this issue, so assuming there are no issues with the code, he will get the full bounty. However, since @kr1z1s submitted code only a few hours afterward, I will also be giving a $500 reward to him. dfoderick and kr1z1s, please send me your BCH (or BTC or LTC) address so that I can pay your bounties.

kr1z1s commented 5 years ago

Tests of dfoderick's code on BCH testnet went well. I'm testing @dfoderick's code on mainnet now in branch https://github.com/jtoomim/p2pool/commits/with_df_ab. Assuming it goes well, I will soon merge it into 1mb_segwit.

@dfoderick was the first to submit code to me for this issue, so assuming there are no issues with the code, he will get the full bounty. However, since @kr1z1s submitted code only a few hours afterward, I will also be giving a $500 reward to him. dfoderick and kr1z1s, please send me your BCH (or BTC or LTC) address so that I can pay your bounties.

12sLRrMCtv2sDyuiYyV1E2jUTFm9NEEHGx - BCH (ABC)

Check out my notes on the code. https://github.com/jtoomim/p2pool/commit/cc25179bf2c726e857ad7060b361b06920ad3a3a#r31714434

kr1z1s commented 5 years ago

Tests of dfoderick's code on BCH testnet went well. I'm testing @dfoderick's code on mainnet now in branch https://github.com/jtoomim/p2pool/commits/with_df_ab. Assuming it goes well, I will soon merge it into 1mb_segwit.

@dfoderick was the first to submit code to me for this issue, so assuming there are no issues with the code, he will get the full bounty. However, since @kr1z1s submitted code only a few hours afterward, I will also be giving a $500 reward to him. dfoderick and kr1z1s, please send me your BCH (or BTC or LTC) address so that I can pay your bounties.

And... This is not a full implementation. Proprietary implementation from Bitmain differs from the BIP310 Example {"id": 0, "method": "mining.multi_version", "params": "4"} I'm working on full asicboost support. The results will be later.

jtoomim commented 5 years ago

@kr1z1s

4.25348441 BCH @@ $500 for AB code submission -- f92afc94ef408c0dcb18559af8a03ce19641cdc7069ddbf0712d2cd42939de3b

1.27837936 BCH @@ $150 for AB code review -- 70ef97f94e09a27e1f1dfd9e0ed67c965c97a95ef89f446bc012744208c4d172

@dfoderick still need an address from you.

kr1z1s commented 5 years ago

@kr1z1s

4.25348441 BCH @@ $500 for AB code submission -- f92afc94ef408c0dcb18559af8a03ce19641cdc7069ddbf0712d2cd42939de3b

1.27837936 BCH @@ $150 for AB code review -- 70ef97f94e09a27e1f1dfd9e0ed67c965c97a95ef89f446bc012744208c4d172

@dfoderick still need an address from you.

Thank you. When I finish working on the proprietary boost implementation(from Bitmain), I'll send you the code.

jtoomim commented 5 years ago

Block mined with @dfoderick's Asicboost code: https://bch.btc.com/000000000000000004f288fa4e925908231751a2cd68111faca7f68948f9de18

jtoomim commented 5 years ago

@dfoderick has been paid. He gave me his address privately, so I presume he wanted to keep his address private, and I'm choosing not to post the payment transaction publicly.

jtoomim commented 5 years ago

Two more AsicBoost BCH blocks have been mined:

https://bch.btc.com/0000000000000000014038d2007fc1586925b76c8c4a4514dc0a3a9020d132ec - version 0x20400000 https://bch.btc.com/00000000000000000216cc2c5e6565072328534b27e8700dca268ce315b84af5 - version 0x20000000

The second one was mined with AsicBoost, but ended up with the same version as a non-AsicBoost block. This is expected to happen 25% of the time.

I'm happy enough with these results. I have merged the AsiBoost code into 1mb_segwit.

I've also added a few other changes at the same time, including a performance improvement and some bugfixes when starting new solo-mining chains (e.g. on testnet).