The 0.14 branch is ~2 years old and has got no support for segwit at all. For receiving on native Segwit addresses, you can use the master branch. For receiving on P2WPKH-P2SH, I'm not sure. If master doesn't work you can try the segwit branch (but that one isn't tested well).
Warning: master currently has no support for spending segwit outputs. So only use testnet or really small amounts for now. I hope I can merge back signing from the segwit branch to master soon. On 04/16/2018 11:55 PM, Tyga Christed wrote: > i am worrking on bitcoinj <version>0.14.7</version> > > On Tuesday, April 17, 2018 at 2:21:53 AM UTC+5, Andreas Schildbach wrote: > > What branch or commit are you working on? > > > > On 04/16/2018 06:41 PM, Tyga Christed wrote: > > I am generating Segwit address like this > > > > Address.fromP2SHScript(params,segWitOutputScript()); > > > > > > public static Script segWitOutputScript() { > > > > // > > // OP_HASH160 hash160(redeemScript) OP_EQUAL > > // > > byte[] hash = Utils.sha256hash160(segWitRedeemScript().getProgram()); > > byte[] buf = new byte[3 + hash.length]; > > buf[0] = (byte)0xa9; // HASH160 > > buf[1] = (byte)0x14; // push 20 bytes > > System.arraycopy(hash, 0, buf, 2, hash.length); // keyhash > > buf[22] = (byte)0x87; // OP_EQUAL > > > > return new Script(buf); > > } > > > > public static Script segWitRedeemScript() { > > > > // > > // The P2SH segwit redeemScript is always 22 bytes. It starts with a > > OP_0, followed by a canonical push of the keyhash (i.e. > 0x0014{20-byte > > keyhash}) > > // > > ECKey ecKey = new ECKey(); > > > > byte[] hash = Utils.sha256hash160(ecKey.getPubKey()); > > byte[] buf = new byte[2 + hash.length]; > > buf[0] = (byte)0x00; // OP_0 > > buf[1] = (byte)0x14; // push 20 bytes > > System.arraycopy(hash, 0, buf, 2, hash.length); // keyhash > > > > return new Script(buf); > > } > > > > > > i am not able to receive payment on the Segwit Address, but when i > send payment on Standard Addr then i receive it. > > > > what i am doing wrong here ? > > > > -- > > 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 > <https://groups.google.com/d/optout>. > > > -- > 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 > <mailto:bitcoinj+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- 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.