Create Your BABY Address
Your BABY key derives the address where BABY token can be received. Below are the steps to create your BABY key and retrieve a BABY address, and how to recover the key with the mnemonic phrase.
1. Install the babylond
binary
The babylond
binary creates your Babylon Genesis keys. You'll need to use babylond v1.0.0-rc.5. Here's how to install the binary:
First, clone the official Babylon GitHub repository.
git clone https://github.com/babylonlabs-io/babylon.git
Cloning into 'babylon'...
Navigate to the cloned repository and checkout the v1.0.0-rc.5
release tag.
git clone https://github.com/babylonlabs-io/babylon.git
Cloning into 'babylon'...
Install the binary with the make install
command.
make install
go build -mod=readonly -tags "netgo ledger mainnet" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=babylon -X github.com/cosmos/cosmos-sdk/version.AppName=babylond -X github.com/cosmos/cosmos-sdk/version.Version=v1.0.0-rc.3 -X github.com/cosmos/cosmos-sdk/version.Commit=b5646552a1606e38fcdfa97ed2606549b9a233f7 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger" -w -s' -trimpath -o /home/rafilx/projects/github.com/babylonlabs-io/babylon/build/ ./...
Verify the installation by checking the version:
babylond version
v1.0.0-rc.5
2. Create Babylon Key
Create a Babylon key pair using the babylond keys add
command. The key pair is stored in your file system for later use.
The command takes one parameter baby-key-name
e.g. my-baby-key-name
and these flag options:
--home
sets where the new key will be stored. In most cases, $HOME/.babylond is used.--passphrase
sets the key encryption password (recommended for encrypted keyrings) without CLI interactivity.--hd-path
sets the HD derivation path of the private key.--keyring-backend
sets the keyring backend. Options include [file, os, kwallet, test, pass, memory]. See details about available backends here. Whiletest is
the default, an encrypted keyring is recommended. Iftest
is specified, the key will be created in keyring-test under--home
.--recover
allows you to recover an existing key using a seed phrase instead of creating a new one. We show how to import an existing key in the subsequent section.
An example command look like this:
Reminder: if you used the --keyring-backend
flag to create the key, use the same flag and option to access it later. After completing these steps, your Babylon key pair will be generated.
babylond keys add my-baby-key-name --home $HOME/.babylond --keyring-backend file
Enter keyring passphrase (attempt 1/3):
...
- address: bbn17ew0he6svxrqj2c7mef7qsyg0assc2upa5gy7w
name: my-baby-key-name
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5UjwURAlm0ndhMLfmNKIe4wzc8NnsBkNOgr7Ogx6kQQ"}'
type: local
**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
bad mnemonic private split ... real frown cabin few
Reminder: if you used the --keyring-backend
flag to create the key, use the same flag and option to access it later. After completing these steps, your Babylon key pair will be generated.
⚠ Warning! Store the mnemonic phrases in a safe place. Using these mnemonic phrases is the only way you can recover your keys if they're lost or corrupted.
You can view your created key and the address by running the command below:
babylond keys show my-baby-key-name --home $HOME/.babylond --keyring-backend file
Enter keyring passphrase (attempt 1/3):
...
- address: bbn17ew0he6svxrqj2c7mef7qsyg0assc2upa5gy7w
name: my-baby-key-name
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A5UjwURAlm0ndhMLfmNKIe4wzc8NnsBkNOgr7Ogx6kQQ"}'
type: local
View all of your keys by running babylond keys list
.
3. Import existing key
To import an existing key using your mnemonic seed phrase, run babylond keys add
<your-baby-key-name> including the --recover flag needed for recovery. You'll be prompted to enter your bip39 mnemonic — your 24-word mnemonic phrases created before.
You will run the command with output something like this:
babylond keys add test-key-recovered --recover --home $HOME/.babylond --keyring-backend file
> Enter your bip39 mnemonic
insane goat audit please ... fury plug monitor rib
- address: bbn1p86s3dxf48anxdsjk0430mye4yy4wzw5rm9fld
name: test-key-recovered
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Az1zFH5lCTVvJFX7AHVeKLBX6TtqzAWE63G/E3TsIKJE"}'
type: local