EOS mainnet has recently launched, and there’s still lack of tools and instructions for an average user. EOS accounts were generated automatically at the ond of ICO for those who kept their ERC20 tokens in their own Ethereum walltes, and took the time to create and register new EOS keys at EOS smart contract. As the mainnet starts operating, new accounts are needed for new users.
In this article, Alice is an EOS account owner, and she creates an account for Bob.
Setting up EOS software environment
Alice needs to set up the
cleos command-line tool on a Linux machine. The instructions are available in EOS wiki on Github. The build process takes a couple of hours, and it creates a full suite to run a testnet node. We don’t need that, and we will only use the cleos tool talking to mainnet API.
Alice chooses the API endpoint to connect to. There’s a number of Block Producers, and each has its own public API URL. You can easily find the URL by accessing
/bp.json from the BP’s web site. Here are a few examples of working URLs:
Alice needs to check that her tools are able to work with the mainnet. The command will output the latest block information. For her own security, Alice also verifies that the block information is the same as at https://eostracker.io/
cleos -u https://eos.greymass.com/ get info
Setting up a wallet
Alice has its EOS private key in a secure place, and she needs to import it to the machine where
cleos is installed. She creates a wallet named “default” and imports her private EOS key into it:
# this generates a new wallet and a new password
# which you need to save in a secure place. it also starts
# kleos process in the background. The wallet is created in
cleos wallet create# this imports your private key into the wallet. Add a space
# in front of the command, so that it does not get
# into .bash_history
cleos wallet import *********# this shows Alice's public EOS key
cleos wallet keys# This shows Alice's account name on the mainnet
# (we call it xxAlice further on)
cleos -u https://eos.greymass.com/ get accounts EOS7RHpN5****
Generating Bob’s keys
Bob needs to create a pair of keys using one of the tools available. The private key needs to be stored secretly and never be shared.
# Further on, we call the public key BOBSPUB
cleos create key
Creating the account
Alice needs to have some liquid EOS on her account in order to create an account for Bob. When I tried this command, my account was charged EOS0.3249.
IMPORTANT: the new account name should be exactly 12 characters! Further on, we name the new account as “xxBob”
# Check Alice's balance
cleos -u https://api.cypherglass.com get currency balance eosio.token xxAlice# unlock Alice's wallet
cleos wallet unlock# create the new account
cleos -u https://api.cypherglass.com system newaccount -x 1000 --stake-net "0.1 EOS" --stake-cpu "0.1 EOS" --buy-ram-kbytes 8 --transfer xxAlice xxBob BOBSPUB BOBSPUB# The new transaction will take a short while to propagate,
# and you can check the new account status in the live network:
cleos -u https://api.cypherglass.com get account xxBob# Send EOS to the new account
cleos -u https://api.cypherglass.com transfer xxAlice xxBob "1.0 EOS"# Check the balance
cleos -u https://api.cypherglass.com get currency balance eosio.token xxBob
Now Bob can use his private key to operate his account on his own.