commands

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const EyesCacheSize = 10000

Variables

View Source
var (
	AddrFlag = cli.StringFlag{
		Name:  "address",
		Value: "tcp://0.0.0.0:46658",
		Usage: "Listen address",
	}

	EyesFlag = cli.StringFlag{
		Name:  "eyes",
		Value: "local",
		Usage: "MerkleEyes address, or 'local' for embedded",
	}

	WithoutTendermintFlag = cli.BoolFlag{
		Name:  "without-tendermint",
		Usage: "Run the Basecoin app without Tendermint",
	}
)

start flags

View Source
var (
	NodeFlag = cli.StringFlag{
		Name:  "node",
		Value: "tcp://localhost:46657",
		Usage: "Tendermint RPC address",
	}

	ToFlag = cli.StringFlag{
		Name:  "to",
		Value: "",
		Usage: "Destination address for the transaction",
	}

	AmountFlag = cli.StringFlag{
		Name:  "amount",
		Value: "",
		Usage: "Coins to send in transaction of the format <amt><coin>,<amt2><coin2>,... (eg: 1btc,2gold,5silver)",
	}

	FromFlag = cli.StringFlag{
		Name:  "from",
		Value: "key.json",
		Usage: "Path to a private key to sign the transaction",
	}

	SeqFlag = cli.IntFlag{
		Name:  "sequence",
		Value: 0,
		Usage: "Sequence number for the account",
	}

	GasFlag = cli.IntFlag{
		Name:  "gas",
		Value: 0,
		Usage: "The amount of gas for the transaction",
	}

	FeeFlag = cli.StringFlag{
		Name:  "fee",
		Value: "",
		Usage: "Coins for the transaction fee of the format <amt><coin>",
	}

	DataFlag = cli.StringFlag{
		Name:  "data",
		Value: "",
		Usage: "Data to send with the transaction",
	}

	NameFlag = cli.StringFlag{
		Name:  "name",
		Value: "",
		Usage: "Plugin to send the transaction to",
	}

	ChainIDFlag = cli.StringFlag{
		Name:  "chain_id",
		Value: "test_chain_id",
		Usage: "ID of the chain for replay protection",
	}
)
View Source
var (
	ProofFlag = cli.StringFlag{
		Name:  "proof",
		Usage: "hex-encoded IAVL proof",
		Value: "",
	}

	KeyFlag = cli.StringFlag{
		Name:  "key",
		Usage: "key to the IAVL tree",
		Value: "",
	}

	ValueFlag = cli.StringFlag{
		Name:  "value",
		Usage: "value in the IAVL tree",
		Value: "",
	}

	RootFlag = cli.StringFlag{
		Name:  "root",
		Usage: "root hash of the IAVL tree",
		Value: "",
	}
)

proof flags

