Is Segwit integration complete?

129 views
Skip to first unread message

Amitabh Saxena

unread,
Nov 12, 2017, 3:26:34 AM11/12/17
to bitcoinj
Can bitcoinj listen and understand segwit transactions and can it create segwit transactions? Which branch should I clone? 

Andreas Schildbach

unread,
Nov 13, 2017, 2:22:47 PM11/13/17
to bitc...@googlegroups.com
On 11/12/2017 09:26 AM, Amitabh Saxena wrote:

> Can bitcoinj listen and understand segwit transactions and can it create
> segwit transactions? Which branch should I clone?

It cannot spend from Segwit addresses yet, and thus also doesn't create
segwit addresses to listen on.

It can spend to Segwit addresses though, e.g. if the payment protocol is
used.

All segwit development happens on the segwit branch, but lately not much
has happened. I suspect everyone was busy waiting for how the 2X fork
plays out.

NelsoN Melina

unread,
Nov 27, 2017, 12:08:14 PM11/27/17
to bitcoinj
What is currently missing to have it functional and merged to the main branch ?

Also is there a place that define the technical approach taken to integrate Segwit in BitcoinJ ?

Ishmael Riles

unread,
Dec 4, 2017, 2:06:46 PM12/4/17
to bitcoinj
I would also like to know the answer to these questions. Also how production ready is the segwit branch? I would just need to use the library for creating and signing transactions. No need for any wallet or node/networking features.

Andreas Schildbach

unread,
Dec 4, 2017, 6:27:55 PM12/4/17
to bitc...@googlegroups.com
The answer is pretty much in my post you were replying to.

It depends a bit on your usecase. For a Bitcoin wallet, the Wallet
integration is missing. The idea is to create a second
DeterministicKeyChain under a different derivation path and use it for
Segwit addresses. See my "HD wallet format for Segwit" post.

Perhaps also read the discussion on PR #1441.
> --
> 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+u...@googlegroups.com
> <mailto:bitcoinj+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


Andreas Schildbach

unread,
Dec 8, 2017, 1:56:36 PM12/8/17
to bitc...@googlegroups.com
You should be able to do that already, even using the current stable
bitcoinj. The receiving wallet sends you a P2SH segwit address or (via
payment protocol) a script to send to. You send as usual.

Ishmael Riles

unread,
Dec 9, 2017, 1:21:59 AM12/9/17
to bitc...@googlegroups.com
I need to create them and spend them.

You received this message because you are subscribed to a topic in the Google Groups "bitcoinj" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bitcoinj/LflG3ZaEBOc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bitcoinj+u...@googlegroups.com.

Danielle Strijdhaftig

unread,
Dec 21, 2017, 9:26:54 AM12/21/17
to bitcoinj
This conversation is from a month ago. How close is full SegWit support now?

I'm fired up due to this call to use only SegWit wallets and exchanges, and what I use relying on BitcoinJ:
https://hackernoon.com/bitcoin-owners-you-need-to-do-these-two-things-right-now-a73122dd23d4

Op maandag 13 november 2017 16:22:47 UTC-3 schreef Andreas Schildbach:

Amitabh Saxena

unread,
Dec 25, 2017, 12:45:02 PM12/25/17
to bitcoinj
I have made my own implementation of segwit in Scala, so hopefully I won't be relying on bitcoinj that much.
Have tested on testnet. Sharing my code for others to review and use. Note that its in Scala but should be easy to use for Java devs.


examples here:

An extract from the above explaining how to use it:

val key = new sh.ecc.PrvKey("BB2AC60BC518C0E239D5AF9D8D051A6BDFD0D931268DCA70C59E5992", true) // true = compressed val tx0 = createSegWitTxRaw(Seq(in0,in1,in2,in3,in4,in5,in6), Seq(out1)) // unsigned tx, 7 inputs, 1 output
val tx1 = key.signTx_P2PKH (tx0, Seq(0, 2, 5)) // inputs 0, 2, 5 are P2PKH
val tx2 = key.signTx_P2SH_P2WPKH(tx1, Seq((1, 2031250), (6, 1015625)))
// inputs 1, 6 are segwit. Those need the input value in satoshis as well
val signed = key.signTx_P2SH_P2PK(tx2, Seq(3, 4)) // inputs 3, 4 are P2SH_P2PK


Regards
Amit
Reply all
Reply to author
Forward
Message has been deleted
0 new messages