server

package
v0.0.0-...-91a82d4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: LGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB(ctx *node.Context, config *UranusConfig, name string) (db.Database, error)

CreateDB creates the chain database.

Types

type APIBackend

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

APIBackend implements node all apis.

func (*APIBackend) Accounts

func (api *APIBackend) Accounts() (wallet.Accounts, error)

Accounts list all wallet accounts.

func (*APIBackend) AddPeer

func (api *APIBackend) AddPeer(url string) error

func (*APIBackend) BlockByHash

func (api *APIBackend) BlockByHash(ctx context.Context, blockHash utils.Hash) (*types.Block, error)

BlockByHash returns Block by block hash.

func (*APIBackend) BlockByHeight

func (api *APIBackend) BlockByHeight(ctx context.Context, height rpcapi.BlockHeight) (*types.Block, error)

BlockByHeight returns block by block height.

func (*APIBackend) BlockChain

func (api *APIBackend) BlockChain() *core.BlockChain

BlockChain return core blockchian.

func (*APIBackend) CurrentBlock

func (api *APIBackend) CurrentBlock() *types.Block

CurrentBlock returns blockchain current block.

func (*APIBackend) Delete

func (api *APIBackend) Delete(address utils.Address, passphrase string) error

Delete removes the speciified account

func (*APIBackend) ExportRawKey

func (api *APIBackend) ExportRawKey(addr utils.Address, passphrase string) (string, error)

ExportRawKey return key hex.

func (*APIBackend) GetBFTConfirmedBlockNumber

func (api *APIBackend) GetBFTConfirmedBlockNumber() (*big.Int, error)

func (*APIBackend) GetConfirmedBlockNumber

func (api *APIBackend) GetConfirmedBlockNumber() (*big.Int, error)

func (*APIBackend) GetEVM

func (api *APIBackend) GetEVM(ctx context.Context, from utils.Address, tx *types.Transaction, state *state.StateDB, bheader *types.BlockHeader, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*APIBackend) GetLogs

func (api *APIBackend) GetLogs(ctx context.Context, blockHash utils.Hash) ([][]*types.Log, error)

GetLogs return Logs by block hash.

func (*APIBackend) GetPoolNonce

func (api *APIBackend) GetPoolNonce(ctx context.Context, addr utils.Address) (uint64, error)

GetPoolNonce get txpool nonce by address.

func (*APIBackend) GetPoolTransaction

func (api *APIBackend) GetPoolTransaction(txHash utils.Hash) *types.Transaction

GetPoolTransaction get tansaction by hash from txpool.

func (*APIBackend) GetPoolTransactions

func (api *APIBackend) GetPoolTransactions() (types.Transactions, error)

GetPoolTransactions get txpool pending transactions.

func (*APIBackend) GetReceipt

func (api *APIBackend) GetReceipt(ctx context.Context, txHash utils.Hash) (*types.Receipt, error)

GetReceipt returns receipte by tx hash.

func (*APIBackend) GetReceipts

func (api *APIBackend) GetReceipts(ctx context.Context, blockHash utils.Hash) (types.Receipts, error)

GetReceipts returns receipte by block hash.

func (*APIBackend) GetTd

func (api *APIBackend) GetTd(blockHash utils.Hash) *big.Int

GetTd get total difficulty by block hash.

func (*APIBackend) GetTransaction

func (api *APIBackend) GetTransaction(txHash utils.Hash) *types.StorageTx

GetTransaction get tansaction by hash from chain db.

func (*APIBackend) ImportRawKey

func (api *APIBackend) ImportRawKey(privkey string, passphrase string) (utils.Address, error)

ImportRawKey import raw key intfo wallet.

func (*APIBackend) NewAccount

func (api *APIBackend) NewAccount(passphrase string) (wallet.Account, error)

NewAccount creates a new account

func (*APIBackend) NodeInfo

func (api *APIBackend) NodeInfo() (*p2p.NodeInfo, error)

func (*APIBackend) Peers

func (api *APIBackend) Peers() ([]*p2p.PeerInfo, error)

func (*APIBackend) RemovePeer

func (api *APIBackend) RemovePeer(url string) error

func (*APIBackend) SendTx

