README

IOV Weave

Build Status TravisCI codecov LoC Go Report Card API Reference ReadTheDocs license

Weave Logo

IOV Weave is a framework for quickly building your custom ABCI application to run a blockchain on top of the best-of-class BFT Proof-of-stake Tendermint consensus engine. It provides much commonly used functionality that can quickly be imported in your custom chain, as well as a simple framework for adding the custom functionality unique to your project.

Join the Weave community channel 📢

It is inspired by the routing and middleware model of many web application frameworks, and informed by years of wrestling with blockchain state machines. More directly, it is based on the official cosmos-sdk, both the 0.8 release as well as the future 0.9 rewrite. Naturally, as I was the main author of 0.8.

While both of those are extremely powerful and flexible and contain advanced features, they have a steep learning curve for novice users. Thus, this library aims to favor simplicity over power when there is a choice. If you hit limitations in the design of this library (such as maintaining multiple merkle stores in one app), I highly advise you to use the official cosmos sdk.

On the other hand, if you want to try out tendermint, or have a design that doesn't require an advanced setup, you should try this library and give feedback, especially on ease-of-use. The end goal is to make blockchain development almost as productive as web development (in golang), by providing defaults and best practices for many choices, while allowing extreme flexibility in business logic and data modelling.

For more details on the design goals, see the Design Document

Prerequisites

Instructions

First, make sure you have set up the requirements. If you have a solid go and node developer setup, you may skip this, but good to go through it to be sure.

Once you are set up, you should be able to run something like the following to compile both bnsd (IOV blockchain application) and bnscli (a client side app to interact with bnsd). You will have to install a compatible version of tendermint separately. (Currently we use the v0.31.5 release).

# cd into to your workspace that is not in your $GOPATH
git clone https://github.com/iov-one/weave.git
cd weave
make install

Note that this app relies on a separate tendermint process to drive it. It is helpful to first read a primer on tendermint as well as the documentation on the tendermint cli commands.

Once it compiles, I highly suggest going through the readthedocs

Compatibility

Check out compatibility charts

Protobuf Documentation

We generate documentation from the *.proto files to keep it up to date.

You can view the documentation for all packages used in the bns app.

Or generate it yourself:

make protodocs
open ./docs/proto/index.html

Contributions

When opening a pull request with a change that does not require a CHANGELOG entry, include !nochangelog in the description. This will inform our build system to not fail the build due to a missing CHANGELOG update. This instruction is needed only if you are changing any of the Go source files.

History

The original version, until v0.6.0 was released under confio/weave. The original author, Ethan Frey, had previously worked on the Cosmos SDK and wanted to make a simpler framework he could use to start building demo apps, while the main sdk matured. Thus, confio/weave was born the first few months of 2018. This framework was designed to be open source and shared, but the only real usage and development was by IOV, so it was donated to that organization in August 2018 to be developed further for their BNS blockchain, as well as a companion to iov-core client libraries that deprecated confio/weave-js

Audit

Check out our latest audit report.

Thanks to newfinal100 for designing the weave logo.

Documentation

