service

package
v0.0.0-...-7492f51 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = fmt.Errorf("Not implemented yet")

Functions

func GetEthAPIs

func GetEthAPIs(s *Service) []rpc.API

GetAPIsEth return the collection of RPC services the ethereum package offers.

func GetNodeAPIs

func GetNodeAPIs(n *Service) []rpc.API

GetNodeAPIs returns the collection of RPC descriptors this node offers.

Types

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 CORSServer

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

func (*CORSServer) ServeHTTP

func (s *CORSServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type JsonAccount

type JsonAccount struct {
	Address string   `json:"address"`
	Balance *big.Int `json:"balance"`
	Nonce   uint64   `json:"nonce"`
}

type JsonAccountList

type JsonAccountList struct {
	Accounts []JsonAccount `json:"accounts"`
}

type JsonBlock

type JsonBlock struct {
	Hash         string        `json:"hash"`
	Index        int64         `json:"index"`
	Round        int64         `json:"round"`
	StateHash    string        `json:"stateHash"`
	FrameHash    string        `json:"frameHash"`
	Transactions []JsonReceipt `json:"transactions"`
}

type JsonCallRes

type JsonCallRes struct {
	Data string `json:"data"`
}

type JsonReceipt

type JsonReceipt struct {
	Root              common.Hash     `json:"root"`
	TransactionHash   common.Hash     `json:"transactionHash"`
	From              common.Address  `json:"from"`
	To                *common.Address `json:"to"`
	Value             *big.Int        `json:"value"`
	Gas               *big.Int        `json:"gas"`
	GasUsed           *big.Int        `json:"gasUsed"`
	GasPrice          *big.Int        `json:"gasPrice"`
	CumulativeGasUsed *big.Int        `json:"cumulativeGasUsed"`
	ContractAddress   common.Address  `json:"contractAddress"`
	Logs              []*ethTypes.Log `json:"logs"`
	LogsBloom         ethTypes.Bloom  `json:"logsBloom"`
	Error             string          `json:"error"`
	Failed            bool            `json:"failed"`
	Status            uint64          `json:"status"`
}

type JsonTxRes

type JsonTxRes struct {
	TxHash string `json:"txHash"`
}

type NodePrivateAdminAPI

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

PrivateAdminAPI is the collection of administrative API methods exposed only over a secure RPC channel.

func NewNodePrivateAdminAPI

func NewNodePrivateAdminAPI(node *Service) *NodePrivateAdminAPI

NewPrivateAdminAPI creates a new API definition for the private admin methods of the node itself.

func (*NodePrivateAdminAPI) AddPeer

func (api *NodePrivateAdminAPI) AddPeer(url string) (bool, error)

AddPeer requests connecting to a remote node, and also maintaining the new connection at all times, even reconnecting if it is lost.

func (*NodePrivateAdminAPI) AddTrustedPeer

func (api *NodePrivateAdminAPI) AddTrustedPeer(url string) (bool, error)

AddTrustedPeer allows a remote node to always connect, even if slots are full

func (*NodePrivateAdminAPI) PeerEvents

func (api *NodePrivateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error)

PeerEvents creates an RPC subscription which receives peer events from the node's p2p.Server

func (*NodePrivateAdminAPI) RemovePeer

func (api *NodePrivateAdminAPI) RemovePeer(url string) (bool, error)

RemovePeer disconnects from a remote node if the connection exists

func (*NodePrivateAdminAPI) RemoveTrustedPeer

func (api *NodePrivateAdminAPI) RemoveTrustedPeer(url string) (bool, error)

RemoveTrustedPeer removes a remote node from the trusted peer set, but it does not disconnect it automatically.

func (*NodePrivateAdminAPI) StartRPC

func (api *NodePrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error)

StartRPC starts the HTTP RPC API server.

func (*NodePrivateAdminAPI) StartWS

func (api *NodePrivateAdminAPI) StartWS(host *string, port *int, allowedOrigins *string, apis *string) (bool, error)

StartWS starts the websocket RPC API server.

func (*NodePrivateAdminAPI) StopRPC

func (api *NodePrivateAdminAPI) StopRPC() (bool, error)

StopRPC terminates an already running HTTP RPC API endpoint.

func (*NodePrivateAdminAPI) StopWS

func (api *NodePrivateAdminAPI) StopWS() (bool, error)

StopWS terminates an already running websocket RPC API endpoint.

type NodePublicAdminAPI

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

PublicAdminAPI is the collection of administrative API methods exposed over both secure and unsecure RPC channels.

func NewNodePublicAdminAPI

func NewNodePublicAdminAPI(node *Service) *NodePublicAdminAPI

NewPublicAdminAPI creates a new API definition for the public admin methods of the node itself.

func (*NodePublicAdminAPI) Datadir

func (api *NodePublicAdminAPI) Datadir() string

Datadir retrieves the current data directory the node is using.

func (*NodePublicAdminAPI) NodeInfo

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

NodeInfo retrieves all the information we know about the host node at the protocol granularity.

func (*NodePublicAdminAPI) Peers

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

Peers retrieves all the information we know about each individual peer at the protocol granularity.

type NodePublicDebugAPI

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

PublicDebugAPI is the collection of debugging related API methods exposed over both secure and unsecure RPC channels.

func NewNodePublicDebugAPI

func NewNodePublicDebugAPI(node *Service) *NodePublicDebugAPI

NewPublicDebugAPI creates a new API definition for the public debug methods of the node itself.

func (*NodePublicDebugAPI) Metrics

func (api *NodePublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error)

Metrics retrieves all the known system metric collected by the node.

type NodePublicWeb3API

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

PublicWeb3API offers helper utils

func NewNodePublicWeb3API

func NewNodePublicWeb3API(stack *Service) *NodePublicWeb3API

NewPublicWeb3API creates a new Web3Service instance

func (*NodePublicWeb3API) ClientVersion

func (s *NodePublicWeb3API) ClientVersion() string

ClientVersion returns the node name

func (*NodePublicWeb3API) Sha3

func (s *NodePublicWeb3API) Sha3(input hexutil.Bytes) hexutil.Bytes

Sha3 applies the ethereum sha3 implementation on the input. It assumes the input is hex encoded.

type PrivateAdminAPI

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

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

func NewPrivateAdminAPI

func NewPrivateAdminAPI(eth *Service) *PrivateAdminAPI

NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the Ethereum 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 Ethereum full node APIs exposed over the private debugging endpoint.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *params.ChainConfig, eth *Service) *PrivateDebugAPI

NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the Ethereum 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.

type PrivateMinerAPI

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

PrivateMinerAPI provides private RPC methods to control the miner. These methods can be abused by external users and must be considered insecure for use by untrusted users.

func NewPrivateMinerAPI

func NewPrivateMinerAPI(e *Service) *PrivateMinerAPI

NewPrivateMinerAPI create a new RPC service which controls the miner of this node.

func (*PrivateMinerAPI) GetHashrate

func (api *PrivateMinerAPI) GetHashrate() uint64

GetHashrate returns the current hashrate of the miner.

func (*PrivateMinerAPI) SetEtherbase

func (api *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool

SetEtherbase sets the etherbase of the miner

func (*PrivateMinerAPI) SetExtra

func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)

SetExtra sets the extra data string that is included when this miner mines a block.

func (*PrivateMinerAPI) SetGasPrice

func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool

SetGasPrice sets the minimum accepted gas price for the miner.

func (*PrivateMinerAPI) SetRecommitInterval

func (api *PrivateMinerAPI) SetRecommitInterval(interval int)

SetRecommitInterval updates the interval for miner sealing work recommitting.

func (*PrivateMinerAPI) Start

func (api *PrivateMinerAPI) Start(threads *int) error

Start starts the miner with the given number of threads. If threads is nil, the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use and updates the minimum price required by the transaction pool.

func (*PrivateMinerAPI) Stop

func (api *PrivateMinerAPI) Stop()

Stop terminates the miner, both at the consensus engine level as well as at the block creation level.

type PublicDebugAPI

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

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

func NewPublicDebugAPI

func NewPublicDebugAPI(eth *Service) *PublicDebugAPI

NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Ethereum 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 PublicEthereumAPI

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

PublicEthereumAPI provides an API to access Service full node-related information.

func NewPublicEthereumAPI

func NewPublicEthereumAPI(e *Service) *PublicEthereumAPI

NewPublicEthereumAPI creates a new Ethereum protocol API for full nodes.

func (*PublicEthereumAPI) ChainId

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

ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.

func (*PublicEthereumAPI) Coinbase

func (api *PublicEthereumAPI) Coinbase() (common.Address, error)

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

func (*PublicEthereumAPI) Etherbase

func (api *PublicEthereumAPI) Etherbase() (common.Address, error)

Etherbase is the address that mining rewards will be send to

func (*PublicEthereumAPI) Hashrate

func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64

Hashrate returns the POW hashrate

type PublicMinerAPI

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

PublicMinerAPI provides an API to control the miner. It offers only methods that operate on data that pose no security risk when it is publicly accessible.

func NewPublicMinerAPI

func NewPublicMinerAPI(e *Service) *PublicMinerAPI

NewPublicMinerAPI create a new PublicMinerAPI instance.

func (*PublicMinerAPI) Mining

func (api *PublicMinerAPI) Mining() bool

Mining returns an indication if this node is currently mining.

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *big.Int        `json:"gas"`
	GasPrice *big.Int        `json:"gasPrice"`
	Value    *big.Int        `json:"value"`
	Data     string          `json:"data"`
	Nonce    *uint64         `json:"nonce"`
}

SendTxArgs represents the arguments to submit a new transaction into the transaction pool.

type Service

type Service struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewService

func NewService(genesisFile, keystoreDir, apiAddr, pwdFile string,
	state *state.State,
	submitCh chan []byte,
	logger *logrus.Logger) *Service

func (*Service) GetSubmitCh

func (m *Service) GetSubmitCh() chan []byte

XXX

func (*Service) HTTPEndpoint

func (n *Service) HTTPEndpoint() string

HTTPEndpoint retrieves the current HTTP endpoint used by the protocol stack.

func (*Service) IPCEndpoint

func (n *Service) IPCEndpoint() string

IPCEndpoint retrieves the current IPC endpoint used by the protocol stack.

func (*Service) RestartWeb3API

func (n *Service) RestartWeb3API() error

RestartWeb3API terminates a running node and boots up a new one in its place. If the node isn't running, an error is returned.

func (*Service) Run

func (m *Service) Run()

func (*Service) SetInfoCallback

func (m *Service) SetInfoCallback(f infoCallback)

XXX

func (*Service) StartRPC

func (n *Service) StartRPC() error

StartRPC starts the various API endpoints, terminating all in case of errors

func (*Service) StopRPC

func (n *Service) StopRPC() error

StopRPC terminates a running node along with all it's services. In the node was not started, an error is returned.

func (*Service) WSEndpoint

func (n *Service) WSEndpoint() string

WSEndpoint retrieves the current WS endpoint used by the protocol stack.

func (*Service) WaitUntilRPC

func (n *Service) WaitUntilRPC()

WaitUntilRPC blocks the thread until the Web3 API is stopped. If the it is not running at the time of invocation, the method immediately returns.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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