ape-node

class ape_node.EthereumNetworkConfig(_case_sensitive: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_prefix: str | None = None, _secrets_dir: str | Path | None = None, *, mainnet: dict = {'uri': 'https://rpc.mevblocker.io/fullprivacy'}, holesky: dict = {'uri': 'https://holesky.drpc.org'}, sepolia: dict = {'uri': 'https://rpc-sepolia.rockx.com'}, local: dict = {'chain_id': 1337, 'uri': 'http://localhost:8545'}, **values: Any)
model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_hide_none_type': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_settings_source': None, 'cli_use_class_docs_for_groups': False, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'allow', 'json_file': None, 'json_file_encoding': None, 'protected_namespaces': ('model_', 'settings_'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ape_node.EthereumNodeConfig(_case_sensitive: bool | None = None, _env_prefix: str | None = None, _env_file: DotenvType | None = PosixPath('.'), _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None, _cli_settings_source: CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_prefix: str | None = None, _secrets_dir: str | Path | None = None, *, ethereum: EthereumNetworkConfig = EthereumNetworkConfig(mainnet={'uri': 'https://rpc.mevblocker.io/fullprivacy'}, holesky={'uri': 'https://holesky.drpc.org'}, sepolia={'uri': 'https://rpc-sepolia.rockx.com'}, local={'uri': 'http://localhost:8545', 'chain_id': 1337}), executable: str | None = None, data_dir: Path | None = None, ipc_path: Path | None = None, call_trace_approach: TraceApproach | None = None, **values: Any)

Configure your node: in Ape, the default provider plugin for live-network nodes. Also, ape node can start-up a local development node for testing purposes.

call_trace_approach: TraceApproach | None

Select the trace approach to use. Defaults to deducing one based on your node’s client-version and available RPCs.

data_dir: Path | None

For node-management, choose where the geth data directory shall be located. Defaults to using a location within Ape’s DATA_FOLDER.

ethereum: EthereumNetworkConfig

Configure the Ethereum network settings for the ape node provider, such as which URIs to use for each network.

executable: str | None

For starting nodes, select the executable. Defaults to using shutil.which("geth").

ipc_path: Path | None

For IPC connections, select the IPC path. If managing a process, web3.py can determine the IPC w/o needing to manually configure.

model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_hide_none_type': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_settings_source': None, 'cli_use_class_docs_for_groups': False, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'allow', 'json_file': None, 'json_file_encoding': None, 'protected_namespaces': ('model_', 'settings_'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ape_node.GethDev(*args, name: str = 'node', network: NetworkAPI, provider_settings: dict = {}, request_header: dict, block_page_size: int = 5000, concurrency: int = 16, PROCESS_WAIT_TIMEOUT: int = 15, process: Popen | None = None, is_stopping: bool = False, stdout_queue: JoinableQueue | None = None, stderr_queue: JoinableQueue | None = None)
property auto_mine: bool

Whether automine is enabled.

build_command() list[str]

Get the command as a list of str. Subclasses should override and add command arguments if needed.

Returns:

The command to pass to subprocess.Popen.

Return type:

list[str]

property chain_id: int

The blockchain ID. See ChainList for a comprehensive list of IDs.

connect()

Connect a to a provider, such as start-up a process or create an HTTP connection.

disconnect()

Disconnect from a provider, such as tear-down a process or quit an HTTP session.

mine(**kwargs)

Defined to make the ProviderAPI interchangeable with a TestProviderAPI, as in ape.managers.chain.ChainManager.

Raises:

APINotImplementedError – Unless overriden.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str

The name of the provider (should be the plugin name).

property process_name: str

The name of the process, such as Hardhat node.

restore(snapshot_id: str | int | bytes)

Defined to make the ProviderAPI interchangeable with a TestProviderAPI, as in ape.managers.chain.ChainManager.

Raises:

APINotImplementedError – Unless overriden.

set_timestamp(**kwargs)

Defined to make the ProviderAPI interchangeable with a TestProviderAPI, as in ape.managers.chain.ChainManager.

Raises:

APINotImplementedError – Unless overriden.

snapshot() str | int | bytes

Defined to make the ProviderAPI interchangeable with a TestProviderAPI, as in ape.managers.chain.ChainManager.

Raises:

APINotImplementedError – Unless overriden.

start(timeout: int = 20)

Start the process and wait for its RPC to be ready.

class ape_node.Node(*args, name: str = 'node', network: NetworkAPI, provider_settings: dict = {}, request_header: dict, block_page_size: int = 5000, concurrency: int = 16)
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ape_node.OtterscanQueryEngine
estimate_query(query: BlockQuery | BlockTransactionQuery | AccountTransactionQuery | ContractCreationQuery | ContractEventQuery | ContractMethodQuery) int | None
estimate_query(query: ContractCreationQuery) int | None

Estimation of time needed to complete the query. The estimation is returned as an int representing milliseconds. A value of None indicates that the query engine is not available for use or is unable to complete the query.

Parameters:

query (QueryType) – Query to estimate.

Returns:

Represents milliseconds, returns None if unable to execute.

Return type:

Optional[int]

perform_query(query: BlockQuery | BlockTransactionQuery | AccountTransactionQuery | ContractCreationQuery | ContractEventQuery | ContractMethodQuery) Iterator
perform_query(query: ContractCreationQuery) Iterator[ContractCreation]

Executes the query using best performing estimate_query query engine.

Parameters:

query (QueryType) – query to execute

Returns:

Iterator