跳到主要内容
版本:3.1

How-To-List-All-Key-Pairs

Overview

This how-to guide provides instructions on how to list all public keys and public/private key pairs within the keosd default wallet. You can use the public and private keys to authorize transactions in an Antelope blockchain.

The example in this how-to guide displays all public keys and public/private key pairs stored within the existing default wallet.

Before you begin

Make sure you meet the following requirements:

  • Create a default wallet using the cleos wallet create command. See the How to Create a Wallet section for instructions.
  • Create a keypair within the default wallet.
  • Familiarize with the cleos wallet commands.
  • Install the currently supported version of cleos.
Note

cleos is bundled with the Antelope software. Installing Antelope will also install cleos.

Command Reference

See the following reference guide for cleos command line usage and related options:

Procedure

The following steps show how to list all public keys and public/private key pairs stored within the keosd default wallet:

  1. Open the default wallet:
cleos wallet open
Opened: default
  1. Unlock the default wallet. The command will prompt to enter a password:
cleos wallet unlock
password:
  1. Enter the generated password when you created the default wallet:
***

If the password is correct, the wallet gets unlocked:

Unlocked: default
  1. List all public keys within the default wallet:
cleos wallet keys

Example Output

[
"EOS5VCUBtxS83ZKqVcWtDBF4473P9HyrvnCM9NBc4Upk1C387qmF3"
]
  1. List all public/private key pairs withing the default wallet. The command will prompt to enter a password:
cleos wallet private_keys
password:
  1. Enter the generated password when you created the default wallet:
***

Example Output
If the password is correct, the public/private key pairs are listed:

password: [[
"EOS5VCUBt****************************************F3",
"5JnuuGM1S****************************************4D"
]
]
Warning

Never reveal your private keys in a production environment.

Note

If the above commands does not list any keys, make sure you have created keypairs and imported private keys to your wallet.

Summary

By following these instructions, you are able to list all the public keys and public/private key pairs stored within the keosd default wallet.

Troubleshooting

When you run the cleos wallet open/unlock commands, you may encounter the following CLI error:

cleos wallet open
No wallet service listening on ***. Cannot automatically start keosd because keosd was not found.
Failed to connect to keosd at unix:///Users/xxx.xxx/eosio-wallet/keosd.sock; is keosd running?

To fix this error, make sure the keosd utility is running on your machine:

keosd