ups

package
v0.0.0-...-48d19ed Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: GPL-3.0 Imports: 59 Imported by: 0

README

ups

init

Documentation

Overview

Package ups implements the Upschain protocol.

Index

Constants

View Source
const (
	StatusMsg          = 0x00
	NewBlockHashesMsg  = 0x01
	TransactionMsg     = 0x02
	GetBlockHeadersMsg = 0x03
	BlockHeadersMsg    = 0x04
	GetBlockBodiesMsg  = 0x05
	BlockBodiesMsg     = 0x06
	NewBlockMsg        = 0x07
	GetNodeDataMsg     = 0x0d
	NodeDataMsg        = 0x0e
	GetReceiptsMsg     = 0x0f
	ReceiptsMsg        = 0x10

	// New protocol message codes introduced in eth65
	//
	// Previously these message ids were used by some legacy and unsupported
	// eth protocols, reown them here.
	NewPooledTransactionHashesMsg = 0x08
	GetPooledTransactionsMsg      = 0x09
	PooledTransactionsMsg         = 0x0a

	// Protocol messages belonging to yue/63
	TbftNodeInfoMsg     = 0x14
	TbftNodeInfoHashMsg = 0x15
	GetTbftNodeInfoMsg  = 0x16
)

ups protocol message codes

View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNetworkIDMismatch
	ErrGenesisMismatch
	ErrForkIDRejected
	ErrNoStatusMsg
	ErrExtraStatusMsg
	ErrCamsg
)
View Source
const DefaultULCMinTrustedFraction = 75
View Source
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message

Variables

View Source
var DefaultConfig = Config{
	SyncMode:      downloader.FullSync,
	NodeType:      false,
	NetworkId:     19330,
	DatabaseCache: 768,
	TrieCache:     256,
	TrieTimeout:   60 * time.Minute,

	MinervaMode:   0,
	GasPrice:      big.NewInt(1 * params.Babbage),
	MinerGasFloor: 12000000,
	MinerGasCeil:  16000000,
	TxPool:        core.DefaultTxPoolConfig,
	GPO: gasprice.Config{
		Blocks:     20,
		Percentile: 60,
	},
	Port:        30310,
	StandbyPort: 30311,
}

DefaultConfig contains default settings for use on the Upschain main net.

View Source
var ProtocolLengths = map[uint]uint64{/* contains filtered or unexported fields */}

protocolLengths are the number of implemented message corresponding to different protocol versions.

View Source
var ProtocolName = "ups"

ProtocolName is the official short name of the protocol used during capability negotiation.

View Source
var ProtocolVersions = []uint{eth65, eth64, eth63}

ProtocolVersions are the supported versions of the eth protocol (first is primary).

Functions

func CreateConsensusEngine

func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, db upsdb.Database) consensus.Engine

CreateConsensusEngine creates the required type of consensus engine instance for an Upschain service

func CreateDB

func CreateDB(ctx *node.ServiceContext, config *Config, name string) (upsdb.Database, error)

CreateDB creates the chain database.

func NewBloomIndexer

func NewBloomIndexer(db upsdb.Database, size, confirms uint64) *core.ChainIndexer

NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.

Types

type AgentNetworkProxy

type AgentNetworkProxy interface {
	// SubscribeNewPbftSignEvent should return an event subscription of
	// PbftSignEvent and send events to the given channel.
	SubscribeNewPbftSignEvent(chan<- types.PbftSignEvent) event.Subscription
	// SubscribeNodeInfoEvent should return an event subscription of
	// NodeInfoEvent and send events to the given channel.
	SubscribeNodeInfoEvent(chan<- types.NodeInfoEvent) event.Subscription
	// AddRemoteNodeInfo should add the given NodeInfo to the pbft agent.
	AddRemoteNodeInfo(*types.EncryptNodeMessage) error
	//GetNodeInfoByHash get crypto nodeInfo  by hash
	GetNodeInfoByHash(nodeInfoHash common.Hash) (*types.EncryptNodeMessage, bool)
}

type AgentWork

type AgentWork struct {
	Block *types.Block // the new block
	// contains filtered or unexported fields
}

AgentWork is the leader current environment and holds all of the current state information

type Backend

type Backend interface {
	BlockChain() *core.BlockChain
	TxPool() *core.TxPool
	Config() *Config
}

Backend wraps all methods required for pbft_agent

type BadBlockArgs

