0

Using Blockfrost API, I can query a stake address, and receive known addresses that have "state=used" like when I query them on my local node via Cardano-Wallet. I am interested in "state=unused" though. How can I get unused receiving addresses for a stake key using Blockfrost API?

EDIT: When I use:

localhost:[port]/v2/wallets/[wallet id]/addresses?state=unused' | jq '.[0]

...on my local instance of cardano-wallet, I get the first addr for the wallet that has state=unused I was hoping for something similar from the blockfrost api - so I could avoid having to setup something that provides it to my web app from my local linux box where I have cardano-node & cardano-wallet running

2 Answers 2

1

The ask seems fundamentally wrong, as unused wallets - by definition - are not on-chain and can only be derived using root public keys (in case you haven't, could be helpful for you to check BIP-44 spec that is used by cardano-wallet ). The derivation of addresses can be easily achieved via one of the SDK/libs offline (you can find many of them at developer portal - most popular ones being cardano-serialisation-lib and cardano-multiplatform-lib).

Some notes tho about these (adding here, tho it may not be relevant for your context):

  1. There can be close to infinite unused addresses for a given stake account. You may see limited number of addresses because of default BIP-44 address gap (20), but that will not be all-inclusive list.
  2. One can only derive addresses at different address idx if they have the root pub key, wouldn't be a good practice to rely on external services, especially when you have libraries to do it locally.
  3. Even if you were to use a remote service that would provide list of addresses , from query pov - it would never be guaranteed to include different combinations of payment and stake key credentials , as they can also be merged across from different wallets.
2
  • Thank you for taking the time to answer. When I use: > localhost:[port]/v2/wallets/[wallet id]/addresses?state=unused' | jq '.[0] on my local instance of cardano-wallet, I get the first addr for the wallet that has state=unused I was hoping for something similar from the blockfrost api - so I could avoid having to setup something that provides it to my web app from my local linux box where I have cardano-node & cardano-wallet running Commented Jul 19, 2022 at 15:08
  • You do not need cardano-node/cardano-wallet/etc running, the links above refer to SDKs/libs that should allow you to do this on the device where private keys , while fetching tx-in/UTxO details can be from blockfrost.io/koios.rest/etc
    – RdLrT
    Commented Jul 21, 2022 at 6:39
0

So the correct answer appears to be: "That's not possible". The Blockfrost API does not have a utility call of any kind that returns an unused address of a given wallet.

The Blockfrost API does have a call that returns known used addresses from the blockchain though.

To generate an address for a given set of private keys, I can use one of the libraries as mentioned by RdLrt, thank you.

cardano-serialisation-lib or cardano-multiplatform-lib.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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