Documentation ¶
Overview ¶
Package nodecmd contains command definitions and related functions used for node cmds, such as kcn, kpn, and ken.
Index ¶
- Constants
- Variables
- func BeforeRunBootnode(ctx *cli.Context) error
- func BeforeRunKlaytn(ctx *cli.Context) error
- func CheckCommands(ctx *cli.Context) error
- func CommandNotExist(ctx *cli.Context, s string)
- func GetConsoleCommand(nodeFlags, rpcFlags []cli.Flag) cli.Command
- func GetDumpConfigCommand(nodeFlags, rpcFlags []cli.Flag) cli.Command
- func GetGitCommit() string
- func MakeFullNode(ctx *cli.Context) *node.Node
- func OnUsageError(context *cli.Context, err error, isSubcommand bool) error
- func RunKlaytnNode(ctx *cli.Context) error
- func UnlockAccount(ctx *cli.Context, ks *keystore.KeyStore, address string, i int, ...) (accounts.Account, string)
Constants ¶
View Source
const ( SCNNetworkType = "scn" // Service Chain Network MNNetworkType = "mn" // Mainnet Network )
Variables ¶
View Source
var ( ConsoleFlags = []cli.Flag{utils.JSpathFlag, utils.ExecFlag, utils.PreloadJSFlag} AttachCommand = cli.Command{ Action: utils.MigrateFlags(remoteConsole), Name: "attach", Usage: "Start an interactive JavaScript environment (connect to node)", ArgsUsage: "[endpoint]", Flags: append(ConsoleFlags, utils.DbTypeFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.DataDirFlag), Category: "CONSOLE COMMANDS", Description: ` The Klaytn console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console. This command allows to open a console on a running Klaytn node.`, } )
View Source
var ( AccountCommand = cli.Command{ Name: "account", Usage: "Manage accounts", Category: "ACCOUNT COMMANDS", Description: ` Manage accounts, list all existing accounts, import a private key into a new account, create a new account or update an existing account. It supports interactive mode, when you are prompted for password as well as non-interactive mode where passwords are supplied via a given password file. Non-interactive mode is only meant for scripted use on test networks or known safe environments. Make sure you remember the password you gave when creating a new account (with either new or import). Without it you are not able to unlock your account. Note that exporting your key in unencrypted format is NOT supported. Keys are stored under <DATADIR>/keystore. It is safe to transfer the entire directory or the individual keys therein between klay nodes by simply copying. Make sure you backup your keys regularly.`, Subcommands: []cli.Command{ { Name: "list", Usage: "Print summary of existing accounts", Action: utils.MigrateFlags(accountList), Flags: []cli.Flag{ utils.DbTypeFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.DataDirFlag, utils.KeyStoreDirFlag, }, Description: ` Print a short summary of all accounts`, }, { Name: "new", Usage: "Create a new account", Action: utils.MigrateFlags(accountCreate), Flags: []cli.Flag{ utils.DbTypeFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.DataDirFlag, utils.KeyStoreDirFlag, utils.PasswordFileFlag, utils.LightKDFFlag, }, Description: ` klay account new Creates a new account and prints the address. The account is saved in encrypted format, you are prompted for a passphrase. You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the --password flag: Note, this is meant to be used for testing only, it is a bad idea to save your password to file or expose in any other way. `, }, { Name: "update", Usage: "Update an existing account", Action: utils.MigrateFlags(accountUpdate), ArgsUsage: "<address>", Flags: []cli.Flag{ utils.DbTypeFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.DataDirFlag, utils.KeyStoreDirFlag, utils.LightKDFFlag, }, Description: ` klay account update <address> Update an existing account. The account is saved in the newest version in encrypted format, you are prompted for a passphrase to unlock the account and another to save the updated file. This same command can therefore be used to migrate an account of a deprecated format to the newest format or change the password for an account. For non-interactive use the passphrase can be specified with the --password flag: klay account update [options] <address> Since only one password can be given, only format update can be performed, changing your password is only possible interactively. `, }, { Name: "import", Usage: "Import a private key into a new account", Action: utils.MigrateFlags(accountImport), Flags: []cli.Flag{ utils.DbTypeFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.DataDirFlag, utils.KeyStoreDirFlag, utils.PasswordFileFlag, utils.LightKDFFlag, }, ArgsUsage: "<keyFile>", Description: ` klay account import <keyfile> Imports an unencrypted private key from <keyfile> and creates a new account. Prints the address. The keyfile is assumed to contain an unencrypted private key in hexadecimal format. The account is saved in encrypted format, you are prompted for a passphrase. You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the -password flag: klay account import [options] <keyfile> Note: As you can directly copy your encrypted accounts to another klay instance, this import mechanism is not needed when you transfer an account between nodes. `, }, }, } )
View Source
var CommonNodeFlags = []cli.Flag{ utils.BootnodesFlag, utils.IdentityFlag, utils.UnlockedAccountFlag, utils.PasswordFileFlag, utils.DbTypeFlag, utils.DataDirFlag, utils.KeyStoreDirFlag, utils.TxPoolNoLocalsFlag, utils.TxPoolJournalFlag, utils.TxPoolJournalIntervalFlag, utils.TxPoolPriceLimitFlag, utils.TxPoolPriceBumpFlag, utils.TxPoolExecSlotsAccountFlag, utils.TxPoolExecSlotsAllFlag, utils.TxPoolNonExecSlotsAccountFlag, utils.TxPoolNonExecSlotsAllFlag, utils.TxPoolLifetimeFlag, utils.SyncModeFlag, utils.GCModeFlag, utils.LightKDFFlag, utils.StateDBCachingFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.LevelDBNoBufferPoolFlag, utils.LevelDBCacheSizeFlag, utils.NoParallelDBWriteFlag, utils.SenderTxHashIndexingFlag, utils.TrieMemoryCacheSizeFlag, utils.TrieBlockIntervalFlag, utils.CacheTypeFlag, utils.CacheScaleFlag, utils.CacheUsageLevelFlag, utils.MemorySizeFlag, utils.CacheWriteThroughFlag, utils.TxPoolStateCacheFlag, utils.TrieCacheLimitFlag, utils.ListenPortFlag, utils.SubListenPortFlag, utils.MultiChannelUseFlag, utils.MaxConnectionsFlag, utils.MaxPendingPeersFlag, utils.TargetGasLimitFlag, utils.NATFlag, utils.NoDiscoverFlag, utils.RWTimerWaitTimeFlag, utils.RWTimerIntervalFlag, utils.NetrestrictFlag, utils.NodeKeyFileFlag, utils.NodeKeyHexFlag, utils.VMEnableDebugFlag, utils.VMLogTargetFlag, utils.NetworkIdFlag, utils.RPCCORSDomainFlag, utils.RPCVirtualHostsFlag, utils.MetricsEnabledFlag, utils.PrometheusExporterFlag, utils.PrometheusExporterPortFlag, utils.ExtraDataFlag, utils.SrvTypeFlag, ConfigFileFlag, }
Common flags that configure the node
View Source
var CommonRPCFlags = []cli.Flag{ utils.RPCEnabledFlag, utils.RPCListenAddrFlag, utils.RPCPortFlag, utils.RPCApiFlag, utils.WSEnabledFlag, utils.WSListenAddrFlag, utils.WSPortFlag, utils.GRPCEnabledFlag, utils.GRPCListenAddrFlag, utils.GRPCPortFlag, utils.WSApiFlag, utils.WSAllowedOriginsFlag, utils.IPCDisabledFlag, utils.IPCPathFlag, }
Common RPC flags
View Source
var (
ConfigFileFlag = cli.StringFlag{
Name: "config",
Usage: "TOML configuration file",
}
)
View Source
var ( InitCommand = cli.Command{ Action: utils.MigrateFlags(initGenesis), Name: "init", Usage: "Bootstrap and initialize a new genesis block", ArgsUsage: "<genesisPath>", Flags: []cli.Flag{ utils.DbTypeFlag, utils.NoPartitionedDBFlag, utils.NumStateTriePartitionsFlag, utils.LevelDBCompressionTypeFlag, utils.DataDirFlag, }, Category: "BLOCKCHAIN COMMANDS", Description: ` 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. It expects the genesis file as argument.`, } )
View Source
var KCNFlags = []cli.Flag{ utils.RewardbaseFlag, utils.CypressFlag, utils.BaobabFlag, }
View Source
var KENFlags = []cli.Flag{ utils.ServiceChainSignerFlag, utils.CypressFlag, utils.BaobabFlag, utils.ChildChainIndexingFlag, utils.MainBridgeFlag, utils.MainBridgeListenPortFlag, utils.EnableDBSyncerFlag, utils.DBHostFlag, utils.DBPortFlag, utils.DBNameFlag, utils.DBUserFlag, utils.DBPasswordFlag, utils.EnabledLogModeFlag, utils.MaxIdleConnsFlag, utils.MaxOpenConnsFlag, utils.ConnMaxLifeTimeFlag, utils.BlockSyncChannelSizeFlag, utils.DBSyncerModeFlag, utils.GenQueryThreadFlag, utils.InsertThreadFlag, utils.BulkInsertSizeFlag, utils.EventModeFlag, utils.MaxBlockDiffFlag, utils.TxResendIntervalFlag, utils.TxResendCountFlag, utils.TxResendUseLegacyFlag, }
View Source
var KPNFlags = []cli.Flag{ utils.TxResendIntervalFlag, utils.TxResendCountFlag, utils.TxResendUseLegacyFlag, utils.CypressFlag, utils.BaobabFlag, }
View Source
var KSCNFlags = []cli.Flag{ utils.ServiceChainSignerFlag, utils.MainChainAccountAddrFlag, utils.AnchoringPeriodFlag, utils.SentChainTxsLimit, utils.MainBridgeFlag, utils.MainBridgeListenPortFlag, utils.ChildChainIndexingFlag, utils.SubBridgeFlag, utils.SubBridgeListenPortFlag, utils.ParentChainIDFlag, utils.MainChainURLFlag, utils.VTRecoveryFlag, utils.VTRecoveryIntervalFlag, utils.ServiceChainNewAccountFlag, utils.ServiceChainConsensusFlag, }
View Source
var VersionCommand = cli.Command{ Action: utils.MigrateFlags(version), Name: "version", Usage: "Show version number", ArgsUsage: " ", Category: "MISCELLANEOUS COMMANDS", }
Functions ¶
func BeforeRunBootnode ¶
func BeforeRunBootnode(ctx *cli.Context) error
func BeforeRunKlaytn ¶
func BeforeRunKlaytn(ctx *cli.Context) error
func CheckCommands ¶
func CheckCommands(ctx *cli.Context) error
func CommandNotExist ¶
func CommandNotExist(ctx *cli.Context, s string)
func GetConsoleCommand ¶
func GetConsoleCommand(nodeFlags, rpcFlags []cli.Flag) cli.Command
GetConsoleCommand returns cli.Command `console` whose flags are initialized with nodeFlags, rpcFlags, and ConsoleFlags.
func GetDumpConfigCommand ¶
func GetDumpConfigCommand(nodeFlags, rpcFlags []cli.Flag) cli.Command
GetDumpConfigCommand returns cli.Command `dumpconfig` whose flags are initialized with nodeFlags and rpcFlags.
func MakeFullNode ¶
func OnUsageError ¶
func RunKlaytnNode ¶
func RunKlaytnNode(ctx *cli.Context) error
runKlaytnNode is the main entry point into the system if no special subcommand is ran. It creates a default node based on the command line arguments and runs it in blocking mode, waiting for it to be shut down.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.