Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultPower = 10 DefaultIsCA = true )
View Source
const SUBPATH = "/.subchain"
Variables ¶
View Source
var ( ExamCommand = cli.Command{ Name: "exam", Action: exam, Flags: []cli.Flag{ cli.Int64Flag{ Name: "start", Value: 0, }, }, } InitCommand = cli.Command{ Name: "initial", Action: initial, Flags: []cli.Flag{ cli.Int64Flag{ Name: "start", Value: 0, }, }, } )
View Source
var ( TransferBenchCommand = cli.Command{ Name: "bench", Action: transferBench, Flags: []cli.Flag{ cli.Int64Flag{ Name: "start", Value: 0, }, cli.Int64Flag{ Name: "times", Value: 1, }, }, } AnnCoinBenchCommand = cli.Command{ Name: "benchcoin", Action: benchAnnCoin, Flags: []cli.Flag{}, } )
View Source
var ( //AccountCommands defines a more git-like subcommand system AccountCommands = cli.Command{ Name: "account", Usage: "operations for account", Category: "Account", Subcommands: []cli.Command{ { Name: "generate", Action: generatePrivPubAddr, Usage: "generate new private-pub key pair", Category: "Account", }, }, } )
View Source
var ( //ContractCommands defines a more git-like subcommand system EVMCommands = cli.Command{ Name: "evm", Usage: "operations for evm contract", Category: "Contract", Subcommands: []cli.Command{ { Name: "create", Usage: "create a new contract", Action: createContract, Flags: []cli.Flag{ anntoolFlags.addr, anntoolFlags.pwd, anntoolFlags.bytecode, anntoolFlags.privkey, anntoolFlags.nonce, anntoolFlags.abif, anntoolFlags.callf, }, }, { Name: "execute", Usage: "execute a new contract", Action: executeContract, Flags: []cli.Flag{ anntoolFlags.addr, anntoolFlags.pwd, anntoolFlags.payload, anntoolFlags.privkey, anntoolFlags.nonce, anntoolFlags.abistr, anntoolFlags.callstr, anntoolFlags.to, anntoolFlags.abif, anntoolFlags.callf, }, }, { Name: "read", Usage: "read a contract", Action: readContract, Flags: []cli.Flag{ anntoolFlags.addr, anntoolFlags.pwd, anntoolFlags.payload, anntoolFlags.privkey, anntoolFlags.nonce, anntoolFlags.abistr, anntoolFlags.callstr, anntoolFlags.to, anntoolFlags.abif, anntoolFlags.callf, }, }, { Name: "exist", Usage: "check if a contract has been deployed", Action: existContract, Flags: []cli.Flag{ anntoolFlags.callf, }, }, }, } )
View Source
var ( EventCommands = cli.Command{ Name: "event", Usage: "trigger the inter-chain event system", Category: "Event", Subcommands: []cli.Command{ { Name: "upload-code", Usage: "upload a segment of lisp/lua to process event data for a particular organization", Action: ea.UploadCode, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "code", Usage: "code segment", Value: "", }, cli.StringFlag{ Name: "ownerid", Usage: "chain id of the code owner", Value: "", }, }, }, { Name: "request", Usage: "", Action: ea.Request, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "listener", Usage: "listener chainID", Value: "", }, cli.StringFlag{ Name: "source", Usage: "event source chainID", Value: "", }, cli.StringFlag{ Name: "listener_hash", Usage: "code hash on the listener chain", Value: "", }, cli.StringFlag{ Name: "source_hash", Usage: "code hash on the source chain", Value: "", }, }, }, { Name: "unsubscribe", Usage: "", Action: ea.Unsubscribe, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "listener", Usage: "listener chainID", Value: "", }, cli.StringFlag{ Name: "source", Usage: "event source chainID", Value: "", }, }, }, }, } )
View Source
var ( //ContractCommands defines a more git-like subcommand system IkhofiCommands = cli.Command{ Name: "ikhofi", Usage: "operations for ikhofi", Category: "Contract", Subcommands: []cli.Command{ { Name: "execute", Usage: "execute a contract", Action: execute, Flags: []cli.Flag{ cli.StringFlag{ Name: "method", Value: "", }, cli.StringFlag{ Name: "contractid", Value: "", }, anntoolFlags.privkey, anntoolFlags.bytecode, }, }, { Name: "query", Usage: "query a contract", Action: query, Flags: []cli.Flag{ cli.StringFlag{ Name: "method", Value: "", }, cli.StringFlag{ Name: "contractid", Value: "", }, anntoolFlags.privkey, }, }, }, } )
View Source
var ( InfoCommand = cli.Command{ Name: "info", Usage: "get annchain info", Subcommands: []cli.Command{ cli.Command{ Name: "last_block", Action: lastBlockInfo, }, cli.Command{ Name: "num_unconfirmed_txs", Action: numUnconfirmedTxs, }, cli.Command{ Name: "net", Action: netInfo, }, cli.Command{ Name: "num_archived_blocks", Action: numArchivedBlocks, }, }, } )
View Source
var ( InitSubCommands = cli.Command{ Name: "initsub", Usage: "init subchain config file and genesis file", Category: "Organization", Action: initSubConf, Flags: []cli.Flag{ cli.StringFlag{ Name: "configfile", Value: "$HOME/appconfig.toml", }, cli.StringFlag{ Name: "genesisfile", Value: "$HOME/appconfig.toml", }, }, } )
View Source
var ( OrgCommands = cli.Command{ Name: "organization", Usage: "commands for organization control", Category: "Organization", Subcommands: []cli.Command{ { Name: "create", Usage: "create a organization", Action: oa.Create, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "genesisfile", Usage: "point the genesis file for the sharding", Value: "", }, cli.StringFlag{ Name: "configfile", Usage: "custom configs for the sharding", Value: "", }, }, }, { Name: "join", Usage: "join a organization", Action: oa.Join, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "orgid", Usage: "specify the organization's chain id", Value: "", }, cli.StringFlag{ Name: "genesisfile", Usage: "point the genesis file for the sharding", Value: "", }, cli.StringFlag{ Name: "configfile", Usage: "custom configs for the sharding", Value: "", }, }, }, { Name: "leave", Usage: "", Action: oa.Leave, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "orgid", Usage: "specify the organization's chain id", Value: "", }, }, }, }, } )
View Source
var ( QueryCommands = cli.Command{ Name: "query", Usage: "operations for query state", Category: "Query", Subcommands: []cli.Command{ { Name: "nonce", Usage: "query account's nonce", Action: queryNonce, Flags: []cli.Flag{ anntoolFlags.addr, }, }, { Name: "balance", Usage: "query account's balance", Action: queryBalance, Flags: []cli.Flag{ anntoolFlags.addr, }, }, { Name: "receipt", Usage: "", Action: queryReceipt, Flags: []cli.Flag{ anntoolFlags.hash, }, }, { Name: "events", Usage: "query events on the node", Action: queryEvents, Flags: []cli.Flag{}, }, { Name: "event_code", Usage: "", Action: queryEventCode, Flags: []cli.Flag{ anntoolFlags.codeHash, }, }, { Name: "apps", Usage: "query apps on the node", Action: queryNodeApps, Flags: []cli.Flag{}, }, }, } )
View Source
var ( SignCommand = cli.Command{ Name: "sign", Action: signCA, Usage: "nodes who want to join a chain must first get a CA signature from one the CA nodes in that chain", Flags: []cli.Flag{ cli.StringFlag{ Name: "sec", Usage: "CA node's private key", Value: "0", }, cli.StringFlag{ Name: "pub", Value: "0", Usage: "pubkeys of the nodes want to join, comma separated", }, }, } )
View Source
var ( SpecialCommands = cli.Command{ Name: "special", Usage: "commands for special operations", Category: "Special", Subcommands: []cli.Command{ { Name: "change_validator", Usage: "change validator set, promote node up to be a validator, change validator's voting power, change validator's CA status", Action: specials.ChangeValidator, Flags: []cli.Flag{ anntoolFlags.privkey, anntoolFlags.validatorPubkey, anntoolFlags.isCA, anntoolFlags.power, }, }, { Name: "remove_validator", Usage: "remove a validator", Action: specials.ChangeValidator, Flags: []cli.Flag{ anntoolFlags.privkey, anntoolFlags.validatorPubkey, }, }, { Name: "disconnect_peer", Usage: "disconnect a peer and refuse the node to join the network afterwards", Action: specials.DisconnectPeer, Flags: []cli.Flag{ anntoolFlags.peerPubkey, }, }, { Name: "add_refuse_key", Usage: "add a pubkey to refuseList", Action: specials.AddRefuseKey, Flags: []cli.Flag{ anntoolFlags.peerPubkey, }, }, { Name: "delete_refuse_key", Usage: "delete a pubkey from refuseList", Action: specials.DeleteRefuseKey, Flags: []cli.Flag{ anntoolFlags.peerPubkey, }, }, { Name: "list_refuse_key", Usage: "list all refuse key", Action: listRefuseKey, }, }, } )
View Source
var ( TxCommands = cli.Command{ Name: "tx", Usage: "operations for transaction", Category: "Transaction", Subcommands: []cli.Command{ { Name: "send", Usage: "send a transaction", Action: sendTx, Flags: []cli.Flag{ anntoolFlags.addr, anntoolFlags.pwd, anntoolFlags.payload, anntoolFlags.privkey, anntoolFlags.nonce, anntoolFlags.to, anntoolFlags.value, }, }, { Name: "query", Usage: "query transaction execution info", Action: txQuery, Flags: []cli.Flag{ cli.StringFlag{ Name: "txHash", }, }, }, }, } )
View Source
var ( VoteCommands = cli.Command{ Name: "vote", Usage: "commands for vote channel request", Category: "Vote", Subcommands: []cli.Command{ { Name: "request_change_validator", Usage: "make a new request to change validator", Action: vote.voteChangeValidator, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "validator_pubkey", }, anntoolFlags.power, anntoolFlags.isCA, }, }, { Name: "sign_vote", Usage: "sign a vote request, if disagree sign nil", Action: vote.signVote, Flags: []cli.Flag{ anntoolFlags.privkey, cli.StringFlag{ Name: "request_id", }, }, }, { Name: "query_votes", Usage: "get all vote channel reqeusts state", Action: vote.queryVotes, }, { Name: "execute_vote", Usage: "do the vote request", Action: vote.executeVote, Flags: []cli.Flag{ cli.StringFlag{ Name: "request_id", }, }, }, }, } )
Functions ¶
func ContractExecute ¶
func ContractExecute(param *ContractParam) (txhash []byte, err error)
func PathExists ¶
Types ¶
type AnntoolFlags ¶
type AnntoolFlags struct {
// contains filtered or unexported fields
}
type ContractParam ¶
type ContractParam struct {
ChainID string
ContractID string
MethodName string
Args []string
Privkey *ecdsa.PrivateKey
ByteCode []byte
}
func ParseParam ¶
func ParseParam(method, id, chainID, privkey string) (param ContractParam, err error)
type QueryResult ¶
func ContractQuery ¶
func ContractQuery(param *ContractParam) (result QueryResult, err error)
Click to show internal directories.
Click to hide internal directories.