View Source
var (
	IbcChainIDFlag = cli.StringFlag{
		Name:  "chain_id",
		Usage: "ChainID for the new blockchain",
		Value: "",
	}

	IbcGenesisFlag = cli.StringFlag{
		Name:  "genesis",
		Usage: "Genesis file for the new blockchain",
		Value: "",
	}

	IbcHeaderFlag = cli.StringFlag{
		Name:  "header",
		Usage: "Block header for an ibc update",
		Value: "",
	}

	IbcCommitFlag = cli.StringFlag{
		Name:  "commit",
		Usage: "Block commit for an ibc update",
		Value: "",
	}

	IbcFromFlag = cli.StringFlag{
		Name:  "from",
		Usage: "Source ChainID",
		Value: "",
	}

	IbcToFlag = cli.StringFlag{
		Name:  "to",
		Usage: "Destination ChainID",
		Value: "",
	}

	IbcTypeFlag = cli.StringFlag{
		Name:  "type",
		Usage: "IBC packet type (eg. coin)",
		Value: "",
	}

	IbcPayloadFlag = cli.StringFlag{
		Name:  "payload",
		Usage: "IBC packet payload",
		Value: "",
	}

	IbcPacketFlag = cli.StringFlag{
		Name:  "packet",
		Usage: "hex-encoded IBC packet",
		Value: "",
	}

	IbcProofFlag = cli.StringFlag{
		Name:  "proof",
		Usage: "hex-encoded proof of IBC packet from source chain",
		Value: "",
	}

	IbcSequenceFlag = cli.IntFlag{
		Name:  "sequence",
		Usage: "sequence number for IBC packet",
		Value: 0,
	}

	IbcHeightFlag = cli.IntFlag{
		Name:  "height",
		Usage: "Height the packet became egress in source chain",
		Value: 0,
	}
)
View Source
var (
	IbcTxCmd = cli.Command{
		Name:  "ibc",
		Usage: "an IBC transaction, for InterBlockchain Communication",
		Flags: TxFlags,
		Subcommands: []cli.Command{
			IbcRegisterTxCmd,
			IbcUpdateTxCmd,
			IbcPacketTxCmd,
		},
	}

	IbcRegisterTxCmd = cli.Command{
		Name:  "register",
		Usage: "Register a blockchain via IBC",
		Action: func(c *cli.Context) error {
			return cmdIBCRegisterTx(c)
		},
		Flags: []cli.Flag{
			IbcChainIDFlag,
			IbcGenesisFlag,
		},
	}

	IbcUpdateTxCmd = cli.Command{
		Name:  "update",
		Usage: "Update the latest state of a blockchain via IBC",
		Action: func(c *cli.Context) error {
			return cmdIBCUpdateTx(c)
		},
		Flags: []cli.Flag{
			IbcHeaderFlag,
			IbcCommitFlag,
		},
	}

	IbcPacketTxCmd = cli.Command{
		Name:  "packet",
		Usage: "Send a new packet via IBC",
		Subcommands: []cli.Command{
			IbcPacketCreateTx,
			IbcPacketPostTx,
		},
	}

	IbcPacketCreateTx = cli.Command{
		Name:  "create",
		Usage: "Create an egress IBC packet",
		Action: func(c *cli.Context) error {
			return cmdIBCPacketCreateTx(c)
		},
		Flags: []cli.Flag{
			IbcFromFlag,
			IbcToFlag,
			IbcTypeFlag,
			IbcPayloadFlag,
			IbcSequenceFlag,
		},
	}

	IbcPacketPostTx = cli.Command{
		Name:  "post",
		Usage: "Deliver an IBC packet to another chain",
		Action: func(c *cli.Context) error {
			return cmdIBCPacketPostTx(c)
		},
		Flags: []cli.Flag{
			IbcFromFlag,
			IbcHeightFlag,
			IbcPacketFlag,
			IbcProofFlag,
		},
	}
)
View Source
var (
	KeyCmd = cli.Command{
		Name:        "key",
		Usage:       "Manage keys",
		ArgsUsage:   "",
		Subcommands: []cli.Command{NewKeyCmd},
	}

	NewKeyCmd = cli.Command{
		Name:      "new",
		Usage:     "Create a new private key",
		ArgsUsage: "",
		Action: func(c *cli.Context) error {
			return cmdNewKey(c)
		},
	}
)
View Source
var (
	QueryCmd = cli.Command{
		Name:      "query",
		Usage:     "Query the merkle tree",
		ArgsUsage: "<key>",
		Action: func(c *cli.Context) error {
			return cmdQuery(c)
		},
		Flags: []cli.Flag{
			NodeFlag,
		},
	}

	AccountCmd = cli.Command{
		Name:      "account",
		Usage:     "Get details of an account",
		ArgsUsage: "<address>",
		Action: func(c *cli.Context) error {
			return cmdAccount(c)
		},
		Flags: []cli.Flag{
			NodeFlag,
		},
	}

	BlockCmd = cli.Command{
		Name:      "block",
		Usage:     "Get the header and commit of a block",
		ArgsUsage: "<height>",
		Action: func(c *cli.Context) error {
			return cmdBlock(c)
		},
		Flags: []cli.Flag{
			NodeFlag,
		},
	}

	VerifyCmd = cli.Command{
		Name:  "verify",
		Usage: "Verify the IAVL proof",
		Action: func(c *cli.Context) error {
			return cmdVerify(c)
		},
		Flags: []cli.Flag{
			ProofFlag,
			KeyFlag,
			ValueFlag,
			RootFlag,
		},
	}
)
View Source
var (
	TxCmd = cli.Command{
		Name:      "tx",
		Usage:     "Create, sign, and broadcast a transaction",
		ArgsUsage: "",
		Subcommands: []cli.Command{
			SendTxCmd,
			AppTxCmd,
			IbcTxCmd,
		},
	}

	SendTxCmd = cli.Command{
		Name:      "send",
		Usage:     "a SendTx transaction, for sending tokens around",
		ArgsUsage: "",
		Action: func(c *cli.Context) error {
			return cmdSendTx(c)
		},
		Flags: append(TxFlags, ToFlag),
	}

	AppTxCmd = cli.Command{
		Name:      "app",
		Usage:     "an AppTx transaction, for sending raw data to plugins",
		ArgsUsage: "",
		Action: func(c *cli.Context) error {
			return cmdAppTx(c)
		},
		Flags: append(TxFlags, NameFlag, DataFlag),

		Subcommands: []cli.Command{},
	}
)
View Source
var InitCmd = cli.Command{
	Name:      "init",
	Usage:     "Initialize a basecoin blockchain",
	ArgsUsage: "",
	Action: func(c *cli.Context) error {
		return cmdInit(c)
	},
	Flags: []cli.Flag{
		ChainIDFlag,
	},
}
View Source
var StartCmd = cli.Command{
	Name:      "start",
	Usage:     "Start basecoin",
	ArgsUsage: "",
	Action: func(c *cli.Context) error {
		return cmdStart(c)
	},
	Flags: []cli.Flag{
		AddrFlag,
		EyesFlag,
		WithoutTendermintFlag,
		ChainIDFlag,
	},
}
View Source
var UnsafeResetAllCmd = cli.Command{
	Name:      "unsafe_reset_all",
	Usage:     "Reset all blockchain data",
	ArgsUsage: "",
	Action: func(c *cli.Context) error {
		return cmdUnsafeResetAll(c)
	},
}

