0

I am trying to generate a list of (unused) payment addresses with CardanoCLI-JS, but how to do it?

    const wallet = cardanocliJs.wallet("Main");
    const address = cardanocliJs.addressBuild("Main", {
      paymentVkey: wallet.payment.vkey,
      stakeVkey: wallet.stake.vkey,
    });

console.log(address);

This outputs the location of the vkey, which gets updated on execution, but contains the same address as before?

Is this something CardanoCLI-JS just can't do right now?

Cardano-Wallet-JS has wallet.getAddresses(), which returns an array of 20 addresses, but I'd really like to stick to one JS library...

(Can someone pls create the tags cardanocli-js and cardano-wallet-js? thanks...)

1 Answer 1

2

The cardano-cli (what the JS library wraps) has no notion of what a wallet is, how to derive addresses from mnemonic/public key, etc... cardano-wallet-js wraps the cardano-wallet process and can get information about a wallet and it's state on the network (which is required if you want to know unused addresses as a process needs to scrape entire chain to see if an address has been used or not). If you're looking for a simple library to derive addresses and don't care about state, there's a GHCJS build of cardano-addresses https://www.npmjs.com/package/cardano-addresses which provides the ability to derive addresses from a root key, account public key or your 24 word mnemonic for the wallet. However; to identify if an address was used or not, you would need a db-sync or explorer API (like graphql, blockfrost, rosetta, etc...) to check the state of the chain for that particular address.

2
  • Thanks for clearing this up... kinda confusing if you ask me. Why not work on ONE JS Library which can do it all?
    – rx2347
    Dec 14, 2021 at 17:46
  • Mainly because running js code is slow. Dec 23, 2021 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.