Klaytn Docs
Search…
ken CLI commands
ken is a command-line interface for Klaytn Endpoint Node.
1
USAGE:
2
ken [options] command [command options] [arguments...]
Copied!

Commands

ken has the following commands.
1
COMMANDS:
2
account Manage accounts
3
attach Start an interactive JavaScript environment (connect to node)
4
console Start an interactive JavaScript environment
5
dumpconfig Show configuration values
6
dumpgenesis Dump genesis block JSON configuration to stdout (This command is supoported from Klaytn v1.7.0.)
7
init Bootstrap and initialize a new genesis block
8
version Show version number
9
help, h Shows a list of commands or help for one command
Copied!
To get a detailed usage guideline for each command, give -h option.
1
$ ken account -h
2
Manage accounts, list all existing accounts, import a private key into a new
3
account, create a new account or update an existing account.
4
...
5
Keys are stored under <DATADIR>/keystore.
6
It is safe to transfer the entire directory or the individual keys therein
7
between klay nodes by simply copying.
8
9
Make sure you backup your keys regularly.
10
11
USAGE:
12
ken account command [command options] [arguments...]
13
14
COMMANDS:
15
list Print summary of existing accounts
16
new Create a new account
17
update Update an existing account
18
import Import a private key into a new account
Copied!
1
$ ken init -h
2
init [command options] [arguments...]
3
4
The init command initializes a new genesis block and definition for the network.
5
This is a destructive action and changes the network in which you will be
6
participating.
7
...
Copied!

JavaScript Console

Klaytn Endpoint Node comes with JavaScript console. From the console command line, you can initiate part of Klaytn API calls to your EN. To attach to the JavaScript console, execute the following command.
1
$ ken attach ~/kend_home/klay.ipc
2
Welcome to the Klaytn JavaScript console
3
4
!instance: Klaytn/vX.X.X/XXXX-XXXX/goX.X.X
5
datadir: ~/kend_home
6
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
7
8
>
Copied!
attach command connects to the running node, while console command launches a node and connects to it.
1
attach Start an interactive JavaScript environment (connect to node)
2
console Start an interactive JavaScript environment
Copied!

Module APIs

If you type the module name on the console prompt, you will see the available properties and functions of the module. For the details of functions, please see Klaytn API.
1
> personal
2
{
3
listAccounts: [...],
4
listWallets: [...],
5
deriveAccount: function(),
6
ecRecover: function(),
7
getListAccounts: function(callback),
8
getListWallets: function(callback),
9
importRawKey: function(),
10
lockAccount: function(),
11
...
12
}
13
14
> personal.listAccounts
15
["0x960dba2500ab529693ef8e299210768aa0d55ec8", "0x09a04dc9ac3cd92de5ff0d45ae50ff1b618305d9", "0x36662211c072dadbf5fc1e087ddebd36df986abd", "0xbf9683cf04520eeba6d936a3478de29437c5d048"]
16
>
Copied!
Copy link
Edit on GitHub