Functions

func AppTx

func AppTx(c *cli.Context, name string, data []byte) error

func BasecoinRoot added in v0.3.0

func BasecoinRoot(rootDir string) string

func NewIBCPlugin

func NewIBCPlugin() *ibc.IBCPlugin

returns a new IBC plugin to be registered with Basecoin

func ParseCoin

func ParseCoin(str string) (types.Coin, error)

func ParseCoins

func ParseCoins(str string) (types.Coins, error)

func Query

func Query(tmAddr string, key []byte) (*abci.ResponseQuery, error)

func RegisterQuerySubcommand

func RegisterQuerySubcommand(cmd cli.Command)

Register a subcommand of QueryCmd for plugin specific query functionality

func RegisterStartPlugin

func RegisterStartPlugin(name string, newPlugin func() types.Plugin)

RegisterStartPlugin is used to enable a plugin

func RegisterTxSubcommand

func RegisterTxSubcommand(cmd cli.Command)

Register a subcommand of TxCmd to craft transactions for plugins

func StripHex

func StripHex(s string) string

Types

type Address added in v0.3.0

type Address [20]byte

func (Address) MarshalJSON added in v0.3.0

func (a Address) MarshalJSON() ([]byte, error)

func (*Address) UnmarshalJSON added in v0.3.0

func (a *Address) UnmarshalJSON(addrHex []byte) error

type BlockHex

type BlockHex struct {
	Header []byte `json:"header"`
	Commit []byte `json:"commit"`
}

type BlockJSON

type BlockJSON struct {
	Header *tmtypes.Header `json:"header"`
	Commit *tmtypes.Commit `json:"commit"`
}

type Key

type Key struct {
	Address Address         `json:"address"`
	PubKey  crypto.PubKeyS  `json:"pub_key"`
	PrivKey crypto.PrivKeyS `json:"priv_key"`
}

func LoadKey

func LoadKey(keyFile string) *Key

func (*Key) Sign

func (k *Key) Sign(msg []byte) crypto.Signature

Implements Signer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL