fetch-logo
ConceptsConceptsGuidesGuidesExamplesExamplesReferencesReferencesAPIsAPIs
GitHub (opens in a new tab)
  • Guides
      • Quickstart
        • What's an Agent?
        • uAgents Framework installation
        • Create your first agent
        • Agents address
        • Communicating with other agents
        • Agent Handlers (on_...)
        • Agents storage functions
        • Public and private Agents
        • Send tokens with Agents
        • Agents Mailboxes
        • Agent Functions
        • Make agents AI Engine compatible
        • Multi-file agent pipeline for AI Engine: Hugging face API to create a multi agent pipeline
        • Options for running local agents
        • Hosted agent
        • Introducing dialogues
        • Almanac Contract
        • Verify messages with Agents
        • Multi-file agent pipeline for AI Engine: Network of Primary and Secondary functions in Agentverse
        • Localwallet
        • Agentverse: Hosted Agents
        • Agentverse: Dice Roll agent
        • Agentverse: Allowed Imports
        • Agentverse: Mailbox
        • Register Agentverse Functions
        • Agentverse Functions: coin toss agent
        • Field descriptions for DeltaV
        • Agentverse Command Line Interface (AVCTL)
        • AVCTL Hosting commands
      • Agents and Functions creation APIs
      • Secret Management APIs
      • How to convert native FET to and from ERC-20 FET
      • How to stake FET tokens
      • Different ways of staking FET
      • Re-delegating staked FET token
      • Reconciliation service
      • How to setup a Multisig Wallet
        • Getting started
        • How to use the Fetch wallet
        • How to stake and claim rewards
        • Address book
        • Connections
        • Fetch Wallet Hardware Connection Guide
        • Installation
        • Connecting to a blockchain
        • Querying balances
        • Wallets and private keys
        • Sending funds
        • Staking
        • Smart contracts
          • Stake auto-compounder
          • Stake optimizer
          • Oracles
          • Wallet top-up
          • Liquidity pool
          • Swap automation
        • Installation️
        • Getting started
        • Keys
          • How to add profiles
          • How to add contract templates
          • How to compile contracts
          • How to deploy contracts
          • Contract interaction
        • Installation
        • How to use chain state snapshots
        • State-synchronization (state-sync)
        • How to set up a validator node
        • How to join a testnet
        • How to run a single node test network
        • Governance
        • How to get testnet tokens via the Token Faucet
          • CLI - Introduction
          • CLI - Managing keys
          • CLI - Managing tokens
          • CLI - Multisig keys
          • CLI - Delegation
          • Governance proposals
      • Agents 101
      • Agents 101 for AI Engine
  • Guides
      • Quickstart
        • What's an Agent?
        • uAgents Framework installation
        • Create your first agent
        • Agents address
        • Communicating with other agents
        • Agent Handlers (on_...)
        • Agents storage functions
        • Public and private Agents
        • Send tokens with Agents
        • Agents Mailboxes
        • Agent Functions
        • Make agents AI Engine compatible
        • Multi-file agent pipeline for AI Engine: Hugging face API to create a multi agent pipeline
        • Options for running local agents
        • Hosted agent
        • Introducing dialogues
        • Almanac Contract
        • Verify messages with Agents
        • Multi-file agent pipeline for AI Engine: Network of Primary and Secondary functions in Agentverse
        • Localwallet
        • Agentverse: Hosted Agents
        • Agentverse: Dice Roll agent
        • Agentverse: Allowed Imports
        • Agentverse: Mailbox
        • Register Agentverse Functions
        • Agentverse Functions: coin toss agent
        • Field descriptions for DeltaV
        • Agentverse Command Line Interface (AVCTL)
        • AVCTL Hosting commands
      • Agents and Functions creation APIs
      • Secret Management APIs
      • How to convert native FET to and from ERC-20 FET
      • How to stake FET tokens
      • Different ways of staking FET
      • Re-delegating staked FET token
      • Reconciliation service
      • How to setup a Multisig Wallet
        • Getting started
        • How to use the Fetch wallet
        • How to stake and claim rewards
        • Address book
        • Connections
        • Fetch Wallet Hardware Connection Guide
        • Installation
        • Connecting to a blockchain
        • Querying balances
        • Wallets and private keys
        • Sending funds
        • Staking
        • Smart contracts
          • Stake auto-compounder
          • Stake optimizer
          • Oracles
          • Wallet top-up
          • Liquidity pool
          • Swap automation
        • Installation️
        • Getting started
        • Keys
          • How to add profiles
          • How to add contract templates
          • How to compile contracts
          • How to deploy contracts
          • Contract interaction
        • Installation
        • How to use chain state snapshots
        • State-synchronization (state-sync)
        • How to set up a validator node
        • How to join a testnet
        • How to run a single node test network
        • Governance
        • How to get testnet tokens via the Token Faucet
          • CLI - Introduction
          • CLI - Managing keys
            • How to add keys
            • How to look up for an address
            • How to list keys
            • How to recover a key
            • Hardware wallets
          • CLI - Managing tokens
          • CLI - Multisig keys
          • CLI - Delegation
          • Governance proposals
      • Agents 101
      • Agents 101 for AI Engine
