Great question! Fundamentally, you want to use cardano-wallet to replace the following script in cardano-cli.
cardano-cli address key-gen \
--verification-key-file key.vkey \
--signing-key-file pkey.skey
In this tutorial, I will show you how convert the keys from the wallet format into the cli format.
First, create your recovery phrase and then a private key from that phrase. You have probably already completed this step, but here is an example:
cardano-address recovery-phrase generate --size 15 > phrase.prv
cardano-address key from-recovery-phrase Shelley < phrase.prv > root.xsk
Just for safety, let's go ahead and create a child key from that root key. It is not necessary, but we should get into in the habits of good security practices.
cat root.xsk | cardano-address key child 1852H/1815H/0H/0/0 > key.xsk
We have created our root.xsk and then from it our key.xsk. We want to use key.xsk to sign transactions. However, if you try to put it directly into cardano-cli, you will get an error. Even if you were to put it into a JSON format, you still would not be able to use it. We have to convert it into a different format vis a vis the following:
cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file key.xsk --out-file key.skey
Now we have converted our key.xsk into a key.skey. Now we have to create a verification key:
cardano-cli key verification-key --signing-key-file key.skey --verification-key-file key.vkey
Excellent! Now we have a key.skey and a key.vkey. You know what to do! Go ahead and create an address...
cardano-cli address build --payment-verification-key-file key.vkey --out-file key.addr --testnet-magic 1097911063
...and then build the transaction.
cardano-cli transaction sign \
--tx-body-file body.raw \
--testnet-magic 1097911063 \
--signing-key-file key.skey \
--out-file signFile.signed
Boom! You should be done!
We went from our child key.xsk, which looks like
{
"chain_code": "4bfecd01af45a1abde446ec69522867a309f927f61a26d286d2475369e888e46",
"key_type": "private",
"extended_key": "c024ea34b52056996acb2f8f7d74b78b610ed773fb4ff6b933e460714dd8455edf6ea0b09c190126d364e69df714aef5824c7630f7b70e42050149f98b704448"
}
to our key.skey, which looks like
{
"type": "PaymentExtendedSigningKeyShelley_ed25519_bip32",
"description": "",
"cborHex": "5880c024ea34b52056996acb2f8f7d74b78b610ed773fb4ff6b933e460714dd8455edf6ea0b09c190126d364e69df714aef5824c7630f7b70e42050149f98b7044480782a02ee41c9d7455faf2df6f36edb0c9d0c2c31eaf9e2f10f255ead21f53074bfecd01af45a1abde446ec69522867a309f927f61a26d286d2475369e888e46"
}
Sources
A great reference produced by the Cardano Foundation
The associated examples