TUTORIAL: How to Create an æternity Account With CLI?
Each account on the æternity blockchain is represented by a private and public key pair. The public key is your identity to the outside world. The private key you use to sign transactions, and must at all costs be kept secret. If your private key is discovered by someone else, they can use it to impersonate you and take your tokens. You must keep your private key secret.
- Installed node.js and npm (node package manager)
Install from source
Currently, to use the CLI, you must clone the repository and install it from source.
git clone https://github.com/aeternity/aepp-cli-js.git
Get into the cloned repository with
npm link in order to link the AECLI to
aecli/bin/aecli.js (If you have any folder permission issues, try running with sudo
sudo npm link)
npm link command will create a symlink in the global node_modules folder and expose the CLI binary to be used through the terminal.
From npm global repository (comming soon)
The package will soon be available for installation from the global npm repository. You will be able to install it via the following command:
npm i -g @aeternity/aecli
The CLI can be invoked using the command
If you invoke the AECLI with no arguments, it shows basic usage:
Usage: aecli [options] [command] Options: -V, --version output the version number -h, --help output usage information Commands: config Print the client configuration chain Interact with the blockchain inspect Get information on transactions, blocks,... account Handle wallet operations contract Compile contracts name AENS system tx Transaction builder crypto Crypto helpers help [cmd] display help for [cmd]
The account (wallet) commands are those used to create and report on key pairs. Using the Account commands, you can create a wallet, add some coins to it, send coins and view the wallet’s address (public key) and private key.
In this tutorial we will focus on the
account group (mostly
account create), which handles wallet operations.
Create a secure wallet
Create command details:
aecli account create <name> [options]
- the name of the wallet
- Тhe option capabilities of the command are the following:
Options: -u, --url [hostname] Node to connect to (default: "https://sdk-mainnet.aepps.com") -U, --internalUrl [internal] Node to connect to(internal) (default: "https://sdk-mainnet.aepps.com") --native Build transaction natively --networkId [networkId] Network ID (default: ae_mainnet) -P, --password [password] Wallet Password -n, --nonce [nonce] Override the nonce that the transaction is going to be sent with -f --force Ignore epoch version compatibility check --json Print result in json format -h, --help Output usage information
Let's create our new æternity account:
aecli account create my-ae-wallet --password 12345
Wallet saved Wallet address________________ ak_2EdPu7gJTMZSdFntHK5864CnsRykW1GUwLGC2KeC8tjNnFBjBx Wallet path___________________ ~/aeternity-project/my-ae-wallet
The above command generates a wallet file with name -
my-ae-wallet, located where the command was executed.
The content of wallet file looks like this:
View the address (public key) of your wallet using the following command:
aecli account address my-ae-wallet
The CLI will prompt you to type in your password and will give you the following output:
Your address is: ak_2EdPu7gJTMZSdFntHK5864CnsRykW1GUwLGC2KeC8tjNnFBjBx
In order to get the private key of an account one can use the following command:
aecli account address my-ae-wallet --privateKey
Type your password in and you will see output similar to this:
Your address is: ak_2EdPu7gJTMZSdFntHK5864CnsRykW1GUwLGC2KeC8tjNnFBjBx Your private key is: 195675e7ef31c689f92eb86fc67e31124b3b124889906607f63ee9d323834039a2a39512ab47c05b764883c04466533e0661007061a4787dc34e95de96b7b8e7
Accounts (wallets) are digital key pairs associated with your digital assets.
As you can see, the tool AECLI allows you to create your account with just a few commands. Once you have your wallet set up, remember not to share your private keys with anyone, never lose them and store them safely in a location where you can retrieve on demand. Your wallet is now ready to execute blockchain actions for you. Go ahead and try spending, deploying and all the goodies AE has to offer.
The æternity team will be keeping this tutorial updated. If you encounter any problems please contract us through the aeternity dev forum.