MultiProviderWeb3Factory

Documentation for eth_defi.provider.multi_provider.MultiProviderWeb3Factory Python class.

class MultiProviderWeb3Factory

Bases: object

Needed to pass RPC URL as Web3Factory

  • Allows creating web3 connections from a config line in multiprocessing worker pools

Attributes summary

skip_verification

Skip the per-worker eth_chainId provider cross-check.

expected_chain_id

Parent-verified chain ID to seed into each worker when skip_verification is set, preserving the runtime switchover chain-id safety check.

rpc_request_stats

Optional accumulator shared by parent-process worker threads.

Methods summary

__init__(rpc_url[, retries, hint, ...])

__init__(rpc_url, retries=6, hint='', skip_verification=False, expected_chain_id=None, rpc_request_stats=None)
Parameters
skip_verification

Skip the per-worker eth_chainId provider cross-check.

Defaults to False so a stand-alone factory behaves like create_multi_provider_web3(). Set to True when this factory is handed to a multiprocessing worker pool: the parent process has already verified the chain ID, and re-verifying in every worker multiplies eth_chainId load on the primary provider and can itself trigger HTTP 429 rate limiting.

expected_chain_id

Parent-verified chain ID to seed into each worker when skip_verification is set, preserving the runtime switchover chain-id safety check.

rpc_request_stats

Optional accumulator shared by parent-process worker threads.