bitcoinops / taproot-workshop

Taproot & Schnorr Python Library & Documentation.
MIT License
375 stars 112 forks source link

Make generate_and_send_coins send rewards to bech32 address. #131

Closed jachiang closed 5 years ago

jachiang commented 5 years ago

Default generate() call sends rewards to P2SH(P2WPKH) output. Sending rewards to a native segwit address reduces weight of spending transaction and facilitates weight comparisons between native segwit v0 and v1 transactions. I would prefer minimizing transaction weights where possible.

jnewbery commented 5 years ago

I'm confused about the rationale here. Presumably we'd been making weight comparisons between transactions we create ourselves (see https://github.com/bitcoinops/taproot-workshop/pull/129 for example)

jachiang commented 5 years ago

Sorry, the rational isn't correct.

In the chapter 2.2 update (#133) , I compare two transactions.

For the weight comparison, I prefer (it isn't necessary) to minimize the weight of both transactions, by spending native segwit coinbase outputs in both cases.

jnewbery commented 5 years ago

for (ii), how are you adding the commitment to the transaction output if you're creating the tx with generate_and_send_coins()?

jachiang commented 5 years ago

for (ii), how are you adding the commitment to the transaction output if you're creating the tx with generate_and_send_coins()?

With a tweaked pubkey which is encoded in the segwit v1 address passed to generate_and_send_coins(segwit_v1_address).

jachiang commented 5 years ago

Hi @jnewbery - anything I can do to move this forward if desirable?

jnewbery commented 5 years ago

Sorry for the delay here. Using bech32 everywhere seems reasonable to me. Thanks!