type BadBlockArgs struct {
	Hash  common.Hash            `json:"hash"`
	Block map[string]interface{} `json:"block"`
	RLP   string                 `json:"rlp"`
}

BadBlockArgs represents the entries in the list returned when bad blocks are queried.

type BlockHeadersData

type BlockHeadersData struct {
	Headers []*types.Header
	Call    uint32 // Distinguish fetcher and downloader
}

BlockHeadersData represents a block header send.

type BloomIndexer

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

BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index for the Upschain header bloom filters, permitting blazing fast filtering.

func (*BloomIndexer) Commit

func (b *BloomIndexer) Commit() error

Commit implements core.ChainIndexerBackend, finalizing the bloom section and writing it out into the database.

func (*BloomIndexer) Process

func (b *BloomIndexer) Process(header *types.Header)

Process implements core.ChainIndexerBackend, adding a new header's bloom into the index.

func (*BloomIndexer) Reset

func (b *BloomIndexer) Reset(ctx context.Context, section uint64, lastSectionHead common.Hash) error

Reset implements core.ChainIndexerBackend, starting a new bloombits index section.

type Config

type Config struct {
	// The genesis block, which is inserted if the database is empty.
	// If nil, the Upschain main net block is used.
	Genesis *core.Genesis

	// Protocol options
	NetworkId    uint64 // Network ID to use for selecting peers to connect to
	SyncMode     downloader.SyncMode
	NoPruning    bool
	DeletedState bool

	// Whitelist of required block number -> hash values to accept
	Whitelist map[uint64]common.Hash `toml:"-"`
	// GasPrice used for estimate gas
	GasPrice *big.Int `toml:",omitempty"`
	// CommitteeKey is the ECDSA private key for committee member.
	// If this filed is empty, can't be a committee member.
	CommitteeKey  []byte `toml:",omitempty"`
	CommitteeBase common.Address
	PrivateKey    *ecdsa.PrivateKey `toml:"-"`

	// Host is the host interface on which to start the pbft server. If this
	// field is empty, can't be a committee member.
	Host string `toml:",omitempty"`

	// Port is the TCP port number on which to start the pbft server.
	Port int `toml:",omitempty"`

	// StandByPort is the TCP port number on which to start the pbft server.
	StandbyPort int `toml:",omitempty"`
	// Database options
	SkipBcVersionCheck bool `toml:"-"`
	DatabaseHandles    int  `toml:"-"`
	DatabaseCache      int
	TrieCache          int
	TrieTimeout        time.Duration
	// ModeNormal(0) for Minerva
	MinervaMode   int
	MinerGasCeil  uint64
	MinerGasFloor uint64
	// Transaction pool options
	TxPool core.TxPoolConfig
	// Gas Price Oracle options
	GPO gasprice.Config

	// Enables tracking of SHA3 preimages in the VM
	EnablePreimageRecording bool

	// Miscellaneous options
	DocRoot string `toml:"-"`

	// true indicate singlenode start
	NodeType bool `toml:",omitempty"`
	// Checkpoint is a hardcoded checkpoint which can be nil.
	Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
}

func (*Config) GetNodeType

func (c *Config) GetNodeType() bool

func (Config) MarshalTOML

func (c Config) MarshalTOML() (interface{}, error)

MarshalTOML marshals as TOML.

func (*Config) UnmarshalTOML

func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error

UnmarshalTOML unmarshals from TOML.

type LesServer

type LesServer interface {
	Start(srvr *p2p.Server)
	Stop()
	Protocols() []p2p.Protocol
	SetBloomBitsIndexer(bbIndexer *core.ChainIndexer)
}

type NodeInfo

type NodeInfo struct {
	Network    uint64              `json:"network"`    // Upschain network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
	Difficulty *big.Int            `json:"difficulty"` // Total difficulty of the host's blockchain
	Genesis    common.Hash         `json:"genesis"`    // SHA3 hash of the host's genesis block
	Config     *params.ChainConfig `json:"config"`     // Chain configuration for the fork rules
	Head       common.Hash         `json:"head"`       // SHA3 hash of the host's best owned block
}

NodeInfo represents a short summary of the Ethereum sub-protocol metadata known about the host peer.

type PbftAgent

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

PbftAgent receive events from election and communicate with pbftServer

func NewPbftAgent

func NewPbftAgent(ups Backend, config *params.ChainConfig, engine consensus.Engine, election *elect.Election, gasFloor, gasCeil uint64) *PbftAgent

