Documentation ¶
Overview ¶
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. * * The onyxchain is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The onyxchain is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The onyxchain. If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. * * The onyxchain is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The onyxchain is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The onyxchain. If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. * * The onyxchain is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The onyxchain is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The onyxchain. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func PrintErrorMsg(format string, a ...interface{})
- func PrintInfoMsg(format string, a ...interface{})
- func PrintJsonData(data []byte)
- func PrintJsonObject(obj interface{})
- func PrintWarnMsg(format string, a ...interface{})
- func SetOnyxChainConfig(ctx *cli.Context) (*config.OnyxChainConfig, error)
- func SetRpcPort(ctx *cli.Context)
- type FmtFlag
Constants ¶
This section is empty.
Variables ¶
var ( AppHelpTemplate = `` /* 814-byte string literal not displayed */ SubcommandHelpTemplate = `` /* 433-byte string literal not displayed */ CommandHelpTemplate = `` /* 582-byte string literal not displayed */ )
AppHelpTemplate is the test template for the default, global app help topic.
var ( AccountCommand = cli.Command{ Action: cli.ShowSubcommandHelp, Name: "account", Usage: "Manage accounts", ArgsUsage: "[arguments...]", Description: `Wallet management commands can be used to add, view, modify, delete, import account, and so on. You can use ./OnyxChain account --help command to view help information of wallet management command.`, Subcommands: []cli.Command{ { Action: accountCreate, Name: "add", Usage: "Add a new account", ArgsUsage: "[sub-command options]", Flags: []cli.Flag{ utils.AccountQuantityFlag, utils.AccountTypeFlag, utils.AccountKeylenFlag, utils.AccountSigSchemeFlag, utils.AccountDefaultFlag, utils.AccountLabelFlag, utils.IdentityFlag, utils.WalletFileFlag, }, Description: ` Add a new account to wallet. OnyxChain support three type of key: ecdsa, sm2 and ed25519, and support 224、256、384、521 bits length of key in ecdsa, but only support 256 bits length of key in sm2 and ed25519. OnyxChain support multiple signature scheme. For ECDSA support SHA224withECDSA、SHA256withECDSA、SHA384withECDSA、SHA512withEdDSA、SHA3-224withECDSA、SHA3-256withECDSA、SHA3-384withECDSA、SHA3-512withECDSA、RIPEMD160withECDSA; For SM2 support SM3withSM2, and for SHA512withEdDSA. ------------------------------------------------- Key |key-length(bits)| signature-scheme ---------|----------------|---------------------- 1 ecdsa | 1 P-224: 224 | 1 SHA224withECDSA |----------------|---------------------- | 2 P-256: 256 | 2 SHA256withECDSA |----------------|---------------------- | 3 P-384: 384 | 3 SHA384withECDSA |----------------|---------------------- | 4 P-521: 521 | 4 SHA512withEdDSA |----------------|---------------------- | | 5 SHA3-224withECDSA | |---------------------- | | 6 SHA3-256withECDSA | |---------------------- | | 7 SHA3-384withECDSA | |---------------------- | | 8 SHA3-512withECDSA | |---------------------- | | 9 RIPEMD160withECDSA ---------|----------------|---------------------- 2 sm2 | sm2p256v1 256 | SM3withSM2 ---------|----------------|---------------------- 3 ed25519| 25519 256 | SHA512withEdDSA -------------------------------------------------`, }, { Action: accountList, Name: "list", Usage: "List existing accounts", ArgsUsage: "[sub-command options] <label|address|index>", Flags: []cli.Flag{ utils.WalletFileFlag, utils.AccountVerboseFlag, }, Description: `List existing accounts. If specified in args, will list those account. If not specified in args, will list all accouns in wallet`, }, { Action: accountSet, Name: "set", Usage: "Modify an account", ArgsUsage: "[sub-command options] <label|address|index>", Flags: []cli.Flag{ utils.AccountSetDefaultFlag, utils.WalletFileFlag, utils.AccountLabelFlag, utils.AccountChangePasswdFlag, utils.AccountSigSchemeFlag, }, Description: `Modify settings for an account. Account is specified by address, label of index. Index start from 1. This can be showed by the 'list' command.`, }, { Action: accountDelete, Name: "del", Usage: "Delete an account", ArgsUsage: "[sub-command options] <address|label|index>", Flags: []cli.Flag{ utils.WalletFileFlag, }, Description: `Delete an account specified by address, label of index. Index start from 1. This can be showed by the 'list' command`, }, { Action: accountImport, Name: "import", Usage: "Import accounts of wallet to another", ArgsUsage: "[sub-command options] <address|label|index>", Flags: []cli.Flag{ utils.WalletFileFlag, utils.AccountSourceFileFlag, utils.AccountWIFFlag, }, Description: "Import accounts of wallet to another. If not specific accounts in args, all account in source will be import", }, { Action: accountExport, Name: "export", Usage: "Export accounts to a specified wallet file", ArgsUsage: "[sub-command options] <filename>", Flags: []cli.Flag{ utils.WalletFileFlag, utils.AccountLowSecurityFlag, }, }, }, } )
var AppHelpFlagGroups = []flagGroup{ { Name: "ONYXCHAIN", Flags: []cli.Flag{ utils.ConfigFlag, utils.LogLevelFlag, utils.DisableEventLogFlag, utils.DataDirFlag, }, }, { Name: "ACCOUNT", Flags: []cli.Flag{ utils.WalletFileFlag, utils.AccountAddressFlag, utils.AccountPassFlag, utils.AccountDefaultFlag, utils.AccountKeylenFlag, utils.AccountSetDefaultFlag, utils.AccountSigSchemeFlag, utils.AccountTypeFlag, utils.AccountVerboseFlag, utils.AccountLabelFlag, utils.AccountQuantityFlag, utils.AccountChangePasswdFlag, utils.AccountSourceFileFlag, utils.AccountWIFFlag, utils.AccountLowSecurityFlag, utils.AccountMultiMFlag, utils.AccountMultiPubKeyFlag, utils.IdentityFlag, }, }, { Name: "CONSENSUS", Flags: []cli.Flag{ utils.EnableConsensusFlag, utils.MaxTxInBlockFlag, }, }, { Name: "TXPOOL", Flags: []cli.Flag{ utils.GasPriceFlag, utils.GasLimitFlag, utils.TxpoolPreExecDisableFlag, utils.DisableSyncVerifyTxFlag, utils.DisableBroadcastNetTxFlag, }, }, { Name: "P2P NODE", Flags: []cli.Flag{ utils.ReservedPeersOnlyFlag, utils.ReservedPeersFileFlag, utils.NetworkIdFlag, utils.NodePortFlag, utils.DualPortSupportFlag, utils.ConsensusPortFlag, utils.MaxConnInBoundFlag, utils.MaxConnOutBoundFlag, utils.MaxConnInBoundForSingleIPFlag, }, }, { Name: "RPC", Flags: []cli.Flag{ utils.RPCDisabledFlag, utils.RPCPortFlag, utils.RPCLocalEnableFlag, utils.RPCLocalProtFlag, }, }, { Name: "RESTFUL", Flags: []cli.Flag{ utils.RestfulEnableFlag, utils.RestfulPortFlag, }, }, { Name: "WEB SOCKET", Flags: []cli.Flag{ utils.WsEnabledFlag, utils.WsPortFlag, }, }, { Name: "TEST MODE", Flags: []cli.Flag{ utils.EnableTestModeFlag, utils.TestModeGenBlockTimeFlag, }, }, { Name: "CONTRACT", Flags: []cli.Flag{ utils.ContractPrepareDeployFlag, utils.ContractAddrFlag, utils.ContractAuthorFlag, utils.ContractCodeFileFlag, utils.ContractDescFlag, utils.ContractEmailFlag, utils.ContractNameFlag, utils.ContractVersionFlag, utils.ContractStorageFlag, utils.ContractPrepareInvokeFlag, utils.ContractParamsFlag, utils.ContractReturnTypeFlag, }, }, { Name: "TRANSACTION", Flags: []cli.Flag{ utils.TransactionGasLimitFlag, utils.TransactionGasPriceFlag, utils.TransactionAssetFlag, utils.TransactionFromFlag, utils.TransactionToFlag, utils.TransactionAmountFlag, utils.TransactionHashFlag, utils.TransferFromSenderFlag, utils.ApproveAssetFlag, utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, utils.ApproveAmountFlag, utils.SendTxFlag, utils.ForceSendTxFlag, utils.TransactionPayerFlag, utils.PrepareExecTransactionFlag, utils.TransferFromAmountFlag, utils.WithdrawOXGReceiveAccountFlag, utils.WithdrawOXGAmountFlag, }, }, { Name: "Approve", Flags: []cli.Flag{ utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, }, }, { Name: "EXPORT", Flags: []cli.Flag{ utils.ExportFileFlag, utils.ExportSpeedFlag, utils.ExportStartHeightFlag, utils.ExportEndHeightFlag, }, }, { Name: "IMPORT", Flags: []cli.Flag{ utils.ImportFileFlag, utils.ImportEndHeightFlag, }, }, { Name: "MISC", }, }
var ApproveTxCommond = cli.Command{ Name: "approve", Usage: "Build approve transaction", Description: "Build approve transaction.", Action: approveTx, Flags: []cli.Flag{ utils.WalletFileFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.TransactionPayerFlag, utils.ApproveAssetFlag, utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, utils.ApproveAmountFlag, }, }
var AssetCommand = cli.Command{ Name: "asset", Usage: "Handle assets", Description: "Asset management commands can check account balance, ONYX/OXG transfers, extract OXGs, and view unbound OXGs, and so on.", Subcommands: []cli.Command{ { Action: transfer, Name: "transfer", Usage: "Transfer onx or oxg to another account", ArgsUsage: " ", Description: "Transfer onx or oxg to another account. If from address does not specified, using default account", Flags: []cli.Flag{ utils.RPCPortFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.TransactionAssetFlag, utils.TransactionFromFlag, utils.TransactionToFlag, utils.TransactionAmountFlag, utils.ForceSendTxFlag, utils.WalletFileFlag, }, }, { Action: approve, Name: "approve", ArgsUsage: " ", Usage: "Approve another user can transfer asset", Flags: []cli.Flag{ utils.RPCPortFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.ApproveAssetFlag, utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, utils.ApproveAmountFlag, utils.WalletFileFlag, }, }, { Action: transferFrom, Name: "transferfrom", ArgsUsage: " ", Usage: "Using to transfer asset after approve", Flags: []cli.Flag{ utils.RPCPortFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.ApproveAssetFlag, utils.TransferFromSenderFlag, utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, utils.TransferFromAmountFlag, utils.ForceSendTxFlag, utils.WalletFileFlag, }, }, { Action: getBalance, Name: "balance", Usage: "Show balance of onx and oxg of specified account", ArgsUsage: "<address|label|index>", Flags: []cli.Flag{ utils.RPCPortFlag, utils.WalletFileFlag, }, }, { Action: getAllowance, Name: "allowance", Usage: "Show approve balance of onx or oxg of specified account", Flags: []cli.Flag{ utils.RPCPortFlag, utils.ApproveAssetFlag, utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, utils.WalletFileFlag, }, }, { Action: unboundOxg, Name: "unboundoxg", Usage: "Show the balance of unbound OXG", ArgsUsage: "<address|label|index>", Flags: []cli.Flag{ utils.RPCPortFlag, utils.WalletFileFlag, }, }, { Action: withdrawOxg, Name: "withdrawoxg", Usage: "Withdraw OXG", ArgsUsage: "<address|label|index>", Flags: []cli.Flag{ utils.RPCPortFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.WalletFileFlag, }, }, }, }
var ( ContractCommand = cli.Command{ Name: "contract", Action: cli.ShowSubcommandHelp, Usage: "Deploy or invoke smart contract", ArgsUsage: " ", Description: `Smart contract operations support the deployment of NeoVM smart contract, and the pre-execution and execution of NeoVM smart contract.`, Subcommands: []cli.Command{ { Action: deployContract, Name: "deploy", Usage: "Deploy a smart contract to onyxchain", ArgsUsage: " ", Flags: []cli.Flag{ utils.RPCPortFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.ContractStorageFlag, utils.ContractCodeFileFlag, utils.ContractNameFlag, utils.ContractVersionFlag, utils.ContractAuthorFlag, utils.ContractEmailFlag, utils.ContractDescFlag, utils.ContractPrepareDeployFlag, utils.WalletFileFlag, utils.AccountAddressFlag, }, }, { Action: invokeContract, Name: "invoke", Usage: "Invoke smart contract", ArgsUsage: `NeoVM contract support bytearray(need encode to hex string), string, integer, boolean parameter type. Parameter Contract parameters separate with comma ',' to split params. and must add type prefix to params. For example:string:foo,int:0,bool:true If parameter is an object array, enclose array with '[]'. For example: string:foo,[int:0,bool:true] Note that if string contain some special char like :,[,] and so one, please use '/' char to escape. For example: string:did/:ed1e25c9dccae0c694ee892231407afa20b76008 Return type When invoke contract with --prepare flag, you need specifies return type by --return flag, to decode the return value. Return type support bytearray(encoded to hex string), string, integer, boolean. If return type is object array, enclose array with '[]'. For example: [string,int,bool,string] `, Flags: []cli.Flag{ utils.RPCPortFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.ContractAddrFlag, utils.ContractParamsFlag, utils.ContractVersionFlag, utils.ContractPrepareInvokeFlag, utils.ContractReturnTypeFlag, utils.WalletFileFlag, utils.AccountAddressFlag, }, }, { Action: invokeCodeContract, Name: "invokecode", Usage: "Invoke smart contract by code", ArgsUsage: " ", Flags: []cli.Flag{ utils.RPCPortFlag, utils.ContractCodeFileFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.WalletFileFlag, utils.ContractPrepareInvokeFlag, utils.AccountAddressFlag, }, }, }, } )
var ExportCommand = cli.Command{ Name: "export", Usage: "Export blocks in DB to a file", ArgsUsage: "", Action: exportBlocks, Flags: []cli.Flag{ utils.RPCPortFlag, utils.ExportFileFlag, utils.ExportStartHeightFlag, utils.ExportEndHeightFlag, utils.ExportSpeedFlag, }, Description: "", }
var ImportCommand = cli.Command{ Name: "import", Usage: "Import blocks to DB from a file", ArgsUsage: "", Action: importBlocks, Flags: []cli.Flag{ utils.ImportFileFlag, utils.ImportEndHeightFlag, utils.DataDirFlag, utils.ConfigFlag, utils.NetworkIdFlag, utils.DisableEventLogFlag, }, Description: "Note that import cmd doesn't support testmode", }
var InfoCommand = cli.Command{ Name: "info", Usage: "Display information about the chain", Subcommands: []cli.Command{ { Action: txInfo, Name: "tx", Usage: "Display transaction information", ArgsUsage: "txHash", Flags: []cli.Flag{ utils.RPCPortFlag, }, Description: "Display transaction information", }, { Action: blockInfo, Name: "block", Usage: "Display block information", ArgsUsage: "<blochHash|height>", Flags: []cli.Flag{ utils.RPCPortFlag, }, Description: "Display block information", }, { Action: txStatus, Name: "status", Usage: "Display transaction status", ArgsUsage: "<txhash>", Description: `Display status of transaction.`, Flags: []cli.Flag{ utils.RPCPortFlag, }, }, { Action: curBlockHeight, Name: "curblockheight", Usage: "Display the current block height", ArgsUsage: "", Description: `Display the current block height.`, Flags: []cli.Flag{ utils.RPCPortFlag, }, }, }, Description: `Query information command can query information such as blocks, transactions, and transaction executions. You can use the ./OnyxChain info block --help command to view help information.`, }
var MultiSigAddrCommand = cli.Command{ Name: "multisigaddr", Usage: "Generate multi-signature address", Description: "Generate multi-signature address.", Action: genMultiSigAddress, Flags: []cli.Flag{ utils.AccountMultiMFlag, utils.AccountMultiPubKeyFlag, }, }
var MultiSigTxCommand = cli.Command{ Name: "multisigtx", Usage: "Sign to multi-signature transaction", ArgsUsage: "<rawtx>", Description: "Sign to multi-signature transaction.", Action: multiSigToTx, Flags: []cli.Flag{ utils.RPCPortFlag, utils.WalletFileFlag, utils.AccountMultiMFlag, utils.AccountMultiPubKeyFlag, utils.AccountAddressFlag, utils.SendTxFlag, utils.PrepareExecTransactionFlag, }, }
var SendTxCommand = cli.Command{ Name: "sendtx", Usage: "Send raw transaction to OnyxChain", Description: "Send raw transaction to OnyxChain.", ArgsUsage: "<rawtx>", Action: sendTx, Flags: []cli.Flag{ utils.RPCPortFlag, utils.PrepareExecTransactionFlag, }, }
var ShowTxCommand = cli.Command{ Action: showTx, Name: "showtx", Usage: "Show info of raw transaction.", ArgsUsage: "<rawtx>", Flags: []cli.Flag{ utils.RPCPortFlag, }, Description: "Show info of raw transaction.", }
var SigTxCommand = cli.Command{ Name: "sigtx", Usage: "Sign to transaction", ArgsUsage: "<rawtx>", Description: "Sign to transaction.", Action: sigToTx, Flags: []cli.Flag{ utils.RPCPortFlag, utils.WalletFileFlag, utils.AccountAddressFlag, utils.SendTxFlag, utils.PrepareExecTransactionFlag, }, }
var TransferFromTxCommond = cli.Command{ Name: "transferfrom", Usage: "Build transfer from transaction", Description: "Build transfer from transaction.", Action: transferFromTx, Flags: []cli.Flag{ utils.WalletFileFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.ApproveAssetFlag, utils.TransactionPayerFlag, utils.TransferFromSenderFlag, utils.ApproveAssetFromFlag, utils.ApproveAssetToFlag, utils.TransferFromAmountFlag, }, }
var TransferTxCommond = cli.Command{ Name: "transfer", Usage: "Build transfer transaction", Description: "Build transfer transaction.", Action: transferTx, Flags: []cli.Flag{ utils.WalletFileFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.TransactionPayerFlag, utils.TransactionAssetFlag, utils.TransactionFromFlag, utils.TransactionToFlag, utils.TransactionAmountFlag, }, }
var TxCommond = cli.Command{ Name: "buildtx", Usage: "Build transaction", Subcommands: []cli.Command{ TransferTxCommond, ApproveTxCommond, TransferFromTxCommond, WithdrawOXGTxCommond, }, Description: "Build transaction", }
var WithdrawOXGTxCommond = cli.Command{ Action: withdrawOXGTx, Name: "withdrawoxg", Usage: "Build Withdraw OXG transaction", Description: "Build Withdraw OXG transaction", ArgsUsage: "<address|label|index>", Flags: []cli.Flag{ utils.RPCPortFlag, utils.WalletFileFlag, utils.TransactionGasPriceFlag, utils.TransactionGasLimitFlag, utils.TransactionPayerFlag, utils.WithdrawOXGAmountFlag, utils.WithdrawOXGReceiveAccountFlag, }, }
Functions ¶
func PrintErrorMsg ¶
func PrintErrorMsg(format string, a ...interface{})
func PrintInfoMsg ¶
func PrintInfoMsg(format string, a ...interface{})
func PrintJsonData ¶
func PrintJsonData(data []byte)
func PrintJsonObject ¶
func PrintJsonObject(obj interface{})
func PrintWarnMsg ¶
func PrintWarnMsg(format string, a ...interface{})
func SetOnyxChainConfig ¶
func SetOnyxChainConfig(ctx *cli.Context) (*config.OnyxChainConfig, error)
func SetRpcPort ¶
Types ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library.
|
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. |
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library.
|
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. |
handlers
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library.
|
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. |
store
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library.
|
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. |
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library.
|
* Copyright (C) 2019 The onyxchain Authors * This file is part of The onyxchain library. |