Documentation ¶
Index ¶
- Constants
- Variables
- func FoutputProof(w io.Writer, v interface{}, height int64) error
- func Get(key []byte, height int64, prove bool) (data.Bytes, int64, error)
- func GetHeight() int64
- func GetParsed(key []byte, data interface{}, height int64, prove bool) (int64, error)
- func GetWithProof(key []byte, height int64) (data.Bytes, int64, iavl.KeyProof, error)
- func OutputProof(data interface{}, height int64) error
- func ParseHexKey(args []string, argname string) ([]byte, error)
Constants ¶
const (
FlagHeight = "height"
)
nolint
Variables ¶
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
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
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 ¶
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 ¶
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 GetParsed ¶
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 ¶
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 ¶
OutputProof prints the proof to stdout reuse this for printing proofs and we should enhance this for text/json, better presentation of height
Types ¶
This section is empty.