blockchain

package
v0.0.0-...-215cb89 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: GPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AuthorizationLimit = 500
)

Variables

View Source
var (
	HashMisMatch  = errors.New("mismatch hash")
	InvalidAuths  = errors.New("invalid authorizations")
	ChainPathLack = errors.New("the parameter chainPath must be needed")
)

Functions

This section is empty.

Types

type Blockchain

type Blockchain struct {
	// blocks in the blockchain
	Blocks []*blockType.Block
	// global state used for authentication
	State *blockType.GlobalState
	// pending authorizations and operations stored in pool
	AuthPool *blockType.AuthPool
	// chainDB used for blockchain data storage
	ChainDB *leveldb.DB
	// log used for logging
	Log log.Logger
	// contains filtered or unexported fields
}

func InitBlockchain

func InitBlockchain(chainConfPath string, logger *log.Logger) (*Blockchain, error)

func (*Blockchain) AddNewBlock

func (bc *Blockchain) AddNewBlock(b *blockType.Block) (bool, error)

func (*Blockchain) CheckNewBlock

func (bc *Blockchain) CheckNewBlock(b *blockType.Block) bool

func (*Blockchain) GenerateNewBlock

func (bc *Blockchain) GenerateNewBlock() *blockType.Block

func (*Blockchain) GetHeight

func (bc *Blockchain) GetHeight() int

func (*Blockchain) GetLastBlock

func (bc *Blockchain) GetLastBlock() *blockType.Block

func (*Blockchain) GetLastHash

func (bc *Blockchain) GetLastHash() *cryptoTypes.Hash

func (*Blockchain) Quit

func (bc *Blockchain) Quit()

func (*Blockchain) ToIndexJson

func (bc *Blockchain) ToIndexJson() []byte

func (*Blockchain) ToIndexMap

func (bc *Blockchain) ToIndexMap() *map[string]interface{}

func (*Blockchain) ToJson

func (bc *Blockchain) ToJson() []byte

func (*Blockchain) ToMap

func (bc *Blockchain) ToMap() *map[string]interface{}

func (*Blockchain) ToPrettyJson

func (bc *Blockchain) ToPrettyJson() []byte

func (*Blockchain) ToString

func (bc *Blockchain) ToString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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