Skip to main content

Account Basics

WARNING: Remember your password. If you lose the password of your account, you will not be able to access that account. There is no forgot my password option here. Never forget it.

Kaia provides two handy command-line tools, ken and JavaScript console, for developers to manage accounts. Note that exporting your private key in an unencrypted format is NOT supported.

ken

The Kaia Endpoint Node binary ken provides account management via the account command. The command account lets you create new accounts, lists all existing accounts, imports a private key into a new account, migrates to the newest key format, and changes your password.

Usage


$ ken account <command> [options...] [arguments...]

Commands


$ ken account -help
...
COMMANDS:
list Print summary of existing accounts
new Create a new account
update Update an existing account
import Import a private key into a new account
...

You can get info about subcommands by ken account <command> --help.


$ ken account list --help
list [command options] [arguments...]
Print a short summary of all accounts
KAIA OPTIONS:
--dbtype value Blockchain storage database type ("leveldb", "badger") (default: "leveldb")
--datadir "/Users/ethan/Library/KEN" Data directory for the databases and keystore
--keystore Directory for the keystore (default = inside the datadir)
DATABASE OPTIONS:
--db.no-partitioning Disable partitioned databases for persistent storage

Data Directory

Keystore files are stored under <DATADIR>/keystore. You can specify the data directory as below. It is highly recommended to execute ken account command with --datadir option. Make the data directory point to the DATA_DIR set in the kend.conf to seamlessly share the accounts with your Endpoint Node.


$ ken account new --datadir <DATADIR>
$ ken account new --datadir "~/kend_home"

If you do not specify the data directory, the default location is as follows.

  • Mac: ~/Library/KEN
  • Linux: ~/.ken

JavaScript Console

To connect to the JavaScript console, an EN must be in running status. For more information, see Launching an EN. Start an EN and attach to the console as follows.

Usage


$ kend start
Starting kend: OK
$ ken attach ~/kend_home/kaia.ipc
Welcome to the Kaia JavaScript console!
instance: Kaia/vX.X.X/XXXX-XXXX/goX.X.X
datadir: ~/kend_home
modules: admin:1.0 debug:1.0 governance:1.0 istanbul:1.0 klay:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0
>

Commands

Type personal or kaia to get the list of available functions. In this tutorial, we are going to visit the following functions.


> personal.newAccount()
> personal.importRawKey()
> personal.unlockAccount()
> kaia.accounts
> kaia.getBalance()

Data Directory

When you create an account, the keystore file is stored under <DATADIR>/keystore. The <DATADIR> is the DATA_DIR set in the kend.conf. If you follow the quick start guide with the given example, it must be ~/kend_home.

Make this page better