query

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagHeight = "height"
)

nolint

Variables

View Source
var KeyQueryCmd = &cobra.Command{
	Use:   "key [key]",
	Short: "Handle proofs for state of abci app",
	Long: `This will look up a given key in the abci app, verify the proof,
and output it as hex.

If you want json output, use an app-specific command that knows key and value structure.`,
	RunE: commands.RequireInit(keyQueryCmd),
}

KeyQueryCmd - CLI command to query a state by key with proof

View Source
var RootCmd = &cobra.Command{
	Use:   "query",
	Short: "Get and store merkle proofs for blockchain data",
	Long: `Proofs allows you to validate data and merkle proofs.

These proofs tie the data to a checkpoint, which is managed by "seeds".
Here we can validate these proofs and import/export them to prove specific
data to other peers as needed.
`,
}

RootCmd represents the base command when called without any subcommands

View Source
var TxQueryCmd = &cobra.Command{
	Use:   "tx [txhash]",
	Short: "Handle proofs of commited txs",
	Long: `Proofs allows you to validate abci state with merkle proofs.

These proofs tie the data to a checkpoint, which is managed by "seeds".
Here we can validate these proofs and import/export them to prove specific
data to other peers as needed.
`,
	RunE: commands.RequireInit(txQueryCmd),
}

TxQueryCmd - CLI command to query a transaction with proof

Functions

func FoutputProof

func FoutputProof(w io.Writer, v interface{}, height uint64) error

FoutputProof writes the output of wrapping height and info in the form {"data": <the_data>, "height": <the_height>} to the provider io.Writer

func Get

func Get(key []byte, prove bool) (data.Bytes, uint64, error)

Get queries the given key and returns the value stored there and the height we checked at.

If prove is true (and why shouldn't it be?), the data is fully verified before returning. If prove is false, we just repeat whatever any (potentially malicious) node gives us. Only use that if you are running the full node yourself, and it is localhost or you have a secure connection (not HTTP)

func GetHeight

func GetHeight() int

GetHeight reads the viper config for the query height

func GetParsed

func GetParsed(key []byte, data interface{}, prove bool) (uint64, error)

GetParsed does most of the work of the query commands, but is quite opinionated, so if you want more control about parsing, call Get directly.

It will try to get the proof for the given key. If it is successful, it will return the height and also unserialize proof.Data into the data argument (so pass in a pointer to the appropriate struct)

func GetWithProof

func GetWithProof(key []byte) (data.Bytes, uint64, iavl.KeyProof, error)

GetWithProof returns the values stored under a given key at the named height as in Get. Additionally, it will return a validated merkle proof for the key-value pair if it exists, and all checks pass.

func OutputProof

func OutputProof(data interface{}, height uint64) error

OutputProof prints the proof to stdout reuse this for printing proofs and we should enhance this for text/json, better presentation of height

func ParseHexKey

func ParseHexKey(args []string, argname string) ([]byte, error)

ParseHexKey parses the key flag as hex and converts to bytes or returns error argname is used to customize the error message

Types

This section is empty.

Jump to

Keyboard shortcuts

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