0

我使用 BitcoinJ 为比特币创建了一个加密货币钱包。现在我想在这个钱包中添加莱特币。如何为莱特币实现 BitcoinJ 依赖?在为莱特币和比特币使用 BitcoinJ 时,我得到了两个地址的比特币区块链。我应该怎么做才能获得比特币地址的比特币区块链和莱特币地址的莱特币区块链?

这是我使用的依赖项>>>

  implementation 'org.bitcoinj:bitcoinj-core:0.14.7'

这是我的比特币区块链下载初始化代码>>>

  public void initWallet() {
    ECKey key;
    String btcpri = 
     "cxxxxxre75ENAnpGjUr8EEdP2kxtvk1r65nTydnM954n4WxxxxxM";
    if (btcpri.length() == 51 || btcpri.length() == 52) {
        DumpedPrivateKey dumpedPrivateKey = 
        DumpedPrivateKey.fromBase58(params, btcpri);
        key = dumpedPrivateKey.getKey();
    } else {
        BigInteger privKey = Base58.decodeToBigInteger(btcpri);
        key = ECKey.fromPrivate(privKey);
    }
    Log.e("key ", String.valueOf(key));
    setBtcSDKThread();
    BriefLogFormatter.init();

    kit = new WalletAppKit(params, file, "btc_justbitcoin") {
        @Override
        protected void onSetupCompleted() {
            wallet().importKey(key);
            setupWalletListeners(wallet());
            Log.e("Address ", 
            String.valueOf(wallet().freshReceiveAddress()));
        }
    };
    kit.setBlockingStartup(false);
    kit.startAsync();
    kit.awaitRunning();
 }
4

0 回答 0