Does anyone knows how to move from payment verification and signing
keys to a public address or a mnemonic phrase useful to register my
wallet on Cardano-Wallet-Server?
I think you're not able to make that kind of derivation since we are dealing with addr.xsk (from derivation path root.xsk -> acct.xsk -> addr.xsk
). And wallet needs to know about root and acct keys.
You can however use cardano-addresses to create all those keys and generate address with them, and then use cardano-cli key convert-cardano-address-key
to convert them into format that is readable by cardano-cli
if you wish:
- Generate mnemonics
$ cardano-address recovery-phrase generate --size 24 > mnemonics.txt
Using these mnemonics you can already restore the wallet on cardano-wallet server.
- Create root.xsk
$ cardano-address key from-recovery-phrase Shelley < mnemonics.txt > root.xsk
(BTW, at this point you can already figure out what will be wallet id)
$ cardano-address key walletid < root.xsk
- Derive addr.xsk and stake.xsk
$ cardano-address key child 1852H/1815H/0H/0/0 < root.xsk > addr.xsk
$ cardano-address key child 1852H/1815H/0H/2/0 < root.xsk > stake.xsk
- Generate public/verification keys:
$ cardano-address key public --without-chain-code < addr.xsk > payment.vkey
$ cardano-address key public --without-chain-code < stake.xsk > stake.vkey
- Generate wallet address:
$ cardano-address address payment --network-tag preprod < payment.vkey \
| cardano-address address delegation $(cat stake.vkey) > payment.addr
addr.xsk -> 1852H/1815H/0H/0/0
, so this is going to be first address on the wallet, next in the sequence would be 1852H/1815H/0H/0/1
etc. (stake.xsk stays the same)
The address can be also generated with cardano-cli
:
cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--out-file paymentCli.addr \
--testnet-magic 1 # preprod
You'll notice that payment.addr
== paymentCli.addr
.
- Now, if you'd like to spend from the address also with
cardano-cli
:
Convert xsk:
$ cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file addr.xsk --out-file payment.skey
$ cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file stake.xsk --out-file stake.skey
Now, you can spend the address using cardano-cli (with payment.skey or stake.skey), e.g.:
$ cardano-cli query utxo --address $(cat payment.addr) --testnet-magic 1
$ cardano-cli query protocol-parameters \
--testnet-magic 1 \
--out-file protocol.json
$ cardano-cli transaction build \
--babbage-era \
--testnet-magic 1 \
--tx-in "3f546b8d958d65b9e0f93030ac4afdc95b92c0dfdadaad1a063bf7024ee0378d#0" \
--tx-out "addr_test1qzfdywms54mk9hclupc3yhu8yev6w92swndcaewvxx53ux0vwaztjw0fjsgfmvdqtq3tn4df0ja9tgvxmmapehnmjcxq8u7f98+1000000" \
--change-address $(cat payment.addr) \
--protocol-params-file protocol.json \
--out-file body.tx
$ cardano-cli transaction sign \
--tx-body-file body.tx \
--testnet-magic 2 \
--signing-key-file payment.skey \
--out-file signed.tx
$ cardano-cli transaction submit --tx-file signed.tx --testnet-magic 1