The yoorquezt-sdk-mev Python package provides a Web3.py-compatible provider that routes transactions through YoorQuezt's MEV protection pipeline.
Installation
pip install yoorquezt-sdk-mev
Features
- Web3.py compatible -- works as a drop-in middleware or provider for Web3.py
- Automatic interception --
eth_sendRawTransactionis intercepted and protected; all other methods are proxied - MEV rebates -- 90% of captured backrun value is rebated to the originating wallet
- Transaction status -- query protection status and rebate amounts
- Multi-chain -- supports Ethereum, Arbitrum, Base, Optimism, BSC, Polygon, and more
- Async support -- async provider available for asyncio-based applications
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
api_key | str | -- | Your YoorQuezt API key (required) |
chain_id | int | 1 | Target chain ID |
rpc_url | str | https://rpc.yoorquezt.io/v1/rpc/ethereum | YoorQuezt RPC endpoint |
timeout | int | 30 | Request timeout in seconds |
retries | int | 3 | Number of retry attempts on transient failures |
rebate_address | str | signer address | Address to receive MEV rebates |
Code Example
from web3 import Web3
from yoorquezt_sdk_mev import YoorQueztProvider
# Create protected provider
provider = YoorQueztProvider(
api_key="YOUR_API_KEY",
chain_id=1,
)
# Initialize Web3 with YoorQuezt provider
w3 = Web3(provider)
account = w3.eth.account.from_key("0xYOUR_PRIVATE_KEY")
# Build transaction
tx = {
"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"value": w3.to_wei(0.1, "ether"),
"gas": 21000,
"gasPrice": w3.eth.gas_price,
"nonce": w3.eth.get_transaction_count(account.address),
"chainId": 1,
}
# Sign and send -- automatically MEV-protected
signed = account.sign_transaction(tx)
tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
print(f"Protected tx: {tx_hash.hex()}")
# Wait for confirmation
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"Confirmed in block: {receipt['blockNumber']}")
# Check protection status
status = provider.get_transaction_status(tx_hash.hex())
print(f"MEV detected: {status['mev_detected']}")
print(f"Rebate: {status['rebate_amount']} ETH")
Async Usage
import asyncio
from web3 import AsyncWeb3
from yoorquezt_sdk_mev import AsyncYoorQueztProvider
async def main():
provider = AsyncYoorQueztProvider(
api_key="YOUR_API_KEY",
chain_id=1,
)
w3 = AsyncWeb3(provider)
account = w3.eth.account.from_key("0xYOUR_PRIVATE_KEY")
tx = {
"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"value": w3.to_wei(0.1, "ether"),
"gas": 21000,
"gasPrice": await w3.eth.gas_price,
"nonce": await w3.eth.get_transaction_count(account.address),
"chainId": 1,
}
signed = account.sign_transaction(tx)
tx_hash = await w3.eth.send_raw_transaction(signed.raw_transaction)
print(f"Protected tx: {tx_hash.hex()}")
asyncio.run(main())