blockchain

package module
v0.0.0-...-37e7a24 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 24 Imported by: 1

README

chain5j-blockchain

简介

chain5j-blockchain chain5j链对数据库处理模块。

功能

证书

chain5j-blockchain 的源码允许用户在遵循 Apache 2.0 开源证书 规则的前提下使用。

版权

Copyright@2021 chain5j

chain5j

Documentation

Overview

Package blockchain

@author: xwc1125

Package blockchain

@author: xwc1125

Package blockchain

@author: xwc1125

Package blockchain

@author: xwc1125

Package blockchain

@author: xwc1125

Package blockchain

@author: xwc1125

Package blockchain

@author: xwc1125

Index

Constants

This section is empty.

Variables

View Source
var BadHashes = map[types.Hash]bool{}

BadHashes 硬分叉的hash

View Source
var (
	ErrFutureBlock = errors.New("block in the future")
)

Functions

func NewBlockRW

NewBlockRW 创建block读写对象

func NewBlockReader

func NewBlockReader(config protocol.Config, database protocol.Database, apis protocol.APIs) (protocol.BlockReader, error)

NewBlockReader 创建区块链服务

func NewBlockWriter

func NewBlockWriter(reader protocol.BlockReader,
	engine protocol.Consensus,
	apps protocol.Apps) *blockWriter

NewBlockWriter 创建blockWriter

func RPCMarshalBlock

func RPCMarshalBlock(ctx context.Context, b *models.Block) (map[string]interface{}, error)

Types

type API

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

func NewAPI

func NewAPI(bc protocol.BlockReader) *API

func (*API) BlockHeight

func (api *API) BlockHeight(ctx context.Context) hexutil.Uint64

func (*API) GetBlockByHash

func (api *API) GetBlockByHash(ctx context.Context, blockHash types.Hash) (map[string]interface{}, error)

func (*API) GetBlockByNumber

func (api *API) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (map[string]interface{}, error)

func (*API) GetBlockTransactionCountByHash

func (api *API) GetBlockTransactionCountByHash(ctx context.Context, blockHash types.Hash) *hexutil.Uint

func (*API) NewHeads

func (api *API) NewHeads(ctx context.Context) (*rpc.Subscription, error)

NewHeads send a notification each time a new (header) block is appended to the chain.

type WhCallback

type WhCallback func(*models.Header) error

WhCallback 插入单个区块是的回调函数

type WriteStatus

type WriteStatus byte

WriteStatus 写的状态

const (
	NonStatTy       WriteStatus = iota
	CanonicalStatTy             // 标准状态
	SideStatTy                  // 侧链状态
)

Jump to

Keyboard shortcuts

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