client

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 21 Imported by: 19,098

Documentation

Index

Constants

View Source
const KeySubdir = "keys"

KeySubdir is the directory name under root where we store the keys

Variables

This section is empty.

Functions

func ErrNoData added in v0.8.0

func ErrNoData() error

func GetCertifiedCommit added in v0.8.0

func GetCertifiedCommit(h int64, node rpcclient.Client,
	cert lite.Certifier) (empty lite.Commit, err error)

GetCertifiedCommit gets the signed header for a given height and certifies it. Returns error if unable to get a proven header.

func GetCertifier added in v0.7.0

func GetCertifier(chainID string, trust lite.Provider,
	source lite.Provider) (*lite.Inquiring, error)

GetCertifier initializes an inquiring certifier given a fixed chainID and a local source of trusted data with at least one seed

func GetKeyManager added in v0.7.0

func GetKeyManager(rootDir string) keys.Manager

GetKeyManager initializes a key manager based on the configuration

func GetLocalProvider added in v0.7.0

func GetLocalProvider(dir string) lite.Provider

GetLocalProvider returns a reference to a file store of headers wrapped with an in-memory cache

func GetNode added in v0.7.0

func GetNode(url string) rpcclient.Client

GetNode prepares a simple rpc.Client for the given endpoint

func GetRPCProvider added in v0.7.0

func GetRPCProvider(url string) lite.Provider

GetRPCProvider retuns a certifier compatible data source using tendermint RPC

func GetWithProof added in v0.7.0

func GetWithProof(key []byte, reqHeight int64, node rpcclient.Client,
	cert lite.Certifier) (
	val data.Bytes, height int64, proof iavl.KeyProof, err error)

GetWithProof will query the key on the given node, and verify it has a valid proof, as defined by the certifier.

If there is any error in checking, returns an error. If val is non-empty, proof should be KeyExistsProof If val is empty, proof should be KeyMissingProof

func GetWithProofOptions added in v0.8.0

func GetWithProofOptions(path string, key []byte, opts rpcclient.ABCIQueryOptions,
	node rpcclient.Client, cert lite.Certifier) (
	*ctypes.ResultABCIQuery, iavl.KeyProof, error)

GetWithProofOptions is useful if you want full access to the ABCIQueryOptions

func IsNoDataErr added in v0.8.0

func IsNoDataErr(err error) bool

IsNoDataErr checks whether an error is due to a query returning empty data

func RPCRoutes added in v0.7.0

func RPCRoutes(c rpcclient.Client) map[string]*rpc.RPCFunc

RPCRoutes just routes everything to the given client, as if it were a tendermint fullnode.

if we want security, the client must implement it as a secure client

func StartProxy added in v0.7.0

func StartProxy(c rpcclient.Client, bind string, logger log.Logger) error

StartProxy will start the websocket manager on the client, set up the rpc routes to proxy via the given client, and start up an http/rpc server on the location given by bind (eg. :1234)

func ValidateBlock added in v0.8.0

func ValidateBlock(meta *types.Block, check lite.Commit) error

func ValidateBlockMeta added in v0.8.0

func ValidateBlockMeta(meta *types.BlockMeta, check lite.Commit) error

func ValidateHeader added in v0.8.0

func ValidateHeader(head *types.Header, check lite.Commit) error

Types

type Wrapper added in v0.8.0

type Wrapper struct {
	rpcclient.Client
	// contains filtered or unexported fields
}

Wrapper wraps a rpcclient with a Certifier and double-checks any input that is provable before passing it along. Allows you to make any rpcclient fully secure.

func SecureClient added in v0.7.0

func SecureClient(c rpcclient.Client, cert *lite.Inquiring) Wrapper

SecureClient uses a given certifier to wrap an connection to an untrusted host and return a cryptographically secure rpc client.

If it is wrapping an HTTP rpcclient, it will also wrap the websocket interface

func (Wrapper) ABCIQuery added in v0.8.0

func (w Wrapper) ABCIQuery(path string, data data.Bytes) (*ctypes.ResultABCIQuery, error)

ABCIQuery uses default options for the ABCI query and verifies the returned proof

func (Wrapper) ABCIQueryWithOptions added in v0.8.0

func (w Wrapper) ABCIQueryWithOptions(path string, data data.Bytes, opts rpcclient.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

ABCIQueryWithOptions exposes all options for the ABCI query and verifies the returned proof

func (Wrapper) Block added in v0.8.0

func (w Wrapper) Block(height *int64) (*ctypes.ResultBlock, error)

Block returns an entire block and verifies all signatures

func (Wrapper) BlockchainInfo added in v0.8.0

func (w Wrapper) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

BlockchainInfo requests a list of headers and verifies them all... Rather expensive.

TODO: optimize this if used for anything needing performance

func (Wrapper) Commit added in v0.8.0

func (w Wrapper) Commit(height *int64) (*ctypes.ResultCommit, error)

Commit downloads the Commit and certifies it with the lite.

This is the foundation for all other verification in this module

func (Wrapper) Tx added in v0.8.0

func (w Wrapper) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)

Tx queries for a given tx and verifies the proof if it was requested

Directories

Path Synopsis
module
Package commands contains any general setup/helpers valid for all subcommands
Package commands contains any general setup/helpers valid for all subcommands
rpc
txs

Jump to

Keyboard shortcuts

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