api

package
v0.4.9-rc9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandHome

func ExpandHome(p string) (string, error)

ExpandHome expands home directory in file paths. ~someuser/tmp will not be expanded.

func NewWeb3API

NewWeb3API creates a new web3 DebugAPI instance.

func RPCMarshalBlock

func RPCMarshalBlock(block *rpctypes.Block, inclTx bool, fullTx bool, config *params.ChainConfig) (map[string]interface{}, error)

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.

func RPCMarshalHeader

func RPCMarshalHeader(head *types.Header, hash common.Hash) map[string]interface{}

RPCMarshalHeader converts the given header to the RPC output .

func SubmitTransaction

func SubmitTransaction(ctx context.Context, logger log.Logger, b rpctypes.TrancsactionBackend, tx *types.Transaction) (common.Hash, error)

SubmitTransaction is a helper function that submits tx to txPool and logs a message.

Types

type AccessListResult

type AccessListResult struct {
	Accesslist *types.AccessList `json:"accessList"`
	Error      string            `json:"error,omitempty"`
	GasUsed    hexutil.Uint64    `json:"gasUsed"`
}

AccessListResult returns an optional access list It's the result of the `debug_createAccessList` RPC call. It contains an error if the transaction itself failed.

type AccountResult

type AccountResult struct {
	Address      common.Address  `json:"address"`
	AccountProof []string        `json:"accountProof"`
	Balance      *hexutil.Big    `json:"balance"`
	CodeHash     common.Hash     `json:"codeHash"`
	Nonce        hexutil.Uint64  `json:"nonce"`
	StorageHash  common.Hash     `json:"storageHash"`
	StorageProof []StorageResult `json:"storageProof"`
}

Result structs for GetProof

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 BlockChainAPI

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

BlockChainAPI provides an API to access Ethereum blockchain data.

func NewBlockChainAPI

func NewBlockChainAPI(b rpctypes.BlockChainBackend, logger log.Logger) *BlockChainAPI

NewBlockChainAPI creates a new Ethereum blockchain API.

func (*BlockChainAPI) BlockNumber

func (s *BlockChainAPI) BlockNumber() hexutil.Uint64

BlockNumber returns the block number of the chain head.

func (*BlockChainAPI) Call

Call executes the given transaction on the states for the given block number.

Additionally, the caller can specify a batch of contract for fields overriding.

Note, this function doesn't make and changes in the states/blockchain and is useful to execute and retrieve values.

func (*BlockChainAPI) ChainId

func (s *BlockChainAPI) ChainId() *hexutil.Big

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

Note, this method does not conform to EIP-695 because the configured chain ID is always returned, regardless of the current head block. We used to return an error when the chain wasn't synced up to a block where EIP-155 is enabled, but this behavior caused issues in CL clients.

func (*BlockChainAPI) Coinbase

func (s *BlockChainAPI) Coinbase() (common.Address, error)

func (*BlockChainAPI) CreateAccessList

CreateAccessList creates an EIP-2930 type AccessList for the given transaction. Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain states.

func (*BlockChainAPI) EstimateGas

func (s *BlockChainAPI) EstimateGas(ctx context.Context, args rpctypes.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)

EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.

func (*BlockChainAPI) GetBalance

func (s *BlockChainAPI) GetBalance(_ context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)

GetBalance returns the amount of wei for the given address in the states of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*BlockChainAPI) GetBlockByHash

