Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: jonnybravo0311 on November 08, 2016, 03:31:59 PM



Title: preparing for segwit
Post by: jonnybravo0311 on November 08, 2016, 03:31:59 PM
All,

I just want to ensure I understand what I need to do to support the segwit changes from a pool operator perspective.  Please comment/correct/add anything I may miss.

1) Call to GBT.  I must add the following when I call getblocktemplate:
Code:
{"rules":["segwit"]}

2) Use txid instead of hash from GBT output to calculate merkle root. I don't ever have to use the "hash" because even transactions from non-upgraded wallets will, when my upgraded node processes them, replicate the value in "hash" to "txid".
Code:
{
      "data": "010000000201647651a5699449ef97d5fdeb71233401d36f727826c0c0949dee3971b1690d00000000fc0047304402204e92b2e7a58a8f73351f0fe0f889826cc5760ba83ac4d380a911f4749e5e610f02200bd00f948af01c7b7336089430e5bb02b6e80a9135160d95d81b5843cb68099d01473044022015d4229114b2e3fc3d56eb026860189600f0b076b0d74aabe227128138cb1f4402202bbb82fdcb375042ede6f82e3f65953265544eaabe318bdaab857117321f8e9f014c6952210237679c99cf1548455c2dbdd95398308527d22bb8eb78c6f2f8bfc098151fbc192102a5c087ca7b03f6dd98611f204fd976d773eeae4248a49b790c283b1ec31025012103382f2f9dc0f901344ffda60bb330df103159015c0b2fd436ffcb5a8f5da35cc353aeffffffffbaadf8627fa17569d1d24aa4c8d433ae00edfb9d4a2b84e450e440cdaead7e9500000000fdfd00004730440220132f5c91d923c7d9baeb1c3f47b2dbd16b5e646b80af3a0ef0adb4880859d23d022022629c007bb581de55e4710f79c4d2e8115082328b0eacc0c659206fcee3981801483045022100ca2175bcb9a56473745a1341276b0d51cbc34829b70292de971e6ce608bd6234022032a71e54c345e45d78fcaf31cf6b36ed39cf2349a8a47b3fde030c2dc4dfc58a014c6952210237679c99cf1548455c2dbdd95398308527d22bb8eb78c6f2f8bfc098151fbc192102a5c087ca7b03f6dd98611f204fd976d773eeae4248a49b790c283b1ec31025012103382f2f9dc0f901344ffda60bb330df103159015c0b2fd436ffcb5a8f5da35cc353aeffffffff02a0860100000000001976a91496e85759feba955df98e8af83e3ca97ba0bf4ea488acb88201000000000017a914e830166009d9b44ff7c8e9ade5fdc1a5bcf3a2858700000000",
      "txid": "9b18cadc4124913f12c16bd0a97b8df5437761f1d08cabb84a216a72b818c086",
      "hash": "9b18cadc4124913f12c16bd0a97b8df5437761f1d08cabb84a216a72b818c086",
      "depends": [
      ],
      "fee": 1000,
      "sigops": 28,
      "weight": 2660
    }

3) Append witness commitment to coinbase transaction as OP_RETURN in the following format:
Code:
0x6a24aa21a9ed + witness root hash
The witness hash can be pulled from GBT call as "default_witness_commitment".

Anything I've missed here?

Thanks in advance!

Jonny


Title: Re: preparing for segwit
Post by: gmaxwell on November 10, 2016, 01:10:25 AM
I bounced your message past Cory Fields, who has been helping others with segwit integration and he pointed out that it wasn't clear from your message if you'd end up duplicating the OP_RETURN-- the default_witness_commitment contains the OP_RETURN + magic already.  Otherwise it sounds correct.


Title: Re: preparing for segwit
Post by: jonnybravo0311 on November 10, 2016, 02:22:49 PM
I bounced your message past Cory Fields, who has been helping others with segwit integration and he pointed out that it wasn't clear from your message if you'd end up duplicating the OP_RETURN-- the default_witness_commitment contains the OP_RETURN + magic already.  Otherwise it sounds correct.
Thanks for following up.  If I'm reading your response correctly, according to Cory, I simply have to add the value in "default_witness_commitment" instead of concatenating 0x6a24aa21a9ed and "default_witness_commitment".

Much obliged for the reply.


Title: Re: preparing for segwit
Post by: gmaxwell on November 11, 2016, 03:45:04 AM
Thanks for following up.  If I'm reading your response correctly, according to Cory, I simply have to add the value in "default_witness_commitment" instead of concatenating 0x6a24aa21a9ed and "default_witness_commitment".
Correct.  Segwit is active on testnet-- so you can freely test out your mining there. If you could use some hashpower for testing, I can direct some to you.