NewPbftAgent creates a new pbftAgent ,receive events from election and communicate with pbftServer

func (*PbftAgent) AcquireCommitteeAuth

func (agent *PbftAgent) AcquireCommitteeAuth(fastHeight *big.Int) bool

AcquireCommitteeAuth determine whether the node pubKey is in the specified committee

func (*PbftAgent) AddRemoteNodeInfo

func (agent *PbftAgent) AddRemoteNodeInfo(cryNodeInfo *types.EncryptNodeMessage) error

AddRemoteNodeInfo send cryNodeInfo of committeeNode to network,and recieved by other committeenode

func (*PbftAgent) BroadcastConsensus

func (agent *PbftAgent) BroadcastConsensus(fb *types.Block) error

BroadcastConsensus when More than 2/3 signs with agree,

committee Member Reach a consensus  and insert the fastBlock into fastBlockChain

func (*PbftAgent) ChangeCommitteeLeader

func (agent *PbftAgent) ChangeCommitteeLeader(height *big.Int) bool

ChangeCommitteeLeader trigger view change.

func (*PbftAgent) CommitteeNumber

func (agent *PbftAgent) CommitteeNumber() uint64

CommitteeNumber return current committee number

func (*PbftAgent) FetchFastBlock

func (agent *PbftAgent) FetchFastBlock(committeeID *big.Int, infos []*types.CommitteeMember) (*types.Block, error)

FetchFastBlock generate fastBlock as leader

func (*PbftAgent) GenerateSign

func (agent *PbftAgent) GenerateSign(fb *types.Block) (*types.PbftSign, error)

GenerateSign generate sign with default agree from committeeMember in fastBlock

func (*PbftAgent) GenerateSignWithVote

func (agent *PbftAgent) GenerateSignWithVote(fb *types.Block, vote uint32, result bool) (*types.PbftSign, error)

GenerateSignWithVote generate sign from committeeMember in fastBlock

func (*PbftAgent) GetAlternativeCommittee

func (agent *PbftAgent) GetAlternativeCommittee() []string

GetAlternativeCommittee return received back committee member's pubkey information

func (*PbftAgent) GetCommitteeNumber

func (agent *PbftAgent) GetCommitteeNumber(blockHeight *big.Int) int32

GetCommitteeNumber get Committees number from blockHeight

func (*PbftAgent) GetCommitteeStatus

func (agent *PbftAgent) GetCommitteeStatus() map[string]interface{}

GetCommitteeStatus return current committee infomation

func (*PbftAgent) GetCurrentCommittee

func (agent *PbftAgent) GetCurrentCommittee() []string

GetCurrentCommittee return committee member's pubkey information

func (*PbftAgent) GetCurrentHeight

func (agent *PbftAgent) GetCurrentHeight() *big.Int

GetCurrentHeight return current fastBlock number

func (*PbftAgent) GetFastLastProposer

func (agent *PbftAgent) GetFastLastProposer() common.Address

GetFastLastProposer get last proposer

func (*PbftAgent) GetNodeInfoByHash

func (agent *PbftAgent) GetNodeInfoByHash(nodeInfoHash common.Hash) (*types.EncryptNodeMessage, bool)

GetNodeInfoByHash get cryptoNodeInfo by hash

func (*PbftAgent) GetPrivateKey

func (agent *PbftAgent) GetPrivateKey() *ecdsa.PrivateKey

GetAlternativeCommittee return received back committee member's pubkey information

func (*PbftAgent) GetSeedMember

func (agent *PbftAgent) GetSeedMember() []*types.CommitteeMember

GetSeedMember get seed member

func (*PbftAgent) IsCommitteeMember

func (agent *PbftAgent) IsCommitteeMember() bool

IsCurrentCommitteeMember get whether self is committee member or not

func (*PbftAgent) IsLeader

func (agent *PbftAgent) IsLeader() bool

IsLeader get current committee leader

func (*PbftAgent) IsUsedOrUnusedMember

func (agent *PbftAgent) IsUsedOrUnusedMember(committeeInfo *types.CommitteeInfo, publickey []byte) bool

IsUsedOrUnusedMember whether publickey in committee member

func (*PbftAgent) MarkBroadcastNodeTag

func (agent *PbftAgent) MarkBroadcastNodeTag(cryptoNodeInfo *types.EncryptNodeMessage)

MarkNodeTag Mark received nodeTag,avoid old node information