func (api *APIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

SendTx send signed transaction to txpool.

func (*APIBackend) SetCoinbase

func (api *APIBackend) SetCoinbase(address utils.Address) error

func (*APIBackend) SignTx

func (api *APIBackend) SignTx(addr utils.Address, tx *types.Transaction, passphrase string) (*types.Transaction, error)

SignTx sign the specified transaction

func (*APIBackend) Start

func (api *APIBackend) Start(threads int32) error

func (*APIBackend) Stop

func (api *APIBackend) Stop() error

func (*APIBackend) SuggestGasPrice

func (api *APIBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error)

SuggestGasPrice suggest gas price

func (*APIBackend) TxPoolContent

func (api *APIBackend) TxPoolContent() (map[utils.Address]types.Transactions, map[utils.Address]types.Transactions)

TxPoolContent get transaction pool content.

func (*APIBackend) TxPoolStats

func (api *APIBackend) TxPoolStats() (pending int, queued int)

TxPoolStats get transaction pool stats.

func (*APIBackend) Update

func (api *APIBackend) Update(address utils.Address, passphrase, newPassphrase string) error

Update update the specified account

type MinerBakend

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

func (*MinerBakend) Actions

func (m *MinerBakend) Actions() []*types.Action

func (*MinerBakend) Config

func (m *MinerBakend) Config() *params.ChainConfig

func (*MinerBakend) CurrentBlock

func (m *MinerBakend) CurrentBlock() *types.Block

func (*MinerBakend) ExecActions

func (m *MinerBakend) ExecActions(statedb *state.StateDB, actions []*types.Action)

func (*MinerBakend) ExecTransaction

func (m *MinerBakend) ExecTransaction(author *utils.Address, dposcontext *types.DposContext,
	gp *utils.GasPool, statedb *state.StateDB, header *types.BlockHeader,
	tx *types.Transaction, usedGas *uint64, cfg vm.Config) ([]byte, *types.Receipt, uint64, error)

ExecTransaction exectue transaction return receipt

func (*MinerBakend) GetBlockByHash

func (m *MinerBakend) GetBlockByHash(hash utils.Hash) *types.Block

func (*MinerBakend) GetBlockByHeight

func (m *MinerBakend) GetBlockByHeight(height uint64) *types.Block

func (*MinerBakend) GetCurrentInfo

func (m *MinerBakend) GetCurrentInfo() (*types.Block, *state.StateDB, error)

GetCurrentInfo get blockchain current info

func (*MinerBakend) GetHeader

func (m *MinerBakend) GetHeader(hash utils.Hash) *types.BlockHeader

GetHeader retrieves a header from the database by hash,

func (*MinerBakend) Pending

func (m *MinerBakend) Pending() (map[utils.Address]types.Transactions, error)

Pending returns txpool pending transactions

func (*MinerBakend) PostEvent

func (m *MinerBakend) PostEvent(event interface{})

func (*MinerBakend) SubscribeChainBlockEvent

func (m *MinerBakend) SubscribeChainBlockEvent(ch chan<- feed.BlockAndLogsEvent) feed.Subscription

func (*MinerBakend) SubscribeNewTxsEvent

func (m *MinerBakend) SubscribeNewTxsEvent(ch chan<- feed.NewTxsEvent) feed.Subscription

func (*MinerBakend) WriteBlockWithState

func (m *MinerBakend) WriteBlockWithState(block *types.Block, receipts types.Receipts, state *state.StateDB) (bool, error)

WriteBlockWithState write block and state in chain

type Uranus

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

Uranus implements the service.

func New

func New(ctx *node.Context, config *UranusConfig) (*Uranus, error)

New creates a new Uranus object

func (*Uranus) APIs

func (u *Uranus) APIs() []rpc.API

APIs return the collection of RPC services the Uranus package offers.

func (*Uranus) BlockChain

func (u *Uranus) BlockChain() *core.BlockChain

BlockChain returns blcokchain.

func (*Uranus) Protocols

func (u *Uranus) Protocols() []*p2p.Protocol

Protocols implements node.Service.

func (*Uranus) Start

func (u *Uranus) Start(p2p *p2p.Server) error

Start implements node.Service, starting all internal goroutines.

func (*Uranus) Stop

func (u *Uranus) Stop() error

Stop implements node.Service, terminating all internal goroutine

type UranusConfig

type UranusConfig struct {
	// If nil, the default genesis block is used.
	Genesis *ledger.Genesis

	DBHandles   int
	DBCache     int
	TrieCache   int
	TrieTimeout time.Duration

	StartMiner bool `mapstructure:"miner-start"`

	// Ledger config
	LedgerConfig *ledger.Config

	// Transaction pool options
	TxPoolConfig *txpool.Config

	// miner config
	MinerConfig *miner.Config
}

UranusConfig uranus config

func (UranusConfig) String

func (c UranusConfig) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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