Guides
Fetch Network
Ledger
CLI - Command Line Interface
CLI - Managing keys

CLI - Managing keys 🔑

Managing keys is an essential part of working with the Ledger, since all interactions are authenticated with these keys.

How to add keys

If you want to create a new local key, you would need to run the following command:

fetchd keys add <your_key_name>
ℹ️

These keys are stored locally on your system. By default, these keys will be stored in the OS level keychain, however, in general these keys are considered less secure than using a hardware device

After running the above command, fetchd will print out a summary of the new key being produced. An output example is shown below:

- name: test
  type: local
  address: fetch142tawq2rj397mctc3jtw9dfzf03ns0ze4swat0
  pubkey: fetchpub1addwnpepqvtmze0ekffynnjx9n85g6sexzl49ze2vpgc2f52fteyyghjtvvqw682nkx
  mnemonic: ""
  threshold: 0
  pubkeys: []

This will be followed by a 24-word mnemonic that can be used to re-generate the private key and address for the account.want

⚠️

Keep this safe if ever use it to control Mainnet tokens!

How to look up for an address

A common operation that you may want to carry out is to research the address related to specified key. This can be performed quickly, by running following command:

fetchd keys show -a <name of key>

The expected output should be as shown below:

fetch142tawq2rj397mctc3jtw9dfzf03ns0ze4swat0

A less common operation, but still useful, would be to look for the public key related to a specified key. This can be achieved with the following command:

fetchd keys show -p <name of the key>

The expected output should be similar to what shown below:

fetchpub1addwnpepqvtmze0ekffynnjx9n85g6sexzl49ze2vpgc2f52fteyyghjtvvqw682nkx

How to list keys

If you wish to research for more detailed information for all keys within your system, simply use the following command:

fetchd keys list

This will show all your keys information in a yaml format similar to the one generated when you first created the key:

- name: test
  type: local
  address: fetch142tawq2rj397mctc3jtw9dfzf03ns0ze4swat0
  pubkey: fetchpub1addwnpepqvtmze0ekffynnjx9n85g6sexzl49ze2vpgc2f52fteyyghjtvvqw682nkx
  mnemonic: ""
  threshold: 0
  pubkeys: []

How to recover a key

You can import a key from a 24-word mnemonic by running the following:

fetchd keys add <name> --recover
> Enter your bip39 mnemonic
<type or paste your mnemonic>

You will be prompted to enter the mnemonic phrase, and it will then print the matching address and key details as when creating a new key.

Hardware wallets

Set up your hardware wallet

We recommend hardware wallets as a solution for managing private keys!

The Fetch ledger is compatible with Ledger Nano hardware wallets. To use your Ledger Nano, you will need to go through the following steps:

  1. Set-up your wallet by creating a PIN and passphrase, which must be stored securely to enable recovery if the device is lost or damaged.
  2. Connect your device to your PC and update the firmware to the latest version using the Ledger Live application.
  3. Install the Cosmos application using the software manager (Manager > Cosmos > Install).

How to add a new key

To use the hardware wallet address with the CLI, the user must first add it via fetchd. This process only records the public information about the key. You can import the key by first plugging in the device and enter the device pin. Once you have unlocked the device, navigate to the Cosmos app on the device and open it.

Then, you can **add the key using the following command:

fetchd keys add <name for the key> --ledger --index 0
ℹ️

The --ledger flag tells the command line tool to talk to the ledger device and the --index flag selects which HD index should be used.

When running this command, the Ledger device will prompt you to verify the generated address. Once you have done this. you will get an output in the following form:

- name: hw1
  type: ledger
  address: fetch1xqqftqp8ranv2taxsx8h594xprfw3qxl7j3ra2
  pubkey: fetchpub1addwnpepq2dulyd9mly3xqnvfgdsjkqlqzsxldpdhd6cnpm67sx90zhfw2ragk9my5h
  mnemonic: ""
  threshold: 0
  pubkeys: []

Was this page helpful?

CLI - IntroductionCLI - Managing tokens
footer-logo

Main website

Integrations

Events

We’re hiring!

Twitter (opens in a new tab)Telegram (opens in a new tab)Discord (opens in a new tab)GitHub (opens in a new tab)Youtube (opens in a new tab)LinkedIn (opens in a new tab)Reddit (opens in a new tab)
Sign up for developer updates