func (s *BlockChainAPI) GetBlockByHash(ctx context.Context, hash 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 (*BlockChainAPI) GetBlockByNumber

func (s *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

GetBlockByNumber returns the requested canonical block.

  • When blockNr is -1 the chain head is returned.
  • When blockNr is -2 the pending chain head is returned.
  • When fullTx is true all transactions in the block are returned, otherwise only the transaction hash is returned.

func (*BlockChainAPI) GetCode

func (s *BlockChainAPI) GetCode(_ context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetCode returns the code stored at the given address in the states for the given block number.

func (*BlockChainAPI) GetHeaderByHash

func (s *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{}

GetHeaderByHash returns the requested header by hash.

func (*BlockChainAPI) GetHeaderByNumber

func (s *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)

GetHeaderByNumber returns the requested canonical block header. * When blockNr is -1 the chain head is returned. * When blockNr is -2 the pending chain head is returned.

func (*BlockChainAPI) GetProof

func (s *BlockChainAPI) GetProof(_ context.Context, address common.Address, storageKeys []string, blockNrOrHash rpctypes.BlockNumberOrHash) (*rpctypes.AccountResult, error)

GetProof returns the Merkle-proof for a given account and optionally some storage keys.

func (*BlockChainAPI) GetStorageAt

func (s *BlockChainAPI) GetStorageAt(_ context.Context, address common.Address, hexKey string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetStorageAt returns the storage from the states at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

func (*BlockChainAPI) GetUncleByBlockHashAndIndex

func (s *BlockChainAPI) 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.

func (*BlockChainAPI) GetUncleByBlockNumberAndIndex

func (s *BlockChainAPI) 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.

func (*BlockChainAPI) GetUncleCountByBlockHash

func (s *BlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetUncleCountByBlockHash returns number of uncles in the block for the given block hash

func (*BlockChainAPI) GetUncleCountByBlockNumber

func (s *BlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetUncleCountByBlockNumber returns number of uncles in the block for the given block number

type BlockOverrides

type BlockOverrides struct {
	Number     *hexutil.Big
	Difficulty *hexutil.Big
	Time       *hexutil.Uint64
	GasLimit   *hexutil.Uint64
	Coinbase   *common.Address
	Random     *common.Hash
	BaseFee    *hexutil.Big
}

BlockOverrides is a set of header fields to override.

func (*BlockOverrides) Apply

func (diff *BlockOverrides) Apply(blockCtx *vm.BlockContext)

Apply overrides the given header fields into the given block context.

type ChainContext

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

ChainContext is an implementation of core.ChainContext. It's main use-case is instantiating a vm.BlockContext without having access to the BlockChain object.

func NewChainContext

func NewChainContext(ctx context.Context, backend ChainContextBackend) *ChainContext

NewChainContext creates a new ChainContext object.

func (*ChainContext) Engine

func (context *ChainContext) Engine() consensus.Engine

func (*ChainContext) GetHeader

func (context *ChainContext) GetHeader(hash common.Hash, number uint64) *types.Header

type ChainContextBackend

type ChainContextBackend interface {
	Engine() consensus.Engine
	HeaderByNumber(context.Context, rpc.BlockNumber) (*types.Header, error)
}

ChainContextBackend provides methods required to implement ChainContext.

type DebugAPI

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

DebugAPI is the collection of tracing APIs exposed over the private debugging endpoint.

func NewDebugAPI

func NewDebugAPI(
	backend rpctypes.DebugBackend,
	logger log.Logger,
	ctx *server.Context,
) *DebugAPI

NewDebugAPI creates a new DebugAPI definition for the tracing methods of the Ethereum service.

func (*DebugAPI) BlockProfile

func (a *DebugAPI) BlockProfile(file string, nsec uint) error

BlockProfile turns on goroutine profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.

func (*DebugAPI) ChaindbCompact

func (api *DebugAPI) ChaindbCompact() error

ChaindbCompact flattens the entire key-value database into a single level, removing all unused slots and merging all keys.

func (*DebugAPI) ChaindbProperty

func (api *DebugAPI) ChaindbProperty(property string) (string, error)

ChaindbProperty returns leveldb properties of the key-value database.

func (*DebugAPI) CpuProfile

func (a *DebugAPI) CpuProfile(file string, nsec uint) error

CpuProfile turns on CPU profiling for nsec seconds and writes profile data to file.

func (*DebugAPI) DbAncient

func (api *DebugAPI) DbAncient(_ string, _ uint64) (hexutil.Bytes, error)

DbAncient retrieves an ancient binary blob from the append-only immutable files. It is a mapping to the `AncientReaderOp.Ancient` method

func (*DebugAPI) DbAncients

func (api *DebugAPI) DbAncients() (uint64, error)

DbAncients returns the ancient item numbers in the ancient store. It is a mapping to the `AncientReaderOp.Ancients` method

func (*DebugAPI) DbGet

func (api *DebugAPI) DbGet(_ string) (hexutil.Bytes, error)

DbGet returns the raw value of a key stored in the database.

func (*DebugAPI) FreeOSMemory

func (a *DebugAPI) FreeOSMemory()

FreeOSMemory forces a garbage collection.

func (*DebugAPI) GcStats

func (a *DebugAPI) GcStats() *debug.GCStats

GcStats returns GC statistics.

func (*DebugAPI) GetBlockRlp

func (a *DebugAPI) GetBlockRlp(number uint64) (hexutil.Bytes, error)

GetBlockRlp retrieves the RLP encoded for of a single block.

func (*DebugAPI) GetHeaderRlp

func (a *DebugAPI) GetHeaderRlp(number uint64) (hexutil.Bytes, error)

GetHeaderRlp retrieves the RLP encoded for of a single header.

func (*DebugAPI) GetRawBlock

func (api *DebugAPI) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetRawBlock retrieves the RLP encoded for a single block.

func (*DebugAPI) GetRawHeader

func (api *DebugAPI) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

GetRawHeader retrieves the RLP encoding for a single header.

func (*DebugAPI) GetRawReceipts

func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error)

GetRawReceipts retrieves the binary-encoded receipts of a single block.

func (*DebugAPI) GetRawTransaction

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

GetRawTransaction returns the bytes of the transaction for the given hash.

func (*DebugAPI) GetReceipts

func (api *DebugAPI) GetReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (types.Receipts, error)

func (*DebugAPI) GoTrace

func (a *DebugAPI) GoTrace(file string, nsec uint) error

GoTrace turns on tracing for nsec seconds and writes trace data to file.

func (*DebugAPI) IntermediateRoots

func (a *DebugAPI) IntermediateRoots(hash common.Hash, _ *evmsupport.TraceConfig) ([]common.Hash, error)

IntermediateRoots executes a block, and returns a list of intermediate roots: the stateroot after each transaction.

func (*DebugAPI) MemStats

func (a *DebugAPI) MemStats() *runtime.MemStats

MemStats returns detailed runtime memory statistics.

func (*DebugAPI) MutexProfile

func (a *DebugAPI) MutexProfile(file string, nsec uint) error

MutexProfile turns on mutex profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.

func (*DebugAPI) PrintBlock

func (api *DebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error)

PrintBlock retrieves a block and returns its pretty printed form.

func (*DebugAPI) SeedHash

func (a *DebugAPI) SeedHash(_ uint64) (string, error)

SeedHash retrieves the seed hash of a block.

func (*DebugAPI) SetBlockProfileRate

func (a *DebugAPI) SetBlockProfileRate(rate int)

SetBlockProfileRate sets the rate of goroutine block profile data collection. rate 0 disables block profiling.

func (*DebugAPI) SetGCPercent

func (a *DebugAPI) SetGCPercent(v int) int

SetGCPercent sets the garbage collection target percentage. It returns the previous setting. A negative value disables GC.

func (*DebugAPI) SetHead

func (api *DebugAPI) SetHead(_ hexutil.Uint64)

SetHead rewinds the head of the blockchain to a previous block.

func (*DebugAPI) SetMutexProfileFraction

func (a *DebugAPI) SetMutexProfileFraction(rate int)

SetMutexProfileFraction sets the rate of mutex profiling.

func (*DebugAPI) Stacks

func (a *DebugAPI) Stacks() string

Stacks returns a printed representation of the stacks of all goroutines.

func (*DebugAPI) StartCPUProfile

func (a *DebugAPI) StartCPUProfile(file string) error

StartCPUProfile turns on CPU profiling, writing to the given file.

func (*DebugAPI) StartGoTrace

func (a *DebugAPI) StartGoTrace(file string) error

StartGoTrace turns on tracing, writing to the given file.

func (*DebugAPI) StopCPUProfile

func (a *DebugAPI) StopCPUProfile() error

StopCPUProfile stops an ongoing CPU profile.

func (*DebugAPI) StopGoTrace

func (a *DebugAPI) StopGoTrace() error

StopGoTrace stops an ongoing trace.

func (*DebugAPI) TraceBlockByHash

func (a *DebugAPI) TraceBlockByHash(hash common.Hash, config evmsupport.TraceConfig) ([]*evmtxs.TxTraceResult, error)

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

func (*DebugAPI) TraceBlockByNumber

func (a *DebugAPI) TraceBlockByNumber(height rpc.BlockNumber, config evmsupport.TraceConfig) ([]*evmtxs.TxTraceResult, error)

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

func (*DebugAPI) TraceTransaction

func (a *DebugAPI) TraceTransaction(hash common.Hash, config evmsupport.TraceConfig) (interface{}, error)

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

func (*DebugAPI) WriteBlockProfile

func (a *DebugAPI) WriteBlockProfile(file string) error

WriteBlockProfile writes a goroutine blocking profile to the given file.

func (*DebugAPI) WriteMemProfile

func (a *DebugAPI) WriteMemProfile(file string) error

WriteMemProfile writes an allocation profile to the given file. Note that the profiling rate cannot be set through the DebugAPI, it must be set on the command line.

func (*DebugAPI) WriteMutexProfile

func (a *DebugAPI) WriteMutexProfile(file string) error

WriteMutexProfile writes a goroutine blocking profile to the given file.

type EthereumAPI

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

EthereumAPI provides an API to access Ethereum related information.

func NewEthereumAPI

func NewEthereumAPI(b rpctypes.EthereumBackend, logger log.Logger) *EthereumAPI

NewEthereumAPI creates a new Ethereum protocol API.

func (*EthereumAPI) FeeHistory

func (s *EthereumAPI) FeeHistory(_ context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*rpctypes.FeeHistoryResult, error)

FeeHistory returns the fee market history.

func (*EthereumAPI) GasPrice

func (s *EthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)

GasPrice returns a suggestion for a gas price for legacy transactions.

func (*EthereumAPI) MaxPriorityFeePerGas

func (s *EthereumAPI) MaxPriorityFeePerGas(_ context.Context) (*hexutil.Big, error)

MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.

func (*EthereumAPI) ProtocolVersion

func (s *EthereumAPI) ProtocolVersion() hexutil.Uint

ProtocolVersion returns the supported Ethereum protocol version.

func (*EthereumAPI) Syncing

func (s *EthereumAPI) 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 synchronize 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 states entries processed until now - knownStates: number of known states entries that still need to be pulled

type EthereumAccountAPI

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

EthereumAccountAPI provides an API to access accounts managed by this node. It offers only methods that can retrieve accounts.

func NewEthereumAccountAPI

func NewEthereumAccountAPI(b rpctypes.EthereumBackend) *EthereumAccountAPI

NewEthereumAccountAPI creates a new EthereumAccountAPI.

func (*EthereumAccountAPI) Accounts

func (s *EthereumAccountAPI) Accounts() []common.Address

Accounts returns the collection of accounts this node manages.

type HandlerT

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

HandlerT keeps track of the cpu profiler and trace execution

type NetAPI

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

NetAPI offers network related RPC methods.

func NewNetAPI

func NewNetAPI(b rpctypes.NetBackend) *NetAPI

NewNetAPI creates a new net DebugAPI instance.

func (*NetAPI) Listening

func (api *NetAPI) Listening() bool

Listening returns an indication if the node is listening for network connections.

func (*NetAPI) PeerCount

func (api *NetAPI) PeerCount() hexutil.Uint

PeerCount returns the number of connected peers.

func (*NetAPI) Version

func (api *NetAPI) Version() string

Version returns the current ethereum protocol version.

type OverrideAccount

type OverrideAccount struct {
	Nonce     *hexutil.Uint64              `json:"nonce"`
	Code      *hexutil.Bytes               `json:"code"`
	Balance   **hexutil.Big                `json:"balance"`
	State     *map[common.Hash]common.Hash `json:"states"`
	StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
}

OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, states and stateDiff can't be specified at the same time. If states is set, message execution will only use the data in the given states. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.

type PersonalAccountAPI

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

PersonalAccountAPI 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 NewPersonalAccountAPI

func NewPersonalAccountAPI(b rpctypes.PersonalBackend, logger log.Logger, nonceLock *AddrLocker) *PersonalAccountAPI

NewPersonalAccountAPI create a new PersonalAccountAPI.

func (*PersonalAccountAPI) DeriveAccount

func (s *PersonalAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error)

DeriveAccount requests an HD wallet to derive a new account, optionally pinning it for later reuse.

func (*PersonalAccountAPI) EcRecover

func (s *PersonalAccountAPI) EcRecover(_ 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 (*PersonalAccountAPI) ImportRawKey

func (s *PersonalAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error)

ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.

func (*PersonalAccountAPI) InitializeWallet

func (s *PersonalAccountAPI) InitializeWallet(_ context.Context, _ string) (string, error)

InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key.

func (*PersonalAccountAPI) ListAccounts

func (s *PersonalAccountAPI) ListAccounts() []common.Address

ListAccounts will return a list of addresses for accounts this node manages.

func (*PersonalAccountAPI) ListWallets

func (s *PersonalAccountAPI) ListWallets() []rawWallet

ListWallets will return a list of wallets this node manages.

func (*PersonalAccountAPI) LockAccount

func (s *PersonalAccountAPI) LockAccount(_ common.Address) bool

LockAccount will lock the account associated with the given address when it's unlocked.

func (*PersonalAccountAPI) NewAccount

func (s *PersonalAccountAPI) NewAccount(password string) (common.AddressEIP55, error)

NewAccount will create a new account and returns the address for the new account.

func (*PersonalAccountAPI) OpenWallet

func (s *PersonalAccountAPI) OpenWallet(_ string, _ *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 (*PersonalAccountAPI) SendTransaction

func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args rpctypes.TransactionArgs, 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.From. If the given passwd isn't able to decrypt the key it fails.

func (*PersonalAccountAPI) Sign

Sign calculates an Ethereum ECDSA signature for: keccak256("\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 (*PersonalAccountAPI) SignTransaction

func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args rpctypes.TransactionArgs, passwd string) (*SignTransactionResult, error)

SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.From. 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 (*PersonalAccountAPI) UnlockAccount

func (s *PersonalAccountAPI) UnlockAccount(_ context.Context, _ common.Address, _ 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.

func (*PersonalAccountAPI) Unpair

func (s *PersonalAccountAPI) Unpair(_ context.Context, _ string, _ string) error

Unpair deletes a pairing between wallet and geth.

type SignTransactionResult

type SignTransactionResult struct {
	Raw hexutil.Bytes      `json:"raw"`
	Tx  *types.Transaction `json:"tx"`
}

SignTransactionResult represents a RLP encoded signed transaction.

type StateOverride

type StateOverride map[common.Address]OverrideAccount

StateOverride is the collection of overridden accounts.

func (*StateOverride) Apply

func (diff *StateOverride) Apply(state *state.StateDB) error

Apply overrides the fields of specified accounts into the given states.

type StorageResult

type StorageResult struct {
	Key   string       `json:"key"`
	Value *hexutil.Big `json:"value"`
	Proof []string     `json:"proof"`
}

type TransactionAPI

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

TransactionAPI exposes methods for reading and creating transaction data.

func NewTransactionAPI

func NewTransactionAPI(b rpctypes.TrancsactionBackend, logger log.Logger, nonceLock *AddrLocker) *TransactionAPI

NewTransactionAPI creates a new RPC service with methods for interacting with transactions.

func (*TransactionAPI) FillTransaction

FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) on a given unsigned transaction, and returns it to the caller for further processing (signing + broadcast).

func (*TransactionAPI) GetBlockTransactionCountByHash

func (s *TransactionAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint

GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.

func (*TransactionAPI) GetBlockTransactionCountByNumber

func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint

GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.

func (*TransactionAPI) GetRawTransactionByBlockHashAndIndex

func (s *TransactionAPI) 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 (*TransactionAPI) GetRawTransactionByBlockNumberAndIndex

func (s *TransactionAPI) 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 (*TransactionAPI) GetRawTransactionByHash

func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

GetRawTransactionByHash returns the bytes of the transaction for the given hash.

func (*TransactionAPI) GetTransactionByBlockHashAndIndex

func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *rpctypes.RPCTransaction

GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.

func (*TransactionAPI) GetTransactionByBlockNumberAndIndex

func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *rpctypes.RPCTransaction

GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.

func (*TransactionAPI) GetTransactionByHash

func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*rpctypes.RPCTransaction, error)

GetTransactionByHash returns the transaction for the given hash

func (*TransactionAPI) GetTransactionCount

func (s *TransactionAPI) GetTransactionCount(_ context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)

GetTransactionCount returns the number of transactions the given address has sent for the given block number

func (*TransactionAPI) GetTransactionReceipt

func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt returns the transaction receipt for the given transaction hash.

func (*TransactionAPI) PendingTransactions

func (s *TransactionAPI) PendingTransactions() ([]*rpctypes.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 (*TransactionAPI) Resend

func (s *TransactionAPI) Resend(ctx context.Context, args rpctypes.TransactionArgs, 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 (*TransactionAPI) SendRawTransaction

func (s *TransactionAPI) SendRawTransaction(ctx context.Context, input 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 (*TransactionAPI) SendTransaction

func (s *TransactionAPI) SendTransaction(ctx context.Context, args rpctypes.TransactionArgs) (common.Hash, error)

SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.

func (*TransactionAPI) Sign

func (s *TransactionAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)

Sign calculates an ECDSA signature for: keccak256("\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.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign

func (*TransactionAPI) SignTransaction

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 TxPoolAPI

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

TxPoolAPI offers and API for the transaction pool. It only operates on data that is non-confidential.

func NewTxPoolAPI

func NewTxPoolAPI(b rpctypes.TxPoolBackend, logger log.Logger) *TxPoolAPI

NewTxPoolAPI creates a new tx pool service that gives information about the transaction pool.

func (*TxPoolAPI) Content

func (s *TxPoolAPI) Content() map[string]map[string]map[string]*rpctypes.RPCTransaction

Content returns the transactions contained within the transaction pool.

func (*TxPoolAPI) ContentFrom

func (s *TxPoolAPI) ContentFrom(address common.Address) map[string]map[string]*rpctypes.RPCTransaction

ContentFrom returns the transactions contained within the transaction pool.

func (*TxPoolAPI) Inspect

func (s *TxPoolAPI) Inspect() map[string]map[string]map[string]string

Inspect retrieves the content of the transaction pool and flattens it into an easily inspectable list.

func (*TxPoolAPI) Status

func (s *TxPoolAPI) Status() map[string]hexutil.Uint

Status returns the number of pending and queued transaction in the pool.

type Web3API

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

web3Api offers network related RPC methods.

func (*Web3API) ClientVersion

func (api *Web3API) ClientVersion() string

ClientVersion returns the node name.

func (*Web3API) Sha3

func (*Web3API) Sha3(input hexutil.Bytes) hexutil.Bytes

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

Jump to

Keyboard shortcuts

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