I've been working on modifying bitcoinj to use segwit, I've seen that other 
people are also working on bitcoinj+SW, and would like to share where I am 
and ask a few questions:

The changes so far are:

   - modify the protobuf definitions and serialization code to include 
   witness data (I think that it should fix issue #1418)
   - a few sw-related minor changes (like not using the payload hash that 
   comes with tx messages for sw txs)
   - a "segwit" mode (more info below)

I believe that the first 2 sets of changes could make their way into 
bicoinj (segwit branch) as-is.
The "segwit mode" is a mode where all receive and change addresses are 
P2SH-of-P2WPKH instead of P2PKH. My understanding is that it is the 
recommended way of migrating a wallet to segwit.

We've used this modified version of bitcoinj in our work on Lighting and it 
fit our requirements, but I would like to have your opinion before I submit 
a PR: 

   - the segwit mode is triggered by an environment variable, but I was 
   wondering if there might be a better option (maybe the Context object but 
   I'm not too sure) ?
   - Also, it is a "binary" mode i.e either all UTXOs managed by the wallet 
   are segwit outputs, or none of them are. I don't see how to mix both modes 
   since to get the benefit of SW then all outputs that you spend must be SW 
   - Likewise, the only migration strategy for an existing wallet that I 
   see is "send everything to a new SW output" ? It's not clear to me yet 
   whether bitcoinj can manage several different wallets at the same time ?
   - I'm not sure how segwit is supposed to work with "married" wallets 

Best regards,


You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bitcoinj+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to