### Install MEV-Boost from Source using go install Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Installs the latest version of MEV-Boost using the go install command. The executable will be placed in your $GOPATH/bin directory. ```bash go install github.com/flashbots/mev-boost@latest mev-boost -help ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/flashbots/flashbots-docs/blob/main/README.md After creating the .env file, run this command to install project dependencies using Yarn. ```console yarn install ``` -------------------------------- ### Install Portable MEV-Boost using go install Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Installs the portable version of MEV-Boost using 'go install' with specific CGO flags to resolve 'SIGILL: illegal instruction' errors. Ensure you have Go 1.18+ installed. ```bash CGO_CFLAGS="-O -D__BLST_PORTABLE__" go install github.com/flashbots/mev-boost@latest ``` -------------------------------- ### Install Specific MEV-Boost Version from Source Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Installs a specific version of MEV-Boost using the go install command with the @VERSION syntax. Replace VERSION with the desired tag from the releases page. ```bash go install github.com/flashbots/mev-boost@VERSION ``` -------------------------------- ### mev_simBundle Example Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx An example response for the `mev_simBundle` RPC, indicating simulation success and providing details on gas usage, profit, and logs. ```json { "success": true, "stateBlock": "0x8b8da8", "mevGasPrice": "0x74c7906005", "profit": "0x4bc800904fc000", "refundableValue": "0x4bc800904fc000", "gasUsed": "0xa620", "logs": [{}, {}] } ``` -------------------------------- ### Verify MEV-Boost Installation Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Verifies the MEV-Boost installation by running the executable with the -help flag. This command should be run from the directory where the binary was placed or built. ```bash ./mev-boost -help ``` -------------------------------- ### Forge Deployment Output Example Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/flash-loan-arbitrage/simple-blind-arbitrage.mdx Example output from a successful contract deployment using forge, showing the deployer address, deployed contract address, and transaction hash. ```text No files changed, compilation skipped Deployer: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 Deployed to: 0xc075BC0f734EFE6ceD866324fc2A9DBe1065CBB1 Transaction hash: 0xe9567cce60dfdc1f815f4724340228f2af77ee5cc157a69d07c4b270fcab3a30 ``` -------------------------------- ### Start Local Development Server Source: https://github.com/flashbots/flashbots-docs/blob/main/README.md Run this command to start the Docusaurus development server. Changes are often reflected live without a server restart. ```console yarn start ``` -------------------------------- ### Initialize New Bot Project with Yarn Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/limit-order/setup.mdx Sets up a new Typescript project directory and initializes it with Yarn. Installs core development dependencies and the ethers and mev-share-client libraries. ```bash mkdir simple-limit-order-bot && cd simple-limit-order-bot yarn init # install typescript & eslint dev dependencies yarn add -D @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser dotenv eslint eslint-plugin-tsdoc ts-node typescript # install ethers & mev-share client yarn add ethers @flashbots/mev-share-client ``` -------------------------------- ### Flashbots Bundle Simulation Output Example Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/troubleshooting.mdx An example of the JSON output from the `eth_callBundle` simulation. This includes total gas used, bundle hash, coinbase difference, and detailed results for each transaction within the bundle, such as gas used, fees, and addresses. ```json { "totalGasUsed": 98564, "bundleHash": "0x9a6a9fa038343fe3c57260fb7bdb2c79ebadb3088656300d8a494123ebda6d85", "coinbaseDiff": BigNumber(0x034dc9949767a4), }, "results": [ { "coinbaseDiff": "929953106847652", "ethSentToCoinbase": "0", "fromAddress": "0x9874Ef8519a0Fc7a6B553aad92fDF0E469488931", "gasFees": "929953106847652", "gasPrice": "35008022393", "gasUsed": 29964, "toAddress": "0x48B2dD9CEFbA73c60882478a16BC3428Aceed2B9", "txHash": "0xee3f6f22bf3b4740b36833d41d4872f48f98c6328fa04b3679558e482ba0e328", "value": "0x0000000000000000000000000000000000000000000000000000000000000001" }, ... ], } ``` -------------------------------- ### Flashbots Bundle Stats Output Example Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/troubleshooting.mdx Example JSON output from the eth_getBundleStats RPC endpoint, detailing simulation and submission timestamps. ```json { "isSimulated": true, "isSentToMiners": true, "isHighPriority": true, "simulatedAt": "2021-10-29T04:00:50.526Z", "submittedAt": "2021-10-29T04:00:50.472Z", "sentToMinersAt": "2021-10-29T04:00:50.546Z" } ``` -------------------------------- ### eth_sendBundle with Builders Example Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx Demonstrates sending a bundle with the eth_sendBundle RPC method when specifying a list of builders to share the bundle with. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_sendBundle", "params": [ { "txs": ["0x123abc...", "0x456def..."], "blockNumber": "0xb63dcd", "minTimestamp": 0, "maxTimestamp": 1615920932, "builders": ["builder0x69"] } ] } ``` -------------------------------- ### Install MEV-Share Client Library (TypeScript) Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/getting-started.mdx Add the MEV-Share client library to your project using yarn. ```bash yarn add @flashbots/mev-share-client ``` -------------------------------- ### eth_sendBundle with Builders Example Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx An example response for eth_sendBundle when builders are specified, including the bundle hash and a 'smart' field indicating builder engagement. ```json { "jsonrpc": "2.0", "id": "123", "result": { "bundleHash": "0x2228f5d8954ce31dc1601a8ba264dbd401bf1428388ce88238932815c5d6f23f", "smart": "true" } } ``` -------------------------------- ### Run Docker Container for Node.js Source: https://github.com/flashbots/flashbots-docs/blob/main/README.md Use this command to start a Docker container with Node.js v22.18.0, mounting the current directory for development. ```bash docker run -p 3000:3000 --rm -it -w /mnt -v $(pwd):/mnt node:22.18.0 /bin/bash ``` -------------------------------- ### Copy Environment Template Source: https://github.com/flashbots/flashbots-docs/blob/main/README.md Before starting local development, copy the .env.template file to .env to configure environment variables. ```sh cp .env.template .env ``` -------------------------------- ### Example eth_callBundle Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx A sample response from the `eth_callBundle` RPC, detailing simulation results including gas prices, bundle hash, and transaction outcomes. ```json { "jsonrpc": "2.0", "id": "123", "result": { "bundleGasPrice": "476190476193", "bundleHash": "0x73b1e258c7a42fd0230b2fd05529c5d4b6fcb66c227783f8bece8aeacdd1db2e", "coinbaseDiff": "20000000000126000", "ethSentToCoinbase": "20000000000000000", "gasFees": "126000", "results": [ { "coinbaseDiff": "10000000000063000", "ethSentToCoinbase": "10000000000000000", "fromAddress": "0x02A727155aeF8609c9f7F2179b2a1f560B39F5A0", "gasFees": "63000", "gasPrice": "476190476193", "gasUsed": 21000, "toAddress": "0x73625f59CAdc5009Cb458B751b3E7b6b48C06f2C", "txHash": "0x669b4704a7d993a946cdd6e2f95233f308ce0c4649d2e04944e8299efcaa098a", "value": "0x" }, { "coinbaseDiff": "10000000000063000", "ethSentToCoinbase": "10000000000000000", "fromAddress": "0x02A727155aeF8609c9f7F2179b2a1f560B39F5A0", "gasFees": "63000", "gasPrice": "476190476193", "gasUsed": 21000, "toAddress": "0x73625f59CAdc5009Cb458B751b3E7b6b48C06f2C", "txHash": "0xa839ee83465657cac01adc1d50d96c1b586ed498120a84a64749c0034b4f19fa", "value": "0x" } ], "stateBlockNumber": 5221585, "totalGasUsed": 42000 } } ``` -------------------------------- ### Generate Vanity Address with Cast Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/limit-order/setup.mdx Demonstrates using the 'cast' tool to generate a vanity Ethereum address that starts with a specific prefix, along with its corresponding private key. ```bash cast wallet vanity --starts-with babe ``` ```text Starting to generate vanity address... Successfully found vanity address in 0 seconds. Address: 0xbabe32A9112Dc37a0A9274c86CAD0D1676fEA55a Private Key: 😉 ``` -------------------------------- ### mev_sendBundle Example Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx Shows the JSON payload for the mev_sendBundle RPC method, utilizing the newer bundle format for MEV-Share. Note the constraint on backrun transactions. ```json { "params": [ { "version": "v0.1", "inclusion": { "block": "0x8b8da8", "maxBlock": "0x8b8dab" }, "body": [ { "hash": "0x24e6e999b8abf2c4df46e8a02516c0983043039a5a54f89fa87274427ce64798" }, { "tx": "0x02f880058201d685e9103fda0085e9103fda368255f0940000c335bc9d5d1af0402cad63fa7f258363d71a8092696d206261636b72756e6e69696969696e67c080a0c5058ccf5759e29d4ad28e038f632a9b6269bbb0644c61447e0f14d56c453d73a048e877ee621c4b6be1234a8ad84379e80d45b288a7271e2b1aede7a04f06fd98", "canRevert": false } ], "validity": { "refund": [], "refundConfig": [] } } ], "method": "mev_sendBundle", "id": 1, "jsonrpc": "2.0" } ``` -------------------------------- ### Sign Legacy Transactions in a Bundle Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/eip1559.mdx Example of signing a bundle containing a legacy transaction. Ensure the `gasPrice` meets the base fee requirement for inclusion. ```javascript const signedTransactions = await flashbotsProvider.signBundle([ { signer: authSigner, transaction: { to: "0xf1a54b075fb71768ac31b33fd7c61ad8f9f7dd18", gasPrice: 10, gasLimit: 33000, chainId: 5, value: 0, }, }, ]); ``` -------------------------------- ### Import and Initialize MEV-Share Client (TypeScript) Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/getting-started.mdx Import necessary modules and initialize the MEV-Share client using your provider and signer. Replace placeholders with your actual data. ```typescript import {Wallet, JsonRpcProvider} from 'ethers'; import MevShareClient, { BundleParams, IPendingBundle, IPendingTransaction, TransactionOptions, } from '@flashbots/mev-share-client'; const provider = new JsonRpcProvider(RPC_URL); const authSigner = new Wallet(FB_REPUTATION_PRIVATE_KEY, provider); const mevShareClient = MevShareClient.useEthereumMainnet(authSigner); ``` -------------------------------- ### eth_cancelPrivateTransaction Example Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-protect/additional-documentation/eth-sendPrivateTransaction.mdx An example JSON-RPC request for cancelling a private transaction. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_cancelPrivateTransaction", "params": [ { "txHash": "0x45df1bc3de765927b053ec029fc9d15d6321945b23cac0614eb0b5e61f3a2f2a" } ] } ``` -------------------------------- ### Setup and Contract Initialization for MEV-Share Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/limit-order/setup.mdx Initializes the MEV-Share client, provider, and wallet instances. It also sets up contract instances for Uniswap V2 router and factory. Ensure your RPC_URL and private keys are set in your environment variables. ```typescript import MevShareClient, {IPendingTransaction} from '@flashbots/mev-share-client' import { Contract, JsonRpcProvider, Wallet } from 'ethers' import { UNISWAP_V2_ABI, UNISWAP_FACTORY_ABI, ERC20_ABI } from './abi' // <-- new import import dotenv from "dotenv" dotenv.config() const RPC_URL = process.env.RPC_URL || 'http://127.0.0.1:8545' const EXECUTOR_KEY = process.env.EXECUTOR_KEY || Wallet.createRandom().privateKey const FB_REPUTATION_PRIVATE_KEY = process.env.FB_REPUTATION_KEY || Wallet.createRandom().privateKey // create web3 provider & wallets, connect to mev-share const provider = new JsonRpcProvider(RPC_URL) const executorWallet = new Wallet(EXECUTOR_KEY, provider) const authSigner = new Wallet(FB_REPUTATION_PRIVATE_KEY, provider) const mevshare = MevShareClient.useEthereumGoerli(authSigner) // if you want to connect to mainnet instead: // const mevshare = MevShareClient.useEthereumMainnet(authSigner) // create contract instances const UNISWAP_V2_ADDRESS = '0x7a250d5630b4cf539739df2c5dacb4c659f2488d' const UNISWAP_FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f' const uniswapRouterContract = new Contract(UNISWAP_V2_ADDRESS, UNISWAP_V2_ABI, executorWallet) const uniswapFactoryContract = new Contract(UNISWAP_FACTORY_ADDRESS, UNISWAP_FACTORY_ABI, provider) ``` -------------------------------- ### eth_sendPrivateRawTransaction Example Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-protect/additional-documentation/eth-sendPrivateTransaction.mdx An example JSON-RPC request for sending a private raw transaction. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_sendPrivateRawTransaction", "params": ["0x123abc..."] } ``` -------------------------------- ### Configure web3.py Provider for Flashbots Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/quick-start.mdx Initialize a web3.py instance for interacting with Flashbots. Use an environment variable for your 'ETH_SIGNATURE_KEY', which serves as an identifying key for Flashbots communication. ```python import os from eth_account.account import Account from eth_account.signers.local import LocalAccount from flashbots import flashbot from web3 import Web3, HTTPProvider # Create a web3 object with a standard json rpc provider, such as Infura, Alchemy, or your own node. w3 = Web3(HTTPProvider("http://localhost:8545")) # ETH_ACCOUNT_SIGNATURE is an Ethereum private key that does NOT store funds and is NOT your bot's primary key. # This is an identifying key for signing payloads to establish reputation and whitelisting ETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNATURE_KEY")) ``` -------------------------------- ### eth_cancelPrivateTransaction Example Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-protect/additional-documentation/eth-sendPrivateTransaction.mdx An example JSON-RPC response indicating the success or failure of a private transaction cancellation. ```json { "jsonrpc": "2.0", "id": 1, "result": true // true if tx successfully cancelled, false if not } ``` -------------------------------- ### Example eth_sendPrivateTransaction Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-protect/additional-documentation/eth-sendPrivateTransaction.mdx An example JSON-RPC request object for sending a private transaction with specified preferences. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_sendPrivateTransaction", "params": [ { "tx": "0x123abc...", "maxBlockNumber": "0xcd23a0", "preferences": { "fast": true, "privacy": { "hints": ["calldata", "transaction_hash"], "builders": ["default"] }, "validity": { "refund": [{ "address": "0xadd123", "percent": 50 }] } } } ] } ``` -------------------------------- ### Simulate and Send Flashbots Bundles on Testnets Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/testnets.mdx This example demonstrates how to sign transactions, simulate a bundle for inclusion in a specific block, and then submit the bundle for inclusion in subsequent blocks. Submitting for multiple future blocks increases the likelihood of inclusion on testnets with fewer validators. ```javascript const wallet = new ethers.Wallet(SOME_PRIVATE_KEY); const signedTransactions = await flashbotsProvider.signBundle([ { signer: wallet, transaction: { to: "0xf1a54b075fb71768ac31b33fd7c61ad8f9f7dd18", gasPrice: 10, gasLimit: 21000, chainId: 5, value: 0, }, }, { signer: wallet, transaction: { to: "0xf1a54b075fb71768ac31b33fd7c61ad8f9f7dd18", gasPrice: 10, gasLimit: 21000, chainId: 5, value: 0, }, }, ]); const blockNumber = await provider.getBlockNumber(); console.log(new Date()); const simulation = await flashbotsProvider.simulate( signedTransactions, blockNumber + 1 ); console.log(new Date()); // Using TypeScript discrimination if ("error" in simulation) { console.log(`Simulation Error: ${simulation.error.message}`); } else { console.log( `Simulation Success: ${blockNumber} ${JSON.stringify( simulation, null, 2 )}` ); } console.log(signedTransactions); for (var i = 1; i <= 10; i++) { const bundleSubmission = flashbotsProvider.sendRawBundle( signedTransactions, blockNumber + i ); console.log("submitted for block # ", blockNumber + i); } console.log("bundles submitted"); ``` -------------------------------- ### Build Static Website Source: https://github.com/flashbots/flashbots-docs/blob/main/README.md Execute this command to generate the static content for the website, which will be placed in the 'build' directory. ```console yarn build ``` -------------------------------- ### Example eth_sendPrivateTransaction Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-protect/additional-documentation/eth-sendPrivateTransaction.mdx An example JSON-RPC response object for a successful eth_sendPrivateTransaction request, returning the transaction hash. ```json { "jsonrpc": "2.0", "id": 1, "result": "0x45df1bc3de765927b053ec029fc9d15d6321945b23cac0614eb0b5e61f3a2f2a" // tx hash } ``` -------------------------------- ### Example MEV-Share SSE Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/event-stream.mdx This is an example of the data format received from the MEV-Share SSE endpoint, containing transaction details. ```json :ping data: {"hash":"0xc7dc06c994400830054ab815732d91275bc1241f9be62b62b687b7882f19b8d4","logs":null,"txs":[{"to":"0x0000c335bc9d5d1af0402cad63fa7f258363d71a","functionSelector":"0x696d2073","callData":"0x696d20736861726969696969696e67"}]} ``` -------------------------------- ### Build MEV-Boost from Source Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Builds the MEV-Boost software after cloning the repository and potentially checking out a specific version. ```bash make build ``` -------------------------------- ### flashbots_getFeeRefundTotalsByRecipient Example Response Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx An example response for flashbots_getFeeRefundTotalsByRecipient, detailing pending and received fee refunds, and the maximum block number processed. ```json { "pending":"0x17812ea4fbbe314", "received":"0x108d1b27b63a213", "maxBlockNumber":"0x13ddb08" } ``` -------------------------------- ### Example eth_callBundle Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx An example JSON payload for the `eth_callBundle` RPC method, demonstrating how to specify transactions and block parameters for simulation. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_callBundle", "params": [ { "txs": ["0x123abc...", "0x456def..."], "blockNumber": "0xb63dcd", "stateBlockNumber": "latest", "timestamp": 1615920932 } ] } ``` -------------------------------- ### Example Transaction Event JSON Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/event-stream.mdx This is an example of a transaction event received from the MEV Share SSE endpoint. Note that all fields are optional. ```json { "hash":"0xb756c9f6c34309d32c32daf1289c96d64a1068dfc2ead5e9bd0504640b91249e", "logs":[ { "address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "topics":[ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000001b59718eafa2bffe5318e07c1c3cb2edde354f9c", "0x0000000000000000000000005c7bcd6e7de5423a257d81b442095a1a6ced35c5" ], "data":"0x000000000000000000000000000000000000000000000000161545fdcf782a85" }, { "address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "topics":[ "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65", "0x0000000000000000000000005c7bcd6e7de5423a257d81b442095a1a6ced35c5" ], "data":"0x000000000000000000000000000000000000000000000000161545fdcf782a85" }, { "address":"0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5", "topics":[ "0x8ab9dc6c19fe88e69bc70221b339c84332752fdd49591b7c51e66bae3947b73c", "0x0000000000000000000000000000000000000000000000000000000000000089", "0x0000000000000000000000000000000000000000000000000000000000117363", "0x0000000000000000000000003a23f943181408eac424116af7b7790c94cb97a5" ], "data":"0x000000000000000000000000000000000000000000000000161fb772f99eaf7a000000000000000000000000000000000000000000000000161fb772f99eaf7a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008900000000000000000000000000000000000000000000000000016b90ac92248e000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000001b59718eafa2bffe5318e07c1c3cb2edde354f9c000000000000000000000000b658ba58f7153e99c05c9b7610f17bfeeab6bff5000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b658ba58f7153e99c05c9b7610f17bfeeab6bff500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000005216e484d6dde000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 ``` -------------------------------- ### Listen for MEV-Share Transactions in TypeScript/JavaScript Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/flash-loan-arbitrage/bot.mdx Initialize the MEV-Share client and set up a listener for incoming transaction events. Ensure you have authenticated with your signer. ```typescript const authSigner = new Wallet(Env.authKey).connect(provider) const mevshare = MevShareClient.useEthereumMainnet(authSigner) mevshare.on("transaction", async (pendingTx: IPendingTransaction) => { // handle tx event }) ``` -------------------------------- ### eth_sendBundle Example Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/advanced/rpc-endpoint.mdx An example JSON payload for the eth_sendBundle RPC method, demonstrating the inclusion of transactions, block number, and optional timestamp parameters. ```json { "jsonrpc": "2.0", "id": 1, "method": "eth_sendBundle", "params": [ { "txs": ["0x123abc...", "0x456def..."], "blockNumber": "0xb63dcd", "minTimestamp": 0, "maxTimestamp": 1615920932 } ] } ``` -------------------------------- ### Initialize Flashbots Provider (Python) Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-auction/quick-start.mdx Initializes a Flashbots provider using a standard web3 provider and an ETH_ACCOUNT_SIGNATURE for authentication and reputation. ```python from flashbots import flashbot # Assuming w3 is an initialized web3 provider instance # and ETH_ACCOUNT_SIGNATURE is your private key or signature string flashbot(w3, ETH_ACCOUNT_SIGNATURE) ``` -------------------------------- ### Example MEV-Share Event JSON Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/flash-loan-arbitrage/bot.mdx This is an example of a JSON object representing an event received from the MEV-Share stream. It includes transaction hash, logs, and potentially transaction details for bundles. ```json { "hash": "0x0c459dce812747c643f06c82eeca2a2f584b4e30af79b2b546fd015e4aac4541", "logs": [ { "address": "0xca25091555d36ac0be8119ad967898ac30223b41", "topics": [ "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x" }, { "address": "0xca25091555d36ac0be8119ad967898ac30223b41", "topics": [ "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x" } ], "txs": null } ``` -------------------------------- ### Build Portable MEV-Boost from Source Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Builds a portable version of MEV-Boost from source, which can help resolve 'SIGILL: illegal instruction' errors. ```bash make build-portable ``` -------------------------------- ### Get UniV2 Swap Event Signature Hash Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/flash-loan-arbitrage/bot.mdx Use `cast sig-event` to get the keccak256 hash of a smart contract event signature. This hash is used to identify specific event types in transaction logs. ```bash cast sig-event "event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to );" 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822 ``` -------------------------------- ### mev-boost CLI Arguments Help Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/usage.md Displays the available command-line interface arguments for mev-boost, including options for network selection, logging, timeouts, and relay configuration. ```bash Usage of ./mev-boost: -addr string listen-address for mev-boost server (default "localhost:18550") -debug shorthand for '-loglevel debug' -genesis-fork-version string use a custom genesis fork version -json log in JSON format instead of text -loglevel string minimum loglevel: trace, debug, info, warn/warning, error, fatal, panic (default "info") -mainnet use Mainnet -relay-check check relay status on startup and on the status API call -relay-monitors string relay monitor urls - single entry or comma-separated list (scheme://host) -relays string relay urls - single entry or comma-separated list (scheme://pubkey@host) -request-timeout-getheader int timeout for getHeader requests to the relay [ms] (default 950) -request-timeout-getpayload int timeout for getPayload requests to the relay [ms] (default 4000) -request-timeout-regval int timeout for registerValidator requests [ms] (default 3000) -sepolia use Sepolia -version only print version ``` -------------------------------- ### Example Pending Transaction Output Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-share/searchers/tutorials/limit-order/using-events.mdx This is an example of the data structure you will receive for each pending transaction event from the MEV-Share stream. It includes transaction hash, logs, recipient address, function selector, call data, and gas usage. ```typescript PendingTransaction { hash: '0x26aba6f3c5083d58915161efb0cd0f713418cdd7a95425cdde451efd1dfb5dff', logs: [ { address: '0x8255ffbb54bbb825cc544b67ccf36526e6101f5e', topics: [Array], data: 'Ox' }, { address: '0x8255ffbb54bbb825cc544b67ccf36526e6101f5e' topics: [Array], data: 'Ox' } ], to: null, functionSelector: null, callData: null, gasUsed: undefined, mevGasPrice: undefined } PendingTransaction { hash: '0xeb0d75030e0c7253b60a17a58eb2a2e66a6e3ca58343cadece70a528dfd378a1', logs: [ { address: 'Oxdac17f958d2ee523a2206206994597c13d831ec7', topics: [Array], data: '0x0000000000000000000000000000000000000000000000000000000253f52170' }, { address: 'Oxdac17f958d2ee523a2206206994597c13d831ec7', topics: [Array], data: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' }, { address: 'Oxdac17f958d2ee523a2206206994597c13d831ec7', topics: [Array], data: '0x0000000000000000000000000000000000000000000000000000000253f52170' }, { address: '0x6b175474e89094c44da98b954eedeac495271d0f', topics: [Array], data: '0x00000000000000000000000000000000000000000000021e08ad287c5f8d3bff' } ] } ``` -------------------------------- ### Run MEV-Boost Docker Container Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-mev-boost/getting-started/installation.md Runs the MEV-Boost Docker container and displays its help information. This is a basic example; actual usage may require additional flags and volume mounts. ```bash docker run flashbots/mev-boost -help ``` -------------------------------- ### Get Pending Nonce with Signed Request Source: https://github.com/flashbots/flashbots-docs/blob/main/docs/flashbots-protect/nonce-management.mdx Send a JSON-RPC request to the Flashbots Protect RPC endpoint to get the 'pending' nonce. This request must be signed by the user's private key and included in the X-Flashbots-Signature header for accurate results. ```json { "jsonrpc": "2.0", "method": "eth_getTransactionCount", "params": [ "0xYOUR_ADDRESS", "pending" ], "id": 1 } ```