Create a Wallet
A WAX wallet is a named, encrypted repository of public and private key pairs that are stored in a file on your local server (not the blockchain). You’ll need to create a development wallet to:
- Create local WAX Blockchain Accounts
- Sign actions performed on your local blockchain
How it Works
To create an account on your local blockchain, you’ll need to have a pre-generated owner public key (required) and an active public key (optional). You can use your local development wallet to create and store these keys.
Default Wallet Content - Public/Private Key Pairs
[[ "EOS4yxqE5KYv5XaB2gj6sZTUDiGzKm42KfiRPDCeXWZUsAZZVXk1F", "5JTZaN1zabi5wyC3LcdeZG3AzF7sLDX4JFqMDe68ThLC3Q5nYez" ],[ "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3" ] ]
Your wallet will use these keys to sign your smart contract’s actions and broadcast the signature to your local network. If the network confirms that the transaction is valid, it’s included in a block on the blockchain.
In this guide, you’ll use cleos to create, open, and unlock a new wallet.
Create a Development Wallet
To create a new wallet, use the wallet create command:
cleos wallet create --to-console
This command creates a wallet named default, saved to a local path (e.g. “/home/username/eosio-wallet/default.wallet”).
The –to-console parameter prints your password to the console. Be sure to save this password someplace safe (you’ll need it to unlock your wallet).
warn 2019-07-16T22:39:39.847 thread-0 wallet.cpp:223 save_wallet_file ] saving wallet to file /home/username/eosio-wallet/./default.wallet Creating wallet: default Save password to use in the future to unlock this wallet. Without password imported keys will not be retrievable. "PW5KRXKVx25yjL3FvxxY9YxYxxYY9Yxx99yyXTRH8DjppKpD9tKtVz"
Open and Unlock Your Wallet
Wallets are closed by default (when starting a keosd instance). To open your wallet, use the wallet open command:
cleos wallet open
The console prints out that your default wallet is open: Opened: default.
Now that your wallet is open, you’ll need to unlock it. You can use the –password command to unlock it in one step. Use the password that was printed to the console when you created your wallet.
cleos wallet unlock --password PW5KRXKVx25yjL3FvxxY9YxYxxYY9Yxx99yyXTRH8DjppKpD9tKtVz
The console prints out that your default wallet is unlocked: Unlocked: default.
To determine if your wallet is Locked/Unlocked, you can use the following command:
cleos wallet list
The console prints your wallet names, with an asterisk (*) to indicate that your wallet is Unlocked:
Wallets: [ "default *" ]
Import the Local Development Key
For development purposes, every WAX chain includes a default system user called eosio. This account is used to set up your local chain by loading system contracts that dictate the governance and consensus.
In your local development environment, this eosio user will simulate your WAX Blockchain Account. You can use the eosio user to create new accounts and push your smart contracts to your local blockchain, without having to worry about staking any WAX.
To sign transactions on behalf of the eosio system user, you’ll need to import the EOSIO development key into your wallet.
cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
The console prints that your development key has been imported for: (your private wallet key).
imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV