← Back to all products
$13
MEV-Share SDK
SDK for MEV-Share matching — searchers bid on user orderflow with privacy and backrunning.
TypeScriptJSONPythonMarkdown
📁 File Structure 18 files
mev-share-sdk/
├── LICENSE
├── README.md
├── package.json
├── security-notes.md
├── src/
│ ├── python/
│ │ └── mev_share_sdk/
│ │ ├── __init__.py
│ │ ├── client.py
│ │ ├── event_stream.py
│ │ └── types.py
│ └── ts/
│ ├── bundle-builder.ts
│ ├── client.ts
│ ├── event-stream.ts
│ ├── hint-preferences.ts
│ ├── index.ts
│ ├── types/
│ │ └── mev-share.ts
│ └── utils/
│ └── helpers.ts
├── test/
│ ├── python/
│ │ └── test_sdk.py
│ └── ts/
│ └── sdk.test.ts
└── tsconfig.json
📖 Documentation Preview README excerpt
MEV-Share SDK
TypeScript + Python SDK for Flashbots MEV-Share orderflow auctions.
Price: $12.99 | License: MIT
Overview
A dual-language SDK (TypeScript + Python) for interacting with the Flashbots MEV-Share protocol. Supports sending bundles, listening to the pending transaction event stream, and submitting private transactions via Flashbots Protect.
Architecture
┌─────────────────────┐
│ MEV-Share Relay │
│ (Flashbots infra) │
└──────────┬──────────┘
│
┌────────────┼────────────┐
│ │ │
SSE Stream Bundle API Protect RPC
│ │ │
EventStream MEVShareClient sendPrivateTransaction
(real-time) (backrun) (private tx)
TypeScript
Installation
npm install
npm run build
Quick Start
import { MEVShareClient, EventStream, BundleBuilder } from "@cryptoforge/mev-share-sdk";
// 1. Listen for pending transactions
const stream = new EventStream("https://mev-share.flashbots.net");
stream.on("event", async (event) => {
console.log("Pending tx:", event.hash);
// 2. Build a backrun bundle
const bundle = new BundleBuilder()
.setBlockNumber(currentBlock + 1)
.addTargetTxHash(event.hash)
.addTransaction(signedBackrunTx)
.setBuilders(["flashbots"])
.build();
// 3. Submit the bundle
const client = new MEVShareClient({ authSignerKey: FLASHBOTS_KEY });
const result = await client.sendBundle(bundle);
console.log("Bundle hash:", result.bundleHash);
});
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/python/mev_share_sdk/client.py
"""MEV-Share API client for Python."""
import json
import time
from typing import Optional
from eth_account import Account
from eth_account.messages import encode_defunct
from web3 import Web3
from .types import (
MEVShareConfig,
BundleParams,
SendBundleResult,
SimulationResult,
TxSimResult,
)
class MEVShareClient:
"""
Client for the Flashbots MEV-Share relay API.
Supports sending bundles, simulating bundles, sending private transactions,
and cancelling pending transactions.
Example::
from mev_share_sdk import MEVShareClient, MEVShareConfig, BundleParams
config = MEVShareConfig(auth_signer_key=os.environ["FLASHBOTS_AUTH_KEY"])
client = MEVShareClient(config)
result = client.send_bundle(BundleParams(
txs=[signed_backrun_tx],
block_number=target_block,
target_tx_hashes=[pending_tx_hash],
))
print(f"Bundle hash: {result.bundle_hash}")
"""
def __init__(self, config: MEVShareConfig) -> None:
self._config = config
self._account = Account.from_key(config.auth_signer_key)
self._w3 = Web3()
@property
def signer_address(self) -> str:
"""Return the authentication signer address."""
return self._account.address
# ... 205 more lines ...