1

Is it possible to generate new address and private key for cardano using blockfrost.io api, that later on can use for transactions and adding it into wallet.

thank you

2 Answers 2

2

Short answer is no, because it poses a security risk for both them (generating and transmitting keys over the network) and the end-user consuming their service to do so (trusting the API not to log or persist those keys).

As with all other blockchains, the responsibility of generating (and securely storing) keys and addresses generally lie with the end-user who wants to interact with it. As they say, not your keys, not your wallet.

That said, you can generate them through:

  • CLI tools (e.g. cardano-cli, or cscli)
  • SDKs in your language of choice (e.g. CardanoSharp, cardano-serialization-lib, cardano-client-lib, etc.)
  • Software wallets which can generate recovery-phrases and root keys to derive multiple keys/addresses (e.g. Eternl/CC, Daedalus, Flint, Yoroi, etc.)
  • Hardware wallets with embedded root keys (e.g. Ledger, Trezor, etc.)

It is also worthwhile mentioning that you should practice extreme caution when generating the keys yourself. I highly recommend using an air-gapped machine, never storing the raw recovery-phrase digitally (raw text,photo,etc.) and never sharing it with anyone else.

2
  • thank you do you know is it possible to generate lite wallet of cardano or how can it possible Commented May 2, 2022 at 8:08
  • At this stage I would ask what exactly are you trying to achieve? Do you mean to generate a set of wallet keys/addresses locally? Or to build light wallet software (e.g. my third point) yourself?
    – keefie
    Commented May 3, 2022 at 2:52
0

Looking at the docs at https://docs.blockfrost.io/ I'm pretty sure that's not possible.

Your best option might be to use a package like this, if your in nodejs:

https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-nodejs

(or this version for the browser: https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-browser)

The generation of keys with this library is explained here:

https://github.com/Emurgo/cardano-serialization-lib/blob/master/doc/getting-started/generating-keys.md

and can look something like this:

  const rootKey = Bip32PrivateKey.generate_ed25519_bip32();

  const harden = (num: number): number => {
    return 0x80000000 + num;
  }

  const accountKey = rootKey.derive(harden(1852)).derive(harden(1815)).derive(harden(0));
  const utxoPubKey = accountKey.derive(0).derive(0);
  const stakeKey = accountKey.derive(2).derive(0);

  const baseAddress = BaseAddress.new(
    NetworkInfo.testnet().network_id(), // Testnet
    StakeCredential.from_keyhash(utxoPubKey.to_public().to_raw_key().hash()),
    StakeCredential.from_keyhash(stakeKey.to_public().to_raw_key().hash())
  )

  console.log("New address: ", baseAddress.to_address().to_bech32())

There are of course also other ways to generate the keys, eg. via the CLI: https://developers.cardano.org/docs/stake-pool-course/handbook/keys-addresses/

1

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.