Documentation ¶
Index ¶
- Variables
- func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)
- type AddrLocker
- type BadBlockArgs
- type CORSServer
- type CallArgs
- type DuplicateServiceError
- type ExecutionResult
- type JsonAccount
- type JsonAccountList
- type JsonBlock
- type JsonCallRes
- type JsonReceipt
- type JsonTxRes
- type PrivateAccountAPI
- func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error)
- func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)
- func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error)
- func (s *PrivateAccountAPI) ListAccounts() []common.Address
- func (s *PrivateAccountAPI) ListWallets() []rawWallet
- func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool
- func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error)
- func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error
- func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
- func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error)
- func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
- func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs, passwd string) (*SignTransactionResult, error)
- func (s *PrivateAccountAPI) UnlockAccount(addr common.Address, password string, duration *uint64) (bool, error)
- type PrivateAdminAPI
- type PrivateDebugAPI
- type PrivateDebugChainAPI
- func (api *PrivateDebugChainAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error)
- func (api *PrivateDebugChainAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
- func (api *PrivateDebugChainAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
- func (api *PrivateDebugChainAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (api *PrivateDebugChainAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, ...) (StorageRangeResult, error)
- type PublicAccountAPI
- type PublicBlockChainAPI
- func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
- func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)
- func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Big, error)
- func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, ...) (hexutil.Bytes, error)
- func (s *PublicBlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
- func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- type PublicDebugAPI
- type PublicDebugChainAPI
- type PublicEthereumAPI
- type PublicEthereumChainAPI
- type PublicNetAPI
- type PublicTransactionPoolAPI
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
- func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
- func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
- func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction
- func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)
- func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
- func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxArgs, gasPrice *hexutil.Big, ...) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
- func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
- func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error)
- type PublicTxPoolAPI
- type RPCTransaction
- type RpcServer
- func (n *RpcServer) AccountManager() *accounts.Manager
- func (n *RpcServer) Attach() (*rpc.Client, error)
- func (n *RpcServer) EventFeed() *event.Feed
- func (n *RpcServer) HTTPEndpoint() string
- func (n *RpcServer) IPCEndpoint() string
- func (n *RpcServer) RPCHandler() (*rpc.Server, error)
- func (n *RpcServer) Register(constructor RpcServiceConstructor) error
- func (n *RpcServer) Restart() error
- func (n *RpcServer) Service(service interface{}) error
- func (n *RpcServer) Start() error
- func (n *RpcServer) Stop() error
- func (n *RpcServer) WSEndpoint() string
- func (n *RpcServer) Wait()
- type RpcService
- type RpcServiceConstructor
- type RpcServiceContext
- type SendTxArgs
- type Service
- type SignTransactionResult
- type StopError
- type StorageRangeResult
- type StructLogRes
- type Web3AccountService
- type Web3ChainService
Constants ¶
This section is empty.
Variables ¶
var ( ErrNodeStopped = errors.New("node not started") ErrNodeRunning = errors.New("node already running") ErrServiceUnknown = errors.New("unknown service") )
var ErrNotImplemented = fmt.Errorf("not implemented yet")
Functions ¶
func RPCMarshalBlock ¶
RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
Types ¶
type AddrLocker ¶
type AddrLocker struct {
// contains filtered or unexported fields
}
func (*AddrLocker) LockAddr ¶
func (l *AddrLocker) LockAddr(address common.Address)
LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.
func (*AddrLocker) UnlockAddr ¶
func (l *AddrLocker) UnlockAddr(address common.Address)
UnlockAddr unlocks the mutex of the given account.
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 CallArgs ¶
type CallArgs struct { From common.Address `json:"from"` To *common.Address `json:"to"` Gas hexutil.Uint64 `json:"gas"` GasPrice hexutil.Big `json:"gasPrice"` Value hexutil.Big `json:"value"` Data hexutil.Bytes `json:"data"` }
CallArgs represents the arguments for a call.
type DuplicateServiceError ¶
DuplicateServiceError is returned during Node startup if a registered service constructor returns a service of the same type that was already started.
func (*DuplicateServiceError) Error ¶
func (e *DuplicateServiceError) Error() string
Error generates a textual representation of the duplicate service error.
type ExecutionResult ¶
type ExecutionResult struct { Gas uint64 `json:"gas"` Failed bool `json:"failed"` ReturnValue string `json:"returnValue"` StructLogs []StructLogRes `json:"structLogs"` }
ExecutionResult groups all structured logs emitted by the EVM while replaying a transaction in debug mode as well as transaction execution status, the amount of gas used and the return value
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 PrivateAccountAPI ¶
type PrivateAccountAPI struct {
// contains filtered or unexported fields
}
PrivateAccountAPI provides an API to access accounts managed by this node. It offers methods to create, (un)lock en list accounts. Some methods accept passwords and are therefore considered private by default.
func NewPrivateAccountAPI ¶
func NewPrivateAccountAPI(b *Service, nonceLock *AddrLocker) *PrivateAccountAPI
NewPrivateAccountAPI create a new PrivateAccountAPI.
func (*PrivateAccountAPI) DeriveAccount ¶
func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error)
DeriveAccount requests a HD wallet to derive a new account, optionally pinning it for later reuse.
func (*PrivateAccountAPI) EcRecover ¶
func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)
EcRecover returns the address for the account that was used to create the signature. Note, this function is compatible with eth_sign and personal_sign. As such it recovers the address of: hash = keccak256("\x19Ethereum Signed Message:\n"${message length}${message}) addr = ecrecover(hash, signature)
Note, the signature must conform to the secp256k1 curve R, S and V values, where the V value must be 27 or 28 for legacy reasons.
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
func (*PrivateAccountAPI) ImportRawKey ¶
ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.
func (*PrivateAccountAPI) ListAccounts ¶
func (s *PrivateAccountAPI) ListAccounts() []common.Address
ListAccounts will return a list of addresses for accounts this node manages.
func (*PrivateAccountAPI) ListWallets ¶
func (s *PrivateAccountAPI) ListWallets() []rawWallet
ListWallets will return a list of wallets this node manages.
func (*PrivateAccountAPI) LockAccount ¶
func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool
LockAccount will lock the account associated with the given address when it's unlocked.
func (*PrivateAccountAPI) NewAccount ¶
func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error)
NewAccount will create a new account and returns the address for the new account.
func (*PrivateAccountAPI) OpenWallet ¶
func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error
OpenWallet initiates a hardware wallet opening procedure, establishing a USB connection and attempting to authenticate via the provided passphrase. Note, the method may return an extra challenge requiring a second open (e.g. the Trezor PIN matrix challenge).
func (*PrivateAccountAPI) SendTransaction ¶
func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
SendTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails.
func (*PrivateAccountAPI) Sign ¶
func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error)
Sign calculates an Ethereum ECDSA signature for: keccack256("\x19Ethereum Signed Message:\n" + len(message) + message))
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The key used to calculate the signature is decrypted with the given password.
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
func (*PrivateAccountAPI) SignAndSendTransaction ¶
func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
SignAndSendTransaction was renamed to SendTransaction. This method is deprecated and will be removed in the future. It primary goal is to give clients time to update.
func (*PrivateAccountAPI) SignTransaction ¶
func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs, passwd string) (*SignTransactionResult, error)
SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast to other nodes
func (*PrivateAccountAPI) UnlockAccount ¶
func (s *PrivateAccountAPI) UnlockAccount(addr common.Address, password string, duration *uint64) (bool, error)
UnlockAccount will unlock the account associated with the given address with the given password for duration seconds. If duration is nil it will use a default of 300 seconds. It returns an indication if the account was unlocked.
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 APIs exposed over the private debugging endpoint.
func NewPrivateDebugAPI ¶
func NewPrivateDebugAPI(b *Service) *PrivateDebugAPI
NewPrivateDebugAPI creates a new API definition for the private debug methods of the Ethereum service.
func (*PrivateDebugAPI) ChaindbCompact ¶
func (api *PrivateDebugAPI) ChaindbCompact() error
func (*PrivateDebugAPI) ChaindbProperty ¶
func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error)
ChaindbProperty returns leveldb properties of the chain database.
func (*PrivateDebugAPI) SetHead ¶
func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64)
SetHead rewinds the head of the blockchain to a previous block.
type PrivateDebugChainAPI ¶
type PrivateDebugChainAPI struct {
// contains filtered or unexported fields
}
PrivateDebugChainAPI is the collection of Ethereum full node APIs exposed over the private debugging endpoint.
func NewPrivateDebugChainAPI ¶
func NewPrivateDebugChainAPI(config *params.ChainConfig, eth *Service) *PrivateDebugChainAPI
NewPrivateDebugChainAPI creates a new API definition for the full node-related private debug methods of the Ethereum service.
func (*PrivateDebugChainAPI) GetBadBlocks ¶
func (api *PrivateDebugChainAPI) 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 (*PrivateDebugChainAPI) GetModifiedAccountsByHash ¶
func (api *PrivateDebugChainAPI) 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 (*PrivateDebugChainAPI) GetModifiedAccountsByNumber ¶
func (api *PrivateDebugChainAPI) 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 (*PrivateDebugChainAPI) Preimage ¶
func (api *PrivateDebugChainAPI) 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 (*PrivateDebugChainAPI) StorageRangeAt ¶
func (api *PrivateDebugChainAPI) 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 PublicAccountAPI ¶
type PublicAccountAPI struct {
// contains filtered or unexported fields
}
PublicAccountAPI provides an API to access accounts managed by this node. It offers only methods that can retrieve accounts.
func NewPublicAccountAPI ¶
func NewPublicAccountAPI(am *accounts.Manager) *PublicAccountAPI
NewPublicAccountAPI creates a new PublicAccountAPI.
func (*PublicAccountAPI) Accounts ¶
func (s *PublicAccountAPI) Accounts() []common.Address
Accounts returns the collection of accounts this node manages
type PublicBlockChainAPI ¶
type PublicBlockChainAPI struct {
// contains filtered or unexported fields
}
PublicBlockChainAPI provides an API to access the Ethereum blockchain. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicBlockChainAPI ¶
func NewPublicBlockChainAPI(b *Service) *PublicBlockChainAPI
NewPublicBlockChainAPI creates a new Ethereum blockchain API.
func (*PublicBlockChainAPI) BlockNumber ¶
func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64
BlockNumber returns the block number of the chain head.
func (*PublicBlockChainAPI) Call ¶
func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
Call executes the given transaction on the state for the given block number. It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.
func (*PublicBlockChainAPI) EstimateGas ¶
func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)
EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.
func (*PublicBlockChainAPI) GetBalance ¶
func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Big, error)
GetBalance returns the amount of wei for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*PublicBlockChainAPI) GetBlockByHash ¶
func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, blockHash common.Hash, fullTx bool) (map[string]interface{}, error)
GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetBlockByNumber ¶
func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the requested block. When blockNr is -1 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetCode ¶
func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
GetCode returns the code stored at the given address in the state for the given block number.
func (*PublicBlockChainAPI) GetStorageAt ¶
func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*PublicBlockChainAPI) GetUncleByBlockHashAndIndex ¶
func (s *PublicBlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetUncleByBlockNumberAndIndex ¶
func (s *PublicBlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicBlockChainAPI) GetUncleCountByBlockHash ¶
func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
GetUncleCountByBlockHash returns number of uncles in the block for the given block hash
func (*PublicBlockChainAPI) GetUncleCountByBlockNumber ¶
func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
GetUncleCountByBlockNumber returns number of uncles in the block for the given block number
type PublicDebugAPI ¶
type PublicDebugAPI struct {
// contains filtered or unexported fields
}
PublicDebugAPI is the collection of Ethereum APIs exposed over the public debugging endpoint.
func NewPublicDebugAPI ¶
func NewPublicDebugAPI(b *Service) *PublicDebugAPI
NewPublicDebugAPI creates a new API definition for the public debug methods of the Ethereum service.
func (*PublicDebugAPI) GetBlockRlp ¶
GetBlockRlp retrieves the RLP encoded for of a single block.
func (*PublicDebugAPI) PrintBlock ¶
PrintBlock retrieves a block and returns its pretty printed form.
type PublicDebugChainAPI ¶
type PublicDebugChainAPI struct {
// contains filtered or unexported fields
}
PublicDebugChainAPI is the collection of Ethereum full node APIs exposed over the public debugging endpoint.
func NewPublicDebugChainAPI ¶
func NewPublicDebugChainAPI(eth *Service) *PublicDebugChainAPI
NewPublicDebugChainAPI creates a new API definition for the full node- related public debug methods of the Ethereum service.
func (*PublicDebugChainAPI) DumpBlock ¶
func (api *PublicDebugChainAPI) 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 Ethereum related information. It offers only methods that operate on public data that is freely available to anyone.
func NewPublicEthereumAPI ¶
func NewPublicEthereumAPI(b *Service) *PublicEthereumAPI
NewPublicEthereumAPI creates a new Ethereum protocol API.
func (*PublicEthereumAPI) ProtocolVersion ¶
func (s *PublicEthereumAPI) ProtocolVersion() hexutil.Uint
ProtocolVersion returns the current Ethereum protocol version this node supports
func (*PublicEthereumAPI) Syncing ¶
func (s *PublicEthereumAPI) Syncing() (interface{}, error)
Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not yet received the latest block headers from its pears. In case it is synchronizing: - startingBlock: block number this node started to synchronise from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled
type PublicEthereumChainAPI ¶
type PublicEthereumChainAPI struct {
// contains filtered or unexported fields
}
PublicEthereumChainAPI provides an API to access Service full node-related information.
func NewPublicEthereumChainAPI ¶
func NewPublicEthereumChainAPI(e *Service) *PublicEthereumChainAPI
NewPublicEthereumChainAPI creates a new Ethereum protocol API for full nodes.
func (*PublicEthereumChainAPI) ChainId ¶
func (api *PublicEthereumChainAPI) ChainId() hexutil.Uint64
ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func (*PublicEthereumChainAPI) Coinbase ¶
func (api *PublicEthereumChainAPI) Coinbase() (common.Address, error)
Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func (*PublicEthereumChainAPI) Etherbase ¶
func (api *PublicEthereumChainAPI) Etherbase() (common.Address, error)
Etherbase is the address that mining rewards will be send to
func (*PublicEthereumChainAPI) Hashrate ¶
func (api *PublicEthereumChainAPI) Hashrate() hexutil.Uint64
Hashrate returns the POW hashrate
type PublicNetAPI ¶
type PublicNetAPI struct {
// contains filtered or unexported fields
}
PublicNetAPI offers network related RPC methods
func NewPublicNetAPI ¶
func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI
NewPublicNetAPI creates a new net API instance.
func (*PublicNetAPI) Listening ¶
func (s *PublicNetAPI) Listening() bool
Listening returns an indication if the node is listening for network connections.
func (*PublicNetAPI) PeerCount ¶
func (s *PublicNetAPI) PeerCount() hexutil.Uint
PeerCount returns the number of connected peers
func (*PublicNetAPI) Version ¶
func (s *PublicNetAPI) Version() string
Version returns the current ethereum protocol version.
type PublicTransactionPoolAPI ¶
type PublicTransactionPoolAPI struct {
// contains filtered or unexported fields
}
PublicTransactionPoolAPI exposes methods for the RPC interface
func NewPublicTransactionPoolAPI ¶
func NewPublicTransactionPoolAPI(b *Service, nonceLock *AddrLocker) *PublicTransactionPoolAPI
NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.
func (*PublicTransactionPoolAPI) GetBlockTransactionCountByHash ¶
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint
GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
func (*PublicTransactionPoolAPI) GetBlockTransactionCountByNumber ¶
func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint
GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
func (*PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex ¶
func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes
GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.
func (*PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex ¶
func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes
GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.
func (*PublicTransactionPoolAPI) GetRawTransactionByHash ¶
func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
GetRawTransactionByHash returns the bytes of the transaction for the given hash.
func (*PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex ¶
func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction
GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
func (*PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex ¶
func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*PublicTransactionPoolAPI) GetTransactionByHash ¶
func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) *RPCTransaction
GetTransactionByHash returns the transaction for the given hash
func (*PublicTransactionPoolAPI) GetTransactionCount ¶
func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)
GetTransactionCount returns the number of transactions the given address has sent for the given block number
func (*PublicTransactionPoolAPI) GetTransactionReceipt ¶
func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (*PublicTransactionPoolAPI) PendingTransactions ¶
func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error)
PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
func (*PublicTransactionPoolAPI) Resend ¶
func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error)
Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the pool and reinsert it with the new gas price and limit.
func (*PublicTransactionPoolAPI) SendRawTransaction ¶
func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.
func (*PublicTransactionPoolAPI) SendTransaction ¶
func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.
func (*PublicTransactionPoolAPI) Sign ¶
func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
Sign calculates an ECDSA signature for: keccack256("\x19Ethereum Signed Message:\n" + len(message) + message).
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The account associated with addr must be unlocked.
func (*PublicTransactionPoolAPI) SignTransaction ¶
func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error)
SignTransaction will sign the given transaction with the from account. The node needs to have the private key of the account corresponding with the given from address and it needs to be unlocked.
type PublicTxPoolAPI ¶
type PublicTxPoolAPI struct {
// contains filtered or unexported fields
}
PublicTxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential.
func NewPublicTxPoolAPI ¶
func NewPublicTxPoolAPI(b *Service) *PublicTxPoolAPI
NewPublicTxPoolAPI creates a new tx pool service that gives information about the transaction pool.
func (*PublicTxPoolAPI) Content ¶
func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction
Content returns the transactions contained within the transaction pool.
type RPCTransaction ¶
type RPCTransaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From common.Address `json:"from"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Hash common.Hash `json:"hash"` Input hexutil.Bytes `json:"input"` Nonce hexutil.Uint64 `json:"nonce"` To *common.Address `json:"to"` TransactionIndex hexutil.Uint `json:"transactionIndex"` Value *hexutil.Big `json:"value"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` }
RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction
type RpcServer ¶
type RpcServer struct {
// contains filtered or unexported fields
}
Node is a container on which services can be registered. ( based on "github.com/ethereum/go-ethereum/node.Node" )
func NewRpcServer ¶
New creates a new P2P node, ready for protocol registration.
func (*RpcServer) AccountManager ¶
AccountManager retrieves the account manager used by the protocol stack.
func (*RpcServer) EventFeed ¶
EventFeed retrieves the event feed used by all the network services in the current protocol stack.
func (*RpcServer) HTTPEndpoint ¶
HTTPEndpoint retrieves the current HTTP endpoint used by the protocol stack.
func (*RpcServer) IPCEndpoint ¶
IPCEndpoint retrieves the current IPC endpoint used by the protocol stack.
func (*RpcServer) RPCHandler ¶
RPCHandler returns the in-process RPC request handler.
func (*RpcServer) Register ¶
func (n *RpcServer) Register(constructor RpcServiceConstructor) error
Register injects a new service into the node's stack. The service created by the passed constructor must be unique in its type with regard to sibling ones.
func (*RpcServer) Restart ¶
Restart terminates a running node and boots up a new one in its place. If the node isn't running, an error is returned.
func (*RpcServer) Service ¶
Service retrieves a currently running service registered of a specific type.
func (*RpcServer) Stop ¶
Stop terminates a running node along with all it's services. In the node was not started, an error is returned.
func (*RpcServer) WSEndpoint ¶
WSEndpoint retrieves the current WS endpoint used by the protocol stack.
type RpcService ¶
type RpcService interface { // APIs retrieves the list of RPC descriptors the service provides APIs() []rpc.API // Start is called after all services have been constructed and the networking // layer was also initialized to spawn any goroutines required by the service. Start() error // Stop terminates all goroutines belonging to the service, blocking until they // are all terminated. Stop() error }
Service is an individual protocol that can be registered into a node.
Notes:
• Service life-cycle management is delegated to the node. The service is allowed to initialize itself upon creation, but no goroutines should be spun up outside of the Start method.
• Restart logic is not required as the node will create a fresh instance every time a service is started.
type RpcServiceConstructor ¶
type RpcServiceConstructor func(ctx *RpcServiceContext) (RpcService, error)
RpcServiceConstructor is the function signature of the constructors needed to be registered for service instantiation.
func NewWeb3AccountServiceConstructor ¶
func NewWeb3AccountServiceConstructor(backend *Service) RpcServiceConstructor
func NewWeb3ChainServiceConstructor ¶
func NewWeb3ChainServiceConstructor(backend *Service) RpcServiceConstructor
type RpcServiceContext ¶
type RpcServiceContext struct { EventFeed *event.Feed // Event multiplexer used for decoupled notifications AccountManager *accounts.Manager // Account manager created by the node. // contains filtered or unexported fields }
RpcServiceContext is a collection of service independent options inherited from the protocol stack, that is passed to all constructors to be optionally used; as well as utility methods to operate on the service environment.
func (*RpcServiceContext) Service ¶
func (ctx *RpcServiceContext) Service(service interface{}) error
RpcService retrieves a currently running service registered of a specific type.
type SendTxArgs ¶
type SendTxArgs struct { From common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We accept "data" and "input" for backwards-compatibility reasons. "input" is the // newer name and should be preferred by clients. Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` }
SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool.
type Service ¶
func NewService ¶
func (*Service) AccountManager ¶
func (*Service) ChainConfig ¶
func (m *Service) ChainConfig() *params.ChainConfig
type SignTransactionResult ¶
type SignTransactionResult struct { Raw hexutil.Bytes `json:"raw"` Tx *types.Transaction `json:"tx"` }
SignTransactionResult represents a RLP encoded signed transaction.
type StopError ¶
StopError is returned if a Node fails to stop either any of its registered services or itself.
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 StructLogRes ¶
type StructLogRes struct { Pc uint64 `json:"pc"` Op string `json:"op"` Gas uint64 `json:"gas"` GasCost uint64 `json:"gasCost"` Depth int `json:"depth"` Error error `json:"error,omitempty"` Stack *[]string `json:"stack,omitempty"` Memory *[]string `json:"memory,omitempty"` Storage *map[string]string `json:"storage,omitempty"` }
StructLogRes stores a structured log emitted by the EVM while replaying a transaction in debug mode
func FormatLogs ¶
func FormatLogs(logs []vm.StructLog) []StructLogRes
formatLogs formats EVM returned structured logs for json output
type Web3AccountService ¶
type Web3AccountService struct {
// contains filtered or unexported fields
}
func (*Web3AccountService) APIs ¶
func (s *Web3AccountService) APIs() []rpc.API
func (*Web3AccountService) Start ¶
func (s *Web3AccountService) Start() error
func (*Web3AccountService) Stop ¶
func (s *Web3AccountService) Stop() error
type Web3ChainService ¶
type Web3ChainService struct {
// contains filtered or unexported fields
}
func (*Web3ChainService) APIs ¶
func (s *Web3ChainService) APIs() []rpc.API
func (*Web3ChainService) Start ¶
func (s *Web3ChainService) Start() error
func (*Web3ChainService) Stop ¶
func (s *Web3ChainService) Stop() error