v032

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ABCIPubKeyTypeEd25519 = "ed25519"
View Source
const (
	// MaxChainIDLen is a maximum length of the chain ID.
	MaxChainIDLen = 50
)

Variables

View Source
var Cdc = codec.New()

Replace amino codec with sdk codec to avoid an explicit amino import in go.mod. This will use a different version of amino from tendermint v0.32, but they are backwards compatible.

Functions

func RegisterBlockAmino

func RegisterBlockAmino(cdc *codec.Codec)

Types

type Block added in v0.11.0

type Block struct {
	Header     `json:"header"`
	Data       tmtypes.Data         `json:"data"`
	Evidence   tmtypes.EvidenceData `json:"evidence"`
	LastCommit *Commit              `json:"last_commit"` // not using for trust wallet
	// contains filtered or unexported fields
}

Block defines the atomic unit of a Tendermint blockchain.

type BlockMeta added in v0.11.0

type BlockMeta struct {
	BlockID tmtypes.BlockID `json:"block_id"` // the block hash and partsethash
	Header  Header          `json:"header"`   // The block's Header
}

BlockMeta contains meta information about a block - namely, it's ID and Header.

type BlockParams

type BlockParams struct {
	MaxBytes int64 `json:"max_bytes"`
	MaxGas   int64 `json:"max_gas"`
	// Minimum time increment between consecutive blocks (in milliseconds)
	// Not exposed to the application.
	TimeIotaMs int64 `json:"time_iota_ms"`
}

BlockParams define limits on the block size and gas plus minimum time between blocks.

func DefaultBlockParams

func DefaultBlockParams() BlockParams

DefaultBlockParams returns a default BlockParams.

type Commit added in v0.11.0

type Commit struct {
}

Commit contains the evidence that a block was committed by a set of validators.

type Consensus added in v0.11.0

type Consensus struct {
	Block Protocol `json:"block"`
	App   Protocol `json:"app"`
}

Consensus captures the consensus rules for processing a block in the blockchain, including all blockchain data structures and the rules of the application's state transition machine.

type ConsensusParams

type ConsensusParams struct {
	Block     BlockParams     `json:"block"`
	Evidence  EvidenceParams  `json:"evidence"`
	Validator ValidatorParams `json:"validator"`
}

ConsensusParams contains consensus critical parameters that determine the validity of blocks.

func DefaultConsensusParams

func DefaultConsensusParams() *ConsensusParams

// DefaultConsensusParams returns a default ConsensusParams.

type EvidenceParams

type EvidenceParams struct {
	MaxAge int64 `json:"max_age"` // only accept new evidence more recent than this
}

EvidenceParams determine how we handle evidence of malfeasance.

func DefaultEvidenceParams

func DefaultEvidenceParams() EvidenceParams

DefaultEvidenceParams Params returns a default EvidenceParams.

type GenesisDoc

type GenesisDoc struct {
	GenesisTime     time.Time                `json:"genesis_time"`
	ChainID         string                   `json:"chain_id"`
	ConsensusParams *ConsensusParams         `json:"consensus_params,omitempty"`
	Validators      []types.GenesisValidator `json:"validators,omitempty"` // v0.33 GenesisValidator is backwards compatible with v0.32
	AppHash         tmbytes.HexBytes         `json:"app_hash"`             // moved from `common` to `bytes` as they are the same between v0.32 and v0.33
	AppState        json.RawMessage          `json:"app_state,omitempty"`
}

GenesisDoc defines the initial conditions for a tendermint blockchain, in particular its validator set.

func GenesisDocFromFile

func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error)

GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.

func GenesisDocFromJSON

func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)

GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc.

func (*GenesisDoc) ValidateAndComplete

func (genDoc *GenesisDoc) ValidateAndComplete() error

ValidateAndComplete checks that all necessary fields are present and fills in defaults for optional fields left empty

type Header struct {
	// basic block info
	Version  Consensus `json:"version"`
	ChainID  string    `json:"chain_id"`
	Height   int64     `json:"height"`
	Time     time.Time `json:"time"`
	NumTxs   int64     `json:"num_txs"`
	TotalTxs int64     `json:"total_txs"`

	// prev block info
	LastBlockID tmtypes.BlockID `json:"last_block_id"`

	// hashes of block data
	LastCommitHash tmbytes.HexBytes `json:"last_commit_hash"` // commit from validators from the last block
	DataHash       tmbytes.HexBytes `json:"data_hash"`        // transactions

	// hashes from the app output from the prev block
	ValidatorsHash     tmbytes.HexBytes `json:"validators_hash"`      // validators for the current block
	NextValidatorsHash tmbytes.HexBytes `json:"next_validators_hash"` // validators for the next block
	ConsensusHash      tmbytes.HexBytes `json:"consensus_hash"`       // consensus params for current block
	AppHash            tmbytes.HexBytes `json:"app_hash"`             // state after txs from the previous block
	// root hash of all results from the txs from the previous block
	LastResultsHash tmbytes.HexBytes `json:"last_results_hash"`

	// consensus info
	EvidenceHash    tmbytes.HexBytes `json:"evidence_hash"`    // evidence included in the block
	ProposerAddress tmtypes.Address  `json:"proposer_address"` // original proposer of the block
}

Header defines the structure of a Tendermint block header.

type Protocol added in v0.11.0

type Protocol uint64

Protocol is used for implementation agnostic versioning.

type ValidatorParams

type ValidatorParams struct {
	PubKeyTypes []string `json:"pub_key_types"`
}

ValidatorParams restrict the public key types validators can use. NOTE: uses ABCI pubkey naming, not Amino names.

func DefaultValidatorParams

func DefaultValidatorParams() ValidatorParams

DefaultValidatorParams returns a default ValidatorParams, which allows only ed25519 pubkeys.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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