In EOS, you have to create a wallet, and then an account using the following procedure. Ensure that keosd and nodeos are running for this procedure.
You can run keosd just by typing keosd. Ensure it is on a different port from nodeos by editing the following line in ‘~/eosio-wallet/config.ini‘ and setting it to another port, such as 8899:
http-server-address = 127.0.0.1:8899
Run nodeos by typing the following (applicable if you are looking to create a single-node testnet for development purposes):
nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin
Option ‘-e’ enables block production even if the chain is ‘stale’, and option ‘-p’ is the producer name, which is ‘eosio’. The latter two options enable the Chain API and History API plugins.
Create An EOS Wallet Using cleos:
If you have already created a ‘default’ wallet, you can create a new EOS wallet named ‘testwallet’ by typing:
cleos --wallet-url=http://127.0.0.1:8890 wallet create -n testwallet
That command should return the following:
Creating wallet: testwallet
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"[generatedpassword]"
Save the generated password in a safe place.
Create An EOS Key Pair For Your Wallet:
Type:
cleos create key
It will then generate print out your EOS private key and the accompanying public keys you’ll need to create an account. These are arbitrary randomly-generated key, but once you create an account with them, they become very important, so back them up safely.
Import the private key from that EOS key pair you just generated using the following command:
cleos --wallet-url=http://127.0.0.1:8890 wallet import -n testwallet [private_key]
It should return:
imported private key for: [your_public_key]
Import the private key for the ‘eosio’ account into your wallet:
cleos --wallet-url http://127.0.0.1:8899/ wallet import -n testwallet 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
Run this command to create a new EOS account with that wallet. Use the public keys you generated earlier to do it:
cleos --wallet-url http://127.0.0.1:8899/ create account eosio accountname [public_key_1] [public_key_2]
Confirm that your EOS account has been created:
cleos --wallet-url http://127.0.0.1:8899/ get account accountname
That command should return something like this:
permissions: owner 1: 1 [public_key_1] active 1: 1 [public_key_2] memory: quota: unlimited used: 2.66 KiB net bandwidth: used: unlimited available: unlimited limit: unlimited cpu bandwidth: used: unlimited available: unlimited limit: unlimited
Errors You Could Encounter, And Their Solutions
Error 3120002: Nonexistent wallet
Possible solutions for EOS error 3120002:
- Ensure that your wallet was created successfully using the cleos wallet list command.
- Open your wallet using the wallet open command:
cleos --wallet-url http://127.0.0.1:8899/ wallet open -n testwallet
Proceed to unlock your EOS wallet once you have opened it and enter the password that was generated for you earlier when you created it. You may also need to do this if you restart keosd.
cleos --wallet-url http://127.0.0.1:8899/ wallet unlock -n testwallet
Error 3090003: provided keys, permissions, and delays do not satisfy declared authorizations
Possible solutions for EOS error 3090003:
- Import the ‘eosio’ account’s private key into your wallet beforehand.
This tutorial’s commands were tested on the following versions of EOS:
- 1.0.0