跳至主要内容
本页面使用机器翻译自英语,可能包含错误或不清楚的语言。如需最准确的信息,请参阅英文原文。由于更新频繁,部分内容可能与英文原文有出入。请加入我们在 Crowdin 上的努力,帮助我们改进本页面的翻译。 (Crowdin translation page, Contributing guide)

ken CLI 命令


USAGE:
ken [options] command [command options] [arguments...]

命令

ken "有以下命令。


COMMANDS:
account Manage accounts
attach Start an interactive JavaScript environment (connect to node)
console Start an interactive JavaScript environment
dumpconfig Show configuration values
dumpgenesis Dump genesis block JSON configuration to stdout (This command is supoported from Kaia v1.7.0.)
init Bootstrap and initialize a new genesis block
snapshot A set of commands based on the snapshot
version Show version number
help, h Shows a list of commands or help for one command

要获得每条命令的详细使用指南,请使用 -h 选项。


$ ken account -h
Manage accounts, list all existing accounts, import a private key into a new
account, create a new account or update an existing account.
...
Keys are stored under <DATADIR>/keystore.
It is safe to transfer the entire directory or the individual keys therein
between kaia nodes by simply copying.
Make sure you backup your keys regularly.
USAGE:
ken account command [command options] [arguments...]
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


$ ken init -h
init [command options] [arguments...]
The init command initializes a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
participating.
...

JavaScript 控制台

Kaia Endpoint Node 附带 JavaScript 控制台。 通过控制台命令行,您可以向您的 EN 发起部分 Kaia API 调用。 要附加到 JavaScript 控制台,请执行以下命令。


$ ken attach --datadir ~/kend_home
欢迎访问 Kaia JavaScript 控制台
!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
>

attach 命令连接运行中的节点,而 console 命令则启动节点并连接它。


attach Start an interactive JavaScript environment (connect to node)
console Start an interactive JavaScript environment

模块应用程序接口

如果在控制台提示符下键入模块名称,就会看到模块的可用属性和功能。 有关功能的详细信息,请参阅 Kaia API


> personal
{
listAccounts: [...],
listWallets: [...],
deriveAccount: function(),
ecRecover: function(),
getListAccounts: function(callback),
getListWallets: function(callback),
importRawKey: function(),
lockAccount: function(),
...
}
> personal.listAccounts
["0x960dba2500ab529693ef8e299210768aa0d55ec8", "0x09a04dc9ac3cd92de5ff0d45ae50ff1b618305d9", "0x36662211c072dadbf5fc1e087ddebd36df986abd", "0xbf9683cf04520eeba6d936a3478de29437c5d048"]
>

让这个页面变得更好