Overview

    Package weave defines all common interfaces to weave together the various subpackages, as well as implementations of some of the simpler components (when interfaces would be too much overhead).

    We pass context through context.Context between app, middleware, and handlers. To do so, weave defines some common keys to store info, such as block height and chain id. Each extension, such as auth, may add its own keys to enrich the context with specific data.

    There should exist two functions for every XYZ of type T that we want to support in Context:

    WithXYZ(Context, T) Context
    GetXYZ(Context) (val T, ok bool)
    

    WithXYZ may error/panic if the value was previously set to avoid lower-level modules overwriting the value (eg. height, header)

    Index

    Constants

    View Source
    const (
    	// KeyQueryMod means to query for exact match (key)
    	KeyQueryMod = ""
    	// PrefixQueryMod means to query for anything with this prefix
    	PrefixQueryMod = "prefix"
    	// RangeQueryMod means to expect complex range query.
    	//
    	// Using query data, it is possible to declare start and end of a
    	// query. Each result is limited to certain amount of results.
    	// For bucket range query, data format is <start>[:<end>]
    	// For index queries, format is  <start>[:<offset>[:<end>]]
    	// Start is inclusive, end is exclusive. All values must be hex
    	// encoded.
    	// See each implementation for more details.
    	RangeQueryMod = "range"
    )

    Variables

    View Source
    var (
    	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
    	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
    )
    View Source
    var (
    	// DefaultLogger is used for all context that have not
    	// set anything themselves
    	DefaultLogger = log.NewNopLogger()
    
    	// IsValidChainID is the RegExp to ensure valid chain IDs
    	IsValidChainID = regexp.MustCompile(`^[a-zA-Z0-9_\-]{6,20}$`).MatchString
    )
    View Source
    var (
    	// AddressLength is the length of all addresses
    	// You can modify it in init() before any addresses are calculated,
    	// but it must not change during the lifetime of the kvstore
    	AddressLength = 20
    )
    View Source
    var Version = "please set in makefile"

      Version should be set by build flags: `git describe --tags`

      Functions

      func BlockTime

      func BlockTime(ctx Context) (time.Time, error)

        BlockTime returns current block wall clock time as declared in the context. An error is returned if a block time is not present in the context or if the zero time value is found.

        func CheckOrError

        func CheckOrError(result *CheckResult, err error, debug bool) abci.ResponseCheckTx

          CheckOrError returns an abci response for CheckTx, converting the error message if present, or using the successful CheckResult

          func CheckTxError

          func CheckTxError(err error, debug bool) abci.ResponseCheckTx

            CheckTxError converts any error into a abci.ResponseCheckTx, preserving as much info as possible. When in debug mode always the full error information is returned.

            func DeliverOrError

            func DeliverOrError(result *DeliverResult, err error, debug bool) abci.ResponseDeliverTx

              DeliverOrError returns an abci response for DeliverTx, converting the error message if present, or using the successful DeliverResult

              func DeliverTxError

              func DeliverTxError(err error, debug bool) abci.ResponseDeliverTx

                DeliverTxError converts any error into a abci.ResponseDeliverTx, preserving as much info as possible. When in debug mode always the full error information is returned.

                func GetChainID

                func GetChainID(ctx Context) string

                  GetChainID returns the current chain id panics if chain id not already set (should never happen)

                  func GetHeader

                  func GetHeader(ctx Context) (abci.Header, bool)

                    GetHeader returns the current block header ok is false if no header set in this Context

                    func GetHeight

                    func GetHeight(ctx Context) (int64, bool)

                      GetHeight returns the current block height ok is false if no height set in this Context

                      func GetLogger

                      func GetLogger(ctx Context) log.Logger

                        GetLogger returns the currently set logger, or DefaultLogger if none was set

                        func GetPath

                        func GetPath(tx Tx) string

                          GetPath returns the path of the message, or (missing) if no message

                          func InTheFuture

                          func InTheFuture(ctx context.Context, t time.Time) bool

                            InTheFuture returns true if given time is in the future compared to the current time as declared in the context. Context "now" should come from the block header. Keep in mind that this function is not inclusive of current time. It given time is equal to "now" then this function returns false. This function panic if the block time is not provided in the context. This must never happen. The panic is here to prevent from broken setup to be processing data incorrectly.

                            func InThePast

                            func InThePast(ctx context.Context, t time.Time) bool

                              InThePast returns true if given time is in the past compared to the current time as declared in the context. Context "now" should come from the block header. Keep in mind that this function is not inclusive of current time. It given time is equal to "now" then this function returns false. This function panic if the block time is not provided in the context. This must never happen. The panic is here to prevent from broken setup to be processing data incorrectly.

                              func IsExpired

                              func IsExpired(ctx Context, t UnixTime) bool

                                IsExpired returns true if given time is in the past as compared to the "now" as declared for the block. Expiration is inclusive, meaning that if current time is equal to the expiration time than this function returns true.

                                This function panic if the block time is not provided in the context. This must never happen. The panic is here to prevent from broken setup to be processing data incorrectly.

                                func LoadMsg

                                func LoadMsg(tx Tx, destination interface{}) error

                                  LoadMsg extracts the message represented by given transaction into given destination. Before returning message validation method is called.

                                  func StoreValidatorUpdates

                                  func StoreValidatorUpdates(store KVStore, vu ValidatorUpdates) error

                                  func ValidatorUpdatesToABCI

                                  func ValidatorUpdatesToABCI(updates ValidatorUpdates) []abci.ValidatorUpdate

                                    ValidatorUpdatesToABCI converts weave validator updates to abci representation.

                                    Types

                                    type Address

                                    type Address []byte

                                      Address represents a collision-free, one-way digest of a Condition

                                      It will be of size AddressLength

                                      func NewAddress

                                      func NewAddress(data []byte) Address

                                        NewAddress hashes and truncates into the proper size

                                        func ParseAddress

                                        func ParseAddress(enc string) (Address, error)

                                          ParseAddress accepts address in a string format and unmarshals it.

                                          func (Address) Bech32String

                                          func (a Address) Bech32String(prefix string) (string, error)

                                            Bech32String returns a human reacable bech32 string.

                                            func (Address) Clone

                                            func (a Address) Clone() Address

                                              Clone provides an independent copy of an address.

                                              func (Address) Equals

                                              func (a Address) Equals(b Address) bool

                                                Equals checks if two addresses are the same

                                                func (Address) MarshalJSON

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

                                                  MarshalJSON provides a hex representation for JSON, to override the standard base64 []byte encoding

                                                  func (*Address) Set

                                                  func (a *Address) Set(enc string) error

                                                    Set updates this address value to what is provided. This method implements flag.Value interface.

                                                    func (Address) String

                                                    func (a Address) String() string

                                                      String returns a human readable string. Currently hex, may move to bech32

                                                      func (*Address) UnmarshalJSON

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

                                                      func (Address) Validate

                                                      func (a Address) Validate() error

                                                        Validate returns an error if the address is not the valid size

                                                        type Batch

                                                        type Batch interface {
                                                        	SetDeleter
                                                        	Write() error
                                                        }

                                                          Batch can write multiple ops atomically to an underlying KVStore

                                                          type CacheableKVStore

                                                          type CacheableKVStore interface {
                                                          	KVStore
                                                          	CacheWrap() KVCacheWrap
                                                          }

                                                            CacheableKVStore is a KVStore that supports CacheWrapping

                                                            CacheWrap() should not return a Committer, since Commit() on cache-wraps make no sense.

                                                            type CheckResult

                                                            type CheckResult struct {
                                                            	// Data is a machine-parseable return value, like id of created entity
                                                            	Data []byte
                                                            	// Log is human-readable informational string
                                                            	Log string
                                                            	// RequiredFee can set an custom fee that must be paid for this transaction to be allowed to run.
                                                            	// This may enforced by a decorator, such as cash.DynamicFeeDecorator
                                                            	RequiredFee coin.Coin
                                                            	// GasAllocated is the maximum units of work we allow this tx to perform
                                                            	GasAllocated int64
                                                            	// GasPayment is the total fees for this tx (or other source of payment)
                                                            	//TODO: Implement when tendermint implements this properly
                                                            	GasPayment int64
                                                            }

                                                              CheckResult captures any non-error abci result to make sure people use error for error cases

                                                              func NewCheck

                                                              func NewCheck(gasAllocated int64, log string) CheckResult

                                                                NewCheck sets the gas used and the response data but no more info these are the most common info needed to be set by the Handler

                                                                func (CheckResult) ToABCI

                                                                func (c CheckResult) ToABCI() abci.ResponseCheckTx

                                                                  ToABCI converts our internal type into an abci response

                                                                  type Checker

                                                                  type Checker interface {
                                                                  	Check(ctx Context, store KVStore, tx Tx) (*CheckResult, error)
                                                                  }

                                                                    Checker is a subset of Handler to verify the validity of a transaction. It is its own interface to allow better type controls in the next arguments in Decorator

                                                                    type CommitID

                                                                    type CommitID struct {
                                                                    	Version int64
                                                                    	Hash    []byte
                                                                    }

                                                                      CommitID contains the tree version number and its merkle root.

                                                                      type CommitInfo

                                                                      type CommitInfo = abci.LastCommitInfo

                                                                        CommitInfo is a type alias for now, which allows us to override this type with a custom one at any moment.

                                                                        func GetCommitInfo

                                                                        func GetCommitInfo(ctx Context) (CommitInfo, bool)

                                                                          GetCommitInfo returns the info on validators that signed this block. Returns false if not present.

                                                                          type CommitKVStore

                                                                          type CommitKVStore interface {
                                                                          	// Get returns the value at last committed state
                                                                          	// returns nil iff key doesn't exist. Panics on nil key.
                                                                          	Get(key []byte) ([]byte, error)
                                                                          
                                                                          	// Get a CacheWrap to perform actions
                                                                          	// TODO: add Batch to atomic writes and efficiency
                                                                          	// invisibly inside this CacheWrap???
                                                                          	CacheWrap() KVCacheWrap
                                                                          
                                                                          	// Commit the next version to disk, and returns info
                                                                          	Commit() (CommitID, error)
                                                                          
                                                                          	// LoadLatestVersion loads the latest persisted version.
                                                                          	// If there was a crash during the last commit, it is guaranteed
                                                                          	// to return a stable state, even if older.
                                                                          	LoadLatestVersion() error
                                                                          
                                                                          	// LatestVersion returns info on the latest version saved to disk
                                                                          	LatestVersion() (CommitID, error)
                                                                          
                                                                          	// LoadVersion loads a specific persisted version.  When you load an old version, or
                                                                          	// when the last commit attempt didn't complete, the next commit after
                                                                          	// loading must be idempotent (return the same commit id).  Otherwise the
                                                                          	// behavior is undefined.
                                                                          	LoadVersion(ver int64) error
                                                                          }

                                                                            CommitKVStore is a root store that can make atomic commits to disk. We modify it in batch by getting a CacheWrap() and then Write(). Commit() will persist all changes to disk

                                                                            This store should also be able to return merkle proofs for any committed state.

                                                                            type Condition

                                                                            type Condition []byte

                                                                              Condition is a specially formatted array, containing information on who can authorize an action. It is of the format:

                                                                              sprintf("%s/%s/%s", extension, type, data)
                                                                              

                                                                              func NewCondition

                                                                              func NewCondition(ext, typ string, data []byte) Condition

                                                                              func (Condition) Address

                                                                              func (c Condition) Address() Address

                                                                                Address will convert a Condition into an Address

                                                                                func (Condition) Equals

                                                                                func (a Condition) Equals(b Condition) bool

                                                                                  Equals checks if two permissions are the same

                                                                                  func (Condition) MarshalJSON

                                                                                  func (c Condition) MarshalJSON() ([]byte, error)

                                                                                  func (Condition) Parse

                                                                                  func (c Condition) Parse() (string, string, []byte, error)

                                                                                    Parse will extract the sections from the Condition bytes and verify it is properly formatted

                                                                                    func (Condition) String

                                                                                    func (c Condition) String() string

                                                                                      String returns a human readable string. We keep the extension and type in ascii and hex-encode the binary data

                                                                                      func (*Condition) UnmarshalJSON

                                                                                      func (c *Condition) UnmarshalJSON(raw []byte) error

                                                                                      func (Condition) Validate

                                                                                      func (c Condition) Validate() error

                                                                                        Validate returns an error if the Condition is not the proper format

                                                                                        type Context

                                                                                        type Context = context.Context

                                                                                          Context is just an alias for the standard implementation. We use functions to extend it to our domain

                                                                                          func WithBlockTime

                                                                                          func WithBlockTime(ctx Context, t time.Time) Context

                                                                                            WithBlockTime sets the block time for the context. Block time is always represented in UTC.

                                                                                            func WithChainID

                                                                                            func WithChainID(ctx Context, chainID string) Context

                                                                                              WithChainID sets the chain id for the Context. panics if called with chain id already set

                                                                                              func WithCommitInfo

                                                                                              func WithCommitInfo(ctx Context, info CommitInfo) Context

                                                                                                WithCommitInfo sets the info on who signed the block in this Context. Panics if already set.

                                                                                                func WithHeader

                                                                                                func WithHeader(ctx Context, header abci.Header) Context

                                                                                                  WithHeader sets the block header for the Context. panics if called with header already set

                                                                                                  func WithHeight

                                                                                                  func WithHeight(ctx Context, height int64) Context

                                                                                                    WithHeight sets the block height for the Context. panics if called with height already set

                                                                                                    func WithLogInfo

                                                                                                    func WithLogInfo(ctx Context, keyvals ...interface{}) Context

                                                                                                      WithLogInfo accepts keyvalue pairs, and returns another context like this, after passing all the keyvals to the Logger

                                                                                                      func WithLogger

                                                                                                      func WithLogger(ctx Context, logger log.Logger) Context

                                                                                                        WithLogger sets the logger for this Context

                                                                                                        type Decorator

                                                                                                        type Decorator interface {
                                                                                                        	Check(ctx Context, store KVStore, tx Tx, next Checker) (*CheckResult, error)
                                                                                                        	Deliver(ctx Context, store KVStore, tx Tx, next Deliverer) (*DeliverResult, error)
                                                                                                        }

                                                                                                          Decorator wraps a Handler to provide common functionality like authentication, or fee-handling, to many Handlers

                                                                                                          type DeliverResult

                                                                                                          type DeliverResult struct {
                                                                                                          	// Data is a machine-parseable return value, like id of created entity
                                                                                                          	Data []byte
                                                                                                          	// Log is human-readable informational string
                                                                                                          	Log string
                                                                                                          	// RequiredFee can set an custom fee that must be paid for this transaction to be allowed to run.
                                                                                                          	// This may enforced by a decorator, such as cash.DynamicFeeDecorator
                                                                                                          	RequiredFee coin.Coin
                                                                                                          	// Diff, if present, will apply to the Validator set in tendermint next block
                                                                                                          	Diff []ValidatorUpdate
                                                                                                          	// Tags, if present, will be used by tendermint to index and search the transaction history
                                                                                                          	Tags []common.KVPair
                                                                                                          	// GasUsed is currently unused field until effects in tendermint are clear
                                                                                                          	GasUsed int64
                                                                                                          }

                                                                                                            DeliverResult captures any non-error abci result to make sure people use error for error cases

                                                                                                            func ParseDeliverOrError

                                                                                                            func ParseDeliverOrError(res abci.ResponseDeliverTx) (*DeliverResult, error)

                                                                                                              ParseDeliverOrError is the inverse of DeliverOrError It will parse back the abci response to return our internal format, or return an error on failed tx

                                                                                                              func (DeliverResult) ToABCI

                                                                                                                ToABCI converts our internal type into an abci response

                                                                                                                type Deliverer

                                                                                                                type Deliverer interface {
                                                                                                                	Deliver(ctx Context, store KVStore, tx Tx) (*DeliverResult, error)
                                                                                                                }

                                                                                                                  Deliverer is a subset of Handler to execute a transaction. It is its own interface to allow better type controls in the next arguments in Decorator

                                                                                                                  type Fraction

                                                                                                                  type Fraction struct {
                                                                                                                  	// The top number in a fraction.
                                                                                                                  	Numerator uint32 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"`
                                                                                                                  	// The bottom number
                                                                                                                  	Denominator uint32 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"`
                                                                                                                  }

                                                                                                                    The Fraction type represents a floating point number without the precision issues that native floating point type has.

                                                                                                                    func ParseFractionString

                                                                                                                    func ParseFractionString(raw string) (*Fraction, error)

                                                                                                                      ParseFractionString returns a fraction value that is represented by given string. This function fails if given string does not represent a fraction value. This fuction does not fail if representation format is correct but the value is invalid (i.e. value of "2/0").

                                                                                                                      func (Fraction) Compare

                                                                                                                      func (a Fraction) Compare(b Fraction) int

                                                                                                                        Compare returns an integer comparing two fraction numbers. The result will be

                                                                                                                         0 if a == b,
                                                                                                                        -1 if a < b,
                                                                                                                        +1 if a > b
                                                                                                                        

                                                                                                                        Comparison of invalid fraction values return undefined value.

                                                                                                                        func (*Fraction) Descriptor

                                                                                                                        func (*Fraction) Descriptor() ([]byte, []int)

                                                                                                                        func (*Fraction) GetDenominator

                                                                                                                        func (m *Fraction) GetDenominator() uint32

                                                                                                                        func (*Fraction) GetNumerator

                                                                                                                        func (m *Fraction) GetNumerator() uint32

                                                                                                                        func (*Fraction) Marshal

                                                                                                                        func (m *Fraction) Marshal() (dAtA []byte, err error)

                                                                                                                        func (Fraction) MarshalJSON

                                                                                                                        func (f Fraction) MarshalJSON() ([]byte, error)

                                                                                                                        func (*Fraction) MarshalTo

                                                                                                                        func (m *Fraction) MarshalTo(dAtA []byte) (int, error)

                                                                                                                        func (Fraction) Normalize

                                                                                                                        func (f Fraction) Normalize() Fraction

                                                                                                                          Normalize returns a new fraction instance that has its numerator and denominator reduced to the smallest possible representation.

                                                                                                                          func (*Fraction) ProtoMessage

                                                                                                                          func (*Fraction) ProtoMessage()

                                                                                                                          func (*Fraction) Reset

                                                                                                                          func (m *Fraction) Reset()

                                                                                                                          func (*Fraction) Size

                                                                                                                          func (m *Fraction) Size() (n int)

                                                                                                                          func (*Fraction) String

                                                                                                                          func (f *Fraction) String() string

                                                                                                                            String returns a human readable fraction representation.

                                                                                                                            func (*Fraction) Unmarshal

                                                                                                                            func (m *Fraction) Unmarshal(dAtA []byte) error

                                                                                                                            func (*Fraction) UnmarshalJSON

                                                                                                                            func (f *Fraction) UnmarshalJSON(raw []byte) error

                                                                                                                            func (Fraction) Validate

                                                                                                                            func (f Fraction) Validate() error

                                                                                                                              Validate returns an error if this fraction represents an invalid value.

                                                                                                                              func (*Fraction) XXX_DiscardUnknown

                                                                                                                              func (m *Fraction) XXX_DiscardUnknown()

                                                                                                                              func (*Fraction) XXX_Marshal

                                                                                                                              func (m *Fraction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

                                                                                                                              func (*Fraction) XXX_Merge

                                                                                                                              func (m *Fraction) XXX_Merge(src proto.Message)

                                                                                                                              func (*Fraction) XXX_Size

                                                                                                                              func (m *Fraction) XXX_Size() int

                                                                                                                              func (*Fraction) XXX_Unmarshal

                                                                                                                              func (m *Fraction) XXX_Unmarshal(b []byte) error

                                                                                                                              type GenesisParams

                                                                                                                              type GenesisParams struct {
                                                                                                                              	Validators []abci.ValidatorUpdate
                                                                                                                              }

                                                                                                                                GenesisParams represents parameters set in genesis that could be useful for some of the extensions.

                                                                                                                                func FromInitChain

                                                                                                                                func FromInitChain(req abci.RequestInitChain) GenesisParams

                                                                                                                                  FromInitChain initialises GenesisParams using abci.RequestInitChain data.

                                                                                                                                  type Handler

                                                                                                                                  type Handler interface {
                                                                                                                                  	Checker
                                                                                                                                  	Deliverer
                                                                                                                                  }

                                                                                                                                    Handler is a core engine that can process a few specific messages This could represent "coin transfer", or "bonding stake to a validator"

                                                                                                                                    type Initializer

                                                                                                                                    type Initializer interface {
                                                                                                                                    	FromGenesis(opts Options, params GenesisParams, kv KVStore) error
                                                                                                                                    }

                                                                                                                                      Initializer implementations are used to initialize extensions from genesis file contents

                                                                                                                                      type Iterator

                                                                                                                                      type Iterator interface {
                                                                                                                                      	// Next moves the iterator to the next sequential key in the database, as
                                                                                                                                      	// defined by order of iteration.
                                                                                                                                      	//
                                                                                                                                      	// Returns (nil, nil, errors.ErrIteratorDone) if there is no more data
                                                                                                                                      	Next() (key, value []byte, err error)
                                                                                                                                      
                                                                                                                                      	// Release releases the Iterator, allowing it to do any needed cleanup.
                                                                                                                                      	Release()
                                                                                                                                      }

                                                                                                                                        Iterator allows us to access a set of items within a range of keys. These may all be preloaded, or loaded on demand.

                                                                                                                                          Usage:
                                                                                                                                        
                                                                                                                                          var itr Iterator = ...
                                                                                                                                          defer itr.Release()
                                                                                                                                        
                                                                                                                                          k, v, err := itr.Next()
                                                                                                                                          for err == nil {
                                                                                                                                        	// ... do stuff with k, v
                                                                                                                                        	k, v, err = itr.Next()
                                                                                                                                          }
                                                                                                                                          // ErrIteratorDone means we hit the end, otherwise this is a real error
                                                                                                                                          if !errors.ErrIteratorDone.Is(err) {
                                                                                                                                        	  return err
                                                                                                                                          }
                                                                                                                                        

                                                                                                                                        type KVCacheWrap

                                                                                                                                        type KVCacheWrap interface {
                                                                                                                                        	// CacheableKVStore allows us to use this Cache recursively
                                                                                                                                        	CacheableKVStore
                                                                                                                                        
                                                                                                                                        	// Write syncs with the underlying store.
                                                                                                                                        	Write() error
                                                                                                                                        
                                                                                                                                        	// Discard invalidates this CacheWrap and releases all data
                                                                                                                                        	Discard()
                                                                                                                                        }

                                                                                                                                          KVCacheWrap allows us to maintain a scratch-pad of uncommitted data that we can view with all queries.

                                                                                                                                          At the end, call Write to use the cached data, or Discard to drop it.

                                                                                                                                          type KVStore

                                                                                                                                          type KVStore interface {
                                                                                                                                          	ReadOnlyKVStore
                                                                                                                                          	SetDeleter
                                                                                                                                          	// NewBatch returns a batch that can write multiple ops atomically
                                                                                                                                          	NewBatch() Batch
                                                                                                                                          }

                                                                                                                                            KVStore is a simple interface to get/set data

                                                                                                                                            For simplicity, we require all backing stores to implement this interface. They *may* implement other methods as well, but at least these are required.

                                                                                                                                            type Marshaller

                                                                                                                                            type Marshaller interface {
                                                                                                                                            	Marshal() ([]byte, error)
                                                                                                                                            }

                                                                                                                                              Marshaller is anything that can be represented in binary

                                                                                                                                              Marshall may validate the data before serializing it and unless you previously validated the struct, errors should be expected.

                                                                                                                                              type Metadata

                                                                                                                                              type Metadata struct {
                                                                                                                                              	Schema uint32 `protobuf:"varint,1,opt,name=schema,proto3" json:"schema,omitempty"`
                                                                                                                                              }

                                                                                                                                                Metadata is expected to be the first argument of every message or model. It contains all essential attributes. Each protobuf message should be declared with the first attribute being

                                                                                                                                                weave.Metadata metadata = 1;
                                                                                                                                                

                                                                                                                                                func (*Metadata) Copy

                                                                                                                                                func (m *Metadata) Copy() *Metadata

                                                                                                                                                  Copy returns a copy of this object. This method is helpful when implementing orm.CloneableData interface to make a copy of the header.

                                                                                                                                                  func (*Metadata) Descriptor

                                                                                                                                                  func (*Metadata) Descriptor() ([]byte, []int)

                                                                                                                                                  func (*Metadata) GetSchema

                                                                                                                                                  func (m *Metadata) GetSchema() uint32

                                                                                                                                                  func (*Metadata) Marshal

                                                                                                                                                  func (m *Metadata) Marshal() (dAtA []byte, err error)

                                                                                                                                                  func (*Metadata) MarshalTo

                                                                                                                                                  func (m *Metadata) MarshalTo(dAtA []byte) (int, error)

                                                                                                                                                  func (*Metadata) ProtoMessage

                                                                                                                                                  func (*Metadata) ProtoMessage()

                                                                                                                                                  func (*Metadata) Reset

                                                                                                                                                  func (m *Metadata) Reset()

                                                                                                                                                  func (*Metadata) Size

                                                                                                                                                  func (m *Metadata) Size() (n int)

                                                                                                                                                  func (*Metadata) String

                                                                                                                                                  func (m *Metadata) String() string

                                                                                                                                                  func (*Metadata) Unmarshal

                                                                                                                                                  func (m *Metadata) Unmarshal(dAtA []byte) error

                                                                                                                                                  func (*Metadata) Validate

                                                                                                                                                  func (m *Metadata) Validate() error

                                                                                                                                                  func (*Metadata) XXX_DiscardUnknown

                                                                                                                                                  func (m *Metadata) XXX_DiscardUnknown()

                                                                                                                                                  func (*Metadata) XXX_Marshal

                                                                                                                                                  func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

                                                                                                                                                  func (*Metadata) XXX_Merge

                                                                                                                                                  func (m *Metadata) XXX_Merge(src proto.Message)

                                                                                                                                                  func (*Metadata) XXX_Size

                                                                                                                                                  func (m *Metadata) XXX_Size() int

                                                                                                                                                  func (*Metadata) XXX_Unmarshal

                                                                                                                                                  func (m *Metadata) XXX_Unmarshal(b []byte) error

                                                                                                                                                  type Model

                                                                                                                                                  type Model struct {
                                                                                                                                                  	Key   []byte
                                                                                                                                                  	Value []byte
                                                                                                                                                  }

                                                                                                                                                    Model groups together key and value to return

                                                                                                                                                    func Pair

                                                                                                                                                    func Pair(key, value []byte) Model

                                                                                                                                                      Pair constructs a model from a key-value pair

                                                                                                                                                      type Msg

                                                                                                                                                      type Msg interface {
                                                                                                                                                      	Persistent
                                                                                                                                                      
                                                                                                                                                      	// Return the message path.
                                                                                                                                                      	// This is used by the Router to locate the proper Handler. Msg should
                                                                                                                                                      	// be created alongside the Handler that corresponds to them.
                                                                                                                                                      	//
                                                                                                                                                      	// Multiple message types may return the same path value and will end
                                                                                                                                                      	// up being processed by the same Handler.
                                                                                                                                                      	//
                                                                                                                                                      	// Path value must be constructed following several rules:
                                                                                                                                                      	// - name must be snake_case
                                                                                                                                                      	// - value must be in format <extension_name>/<message_type_name> where
                                                                                                                                                      	//   extension_name is the same as the Go package name and the
                                                                                                                                                      	//   message_type_name is the snake_case converted message name,
                                                                                                                                                      	//   without the `_msg` suffix.
                                                                                                                                                      	Path() string
                                                                                                                                                      
                                                                                                                                                      	// Validate performs a sanity checks on this message. It returns an
                                                                                                                                                      	// error if at least one test does not pass and message is considered
                                                                                                                                                      	// invalid.
                                                                                                                                                      	// This validation performs only tests that do not require external
                                                                                                                                                      	// resources (ie a database).
                                                                                                                                                      	Validate() error
                                                                                                                                                      }

                                                                                                                                                        Msg is message for the blockchain to take an action (Make a state transition). It is just the request, and must be validated by the Handlers. All authentication information is in the wrapping Tx.

                                                                                                                                                        func ExtractMsgFromSum

                                                                                                                                                        func ExtractMsgFromSum(sum interface{}) (Msg, error)

                                                                                                                                                          ExtractMsgFromSum will find a weave message from a tx sum type if it exists. Assuming you define your Tx with protobuf, this will help you implement GetMsg()

                                                                                                                                                          ExtractMsgFromSum(tx.GetSum())
                                                                                                                                                          

                                                                                                                                                          To work, this requires sum to be a pointer to a struct with one field, and that field can be cast to a Msg. Returns an error if it cannot succeed.

                                                                                                                                                          type Options

                                                                                                                                                          type Options map[string]json.RawMessage

                                                                                                                                                            Options are the app options Each extension can look up it's key and parse the json as desired

                                                                                                                                                            func (Options) ReadOptions

                                                                                                                                                            func (o Options) ReadOptions(key string, obj interface{}) error

                                                                                                                                                              ReadOptions reads the values stored under a given key, and parses the json into the given obj. Returns an error if it cannot parse. Noop and no error if key is missing

                                                                                                                                                              func (Options) Stream

                                                                                                                                                              func (o Options) Stream(key string) func(obj interface{}) error

                                                                                                                                                                Stream expects an array of json elements and allows to process them sequentially this helps when one needs to parse a large json without having any memory leaks. Returns ErrEmpty on empty key or when there are no more elements. Returns ErrState when the stream has finished/encountered a Decode error.mi

                                                                                                                                                                type Persistent

                                                                                                                                                                type Persistent interface {
                                                                                                                                                                	Marshaller
                                                                                                                                                                	Unmarshal([]byte) error
                                                                                                                                                                }

                                                                                                                                                                  Persistent supports Marshal and Unmarshal

                                                                                                                                                                  This is separated from Marshal, as this almost always requires a pointer, and functions that only need to marshal bytes can use the Marshaller interface to access non-pointers.

                                                                                                                                                                  As with Marshaller, this may do internal validation on the data and errors should be expected.

                                                                                                                                                                  type PubKey

                                                                                                                                                                  type PubKey struct {
                                                                                                                                                                  	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
                                                                                                                                                                  	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
                                                                                                                                                                  }

                                                                                                                                                                    PubKey represents a validator public key.

                                                                                                                                                                    func PubkeyFromABCI

                                                                                                                                                                    func PubkeyFromABCI(u abci.PubKey) PubKey

                                                                                                                                                                    func (PubKey) AsABCI

                                                                                                                                                                    func (m PubKey) AsABCI() abci.PubKey

                                                                                                                                                                    func (*PubKey) Descriptor

                                                                                                                                                                    func (*PubKey) Descriptor() ([]byte, []int)

                                                                                                                                                                    func (*PubKey) GetData

                                                                                                                                                                    func (m *PubKey) GetData() []byte

                                                                                                                                                                    func (*PubKey) GetType

                                                                                                                                                                    func (m *PubKey) GetType() string

                                                                                                                                                                    func (*PubKey) Marshal

                                                                                                                                                                    func (m *PubKey) Marshal() (dAtA []byte, err error)

                                                                                                                                                                    func (*PubKey) MarshalTo

                                                                                                                                                                    func (m *PubKey) MarshalTo(dAtA []byte) (int, error)

                                                                                                                                                                    func (*PubKey) ProtoMessage

                                                                                                                                                                    func (*PubKey) ProtoMessage()

                                                                                                                                                                    func (*PubKey) Reset

                                                                                                                                                                    func (m *PubKey) Reset()

                                                                                                                                                                    func (*PubKey) Size

                                                                                                                                                                    func (m *PubKey) Size() (n int)

                                                                                                                                                                    func (*PubKey) String

                                                                                                                                                                    func (m *PubKey) String() string

                                                                                                                                                                    func (*PubKey) Unmarshal

                                                                                                                                                                    func (m *PubKey) Unmarshal(dAtA []byte) error

                                                                                                                                                                    func (*PubKey) XXX_DiscardUnknown

                                                                                                                                                                    func (m *PubKey) XXX_DiscardUnknown()

                                                                                                                                                                    func (*PubKey) XXX_Marshal

                                                                                                                                                                    func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

                                                                                                                                                                    func (*PubKey) XXX_Merge

                                                                                                                                                                    func (m *PubKey) XXX_Merge(src proto.Message)

                                                                                                                                                                    func (*PubKey) XXX_Size

                                                                                                                                                                    func (m *PubKey) XXX_Size() int

                                                                                                                                                                    func (*PubKey) XXX_Unmarshal

                                                                                                                                                                    func (m *PubKey) XXX_Unmarshal(b []byte) error

                                                                                                                                                                    type QueryHandler

                                                                                                                                                                    type QueryHandler interface {
                                                                                                                                                                    	Query(db ReadOnlyKVStore, mod string, data []byte) ([]Model, error)
                                                                                                                                                                    }

                                                                                                                                                                      QueryHandler is anything that can process ABCI queries

                                                                                                                                                                      type QueryRegister

                                                                                                                                                                      type QueryRegister func(QueryRouter)

                                                                                                                                                                        QueryRegister is a function that adds some handlers to this router

                                                                                                                                                                        type QueryRouter

                                                                                                                                                                        type QueryRouter struct {
                                                                                                                                                                        	// contains filtered or unexported fields
                                                                                                                                                                        }

                                                                                                                                                                          QueryRouter allows us to register many query handlers to different paths and then direct each query to the proper handler.

                                                                                                                                                                          Minimal interface modeled after net/http.ServeMux

                                                                                                                                                                          func NewQueryRouter

                                                                                                                                                                          func NewQueryRouter() QueryRouter

                                                                                                                                                                            NewQueryRouter initializes a QueryRouter with no routes

                                                                                                                                                                            func (QueryRouter) Handler

                                                                                                                                                                            func (r QueryRouter) Handler(path string) QueryHandler

                                                                                                                                                                              Handler returns the registered Handler for this path. If no path is found, returns a noSuchPath Handler Always returns a non-nil Handler

                                                                                                                                                                              func (QueryRouter) Register

                                                                                                                                                                              func (r QueryRouter) Register(path string, h QueryHandler)

                                                                                                                                                                                Register adds a new Handler for the given path. This function panics if a handler for given path is already registered.

                                                                                                                                                                                Path should be constructed using following rules: - always use plural form of the model name it represents (unless uncountable) - use only lower case characters, no numbers, no underscore, dash or any

                                                                                                                                                                                other special characters
                                                                                                                                                                                

                                                                                                                                                                                For example, path for the UserProfile model handler is "userprofiles".

                                                                                                                                                                                func (QueryRouter) RegisterAll

                                                                                                                                                                                func (r QueryRouter) RegisterAll(qr ...QueryRegister)

                                                                                                                                                                                  RegisterAll registers a number of QueryRegister at once

                                                                                                                                                                                  type ReadOnlyKVStore

                                                                                                                                                                                  type ReadOnlyKVStore interface {
                                                                                                                                                                                  	// Get returns nil iff key doesn't exist. Panics on nil key.
                                                                                                                                                                                  	Get(key []byte) ([]byte, error)
                                                                                                                                                                                  
                                                                                                                                                                                  	// Has checks if a key exists. Panics on nil key.
                                                                                                                                                                                  	Has(key []byte) (bool, error)
                                                                                                                                                                                  
                                                                                                                                                                                  	// Iterator over a domain of keys in ascending order. End is exclusive.
                                                                                                                                                                                  	// Start must be less than end, or the Iterator is invalid.
                                                                                                                                                                                  	// CONTRACT: No writes may happen within a domain while an iterator exists over it.
                                                                                                                                                                                  	Iterator(start, end []byte) (Iterator, error)
                                                                                                                                                                                  
                                                                                                                                                                                  	// ReverseIterator over a domain of keys in descending order. End is exclusive.
                                                                                                                                                                                  	// Start must be less than end, or the Iterator is invalid.
                                                                                                                                                                                  	// CONTRACT: No writes may happen within a domain while an iterator exists over it.
                                                                                                                                                                                  	ReverseIterator(start, end []byte) (Iterator, error)
                                                                                                                                                                                  }

                                                                                                                                                                                    ReadOnlyKVStore is a simple interface to query data.

                                                                                                                                                                                    type Registry

                                                                                                                                                                                    type Registry interface {
                                                                                                                                                                                    	// Handle assigns given handler to handle processing of every message
                                                                                                                                                                                    	// of provided type.
                                                                                                                                                                                    	// Using a message with an invalid path panics.
                                                                                                                                                                                    	// Registering a handler for a message more than ones panics.
                                                                                                                                                                                    	Handle(Msg, Handler)
                                                                                                                                                                                    }

                                                                                                                                                                                      Registry is an interface to register your handler, the setup side of a Router

                                                                                                                                                                                      type Scheduler

                                                                                                                                                                                      type Scheduler interface {
                                                                                                                                                                                      	// Schedule queues given message in the database to be executed at
                                                                                                                                                                                      	// given time.  Message will be executed with context containing
                                                                                                                                                                                      	// provided authentication addresses.
                                                                                                                                                                                      	// When successful, returns the scheduled task ID.
                                                                                                                                                                                      	Schedule(KVStore, time.Time, []Condition, Msg) ([]byte, error)
                                                                                                                                                                                      
                                                                                                                                                                                      	// Delete removes a scheduled task from the queue. It returns
                                                                                                                                                                                      	// ErrNotFound if task with given ID is not present in the queue.
                                                                                                                                                                                      	Delete(KVStore, []byte) error
                                                                                                                                                                                      }

                                                                                                                                                                                        Scheduler is an interface implemented to allow scheduling message execution.

                                                                                                                                                                                        type SetDeleter

                                                                                                                                                                                        type SetDeleter interface {
                                                                                                                                                                                        	Set(key, value []byte) error // CONTRACT: key, value readonly []byte
                                                                                                                                                                                        	Delete(key []byte) error     // CONTRACT: key readonly []byte
                                                                                                                                                                                        }

                                                                                                                                                                                          SetDeleter is a minimal interface for writing, Unifying KVStore and Batch

                                                                                                                                                                                          type TickResult

                                                                                                                                                                                          type TickResult struct {
                                                                                                                                                                                          	// Tags contains a list of tags that were produced during a single tick
                                                                                                                                                                                          	// execution. They should be included in the block that this tick
                                                                                                                                                                                          	// result was produced.
                                                                                                                                                                                          	// Empty tag list is a valid result.
                                                                                                                                                                                          	Tags []common.KVPair
                                                                                                                                                                                          
                                                                                                                                                                                          	// Diff contains a list of validator update operations produced during
                                                                                                                                                                                          	// a single tick execution. They should be included in the block that
                                                                                                                                                                                          	// this tick result was produced.
                                                                                                                                                                                          	// Empty validator update list is a valid result.
                                                                                                                                                                                          	Diff []ValidatorUpdate
                                                                                                                                                                                          }

                                                                                                                                                                                            TickResult represents the result of a single tick run.

                                                                                                                                                                                            type Ticker

                                                                                                                                                                                            type Ticker interface {
                                                                                                                                                                                            	// Tick is a method called at the beginning of the block. It should be
                                                                                                                                                                                            	// used to execute any scheduled tasks.
                                                                                                                                                                                            	//
                                                                                                                                                                                            	// Because beginning of the block does not allow for an error response
                                                                                                                                                                                            	// this method does not return one as well. It is the implementation
                                                                                                                                                                                            	// responsibility to handle all error situations.
                                                                                                                                                                                            	// In case of an error that is an instance specific (ie database
                                                                                                                                                                                            	// issues) it might be neccessary for the method to terminate (ie
                                                                                                                                                                                            	// panic). An instance specific issue means that all other nodes most
                                                                                                                                                                                            	// likely succeeded processing the task and have different state than
                                                                                                                                                                                            	// this instance. This means that this node is out of sync with the
                                                                                                                                                                                            	// rest of the network and cannot continue operating as its state is
                                                                                                                                                                                            	// invalid.
                                                                                                                                                                                            	Tick(ctx Context, store CacheableKVStore) TickResult
                                                                                                                                                                                            }

                                                                                                                                                                                              Ticker is an interface used to call background tasks scheduled for execution.

                                                                                                                                                                                              type Tx

                                                                                                                                                                                              type Tx interface {
                                                                                                                                                                                              	Persistent
                                                                                                                                                                                              
                                                                                                                                                                                              	// GetMsg returns the action we wish to communicate
                                                                                                                                                                                              	GetMsg() (Msg, error)
                                                                                                                                                                                              }

                                                                                                                                                                                                Tx represent the data sent from the user to the chain. It includes the actual message, along with information needed to authenticate the sender (cryptographic signatures), and anything else needed to pass through middleware.

                                                                                                                                                                                                Each Application must define their own tx type, which embeds all the middlewares that we wish to use. auth.SignedTx and token.FeeTx are common interfaces that many apps will wish to support.

                                                                                                                                                                                                type TxDecoder

                                                                                                                                                                                                type TxDecoder func(txBytes []byte) (Tx, error)

                                                                                                                                                                                                  TxDecoder can parse bytes into a Tx

                                                                                                                                                                                                  type UnixDuration

                                                                                                                                                                                                  type UnixDuration int32

                                                                                                                                                                                                    UnixDuration represents a time duration with granularity of a second. This type should be used mostly for protobuf message declarations.

                                                                                                                                                                                                    func AsUnixDuration

                                                                                                                                                                                                    func AsUnixDuration(d time.Duration) UnixDuration

                                                                                                                                                                                                      AsUnixDuration converts given Duration into UnixDuration. Because of the UnixDuration granularity precision of the value is narrowed to seconds.

                                                                                                                                                                                                      func (UnixDuration) Duration

                                                                                                                                                                                                      func (d UnixDuration) Duration() time.Duration

                                                                                                                                                                                                        Duration returns the time.Duration representation of this value.

                                                                                                                                                                                                        func (UnixDuration) MarshalJSON

                                                                                                                                                                                                        func (d UnixDuration) MarshalJSON() ([]byte, error)

                                                                                                                                                                                                        func (UnixDuration) String

                                                                                                                                                                                                        func (d UnixDuration) String() string

                                                                                                                                                                                                        func (*UnixDuration) UnmarshalJSON

                                                                                                                                                                                                        func (d *UnixDuration) UnmarshalJSON(raw []byte) error

                                                                                                                                                                                                          UnmarshalJSON loads JSON serialized representation into this value. JSON serialized value can be represented as both number of seconds and a human readable string with time unit as used by the time package.

                                                                                                                                                                                                          type UnixTime

                                                                                                                                                                                                          type UnixTime int64

                                                                                                                                                                                                            UnixTime represents a point in time as POSIX time. This type comes in handy when dealing with protobuf messages. Instead of using Go's time.Time that includes nanoseconds use primitive int64 type and seconds precision. Some languages do not support nanoseconds precision anyway.

                                                                                                                                                                                                            When using in protobuf declaration, use gogoproto's typecasting

                                                                                                                                                                                                            int64 deadline = 1 [(gogoproto.casttype) = "github.com/iov-one/weave.UnixTime"];
                                                                                                                                                                                                            

                                                                                                                                                                                                            func AsUnixTime

                                                                                                                                                                                                            func AsUnixTime(t time.Time) UnixTime

                                                                                                                                                                                                              AsUnixTime converts given Time structure into its UNIX time representation. All time information more granular than a second is dropped as it cannot be represented by the UnixTime type.

                                                                                                                                                                                                              func (UnixTime) Add

                                                                                                                                                                                                              func (t UnixTime) Add(d time.Duration) UnixTime

                                                                                                                                                                                                                Add modifies this UNIX time by given duration. This is compatible with time.Time.Add method. Any duration value smaller than a second is ignored as it cannot be represented by the UnixTime type.

                                                                                                                                                                                                                func (UnixTime) String

                                                                                                                                                                                                                func (t UnixTime) String() string

                                                                                                                                                                                                                  String returns the usual string representation of this time as the time.Time structure would.

                                                                                                                                                                                                                  func (UnixTime) Time

                                                                                                                                                                                                                  func (t UnixTime) Time() time.Time

                                                                                                                                                                                                                    Time returns a time.Time structure that represents the same moment in time.

                                                                                                                                                                                                                    func (*UnixTime) UnmarshalJSON

                                                                                                                                                                                                                    func (t *UnixTime) UnmarshalJSON(raw []byte) error

                                                                                                                                                                                                                      UnmarshalJSON supports unmarshaling both as time.Time and from a number. Usually a number is used as a representation of this time in JSON but it is convenient to use a string format in configurations (ie genesis file). Any granularity smaller than a second is dropped. For example, 1900 milliseconds will be narrowed to 1 second.

                                                                                                                                                                                                                      func (UnixTime) Validate

                                                                                                                                                                                                                      func (t UnixTime) Validate() error

                                                                                                                                                                                                                        Validate returns an error if this time value is invalid.

                                                                                                                                                                                                                        type ValidatorUpdate

                                                                                                                                                                                                                        type ValidatorUpdate struct {
                                                                                                                                                                                                                        	PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"`
                                                                                                                                                                                                                        	Power  int64  `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"`
                                                                                                                                                                                                                        }

                                                                                                                                                                                                                          ValidatorUpdate represents an update to validator set.

                                                                                                                                                                                                                          func ValidatorUpdateFromABCI

                                                                                                                                                                                                                          func ValidatorUpdateFromABCI(u abci.ValidatorUpdate) ValidatorUpdate

                                                                                                                                                                                                                          func (ValidatorUpdate) AsABCI

                                                                                                                                                                                                                          func (*ValidatorUpdate) Descriptor

                                                                                                                                                                                                                          func (*ValidatorUpdate) Descriptor() ([]byte, []int)

                                                                                                                                                                                                                          func (*ValidatorUpdate) GetPower

                                                                                                                                                                                                                          func (m *ValidatorUpdate) GetPower() int64

                                                                                                                                                                                                                          func (*ValidatorUpdate) GetPubKey

                                                                                                                                                                                                                          func (m *ValidatorUpdate) GetPubKey() PubKey

                                                                                                                                                                                                                          func (*ValidatorUpdate) Marshal

                                                                                                                                                                                                                          func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error)

                                                                                                                                                                                                                          func (*ValidatorUpdate) MarshalTo

                                                                                                                                                                                                                          func (m *ValidatorUpdate) MarshalTo(dAtA []byte) (int, error)

                                                                                                                                                                                                                          func (*ValidatorUpdate) ProtoMessage

                                                                                                                                                                                                                          func (*ValidatorUpdate) ProtoMessage()

                                                                                                                                                                                                                          func (*ValidatorUpdate) Reset

                                                                                                                                                                                                                          func (m *ValidatorUpdate) Reset()

                                                                                                                                                                                                                          func (*ValidatorUpdate) Size

                                                                                                                                                                                                                          func (m *ValidatorUpdate) Size() (n int)

                                                                                                                                                                                                                          func (*ValidatorUpdate) String

                                                                                                                                                                                                                          func (m *ValidatorUpdate) String() string

                                                                                                                                                                                                                          func (*ValidatorUpdate) Unmarshal

                                                                                                                                                                                                                          func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error

                                                                                                                                                                                                                          func (ValidatorUpdate) Validate

                                                                                                                                                                                                                          func (m ValidatorUpdate) Validate() error

                                                                                                                                                                                                                          func (*ValidatorUpdate) XXX_DiscardUnknown

                                                                                                                                                                                                                          func (m *ValidatorUpdate) XXX_DiscardUnknown()

                                                                                                                                                                                                                          func (*ValidatorUpdate) XXX_Marshal

                                                                                                                                                                                                                          func (m *ValidatorUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

                                                                                                                                                                                                                          func (*ValidatorUpdate) XXX_Merge

                                                                                                                                                                                                                          func (m *ValidatorUpdate) XXX_Merge(src proto.Message)

                                                                                                                                                                                                                          func (*ValidatorUpdate) XXX_Size

                                                                                                                                                                                                                          func (m *ValidatorUpdate) XXX_Size() int

                                                                                                                                                                                                                          func (*ValidatorUpdate) XXX_Unmarshal

                                                                                                                                                                                                                          func (m *ValidatorUpdate) XXX_Unmarshal(b []byte) error

                                                                                                                                                                                                                          type ValidatorUpdates

                                                                                                                                                                                                                          type ValidatorUpdates struct {
                                                                                                                                                                                                                          	ValidatorUpdates []ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates"`
                                                                                                                                                                                                                          }

                                                                                                                                                                                                                            ValidatorUpdates represents latest validator state, currently used to validate SetValidatorMsg transactions.

                                                                                                                                                                                                                            func GetValidatorUpdates

                                                                                                                                                                                                                            func GetValidatorUpdates(store KVStore) (ValidatorUpdates, error)

                                                                                                                                                                                                                            func ValidatorUpdatesFromABCI

                                                                                                                                                                                                                            func ValidatorUpdatesFromABCI(u []abci.ValidatorUpdate) ValidatorUpdates

                                                                                                                                                                                                                            func (ValidatorUpdates) Deduplicate

                                                                                                                                                                                                                            func (m ValidatorUpdates) Deduplicate(dropZeroPower bool) ValidatorUpdates

                                                                                                                                                                                                                              Deduplicate makes sure we only use the last validator update to any given validator. For bookkeeping we have an option to drop validators with zero power, because those are being removed by tendermint once propagated.

                                                                                                                                                                                                                              func (*ValidatorUpdates) Descriptor

                                                                                                                                                                                                                              func (*ValidatorUpdates) Descriptor() ([]byte, []int)

                                                                                                                                                                                                                              func (ValidatorUpdates) Get

                                                                                                                                                                                                                                Get gets a ValidatorUpdate by a public key if it exists

                                                                                                                                                                                                                                func (*ValidatorUpdates) GetValidatorUpdates

                                                                                                                                                                                                                                func (m *ValidatorUpdates) GetValidatorUpdates() []ValidatorUpdate

                                                                                                                                                                                                                                func (*ValidatorUpdates) Marshal

                                                                                                                                                                                                                                func (m *ValidatorUpdates) Marshal() (dAtA []byte, err error)

                                                                                                                                                                                                                                func (*ValidatorUpdates) MarshalTo

                                                                                                                                                                                                                                func (m *ValidatorUpdates) MarshalTo(dAtA []byte) (int, error)

                                                                                                                                                                                                                                func (*ValidatorUpdates) ProtoMessage

                                                                                                                                                                                                                                func (*ValidatorUpdates) ProtoMessage()

                                                                                                                                                                                                                                func (*ValidatorUpdates) Reset

                                                                                                                                                                                                                                func (m *ValidatorUpdates) Reset()

                                                                                                                                                                                                                                func (*ValidatorUpdates) Size

                                                                                                                                                                                                                                func (m *ValidatorUpdates) Size() (n int)

                                                                                                                                                                                                                                func (*ValidatorUpdates) String

                                                                                                                                                                                                                                func (m *ValidatorUpdates) String() string

                                                                                                                                                                                                                                func (*ValidatorUpdates) Unmarshal

                                                                                                                                                                                                                                func (m *ValidatorUpdates) Unmarshal(dAtA []byte) error

                                                                                                                                                                                                                                func (ValidatorUpdates) Validate

                                                                                                                                                                                                                                func (m ValidatorUpdates) Validate() error

                                                                                                                                                                                                                                func (*ValidatorUpdates) XXX_DiscardUnknown

                                                                                                                                                                                                                                func (m *ValidatorUpdates) XXX_DiscardUnknown()

                                                                                                                                                                                                                                func (*ValidatorUpdates) XXX_Marshal

                                                                                                                                                                                                                                func (m *ValidatorUpdates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

                                                                                                                                                                                                                                func (*ValidatorUpdates) XXX_Merge

                                                                                                                                                                                                                                func (m *ValidatorUpdates) XXX_Merge(src proto.Message)

                                                                                                                                                                                                                                func (*ValidatorUpdates) XXX_Size

                                                                                                                                                                                                                                func (m *ValidatorUpdates) XXX_Size() int

                                                                                                                                                                                                                                func (*ValidatorUpdates) XXX_Unmarshal

                                                                                                                                                                                                                                func (m *ValidatorUpdates) XXX_Unmarshal(b []byte) error

                                                                                                                                                                                                                                Directories

                                                                                                                                                                                                                                Path Synopsis
                                                                                                                                                                                                                                cmd
                                                                                                                                                                                                                                bnsd/app
                                                                                                                                                                                                                                Package app links together all the various components to construct the bnsd app.
                                                                                                                                                                                                                                Package app links together all the various components to construct the bnsd app.
                                                                                                                                                                                                                                bnsd/commands
                                                                                                                                                                                                                                Package commands has integration tests of the bnsd application.
                                                                                                                                                                                                                                Package commands has integration tests of the bnsd application.
                                                                                                                                                                                                                                bnsd/x/account
                                                                                                                                                                                                                                Package account implements Account functionality.
                                                                                                                                                                                                                                Package account implements Account functionality.
                                                                                                                                                                                                                                bnsd/x/preregistration
                                                                                                                                                                                                                                Package preregistration implements a storage for account preregistration.
                                                                                                                                                                                                                                Package preregistration implements a storage for account preregistration.
                                                                                                                                                                                                                                bnsd/x/termdeposit
                                                                                                                                                                                                                                Package termdeposit implements an intrest-bearing contracts.
                                                                                                                                                                                                                                Package termdeposit implements an intrest-bearing contracts.
                                                                                                                                                                                                                                bnsd/x/username
                                                                                                                                                                                                                                Package username implements a register of names that point to any blockchain address.
                                                                                                                                                                                                                                Package username implements a register of names that point to any blockchain address.
                                                                                                                                                                                                                                Crypto package is used to build, verify and convert signatures.
                                                                                                                                                                                                                                Crypto package is used to build, verify and convert signatures.
                                                                                                                                                                                                                                Data migration package implements a functionality to declare and execute data migrations.
                                                                                                                                                                                                                                Data migration package implements a functionality to declare and execute data migrations.
                                                                                                                                                                                                                                Package gconf provides a toolset for managing an extension configuration.
                                                                                                                                                                                                                                Package gconf provides a toolset for managing an extension configuration.
                                                                                                                                                                                                                                Package migration provides tooling necessary for working with schema versioned entities.
                                                                                                                                                                                                                                Package migration provides tooling necessary for working with schema versioned entities.
                                                                                                                                                                                                                                Package orm provides an easy to use db wrapper Break state space into prefixed sections called Buckets.
                                                                                                                                                                                                                                Package orm provides an easy to use db wrapper Break state space into prefixed sections called Buckets.
                                                                                                                                                                                                                                Package tmtest provides helpers for testing using tendermint server.
                                                                                                                                                                                                                                Package tmtest provides helpers for testing using tendermint server.
                                                                                                                                                                                                                                Package weavetest provides mocks and functions that makes testing weave functionality easier.
                                                                                                                                                                                                                                Package weavetest provides mocks and functions that makes testing weave functionality easier.
                                                                                                                                                                                                                                x
                                                                                                                                                                                                                                Package x contains some standard extensions Extensions implement common functionality (Handler, Decorator, etc.) and can be combined together to construct an application All sub-packages are various extensions, useful to build applications, but not necessary to use the framework.
                                                                                                                                                                                                                                Package x contains some standard extensions Extensions implement common functionality (Handler, Decorator, etc.) and can be combined together to construct an application All sub-packages are various extensions, useful to build applications, but not necessary to use the framework.
                                                                                                                                                                                                                                aswap
                                                                                                                                                                                                                                Package aswap implements an atomic swap.
                                                                                                                                                                                                                                Package aswap implements an atomic swap.
                                                                                                                                                                                                                                batch
                                                                                                                                                                                                                                Package batch provides batch transaction support middleware to support multiple operations in one transaction Package batch implements batch transactions.
                                                                                                                                                                                                                                Package batch provides batch transaction support middleware to support multiple operations in one transaction Package batch implements batch transactions.
                                                                                                                                                                                                                                cash
                                                                                                                                                                                                                                Package cash defines a simple implementation of sending coins between multi-signature wallets.
                                                                                                                                                                                                                                Package cash defines a simple implementation of sending coins between multi-signature wallets.
                                                                                                                                                                                                                                cron
                                                                                                                                                                                                                                Package cron implements delayed message execution.
                                                                                                                                                                                                                                Package cron implements delayed message execution.
                                                                                                                                                                                                                                currency
                                                                                                                                                                                                                                Package currency provides an implementation of a token registry.
                                                                                                                                                                                                                                Package currency provides an implementation of a token registry.
                                                                                                                                                                                                                                distribution
                                                                                                                                                                                                                                Package distribution implements a revenue stream that is periodically distributing collected coins between defined destinations.
                                                                                                                                                                                                                                Package distribution implements a revenue stream that is periodically distributing collected coins between defined destinations.
                                                                                                                                                                                                                                escrow
                                                                                                                                                                                                                                Package escrow implements an Escrow.
                                                                                                                                                                                                                                Package escrow implements an Escrow.
                                                                                                                                                                                                                                gov
                                                                                                                                                                                                                                Package gov contains on chain governance process protocols.
                                                                                                                                                                                                                                Package gov contains on chain governance process protocols.
                                                                                                                                                                                                                                msgfee
                                                                                                                                                                                                                                Package msgfee allows to define and charge an additional fee per transaction type.
                                                                                                                                                                                                                                Package msgfee allows to define and charge an additional fee per transaction type.
                                                                                                                                                                                                                                multisig
                                                                                                                                                                                                                                > Multisignature (multi-signature) is a digital signature scheme which allows a group of users to sign a single document.
                                                                                                                                                                                                                                > Multisignature (multi-signature) is a digital signature scheme which allows a group of users to sign a single document.
                                                                                                                                                                                                                                paychan
                                                                                                                                                                                                                                Package paychan implements payment side channel functionality.
                                                                                                                                                                                                                                Package paychan implements payment side channel functionality.
                                                                                                                                                                                                                                sigs
                                                                                                                                                                                                                                Package sigs provides basic authentication middleware to verify the signatures on the transaction, and maintain nonces for replay protection.
                                                                                                                                                                                                                                Package sigs provides basic authentication middleware to verify the signatures on the transaction, and maintain nonces for replay protection.
                                                                                                                                                                                                                                txfee
                                                                                                                                                                                                                                Package txfee implements a fee middleware that computes an additional transaction fee, depending on each transaction binary size.
                                                                                                                                                                                                                                Package txfee implements a fee middleware that computes an additional transaction fee, depending on each transaction binary size.