common

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package common defines the interfaces that block, block header and transaction need to implement, and contains the implementations of each chain

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocker

type Blocker interface {
	Header

	// GetBlockHeader returns block header
	GetBlockHeader() Header

	// GetTransaction returns transactions in the block
	GetTransaction() []Transactioner

	// GetExtraData returns extra data in the block
	GetExtraData() interface{}
}

Blocker defines the interface that the block needs to implement

type Header interface {
	// GetChainId returns chainId
	GetChainId() string

	// GetPreHash returns the hash value of previous block
	GetPreHash() []byte

	// GetTxRoot returns the root hash of transaction tree
	GetTxRoot() []byte

	// GetHeight returns block height
	GetHeight() uint64

	// GetBlockHash returns block hash
	GetBlockHash() []byte
}

Header defines the interface that the block header needs to implement

type Transactioner

type Transactioner interface {
	// GetStatusCode returns the transaction status code
	GetStatusCode() int32

	// GetTransactionHash returns transaction hash
	GetTransactionHash() ([]byte, error)

	// GetContractName returns the contract name of transaction
	GetContractName() (string, error)

	// GetMethod returns the method in contract method of transaction
	GetMethod() (string, error)

	// GetParams returns parameters of transaction
	GetParams() ([]interface{}, error)

	// GetExtraData returns extra data of transaction, for example read-write set.
	GetExtraData() (interface{}, error)
}

Transactioner defines the interface that the transaction needs to implement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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