Private keys are stored locally in Keosd. Private keys are one half of public-private key pairs which are used by asymmetric cryptography. The corresponding public keys is stored on the blockchain and associated with an account. It is these keys that are used to secure accounts and to sign transactions.
Use Cleos to run commands on the blockchain and to interact with accounts and keys via wallet and other commands.
Create a Wallet
The first step is to create a wallet. Use cleos wallet create to create a new "default" wallet using the option --to-console
for simplicity. If using cleos in production, it's wise to instead use --file
so your wallet password is not in your bash history. For development purposes and because these are development and not production keys --to-console
poses no security threat.
cleos wallet create --to-console
cleos
will return a password, save this password somewhere as you will likely need it later in the tutorial.
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5Kewn9L76X8Fpd....................t42S9XCw2"
A user builds a transaction object, usually through an interface, sends that object to the wallet to be signed, the wallet then returns that transaction object with a signature which is then broadcast to the network. When/if the network confirms that the transaction is valid, it is included into a block on the blockchain.
Open the Wallet
Wallets are closed by default when starting a keosd instance, to begin, run the following
cleos wallet open
Run the following to return a list of wallets.
cleos wallet list
and it will return
Wallets:
[
"default"
]
Unlock a Wallet
The keosd
wallet(s) have been opened, but is still locked. Moments ago you were provided a password, you're going to need that now.
cleos wallet unlock
You will be prompted for your password, paste it and press enter.
Now run the following command
cleos wallet list
It should now return
Wallets:
[
"default *"
]
Pay special attention to the asterisk (*). This means that the wallet is currently unlocked
Import keys into a Wallet
Generate a private key, cleos
has a helper function for this, just run the following.
cleos wallet create_key
It will return something like..
Created new private key with a public key of: "EOS8PEJ5FM42xLpHK...X6PymQu97KrGDJQY5Y"
Import the Development Key
Every new EOSIO chain has a default "system" user called "eosio". This account is used to setup the chain by loading system contracts that dictate the governance and consensus of the EOSIO chain. Every new EOSIO chain comes with a development key, and this key is the same. Load this key to sign transactions on behalf of the system user (eosio)
cleos wallet import
You'll be prompted for a private key, enter the eosio
development key provided below
5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
Wonderful, you now have a default wallet unlocked and loaded with a key, and are ready to proceed.
Use these to help follow the tutorial series easily
Enter the public key provided in the last step in the box below. It will persist the development public key you just generated throughout the documentation.
What's Next?
Start Keosd and Nodeos: Steps to start Keosd and Nodeos.