4

yoroi and daedalus provide UI to generate new wallet address, how can i use cardano-wallet cli and cardano rest api to generate new address?

2 Answers 2

3

Once you have your cardano-wallet runnig, you can create a new wallet using CLI with the following command:

$ cardano-wallet wallet create from-recovery-phrase "My Wallet"
Please enter a 15–24 word recovery-phrase sentence: <enter generated recovery-phrase words here>
(Enter a blank line if you do not wish to use a second factor.)
Please enter a 9–12 word recovery-phrase second factor: <skip or enter new recovery-phrase words here>
Please enter a passphrase: ****************
Enter the passphrase a second time: ****************
$

See more cardano-wallet cli commands.


To create a new wallet using cardano-wallet REST API, you can use the following command:

$ curl -vX POST http://localhost:8090/v2/wallets \
   -H "Content-Type: application/json; charset=utf-8" \
   -d '{
        "name": "Shelley",
        "mnemonic_sentence": ["identify", "screen", "lock", "bargain", "inch", "drop", "canyon", "flock", "dry", "zone", "wash", "argue", "system", "glory", "light"],
        "passphrase": "Secure Passphrase",
        "address_pool_gap": 20
        }'

See REST API documentation for more information about this call.

2
  • 3
    I know how to create wallet, I have already read the documentation. I want to know how to generate new address when you created your own wallet, there is 20 address in your wallet after created, I want to generate more.
    – mackie
    Jun 2, 2021 at 7:56
  • 1
    This is what address_pool_gap is for, you can specify more than 20 address, but be careful! Using values other than 20 automatically makes your wallet invalid with regards to BIP-44 address discovery (github.com/bitcoin/bips/blob/master/bip-0044.mediawiki). It means that you will not be able to fully restore your wallet in a different software which is strictly following BIP-44. Jun 2, 2021 at 10:08
2

Do you mean something like that?

# generate keys
cardano-cli address key-gen --verification-key-file payment.vkey --signing-key-file payment.skey
# build address from pubkey
cardano-cli address build --payment-verification-key-file payment.vkey --out-file payment.addr --mainnet
1
  • yeah, but instead of using cardano-cli, i'm using cardano-wallet cli and wallet backend restful api.
    – mackie
    Jun 2, 2021 at 6:57

Your Answer

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

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