Saturday, July 6, 2024

Problem with the BitcoinJ for Litecoin. Which dependency can be utilized for Litecoin?

I’ve created a crypto-currency pockets for Bitcoin utilizing BitcoinJ. Now I wish to add Litecoin on this pockets. How you can implement BitcoinJ dependency for Litecoin?
Whereas utilizing BitcoinJ for each Litecoin and Bitcoin, I used to be getting blockchain of Bitcoin for each the addresses. What ought to I achieve this that I can get Bicoin blockchain for Bitcoin deal with and Litecoin blockchain for Litecoin deal with?

right here is dependency which is I used>>>

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

right here is my code for bitcoin blockchain obtain initialisation>>>

  public void initWallet() {
    ECKey key;
    String btcpri = 
     "cxxxxxre75ENAnpGjUr8EEdP2kxtvk1r65nTydnM954n4WxxxxxM";
    if (btcpri.size() == 51 || btcpri.size() == 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();

    package = new WalletAppKit(params, file, "btc_justbitcoin") {
        @Override
        protected void onSetupCompleted() {
            pockets().importKey(key);
            setupWalletListeners(pockets());
            Log.e("Deal with ", 
            String.valueOf(pockets().freshReceiveAddress()));
        }
    };
    package.setBlockingStartup(false);
    package.startAsync();
    package.awaitRunning();
 }

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles