Create Cardano Wallet
On this page I will explain how to generate a Cardano wallet based on mnemonic seed phrase phrase wich gets generated with cardano-wallet CLI.
This tutorial was successful with cardano-wallet-v2022-01-18-linux64.tar.gz
System: Ubuntu 20.04.03 LTS Shell: bash Cardano Node: 1.33.0 (included in cardano-wallet-v2022-01-18)
Credits to ilap and for sure the great COINCASHEW crew. They have already finished almost 100%of the work and I only try to contribute at least a tiny bit.
Most wallets use a recovery phrase / mnemonic seed length of 15 or 24 words. In this expample we will use 24 words.
Benefits of mnemonic based wallets: Track and control pool rewards from any wallet (Daedalus, YOROI or any other wallet) that support stakings.
Good to know: a mnemonic seed phrase is not a pure random number of 15 to 24 words. Words need to be select from a specific library - not all words from all languages are allowed. Indeed, only specific english lowercase words are allowed. Anyway, will not select the words for our seed manually. We will use the cardano-wallet cli, which is part Cardano Wallet library.

1. Download latest cardano-wallet release

GitHub - input-output-hk/cardano-wallet: HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
GitHub
Link to latest cardano-wallet release

2. Lets create the wallet with all necessary keys and phrases

1
# Uncompress the downloaded file in your home directory
2
cd $HOME
3
mkdir cardano-wallet
Copied!
Now pls copy your downloaded cardano-wallet-v20<XX>-<XX>-<XX>-linux64.tar.gz file into the cardano-wallet folder and uncopress it.
<XX> in cardano-wallet-v20<XX>-<XX>-<XX>-linux64.tar.gz might be different at the time you will create your wallet because their is a new release available!
1
cd $HOME/cardano-wallet
2
tar -zxvf cardano-wallet-v20<XX>-<XX>-<XX>-linux64.tar.gz
Copied!
In the next step we will already be able to generate our mnemonic seed phrase with cardano-wallet cli
1
# Set PATH variable temporary (within the current shell session)
2
# to use the cli cardano-wallet
3
cd $HOME/cardano-wallet
4
export PATH="$(pwd)/cardano-wallet-v20<XX>-<XX>-<XX>-linux64:$PATH"
Copied!
Lets generate a 24 words long recovery phrase / mnemonic seed phrase by using the cardano-address cli
1
# cardano-wallet is located in cardano-wallet-v20<XX>-<XX>-<XX>-linux64
2
cardano-wallet recovery-phrase generate --size 24 > mnemonic-phrase.dat
Copied!
Lets have a look inside the mnemonic-phrase.dat file
1
# you will see 24 words randomly choosen from the allowed
2
nano mnemonic-phrase.dat
3
# you will see a line of words separated by spaces:
4
# word1 word2 word3 word4 ... word24
5
# about about century destroy ... diet
Copied!

3. Generate your private cardano wallet keys

These steps must be done on an air-gapped machine. That means the PC, notebook, raspberrypi what ever device you use to generate your wallet is NOT connected to the internet and will never be. You will store informations on this enveronment that will allow attackers to steel youf funds!
  1. 1.
    Make shure to copy mainnet-shelley-genesis.json into your $HOME/cardano-wallet folder
  2. 2.
    Check if jq (JASON convert) is installed on your system. If not run: sudo apt-get install jq If you get the error: E: Couldn't find package jq you need to update your system and include the specific repositories.
  3. 3.
    TESTNET: change mainnet-shelley-genesis.json to testnet-shelley-genesis.json in extractPoolStakingKeys.sh (NOT TESTED)
Create extractPoolStakingKeys.sh script.
1
###
2
### On air-gapped offline machine!
3
###
4
cat > extractPoolStakingKeys.sh << HERE
5
#!/bin/bash
6
7
# original work from ilap https://gist.github.com/ilap/3fd57e39520c90f084d25b0ef2b96894
8
# UPDATE by den-is https://gist.github.com/den-is/0fb758b07cdb68abc968b3dea689fa9b
9
10
CADDR=${CADDR:=$( which cardano-address )}
11
[[ -z "$CADDR" ]] && { echo "cardano-address cannot be found, exiting..." >&2 ; exit 127; }
12
13
CCLI=${CCLI:=$( which cardano-cli )}
14
[[ -z "$CCLI" ]] && { echo "cardano-cli cannot be found, exiting..." >&2 ; exit 127; }
15
16
BECH32=${BECH32:=$( which bech32 )}
17
[[ -z "$BECH32" ]] && { echo "bech32 cannot be found, exiting..." >&2 ; exit 127; }
18
19
# Only 24-word length mnemonic is supported only
20
[[ "$#" -ne 26 ]] && {
21
echo "usage: $(basename $0) <change index e.g. 0/1 external/internal> <ouptut dir> <24-word length mnemonic>" >&2
22
exit 127
23
}
24
25
GEN_FILE=${GEN_FILE:="$HOME/cardano-wallet/mainnet-shelley-genesis.json"}
26
[[ ! -f "$GEN_FILE" ]] && { echo "genesis file does not exit, exiting..." >&2 ; exit 127; }
27
28
IDX=$1
29
shift
30
31
OUT_DIR="$1"
32
[[ -e "$OUT_DIR" ]] && {
33
echo "The \"$OUT_DIR\" is already exist delete and run again." >&2
34
exit 127
35
} || mkdir -p "$OUT_DIR" && pushd "$OUT_DIR" >/dev/null
36
37
shift
38
MNEMONIC="$*"
39
40
# Generate the master key from mnemonics and derive the stake account keys
41
# as extended private and public keys (xpub, xprv)
42
echo "$MNEMONIC" |\
43
"$CADDR" key from-recovery-phrase Shelley > root.prv
44
45
cat root.prv |\
46
"$CADDR" key child 1852H/1815H/0H/2/0 > stake.xprv
47
48
cat root.prv |\
49
"$CADDR" key child 1852H/1815H/0H/$IDX/0 > payment.xprv
50
51
# XPrv/XPub conversion to normal private and public key, keep in mind the
52
# keypars are not a valind Ed25519 signing keypairs.
53
NW=$(jq '.networkId' -r "$GEN_FILE")
54
NW_ID=$(jq '.networkMagic' -r "$GEN_FILE")
55
56
echo "Generating $NW wallet..."
57
if [ "$NW" == "Testnet" ]; then
58
NETWORK=0
59
MAGIC="--testnet-magic $NW_ID"
60
CONV="bech32 | bech32 addr_test"
61
else
62
NETWORK=1
63
MAGIC="--mainnet"
64
CONV="cat"
65
fi
66
67
cat payment.xprv |\
68
"$CADDR" key public --with-chain-code | tee payment.xpub |\
69
"$CADDR" address payment --network-tag $NETWORK |\
70
"$CADDR" address delegation $(cat stake.xprv | "$CADDR" key public --with-chain-code | tee stake.xpub) |\
71
tee base.addr_candidate |\
72
"$CADDR" address inspect
73
74
echo
75
76
echo "Generated from 1852H/1815H/0H/$IDX/0"
77
if [ "$NW" == "Testnet" ]; then
78
cat base.addr_candidate | bech32 | bech32 addr_test > base.addr_candidate_test
79
mv base.addr_candidate_test base.addr_candidate
80
fi
81
82
cat base.addr_candidate
83
echo
84
85
# Convert cardano-addresses extended signing keys to corresponding Shelley-format keys.
86
"$CCLI" key convert-cardano-address-key --shelley-payment-key --signing-key-file payment.xprv --out-file payment.skey
87
"$CCLI" key convert-cardano-address-key --shelley-stake-key --signing-key-file stake.xprv --out-file stake.skey
88
89
# Get verification keys from signing keys.
90
"$CCLI" key verification-key --signing-key-file stake.skey --verification-key-file stake.evkey
91
"$CCLI" key verification-key --signing-key-file payment.skey --verification-key-file payment.evkey
92
93
# Get non-extended verification keys from extended verification keys.
94
"$CCLI" key non-extended-key --extended-verification-key-file stake.evkey --verification-key-file stake.vkey
95
"$CCLI" key non-extended-key --extended-verification-key-file payment.evkey --verification-key-file payment.vkey
96
97
# Build stake and payment addresses
98
"$CCLI" stake-address build --stake-verification-key-file stake.vkey $MAGIC --out-file stake.addr
99
"$CCLI" address build --payment-verification-key-file payment.vkey $MAGIC --out-file payment.addr
100
"$CCLI" address build \
101
--payment-verification-key-file payment.vkey \
102
--stake-verification-key-file stake.vkey \
103
$MAGIC \
104
--out-file base.addr
105
106
107
echo "Important the base.addr and the base.addr_candidate must be the same"
108
diff -s base.addr base.addr_candidate
109
110
echo
111
cat base.addr
112
echo
113
cat base.addr_candidate
114
115
116
popd >/dev/null
117
HERE
Copied!
Now we need to add execution permisson to extractPoolStakingKeys.sh
1
###
2
### On air-gapped offline machine,
3
###
4
chmod +x extractPoolStakingKeys.sh
Copied!
Extract your keys. Update the command with your mnemonic phrase.
1
###
2
### On air-gapped offline machine,
3
###
4
./extractPoolStakingKeys.sh 0 extractedPoolKeys/ $(cat mnemonic-phrase.dat)
Copied!
IMPORTANT: Please check carefully if the base.addr and the base.addr_candidate are identical!
Your new staking keys are in the folder extractedPoolKeys/
Now move payment/stake key pair over to your $HOME/key folder
1
###
2
### On air-gapped offline machine,
3
###
4
cd extractedPoolKeys/
5
cp stake.vkey stake.skey stake.addr payment.vkey payment.skey base.addr $HOME
6
cd $HOME
7
#Rename to base.addr file to payment.addr
8
mv base.addr payment.addr
Copied!
payment.addr, or also known as base.addr from this extraction script, will be the cardano address which holds your pool's pledge.
Finally close all your terminal windows and open new ones with zero history.
1
###
2
### On air-gapped offline machine,
3
###
4
history -c && history -w
Copied!
Congratulations! You have generated all your required keys to interact with the Cardano ecosystem.
👍

Fund your payment address

Copy payment.addr to your hot environment (with internet connection and fully sycroniced node). Payment address can be funded from your Daedalus / Yoroi wallet. Run the following to find your payment address.
1
cat payment.addr
Copied!
RECOMMENDATION: Only fund the minimum amount of ADA initally to your new payment.addr to test if everything works as expected. The minimum is 1 ADA.
You should be able to:
  1. 1.
    Receive funds on your payment.addr
  2. 2.
    Sent funds from your payment.addr to any other wallet address You could try to send some ADA to: addr1qyrytjmrf37r0cfas4pa9ss3v3tgqy0m7v4ljmkwtj4m33u4y6asl5ruap3hj6cqhyjn7guh9z4a3ya58xdh064zq8yq4n09fd
After funding your account, check your payment address balance.
Before continuing, your nodes must be fully synchronized to the blockchain. Otherwise, you won't see your funds.
MAINNET: Fully Syncronized Node
TESTNET: Fully Syncronized Node
1
cardano-cli query utxo \
2
--address $(cat payment.addr) \
3
--mainnet
Copied!
1
cardano-cli query utxo \
2
--address $(cat payment.addr) \
3
--testnet-magic 1097911063
Copied!
You should see output similar to this. This is your unspent transaction output (UXTO).
1
TxHash TxIx Lovelace
2
----------------------------------------------------------------------------------------
3
100322a39d02c2ead.... 0 1000000
Copied!
PLAN B to check the balance:
https://cardanoscan.io (TESTNET available) Simply put the output of $(cat payment.addr) into the search field.