ape-node

class ape_node.provider.EthereumNetworkConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: 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_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _secrets_dir: PathType | None = None, *, mainnet: dict = {'uri': 'https://rpc.mevblocker.io/fullprivacy'}, holesky: dict = {'uri': 'https://ethereum-holesky-rpc.publicnode.com'}, sepolia: dict = {'uri': 'https://rpc.sepolia.org'}, local: dict = {'chain_id': 1337, 'uri': 'http://localhost:8545'}, **values: Any)
class ape_node.provider.EthereumNodeConfig(_case_sensitive: bool | None = None, _nested_model_default_partial_update: 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_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _secrets_dir: PathType | None = None, *, ethereum: EthereumNetworkConfig = EthereumNetworkConfig(mainnet={'uri': 'https://rpc.mevblocker.io/fullprivacy'}, holesky={'uri': 'https://ethereum-holesky-rpc.publicnode.com'}, sepolia={'uri': 'https://rpc.sepolia.org'}, 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, request_headers: dict = {}, **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.

request_headers: dict

Optionally specify request headers to use whenever using this provider.

class ape_node.provider.GethDev(*args, name: str = 'node', network: NetworkAPI, provider_settings: dict = {}, request_header: dict = {'User-Agent': 'EthereumNodeProvider/web3.py/7.6.0'}, 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 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.

get_test_account(index: int) TestAccountAPI

Retrieve one of the provider-generated test accounts.

Parameters:

index (int) – The index of the test account in the HD-Path.

Returns:

TestAccountAPI

mine(**kwargs)

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

Raises:

APINotImplementedError – Unless overridden.

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: SnapshotID)

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

Raises:

APINotImplementedError – Unless overridden.

send_transaction(txn: TransactionAPI) ReceiptAPI

Send a transaction to the network.

Parameters:

txn (TransactionAPI) – The transaction to send.

Returns:

ReceiptAPI

set_timestamp(**kwargs)

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

Raises:

APINotImplementedError – Unless overridden.

snapshot() SnapshotID

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

Raises:

APINotImplementedError – Unless overridden.

start(timeout: int = 20)

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

class ape_node.provider.GethDevProcess(data_dir: Path, hostname: str | None = None, port: int | None = None, ipc_path: Path | None = None, ws_hostname: str | None = None, ws_port: str | None = None, mnemonic: str = 'test test test test test test test test test test test junk', number_of_accounts: int = 10, chain_id: int = 1337, initial_balance: str | int = 10000000000000000000000, executable: str | None = None, auto_disconnect: bool = True, extra_funded_accounts: list[str] | None = None, hd_path: str | None = "m/44'/60'/0'/0")

A developer-configured geth that only exists until disconnected. (Implementation detail of the local node provider).

class ape_node.provider.Node(*args, name: str = 'node', network: NetworkAPI, provider_settings: dict = {}, request_header: dict = {'User-Agent': 'EthereumNodeProvider/web3.py/7.6.0'}, block_page_size: int = 5000, concurrency: int = 16)
connect()

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

send_transaction(txn: TransactionAPI) ReceiptAPI

Send a transaction to the network.

Parameters:

txn (TransactionAPI) – The transaction to send.

Returns:

ReceiptAPI

exception ape_node.provider.NodeSoftwareNotInstalledError
ape_node.provider.create_genesis_data(alloc: dict[str, dict[str, Any]], chain_id: int) GenesisDataTypedDict

A wrapper around genesis data for py-geth that fills in more defaults.