provider.mev_blocker
Documentation for eth_defi.provider.mev_blocker Python module.
MEV blocking RPC provider functionality.
Malicious Extractable Value (MEV) is a problem for all trading activity on EVM-based blockchains.
It can be mitigated by using a special JSON-RPC node that provides a private mempool.
This module provides methods to create special
web3.Web3 instances that
Use MEV blocking JSON-RPC endpoint for all transactions
Normal JSON-RPC node for reading data from the blockchain
Module Attributes
List of RPC methods that execution transactions |
Functions
|
Classes
Routes methods that execute transaction through a special MEV proof endpoint. |
- TRANSACT_METHODS = ('eth_sendTransaction', 'eth_sendRawTransaction')
List of RPC methods that execution transactions
- class MEVBlockerProvider
Bases:
eth_defi.provider.named.BaseNamedProviderRoutes methods that execute transaction through a special MEV proof endpoint.
Depending on whether we are sending a transaction or reading from the blockchain, switch between the JSON-RPC endpoint.
Route all outgoing transactions through a special MEV blocker endpoint
- __init__(call_provider, transact_provider, transact_methods=('eth_sendTransaction', 'eth_sendRawTransaction'))
- Parameters
call_provider (eth_defi.provider.named.BaseNamedProvider) –
transact_provider (eth_defi.provider.named.BaseNamedProvider) –
- provider_counter
Keep tabs on how much API traffic we generate through each endpoint
- is_transact_method(method)
Does this RPC method do a transaction
- Parameters
method (web3.types.RPCEndpoint) –
- Return type
- property call_endpoint_uri: str
Return the active node URI where call JSON-RPCs go.
Warning
Endpoint URIs often contain API keys. They should be never publicly displayed as is.
- request_func(w3, middleware_onion)
@param w3 is the web3 instance @param middleware_onion is an iterable of middleware,
ordered by first to execute
- @returns a function that calls all the middleware and
eventually self.make_request()