dogecoin / libdohj

Java library for adding altcoin support to bitcoinj
Apache License 2.0
107 stars 89 forks source link

add support for P2SH and bech32 for Litecoin #58

Open mehranj73 opened 2 years ago

mehranj73 commented 2 years ago

Please add support for P2SH and bech32 address types for Litecoin. I wish I had the knowledge to do so. Maybe you can use this.

P2SH:

val key = ECKey.fromPrivate(BigInteger("12"))
val redeemScript: Script = ScriptBuilder.createP2WPKHOutputScript(key)
val script = ScriptBuilder.createP2SHOutputScript(redeemScript)
val scriptHash = ScriptPattern.extractHashFromP2SH(script)
LegacyAddress.fromScriptHash(params, scriptHash).toString()

bech32: SegwitAddress.fromKey(params, key).toString()

All address types:

MKyc39yFiUtVBFkE7Av1iuU5GHX9eHYRrx
LfNppYBGy9fdDzFbcddJKYR2e6ZZqCfsnW
ltc1qm5gqhe7e46jhyy2ca00x66slmrlljwa340ldnq