Documentation ¶
Index ¶
- Variables
- func GetEthAPIs(s *Service) []rpc.API
- func GetNodeAPIs(n *Service) []rpc.API
- type BadBlockArgs
- type CORSServer
- type JsonAccount
- type JsonAccountList
- type JsonBlock
- type JsonCallRes
- type JsonReceipt
- type JsonTxRes
- type NodePrivateAdminAPI
- func (api *NodePrivateAdminAPI) AddPeer(url string) (bool, error)
- func (api *NodePrivateAdminAPI) AddTrustedPeer(url string) (bool, error)
- func (api *NodePrivateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error)
- func (api *NodePrivateAdminAPI) RemovePeer(url string) (bool, error)
- func (api *NodePrivateAdminAPI) RemoveTrustedPeer(url string) (bool, error)
- func (api *NodePrivateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error)
- func (api *NodePrivateAdminAPI) StartWS(host *string, port *int, allowedOrigins *string, apis *string) (bool, error)
- func (api *NodePrivateAdminAPI) StopRPC() (bool, error)
- func (api *NodePrivateAdminAPI) StopWS() (bool, error)
- type NodePublicAdminAPI
- type NodePublicDebugAPI
- type NodePublicWeb3API
- type PrivateAdminAPI
- type PrivateDebugAPI
- func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error)
- func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
- func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
- func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, ...) (StorageRangeResult, error)
- type PrivateMinerAPI
- func (api *PrivateMinerAPI) GetHashrate() uint64
- func (api *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool
- func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)
- func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
- func (api *PrivateMinerAPI) SetRecommitInterval(interval int)
- func (api *PrivateMinerAPI) Start(threads *int) error
- func (api *PrivateMinerAPI) Stop()
- type PublicDebugAPI
- type PublicEthereumAPI
- type PublicMinerAPI
- type SendTxArgs
- type Service
- func (m *Service) GetSubmitCh() chan []byte
- func (n *Service) HTTPEndpoint() string
- func (n *Service) IPCEndpoint() string
- func (n *Service) RestartWeb3API() error
- func (m *Service) Run()
- func (m *Service) SetInfoCallback(f infoCallback)
- func (n *Service) StartRPC() error
- func (n *Service) StopRPC() error
- func (n *Service) WSEndpoint() string
- func (n *Service) WaitUntilRPC()
- type StorageRangeResult
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = fmt.Errorf("Not implemented yet")
Functions ¶
func GetEthAPIs ¶
GetAPIsEth return the collection of RPC services the ethereum package offers.
func GetNodeAPIs ¶
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 JsonAccountList ¶
type JsonAccountList struct {
Accounts []JsonAccount `json:"accounts"`
}
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 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.
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.
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
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 ¶
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 ¶
func NewService ¶
func (*Service) HTTPEndpoint ¶
HTTPEndpoint retrieves the current HTTP endpoint used by the protocol stack.
func (*Service) IPCEndpoint ¶
IPCEndpoint retrieves the current IPC endpoint used by the protocol stack.
func (*Service) RestartWeb3API ¶
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) StartRPC ¶
StartRPC starts the various API endpoints, terminating all in case of errors
func (*Service) StopRPC ¶
StopRPC terminates a running node along with all it's services. In the node was not started, an error is returned.
func (*Service) WSEndpoint ¶
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.