func (*PbftAgent) MarkNodeInfo

func (agent *PbftAgent) MarkNodeInfo(encryptNode *types.EncryptNodeMessage, nodeTagHash common.Hash)

MarkNodeInfo Mark received NodeInfo

func (*PbftAgent) MarkNodeTag

func (agent *PbftAgent) MarkNodeTag(nodeTag common.Hash, timestamp *big.Int)

MarkNodeTag Mark received nodeTag,avoid old node information

func (*PbftAgent) Start

func (agent *PbftAgent) Start()

Start means receive events from election and send pbftNode infomation

func (*PbftAgent) SubscribeNewPbftSignEvent

func (agent *PbftAgent) SubscribeNewPbftSignEvent(ch chan<- types.PbftSignEvent) event.Subscription

SubscribeNewPbftSignEvent registers a subscription of PbftSignEvent and starts sending event to the given channel.

func (*PbftAgent) SubscribeNodeInfoEvent

func (agent *PbftAgent) SubscribeNodeInfoEvent(ch chan<- types.NodeInfoEvent) event.Subscription

SubscribeNodeInfoEvent registers a subscription of NodeInfoEvent.

func (*PbftAgent) VerifyCommitteeSign

func (agent *PbftAgent) VerifyCommitteeSign(sign *types.PbftSign) bool

VerifyCommitteeSign verify sign of node is in committee

func (*PbftAgent) VerifyFastBlock

func (agent *PbftAgent) VerifyFastBlock(fb *types.Block, result bool) (*types.PbftSign, error)

VerifyFastBlock committee member verify fastBlock and vote agree or disagree sign

type PeerInfo

type PeerInfo struct {
	Version    int      `json:"version"`    // Upschain protocol version negotiated
	Difficulty *big.Int `json:"difficulty"` // Total difficulty of the peer's blockchain
	Head       string   `json:"head"`       // SHA3 hash of the peer's best owned block
}

PeerInfo represents a short summary of the Upschain sub-protocol metadata known about a connected peer.

type PrivateAdminAPI

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

PrivateAdminAPI is the collection of Upschain full node-related APIs exposed over the private admin endpoint.

func NewPrivateAdminAPI

func NewPrivateAdminAPI(ups *Upschain) *PrivateAdminAPI

NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the Upschain service.

func (*PrivateAdminAPI) ExportChain

func (api *PrivateAdminAPI) ExportChain(file string) (bool, error)

ExportChain exports the current blockchain into a local file.

func (*PrivateAdminAPI) ImportChain

func (api *PrivateAdminAPI) ImportChain(file string) (bool, error)

ImportChain imports a blockchain from a local file.

type PrivateDebugAPI

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

PrivateDebugAPI is the collection of Upschain full node APIs exposed over the private debugging endpoint.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *params.ChainConfig, ups *Upschain) *PrivateDebugAPI

NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the Upschain service.

func (*PrivateDebugAPI) GetBadBlocks

func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error)

GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes

func (*PrivateDebugAPI) GetModifiedAccountsByHash

func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)

GetModifiedAccountsByHash returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.

With one parameter, returns the list of accounts modified in the specified block.

func (*PrivateDebugAPI) GetModifiedAccountsByNumber

func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)

GetModifiedAccountsByNumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.

With one parameter, returns the list of accounts modified in the specified block.

func (*PrivateDebugAPI) Preimage

func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

Preimage is a debug API function that returns the preimage for a sha3 hash, if known.

func (*PrivateDebugAPI) StorageRangeAt

func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error)

StorageRangeAt returns the storage at the given block height and transaction index.

func (*PrivateDebugAPI) TraceBlock

func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error)

TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlockByHash

func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockByHash returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlockByNumber

func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockByNumber returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceBlockFromFile

func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockFromFile returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*PrivateDebugAPI) TraceChain

func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)

TraceChain returns the structured logs created during the execution of EVM between two blocks (excluding start) and returns them as a JSON object.

func (*PrivateDebugAPI) TraceTransaction

func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)

TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.

type ProtocolManager

type ProtocolManager struct {
	SubProtocols []p2p.Protocol
	// contains filtered or unexported fields
}

func NewProtocolManager

