Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

CLI Wallet

Sandwich edited this page Apr 27, 2018 · 11 revisions

Overview

The program keosd, located in the eos/build/programs/keosd folder within the EOSIO/eos repository, can be used to store private keys that will be used to sign transactions sent to the block chain. keosd runs on your local machine and stores your private keys locally.

How to Run keosd

Start keosd on as follows:

$ keosd 

By default, keosd creates the folder ~/eosio-wallet and populates it with a basic config.ini file. The location of the config file can be specified on the command line using the --config-dir argument. The configuration file contains the http server endpoint for incoming http connections and other parameters for cross origin resource sharing.

By default, keosd stores wallets in the ~/eosio-wallet folder. Wallet files follow the naming convention <wallet-name>.wallet. For example, the default wallet will be stored in a file named default.wallet. As other wallets are created, similar files will be created for each. For example, a wallet named "foo" will have a corresponding wallet file named foo.wallet. The location of the wallet data folder can be specified on the command line using the --data-dir argument.

Command Reference

The command line tool to interact with keosd is called “cleos”. It is found in eos/build/programs/cleos folder.

It provides the following commands to interact with keosd:

Create

$ cleos wallet create ${options}

Options:

-n,--name TEXT=default The name of the new wallet

If you don’t provide an optional name it creates a default wallet.

Open

Open an already created wallet. You need to open a wallet to operate on it.

$ cleos wallet open ${options}

Options:

-n,--name TEXT The name of the wallet to open

Lock

Locks a wallet.

$ cleos wallet lock ${options}

Options:

-n,--name TEXT The name of the wallet to lock

Note: Your wallets will be locked when your wallet manager (keosd or nodeos) is shut down. You will need to unlock your wallets after restarting the wallet manager.

Unlock wallet

$ cleos wallet unlock ${options}

Options:

-n,--name TEXT The name of the wallet to unlock --password TEXT The password returned by wallet create

Import private key into wallet

$ cleos wallet import ${options} key

Positionals:

key TEXT Private key in WIF format to import

Options:

-n,--name TEXT The name of the wallet to import key into

List

List opened wallets, * = unlocked

$ cleos wallet list

Keys

List of private keys from all unlocked wallets in WIF format.

$ cleos wallet keys

Read the full Cleos Command Reference

Managing Wallets with nodeos

As an alternative to using keosd to manage your wallets, you can use nodeos to manage them. Using nodeos for wallet management is not the preferred configuration, but is suitable for development and test. It is not recommended to simultaneously have keosd and nodeos doing wallet management; it won't break anything, but you will likely find it very confusing!

To use nodeos for wallet management, you must configure nodeos to use the eosio::wallet_api_plugin. You can do this on the command line argument when starting nodeos, or by defining it in the nodeos config file. You will still use cleos as your interface to perform wallet management tasks, the difference being that cleos will direct its requests to nodeos.

To start nodeos with the wallet plugin, include --plugin eosio::wallet_api_plugin on the nodeos command line.

To include the wallet using the nodeos config file, add the following line to the nodeos config.ini file:

plugin = eosio::wallet_api_plugin 

Note: If you use nodeos for wallet management, your wallets will be locked when nodeos is shut down. You will need to unlock your wallets after restarting nodeos.

Clone this wiki locally