Create a Keychain
Overview
To become a Keychain operator, you need to create and configure a Keychain entity on-chain, as shown in this guide.
1. Run a node
-
Run a local chain as explained here: Run a local chain.
To become an actual Keychain operator, you need to join Buenavista instead. However, we recommend running a local chain first to test your configuration.
For the rest of this guide, we'll assume you have a running Warden Protocol node with a local account (key) that has a few WARD tokens. You'll use these tokens to fund the Keychain and its Writers.
-
The next steps require your local account name, or key name. It's referenced as
my-key-name
in the provided command-line examples.You can check the list of available keys by executing this command:
wardend keys list
To check the local account balance, run this:
wardend query bank balances my-key-name
tipIf you used a
just
script or a devnet snapshot to run your node, the local account name isshulgin
. -
In some of the commands, you'll also need to specify your chain ID. The actual value depends on the configuration you used when running your node.
To check your chain ID, run this:
wardend status
See the
network
field in the output.tipIf you used a
just
script or a devnet snapshot to run your node, the chain ID iswarden_1337-1
.
2. Register a Keychain
The following steps show how to register a new Keychain entity on-chain.
-
Run this command to create a new Keychain:
wardend tx warden new-keychain \
--name 'my-keychain-name' \
--from my-key-name \
--chain-id chain_123-1 \
--description 'my-keychain-description' \
--keychain-fees "{\"key_req\":[{\"amount\":\"100\",\"denom\":\"award\"}],\"sig_req\":[{\"amount\":\"1\",\"denom\":\"award\"}]}"Specify the following details:
name
: The Keychain namefrom
: Your local account name (key name)chain-id
: The ID of the chain you're runningdescription
(optional): The Keychain descriptionkeychainFees
(optional):key_req
: A fee in aWARD for creating a key pairkey_req
: A fee in aWARD for signing a transaction
Note: aWARD equals 0.000000000000000001 WARD.
-
Enter your passphrase if needed and confirm the transaction. A new Keychain object will be created on-chain.
-
Every Keychain is created with a Keychain ID that identifies it in key and signature requests and collects fees from users. You'll need this ID to operate your Keychain. Run the following command and check the
id
field in the output:wardend query warden keychains
keychains:
- admins:
- warden1h7akmejqcrafp3mfpjqamghh89kzmkgjzsy3mc
creator: warden1h7akmejqcrafp3mfpjqamghh89kzmkgjzsy3mc
description: my-keychain-description
fees:
key_req:
- amount: "100"
denom: award
sig_req:
- amount: "1"
denom: award
id: "1"
name: my-keychain-name
pagination:
total: "1"
3. Add a Keychain Writer
A Keychain Writer is an account that can write Keychain results (public keys and signatures) to the chain. The Keychain Writers list is essentially an allowlist of accounts that can interact on behalf of the Keychain.
To add a Keychain Writer, take these steps:
-
Run this command to add a Keychain Writer with a preferred name:
wardend keys add my-keychain-writer-name
The output should look like this:
- address: warden18my6wqsrf5ek85znp8x202wwyg8rw4fqhy54k2
name: my-keychain-writer-name
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A2cECb3ziw5/LzUBUZIChyek3bnGQv/PSXHAH28xd9/Q"}'
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.
virus boat radio apple pilot ask vault exhaust again state doll stereo slide exhibit scissors miss attack boat budget egg bird mask more trick -
Note down the mnemonic phrase and the address of the new account. You'll need this information to interact with the chain.
tipOnly the Keychain Writer address will be able to publish signatures and public keys on behalf of the Keychain.
-
Fund the new account with some tokens. Specify your key name, the Keychain Writer address, and chain ID:
wardend tx bank send my-key-name \
$(wardend keys show -a my-keychain-writer-name) \
1000000000000000000award \
--chain-id chain_123-1To check the Keychain Writer balance, run this:
wardend query bank balances my-keychain-writer-name
Next steps
The next steps depend on your goals:
- To become an actual Keychain operator, join Buenavista and create a Keychain there.
- To start fulfilling key and signature requests, follow this guide: Fulfill requests from CLI.
- To start building a Keychain service, follow Build a Keychain app.