cardano-address
cardano-addresses
cardano-addresses is a module that provides mnemonic (backup phrase) creation, and conversion of a mnemonic to seed for wallet restoration, and address derivation functionalities. It supports both Byron and Shelley wallets and is a useful tool for generating new addresses.
Building and running
Recommended:
- Unpack and unzip the tar file Latest releases page cardano-addresses-x.x.x-xxxxx64.tar.gz to expose the pre-built binary 'cardano-address'.
- chmod +x cardano-address to make prebuilt binary executable
- Run the commands below to use cardano-addresses
Alternative build approach
- Docker
- Nix package manager
Sample commands
#### Generate Byron mnemonic and address #####
./cardano-address recovery-phrase generate --size 12 > byron_mnemonic.prv
cat byron_mnemonic.prv
drastic next obscure flip recycle vapor frown public talent beyond elbow language
cat byron_mnemonic.prv | ./cardano-address key from-recovery-phrase Byron > byron_root.prv
cat byron_root.prv
xprv1jpgscha3s63ymzhlyzxeaur5tg6gnccc6f7qf5pgfv69x2gm5erkvkxvczl2yxg333yhwwncqcv25fw23ct6alw7x32lptk2gcnt7pdzeq9jmwhnewpdx6aft4ja6j7d3xxq7aptzkjryu293026n6zz0qqxxy33
cat byron_root.prv | ./cardano-address key child 14H/42H > byron_addr.prv
cat byron_addr.prv
xprv1fphmm0jh67vtegmgw9glsc0c934qgfjj5h3v5nvsmr3zzdgm5er4jnx7mdxmamr4rc9c4ca9hsyvxvhkwj9tvh4xr64xmyf6df74cnenzf05tyhnqwl98p9a36kh54pmzlylqur5ynka5rve9dc9rq0ua5tsvevr
cat byron_addr.prv | ./cardano-address key public > byron_addr.pub
cat byron_addr.pub
xpub1qrq40c29mr63cukfn7wfgvr7fgk5ccaqksanzet7cz2dt2v7zl4nxyjlgkf0xqa72wztmr4d0f2rk97f7pc8gf8dmgxej2ms2xqlemgdvr4ej$ cat root.prv | cardano-address key public > byron_root_addr.pub
cat byron_root_addr.pub
xpub1fustch8590nrmdns3csl5twywtua8lhn8an59uyvnrhzkzvxgr2gdj4tn708mm54066p8fzaen95ds0uek6l30zmremrakkxm569regjv35tn
$ cat byron_addr.pub | cardano-address address bootstrap $(cat byron_root_addr.pub) --network-tag 764824073 --path 14H/42H > byron_addr.pay
cat byron_addr.pay
DdzFFzCqrhskAjmWewKzoTDiW7exmzvb6n93Gfp59QnAhGLscFaKH6VR81ShwJkAAAvuyzMEs9sdSU8ftTPAUcU72Az4DdK3kxVKzLV6
#### Generate Shelley mnemonic and address #####
./cardano-address recovery-phrase generate --size 15 > mnemonic.prv
cat mnemonic.prv | ./cardano-address key from-recovery-phrase Shelley > root.prv
cat root.prv | ./cardano-address key child 1852H/1815H/0H/0/0 > addr.prv
cat addr.prv | ./cardano-address key public > addr.pub
cat addr.pub | ./cardano-address address payment --network-tag 1 > addr.pay
cat addr.pay
addr1vydprr8wqxrt48kzkrja5qnqze05jqjfegl655cnysprjkcjs9w9n
Find the cardano-wallet derivation path with cardano-addresses 3.1.0 and above
Step 1:
cat byron_mnemonic.prv | ./cardano-address key from-recovery-phrase Byron > byron_root.prv cat byron_root.prv
Step 2:
#INSPECT ADDRESS FROM THE CARDNO-WALLET.. NOTE HERE THAT DERIVATION PATH IS STILL ENCRYPTEDecho "37btjrVyb4KDMR2hTPW1snhR1qX7Uu3ZnangFv6JGhEYRSPSRQNSV4mGdtKeupNa5UG3Z6Yd6XRdP6uLVErB4d11Evs6EC68qE9EcW7yzib5HJN1He" | ./cardano-address address inspect
{
"stake_reference": "none",
"address_style": "Byron",
"address_root": "76ed647f21f627e6662f7d89297aeb44dc5bf1bdaf816e22f53d3893",
"derivation_path": "581c0cdf39b531d1ac76972cd6836dc2c8fffcd66056bcfd89f08618bbd8",
"network_tag": 1097911063
}
Step 3:
#GENERATE THE ROOT PUBLIC KEY THAT INCLUDES THE CHAIN CODE.. THIS WILL BE USED WITH THE INSPECT FUNCTION OF CARDANO-ADDRESSES
cat byron_root.prv | ./cardano-address key public --with-chain-code > byron_root.pub
cat byron_root.pub
root_xvk1a8tzutd7m7dccettwfhgl6qaegl9rf9kkf2l8mnvekz8g8ywduk5v6hu8aw57474gdltndsqku5rqrrdgwa6zpw6jhcnpylfgqzutaqc43jyy
Step 4
# INSPECT THE ADDRESS AND DECRYPT THE DERIVATION PATH
echo -n "37btjrVyb4KDMR2hTPW1snhR1qX7Uu3ZnangFv6JGhEYRSPSRQNSV4mGdtKeupNa5UG3Z6Yd6XRdP6uLVErB4d11Evs6EC68qE9EcW7yzib5HJN1He" | ./cardano-address address inspect --root root_xvk1a8tzutd7m7dccettwfhgl6qaegl9rf9kkf2l8mnvekz8g8ywduk5v6hu8aw57474gdltndsqku5rqrrdgwa6zpw6jhcnpylfgqzutaqc43jyy
{
"stake_reference": "none",
"address_style": "Byron",
"address_root": "76ed647f21f627e6662f7d89297aeb44dc5bf1bdaf816e22f53d3893",
"derivation_path": {
"account_index": "0H",
"address_index": "0H"
},
"network_tag": 1097911063
}
Note the account index and the address index has been decrypted you can generate a new address within the wallet by using account_index/address_index + some random number
Related documentation