func NewProtocolManager(config *params.ChainConfig, checkpoint *params.TrustedCheckpoint,
	mode downloader.SyncMode, networkID uint64, mux *event.TypeMux, txpool txPool,
	engine consensus.Engine, blockchain *core.BlockChain, chaindb upsdb.Database,
	agent *PbftAgent, cacheLimit int, whitelist map[uint64]common.Hash) (*ProtocolManager, error)

NewProtocolManager returns a new Upschain sub protocol manager. The Upschain sub protocol manages peers capable with the Upschain network.

func (*ProtocolManager) BroadcastBlock

func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool)

BroadcastBlock will either propagate a block to a subset of its peers, or will only announce its availability (depending what's requested).

func (*ProtocolManager) BroadcastFastBlock

func (pm *ProtocolManager) BroadcastFastBlock(block *types.Block, propagate bool)

BroadcastFastBlock will either propagate a block to a subset of it's peers, or will only announce it's availability (depending what's requested).

func (*ProtocolManager) BroadcastPbNodeInfo

func (pm *ProtocolManager) BroadcastPbNodeInfo(nodeInfo *types.EncryptNodeMessage)

BroadcastPbNodeInfo will propagate a batch of EncryptNodeMessage to all peers which are not known to already have the given CryNodeInfo.

func (*ProtocolManager) BroadcastTransactions

func (pm *ProtocolManager) BroadcastTransactions(txs types.Transactions, propagate bool)

BroadcastTransactions will propagate a batch of transactions to all peers which are not known to already have the given transaction.

func (*ProtocolManager) NodeInfo

func (pm *ProtocolManager) NodeInfo() *NodeInfo

NodeInfo retrieves some protocol metadata about the running host node.

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(maxPeers int)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

type PublicDebugAPI

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

PublicDebugAPI is the collection of Upschain full node APIs exposed over the public debugging endpoint.

func NewPublicDebugAPI

func NewPublicDebugAPI(ups *Upschain) *PublicDebugAPI

NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Upschain service.

func (*PublicDebugAPI) DumpBlock

func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)

DumpBlock retrieves the entire state of the database at a given block.

type PublicTruechainAPI

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

PublicTruechainAPI provides an API to access Upschain full node-related information.

func NewPublicTruechainAPI

func NewPublicTruechainAPI(e *Upschain) *PublicTruechainAPI

NewPublicTruechainAPI creates a new Upschain protocol API for full nodes.

func (*PublicTruechainAPI) ChainId

func (api *PublicTruechainAPI) ChainId() hexutil.Uint64

ChainId retuurn current upschain's chain config.

func (*PublicTruechainAPI) CommitteeBase

func (api *PublicTruechainAPI) CommitteeBase() common.Address

CommitteeBase is the address that generate by pubkey

func (*PublicTruechainAPI) CommitteeNumber

func (api *PublicTruechainAPI) CommitteeNumber() uint64

CommitteeNumber return number of current committee

func (*PublicTruechainAPI) GetCurrentState

func (api *PublicTruechainAPI) GetCurrentState() map[string]interface{}

GetCurrentState get current committee state

func (*PublicTruechainAPI) IsCommitteeMember

func (api *PublicTruechainAPI) IsCommitteeMember() bool

IsCommitteeMember return node whether current committee member

func (*PublicTruechainAPI) Pubkey

func (api *PublicTruechainAPI) Pubkey() string

Pubkey is the address that mining rewards will be send to (alias for Etherbase)

type StorageRangeResult

type StorageRangeResult struct {
	Storage storageMap   `json:"storage"`
	NextKey *common.Hash `json:"nextKey"` // nil if Storage includes the last key in the trie.
}

StorageRangeResult is the result of a debug_storageRangeAt API call.

type TraceConfig

type TraceConfig struct {
	*vm.LogConfig
	Tracer  *string
	Timeout *string
	Reexec  *uint64
}

TraceConfig holds extra parameters to trace functions.

type TrueAPIBackend

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

TRUEAPIBackend implements ethapi.Backend for full nodes

func (*TrueAPIBackend) AccountManager

func (b *TrueAPIBackend) AccountManager() *accounts.Manager

AccountManager returns Account Manager

func (*TrueAPIBackend) BlockByNumber

func (b *TrueAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

BlockByNumber returns block of fast chain by the number

func (*TrueAPIBackend) BloomStatus

func (b *TrueAPIBackend) BloomStatus() (uint64, uint64)

BloomStatus returns Bloom Status

func (*TrueAPIBackend) ChainConfig

func (b *TrueAPIBackend) ChainConfig() *params.ChainConfig

ChainConfig returns the active chain configuration.

func (*TrueAPIBackend) ChainDb

func (b *TrueAPIBackend) ChainDb() upsdb.Database

ChainDb returns tht database of fastchain

func (*TrueAPIBackend) CurrentBlock

func (b *TrueAPIBackend) CurrentBlock() *types.Block

CurrentBlock return the fast chain current Block

func (*TrueAPIBackend) Downloader

func (b *TrueAPIBackend) Downloader() *downloader.Downloader

Downloader returns the fast downloader

func (*TrueAPIBackend) EventMux

func (b *TrueAPIBackend) EventMux() *event.TypeMux

EventMux returns Event locker

func (*TrueAPIBackend) GetBlock

func (b *TrueAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)

GetBlock returns the block by the block's hash

func (*TrueAPIBackend) GetChainRewardContent

func (b *TrueAPIBackend) GetChainRewardContent(blockNr rpc.BlockNumber) *types.ChainReward

func (*TrueAPIBackend) GetCommittee

func (b *TrueAPIBackend) GetCommittee(number rpc.BlockNumber) (map[string]interface{}, error)

func (*TrueAPIBackend) GetCurrentCommitteeNumber

func (b *TrueAPIBackend) GetCurrentCommitteeNumber() *big.Int

func (*TrueAPIBackend) GetEVM

func (b *TrueAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

GetEVM returns the EVM

func (*TrueAPIBackend) GetLogs

func (b *TrueAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

GetLogs returns the logs by txhash

func (*TrueAPIBackend) GetPoolNonce

func (b *TrueAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

GetPoolNonce returns user nonce by user address in txpool

func (*TrueAPIBackend) GetPoolTransaction

func (b *TrueAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction

GetPoolTransaction returns Transaction by txHash in txpool

func (*TrueAPIBackend) GetPoolTransactions

func (b *TrueAPIBackend) GetPoolTransactions() (types.Transactions, error)

GetPoolTransactions returns Transactions by pending state in txpool

func (*TrueAPIBackend) GetReceipts

func (b *TrueAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

GetReceipts returns the Receipt details by txhash

func (*TrueAPIBackend) GetStateChangeByFastNumber

func (b *TrueAPIBackend) GetStateChangeByFastNumber(fastNumber rpc.BlockNumber) *types.BlockBalance

GetStateChangeByFastNumber returns the Committee info by committee number

func (*TrueAPIBackend) HeaderByHash

func (b *TrueAPIBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

HeaderByHash returns header of fast chain by the hash

func (*TrueAPIBackend) HeaderByNumber

func (b *TrueAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

HeaderByNumber returns Header of fast chain by the number rpc.PendingBlockNumber == "pending"; rpc.LatestBlockNumber == "latest" ; rpc.LatestBlockNumber == "earliest"

func (*TrueAPIBackend) ProtocolVersion

func (b *TrueAPIBackend) ProtocolVersion() int

ProtocolVersion returns the version of protocol

func (*TrueAPIBackend) SendTx

func (b *TrueAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

SendTx returns nil by success to add local txpool

func (*TrueAPIBackend) ServiceFilter

func (b *TrueAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

ServiceFilter make the Filter for the truechian

func (*TrueAPIBackend) SetHead

func (b *TrueAPIBackend) SetHead(number uint64)

SetHead Set the newest position of Fast Chain, that will reset the fast blockchain comment

func (*TrueAPIBackend) StateAndHeaderByNumber

func (b *TrueAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

StateAndHeaderByNumber returns the state of block by the number

func (*TrueAPIBackend) Stats

func (b *TrueAPIBackend) Stats() (pending int, queued int)

Stats returns the count tx in txpool

func (*TrueAPIBackend) SubscribeChainEvent

func (b *TrueAPIBackend) SubscribeChainEvent(ch chan<- types.FastChainEvent) event.Subscription

SubscribeChainEvent registers a subscription of chainEvnet in fast blockchain

func (*TrueAPIBackend) SubscribeChainHeadEvent

func (b *TrueAPIBackend) SubscribeChainHeadEvent(ch chan<- types.FastChainHeadEvent) event.Subscription

SubscribeChainHeadEvent registers a subscription of chainHeadEvnet in fast blockchain

func (*TrueAPIBackend) SubscribeChainSideEvent

func (b *TrueAPIBackend) SubscribeChainSideEvent(ch chan<- types.FastChainSideEvent) event.Subscription

SubscribeChainSideEvent registers a subscription of chainSideEvnet in fast blockchain,deprecated

func (*TrueAPIBackend) SubscribeLogsEvent

func (b *TrueAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

SubscribeLogsEvent registers a subscription of log in fast blockchain

func (*TrueAPIBackend) SubscribeNewTxsEvent

func (b *TrueAPIBackend) SubscribeNewTxsEvent(ch chan<- types.NewTxsEvent) event.Subscription

SubscribeNewTxsEvent returns the subscript event of new tx

func (*TrueAPIBackend) SubscribeRemovedLogsEvent

func (b *TrueAPIBackend) SubscribeRemovedLogsEvent(ch chan<- types.RemovedLogsEvent) event.Subscription

SubscribeRemovedLogsEvent registers a subscription of RemovedLogsEvent in fast blockchain

func (*TrueAPIBackend) SuggestPrice

func (b *TrueAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

SuggestPrice returns tht suggest gas price

func (*TrueAPIBackend) TxPoolContent

type ULCConfig

type ULCConfig struct {
	TrustedServers     []string `toml:",omitempty"` // A list of trusted servers
	MinTrustedFraction int      `toml:",omitempty"` // Minimum percentage of connected trusted servers to validate trusted (1-100)
}

ULCConfig is a Ultra Light client options.

type Upschain

type Upschain struct {
	APIBackend *TrueAPIBackend
	// contains filtered or unexported fields
}

Upschain implements the Upschain full node service.

func New

func New(ctx *node.ServiceContext, config *Config) (*Upschain, error)

New creates a new Upschain object (including the initialisation of the common Upschain object)

func (*Upschain) APIs

func (s *Upschain) APIs() []rpc.API

APIs return the collection of RPC services the ups package offers. NOTE, some of these services probably need to be moved to somewhere else.

func (*Upschain) AccountManager

func (s *Upschain) AccountManager() *accounts.Manager

func (*Upschain) AddLesServer

func (s *Upschain) AddLesServer(ls LesServer)

func (*Upschain) ArchiveMode

func (s *Upschain) ArchiveMode() bool

func (*Upschain) BlockChain

func (s *Upschain) BlockChain() *core.BlockChain

func (*Upschain) ChainDb

func (s *Upschain) ChainDb() upsdb.Database

func (*Upschain) Config

func (s *Upschain) Config() *Config

func (*Upschain) Downloader

func (s *Upschain) Downloader() *downloader.Downloader

func (*Upschain) Engine

func (s *Upschain) Engine() consensus.Engine

func (*Upschain) EthVersion

func (s *Upschain) EthVersion() int

func (*Upschain) EventMux

func (s *Upschain) EventMux() *event.TypeMux

func (*Upschain) IsListening

func (s *Upschain) IsListening() bool

func (*Upschain) NetVersion

func (s *Upschain) NetVersion() uint64

func (*Upschain) PbftAgent

func (s *Upschain) PbftAgent() *PbftAgent

func (*Upschain) Protocols

func (s *Upschain) Protocols() []p2p.Protocol

Protocols implements node.Service, returning all the currently configured network protocols to start.

func (*Upschain) ResetWithFastGenesisBlock

func (s *Upschain) ResetWithFastGenesisBlock(gb *types.Block)

func (*Upschain) ResetWithGenesisBlock

func (s *Upschain) ResetWithGenesisBlock(gb *types.Block)

func (*Upschain) Start

func (s *Upschain) Start(srvr *p2p.Server) error

Start implements node.Service, starting all internal goroutines needed by the Upschain protocol implementation.

func (*Upschain) Stop

func (s *Upschain) Stop() error

Stop implements node.Service, terminating all internal goroutines used by the Upschain protocol.

func (*Upschain) Synced

func (s *Upschain) Synced() bool

func (*Upschain) TxPool

func (s *Upschain) TxPool() *core.TxPool

Directories

Path Synopsis
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
Package fetcher contains the announcement based blocks or transaction synchronisation.
Package fetcher contains the announcement based blocks or transaction synchronisation.
Package filters implements an ethereum filtering system for block, transactions and log events.
Package filters implements an ethereum filtering system for block, transactions and log events.
Package tracers is a collection of JavaScript transaction tracers.
Package tracers is a collection of JavaScript transaction tracers.
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
Package tracers contains the actual JavaScript tracer assets.

Jump to

Keyboard shortcuts

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