版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
26 篇文章1 订阅
订阅专栏
25 篇文章8 订阅
订阅专栏
1.首先引入bitcoinj最新的库
compile 'org.bitcoinj:bitcoinj-core:0.15'
3.生成不同格式地址代码如下:
LegacyAddress address1 = LegacyAddress.fromKey(networkParameters, ecKey); System.out.println("1开头的地址:" + address1.toBase58()); LegacyAddress address3 = LegacyAddress.fromScriptHash(networkParameters, ecKey.getPubKeyHash()); System.out.println("3开头的地址:" + address3.toBase58()); SegwitAddress segwitAddress = SegwitAddress.fromKey(networkParameters, ecKey); System.out.println("bc1开头的地址:" + segwitAddress.toBech32());
打印结果:
1开头的地址:1AMWsQHBgBCmMog3JxSkvAT5NcXQeGNxba
3开头的地址:3B3XnwmdE5X9SyNUS47MLnp1X8p8Afi8kx
bc1开头的地址:bc1qv6dxy7tmsyupwp46skcdg08c8693c6chrcu94h
收藏
一键三连
扫一扫,分享海报
专栏目录
1.测试网络 获取btc https://testnet.coinfaucet.eu/en/ https://live.blockcypher.com/ btc:https://github.com/Samourai-Wallet/samourai-wallet-android eth:https://gitter.im/web3j/web3j eos:https://eos.io/ 2.引...