### Install mevlog-rs Source: https://context7.com/pawurb/mevlog-rs/llms.txt Commands for installing the mevlog-rs tool, including installing the `cryo_cli` dependency, installing from crates.io, installing with TUI support, and building from source. ```bash # Install cryo_cli dependency carpenter install cryo_cli # Install from crates.io carpenter install mevlog # Install with TUI support carpenter install mevlog --features=tui # Or build from source git clone https://github.com/pawurb/mevlog-rs cd mevlog-rs carpenter install --path . ``` -------------------------------- ### Install mevlog-rs and Dependencies (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Instructions for installing the necessary cryo CLI and the mevlog project itself. This involves cloning the repository and using Cargo for installation. ```bash cargo install cryo_cli git clone https://github.com/pawurb/mevlog-rs cd mevlog-rs ``` ```bash cargo install --path . ``` -------------------------------- ### Install mevlog from Crates.io (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Installs the mevlog CLI tool directly from the crates.io registry. This is a simpler installation method for users who don't need to build from source. ```bash cargo install mevlog ``` -------------------------------- ### Install and Launch TUI Source: https://context7.com/pawurb/mevlog-rs/llms.txt Instructions for installing the mevlog CLI with the TUI feature enabled and launching the interactive Terminal User Interface for blockchain exploration. ```bash cargo install mevlog --features=tui mevlog tui ``` -------------------------------- ### mevlog Tx: Single Transaction Analysis CLI Examples Source: https://context7.com/pawurb/mevlog-rs/llms.txt Illustrates the 'mevlog tx' command for analyzing individual transactions. Examples include basic lookup, adding surrounding transaction context, reversing display order, and tracing EVM opcodes using either Revm or RPC with JSON output option. ```bash # Basic transaction lookup mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --chain-id 1 # Include 1 transaction before and after mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 -b 1 -a 1 --chain-id 1 # Reverse display order mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --reverse --chain-id 1 # Trace EVM opcodes using Revm mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --chain-id 1 --trace revm --ops # Trace opcodes using RPC (requires debug API) mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --trace rpc --ops # JSON opcode output mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --chain-id 1 --trace revm --ops --format json ``` -------------------------------- ### mevlog-rs Example: Display ERC20 Transfer Amounts Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Illustrates how to display the amounts of ERC20 tokens transferred in transactions using mevlog-rs. This example filters for USDC transfers and enables the display of transfer amounts. ```bash mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --erc20-transfer-amount ``` -------------------------------- ### mevlog-rs Example: Sort Transactions by Total Cost Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Shows how to find the most expensive transactions by total cost using mevlog-rs. This example sorts by `full-tx-cost`, limits the results, and requires transaction tracing. ```bash mevlog search -b 10:latest --sort full-tx-cost --limit 5 --trace rpc ``` -------------------------------- ### mevlog Chains: List Available EVM Chains CLI Example Source: https://context7.com/pawurb/mevlog-rs/llms.txt Shows how to use the 'mevlog chains' command to list all available EVM chains that mevlog-rs can interact with, leveraging its ChainList integration. ```bash # List all available chains mevlog chains ``` -------------------------------- ### mevlog-rs Example: Filter by Multiple Event Keywords Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Shows how to search for transactions within a block range that emitted events containing specific keywords, using regular expressions with the `--event` filter. This example looks for events matching 'rebase' and 'Transfer'. ```bash mevlog search -b 22045400:22045420 --event "/(?i)(rebase).+" --event "/(Transfer).+" ``` -------------------------------- ### mevlog-rs Example: Filter Transactions by Value Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates filtering transactions based on the amount of Ether they transferred using mevlog-rs. This example finds transactions that transferred more than 1 ETH. ```bash mevlog search -b 10:latest --value ge1ether ``` -------------------------------- ### mevlog-rs Example: Sort Transactions by Gas Price (Ascending) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Illustrates how to sort transactions by gas price in ascending order and limit the results using mevlog-rs. This is useful for identifying the cheapest transactions. ```bash mevlog search -b 10:latest --sort gas-price --sort-dir asc --limit 10 ``` -------------------------------- ### mevlog-rs Example: Sort Transactions by Gas Price Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates how to sort transactions by gas price in descending order and limit the results using mevlog-rs. This is useful for identifying high-priority transactions. ```bash mevlog search -b 20:latest --sort gas-price --limit 10 ``` -------------------------------- ### mevlog-rs Example: Detect Unknown Method Signature Calls Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Shows how to identify transactions with unknown method signatures, often indicative of MEV bots, using mevlog-rs. This example searches for transactions at a specific position within a block, filtering by an unknown method signature and chain ID. ```bash mevlog search -b --method "" -p 0 --chain-id 1 ``` -------------------------------- ### mevlog Search: Query Historical Blocks CLI Examples Source: https://context7.com/pawurb/mevlog-rs/llms.txt Provides examples for using the 'mevlog search' command to query historical blocks. It illustrates filtering by block range, position, sender/receiver addresses, method signatures, event patterns (including regex), contract creation, transaction value, ERC20 transfers, sorting, and output formatting (JSON). ```bash # Search last 10 blocks mevlog search -b 10:latest --chain-id 1 # Search specific block range mevlog search -b 22034300:22034320 --chain-id 1 # Find jaredfromsubway.eth transactions in top positions mevlog search -b 10:latest -p 0:5 --from jaredfromsubway.eth --chain-id 1 # Search for unknown method signatures (likely MEV bots) mevlog search -b 10:latest --method "" -p 0 --chain-id 1 # Find PEPE token transfers mevlog search -b 50:latest --event "Transfer(address,address,uint256)|0x6982508145454ce325ddbe47a25d4ec3d2311933" --chain-id 1 # Exclude Swap events from position 0 transactions mevlog search -b 22034300:22034320 -p 0 --not-event "/(Swap).+"" # Search with regex for rebase and Transfer events mevlog search -b 22045400:22045420 --event "/(?i)(rebase).+"" --event "/(Transfer).+"" # Find contract creation transactions mevlog search -b 22045400:22045420 --to CREATE # Find transactions transferring more than 1 ETH mevlog search -b 10:latest --value ge1ether # Find transactions transferring over 100k USDC mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48|ge100gwei" # Display ERC20 transfer amounts mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --erc20-transfer-amount # Sort by gas price, limit to top 10 mevlog search -b 20:latest --sort gas-price --limit 10 # Find 5 most expensive transactions by total cost mevlog search -b 10:latest --sort full-tx-cost --limit 5 --trace rpc # Sort ascending (cheapest first) mevlog search -b 10:latest --sort gas-price --sort-dir asc --limit 10 # Find largest USDC transfer mevlog search -b 50:latest --sort "erc20Transfer|0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --limit 1 --chain-id 1 # JSON output format mevlog search -b 10:latest --format json --chain-id 1 # Pretty JSON streaming output mevlog search -b 10:latest --format json-pretty-stream --chain-id 1 ``` -------------------------------- ### mevlog-rs Example: Filter for Contract Creation Transactions Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Illustrates how to filter transactions that specifically created new smart contracts using mevlog-rs. This is achieved by using the special `--to` filter value 'CREATE'. ```bash mevlog search -b 22045400:22045420 --to CREATE ``` -------------------------------- ### Install mevlog with TUI Feature (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Installs the mevlog CLI with the 'tui' feature enabled, which provides access to the Terminal User Interface mode for a more interactive experience. ```bash cargo install mevlog --features=tui ``` -------------------------------- ### mevlog-rs Example: Filter ERC20 Token Transfers Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Illustrates how to query transactions involving a specific ERC20 token transfer using mevlog-rs. This example filters by a block range, event signature for ERC20 transfer, the token's contract address, and the chain ID. ```bash mevlog search -b 50:latest --event "Transfer(address,address,uint256)|0x6982508145454ce325ddbe47a25d4ec3d2311933" --chain-id 1 ``` -------------------------------- ### Launch mevlog TUI Mode (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Starts the mevlog application in its Terminal User Interface (TUI) mode, allowing for interactive exploration and analysis of EVM chains directly within the terminal. ```bash mevlog tui ``` -------------------------------- ### mevlog Watch: Real-time Transaction Monitoring CLI Examples Source: https://context7.com/pawurb/mevlog-rs/llms.txt Demonstrates how to use the 'mevlog watch' command for real-time monitoring of new blocks. It covers basic usage, chain ID selection, position filtering, event pattern matching, ENS and ERC20 symbol resolution, and network switching. ```bash # Basic watch mode on Ethereum mainnet mevlog watch --rpc-url https://eth.merkle.io # Watch using chain ID (auto-selects fastest RPC) mevlog watch --chain-id 1 # Watch with position filter (top 20 transactions) mevlog watch --chain-id 1 -p 0:19 # Watch for specific event patterns mevlog watch --chain-id 1 --event "/(Swap).+"" # Watch with ENS and ERC20 symbol resolution mevlog watch --chain-id 1 --ens --erc20-symbols # Watch Polygon network mevlog watch --chain-id 137 ``` -------------------------------- ### mevlog-rs Example: Filter ERC20 Transfers by Amount Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Shows how to filter ERC20 token transfers for a specific token (USDC in this case) and a minimum amount using mevlog-rs. The `--erc20-transfer` option supports filtering by address and amount ranges. ```bash mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48|ge100gwei" ``` -------------------------------- ### JSON Transaction Schema Example Source: https://context7.com/pawurb/mevlog-rs/llms.txt Provides an example of the JSON schema used for representing transaction data in mevlog. This schema includes details like transaction hash, block number, sender, receiver, value, gas usage, and log groups for events. ```json { "tx_hash": "0x...", "block_number": 22034300, "tx_index": 0, "from": "0x...", "to": "0x...", "value": "1000000000000000000", "gas_price": 5000000000, "gas_used": 21000, "full_tx_cost": "105000000000000", "log_groups": [ { "source": "0x...", "logs": [ { "signature": "Transfer(address,address,uint256)", "amount": "1000000000000000000" } ] } ], "opcodes": [ {"pc": 0, "op": "PUSH1", "cost": 3, "gas_left": 545253} ] } ``` -------------------------------- ### ENS Lookup Example in Rust Source: https://context7.com/pawurb/mevlog-rs/llms.txt Demonstrates how to perform ENS (Ethereum Name Service) lookups in Rust using the alloy library. It includes resolving an address to an ENS name and vice versa, requiring an RPC URL to be set as an environment variable. ```rust use std::sync::Arc; use alloy::{providers::ProviderBuilder, rpc::client::RpcClient}; use eyre::Result; use mevlog::misc::ens_utils::{ens_lookup_sync, namehash, reverse_address}; use revm::primitives::address; #[tokio::main] async fn main() -> Result<()> { let rpc_url = std::env::var("ETH_URL").expect("ETH_URL must be set"); let client = RpcClient::builder().http(rpc_url.parse()?); let provider = ProviderBuilder::new().connect_client(client); let provider = Arc::new(provider); // Lookup ENS name for an address let addr = address!("0xae2fc483527b8ef99eb5d9b44875f005ba1fae13"); let name = reverse_address(&addr); let node = namehash(&name); println!("node: {node}"); let name = ens_lookup_sync(addr, &provider).await?; println!("name: {name:?}"); Ok(()) } ``` -------------------------------- ### Live Profiling with Hotpath TUI Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Starts `mevlog watch` with `hotpath` and `hotpath-alloc` features enabled for live profiling. In a separate terminal, `hotpath console` can be used to connect and view the profiling data. ```bash QUIET=1 cargo run --release --features='hotpath,hotpath-alloc' --bin mevlog watch --rpc-url https://eth.merkle.io --ens --erc20-symbols ``` ```bash cargo install hotpath --features=tui hotpath console ``` -------------------------------- ### mevlog-rs Example: Search Transactions by Address Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates how to use mevlog-rs to search for transactions originating from a specific Ethereum address or ENS name within a specified block range. This query includes filtering by block range, position, sender, and chain ID. ```bash mevlog search -b 10:latest -p 0:5 --from jaredfromsubway.eth --chain-id 1 ``` -------------------------------- ### Discover Chains with mevlog chains Command (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Utilizes the `chains` subcommand of mevlog to discover and filter available EVM chains. Examples show filtering by name, specifying multiple IDs, and limiting results. ```bash mevlog chains --filter arbitrum # Find Arbitrum-related chains mevlog chains --filter base # Find Base-related chains mevlog chains --chain-id 1 --chain-id 137 # Show specific chains by ID mevlog chains --limit 10 # Show only first 10 chains ``` -------------------------------- ### Get Detailed Chain Information Source: https://context7.com/pawurb/mevlog-rs/llms.txt Retrieves detailed information for a specific blockchain chain, including RPC endpoint benchmarks. Options allow setting custom timeouts, limiting RPC URLs, skipping benchmarking, and specifying JSON output. ```bash mevlog chain-info --chain-id 1 mevlog chain-info --chain-id 56 mevlog chain-info --chain-id 137 mevlog chain-info --chain-id 1 --rpc-timeout-ms 5000 mevlog chain-info --chain-id 1 --rpcs-limit 3 mevlog chain-info --chain-id 1 --skip-urls mevlog chain-info --chain-id 1 --format json ``` -------------------------------- ### mevlog-rs Example: Exclude Specific Event Emission Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates how to find transactions that did not emit a particular event, such as 'Swap', within a specified block range and position. This uses the `--not-event` filter with a regular expression. ```bash mevlog search -b 22034300:22034320 -p 0 --not-event "/(Swap).+" ``` -------------------------------- ### Get Chain Information Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Retrieves detailed information about a specific blockchain network, including its ID, name, currency, and explorer URL. Supports JSON output formats and allows customization of RPC endpoint timeouts and limits. Can optionally skip RPC URL benchmarking for faster results. ```bash mevlog chain-info --chain-id 1 # Ethereum mainnet mevlog chain-info --chain-id 56 # BSC mainnet mevlog chain-info --chain-id 137 # Polygon mainnet mevlog chain-info --chain-id 1 --format json # Compact JSON mevlog chain-info --chain-id 1 --format json-pretty # Pretty JSON mevlog chain-info --chain-id 1 --rpc-timeout-ms 5000 # 5 seconds mevlog chain-info --chain-id 1 --rpcs-limit 3 # Return only first 3 responding URLs mevlog chain-info --chain-id 1 --rpcs-limit 10 # Return up to 10 responding URLs mevlog chain-info --chain-id 1 --skip-urls ``` -------------------------------- ### EVM Tracing Filters for Transaction Cost and Storage Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Illustrates using EVM tracing filters with the `--trace` flag to query transactions based on real transaction cost and storage modifications. It shows how to find transactions exceeding a certain cost or those that interacted with specific storage slots. ```bash # Query txs with total cost > 0.02 ETH mevlog search -b 5:latest -p 0 --real-tx-cost ge0.02ether --trace revm # Find txs that touched storage of Balancer vault contract mevlog search -b 10:latest --touching 0xba12222222228d8ba445958a75a0704d566bf2c8 --trace rpc ``` -------------------------------- ### Configuring Mevlog Output Formats Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Explains the different output formats available in mevlog, including human-readable text, compact JSON, pretty-printed JSON, and streaming variants. It also clarifies the difference between streaming and batch output behaviors. ```bash # Default human-readable output (streaming) mevlog search -b 10:latest --format default # Compact JSON, all results at once (batch) mevlog search -b 10:latest --format json # Pretty JSON, streaming block by block mevlog search -b 10:latest --format json-pretty-stream ``` -------------------------------- ### Enable Tokio Console for Development Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Activates the `tokio-console` feature for live runtime introspection of Tokio-based applications. Requires setting the `tokio_unstable` RUSTFLAG during the build process. ```bash RUSTFLAGS="--cfg tokio_unstable" cargo run --features=tokio-console --bin mevlog watch ``` -------------------------------- ### Benchmark Execution Time Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Runs the `mevlog search` command with the `hotpath` feature enabled to measure execution time. The `QUIET=1` environment variable suppresses output, and `--release` optimizes for performance. Subsequent runs can be profiled without network overhead. ```bash QUIET=1 cargo run --features 'hotpath' --release --bin mevlog search -b 23263469:23263489 --chain-id 1 --skip-verify-chain-id --native-token-price 5000 --rpc-url https://eth.merkle.io ``` -------------------------------- ### Recommended Usage for ENS/Symbol Caching Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Provides a recommended two-step pattern for using ENS and ERC20 symbol resolution: first, populate the cache with recent blocks, then disable the flags for regular usage to minimize RPC calls. ```bash # Step 1: Cache popular symbols and ENS names from recent blocks mevlog search -b 10:latest --ens --erc20-symbols --chain-id 1 # Step 2: Use cached ENS/symbol data only (no additional RPC calls) mevlog search -b 100:latest --chain-id 1 ``` -------------------------------- ### Enabling ENS and ERC20 Symbol Resolution Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates how to enable ENS name resolution and ERC20 token symbol lookups for addresses and transfers. These flags enhance readability of log outputs but may increase RPC calls. ```bash # Enable ENS name display mevlog search -b 10:latest --ens --chain-id 1 # Enable ERC20 token symbols display mevlog search -b 10:latest --erc20-symbols --chain-id 1 # Enable both ENS and token symbols mevlog search -b 10:latest --ens --erc20-symbols --chain-id 1 ``` -------------------------------- ### mevlog-rs Command-Line Filtering Options Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Lists the available command-line options for filtering transactions in mevlog-rs. These options allow users to specify criteria such as transaction limits, sorting, sender/receiver addresses, contract interactions, event filtering, and cost-based filtering. ```bash Options: --limit Limit the number of transactions returned --sort Sort transactions by field (gas-price, gas-used, tx-cost, full-tx-cost, erc20Transfer|) --sort-dir Sort direction (desc, asc) [default: desc] -f, --from Filter by tx source address or ENS name --to Filter by tx target address or ENS name, or CREATE transactions -t, --touching Filter by contracts with storage changed by the transaction --rpc-url The URL of the HTTP provider --chain-id Chain ID to automatically select best RPC URL --event Include txs by event names matching the provided regex or signature and optionally an address --not-event Exclude txs by event names matching the provided regex or signature and optionally an address --method Include txs with root method names matching the provided regex, signature or signature hash --calls Include txs by subcalls method names matching the provided regex, signature or signature hash --show-calls Show detailed tx calls info --ops Display EVM opcodes executed by the transaction (requires --trace) --tx-cost Filter by tx cost (e.g., 'le0.001ether', 'ge0.01ether') --real-tx-cost Filter by real (including coinbase bribe) tx cost (e.g., 'le0.001ether', 'ge0.01ether') --gas-price Filter by effective gas price (e.g., 'ge2gwei', 'le1gwei') --real-gas-price Filter by real (including coinbase bribe) effective gas price (e.g., 'ge3gwei', 'le2gwei') --value Filter by transaction value (e.g., 'ge1ether', 'le0.1ether') --erc20-transfer Filter by Transfer events with specific address and optionally amount (e.g., '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' or '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48|ge1000gwei') --erc20-transfer-amount Display transfer amounts in ERC20 Transfer event logs --ens Enable ENS name resolution for addresses (increases RPC calls) --erc20-symbols Enable ERC20 token symbol resolution (increases RPC calls) --failed Show only txs which failed to execute --format Output format ('text', 'json', 'json-pretty', 'json-stream', 'json-pretty-stream') --batch-size Batch size for data fetching (default: 100) ``` -------------------------------- ### Revm EVM Tracing for Transaction Analysis Source: https://context7.com/pawurb/mevlog-rs/llms.txt Perform local EVM tracing using Revm to analyze transactions. This mode downloads storage slots and runs simulations locally. It supports filtering by real transaction cost, gas price, and searching by subcall methods. ```bash mevlog search -b 5:latest -p 0 --real-tx-cost ge0.02ether --trace revm mevlog search -b 5:latest -p 0:5 --real-gas-price ge10gwei --trace revm mevlog search -b 5:latest -p 0:5 --calls "/(swap).+" --trace revm ``` -------------------------------- ### Benchmark Allocations Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Measures memory allocations during the execution of `mevlog search` by enabling both `hotpath` and `hotpath-alloc` features. This helps in identifying potential memory leaks or inefficiencies. ```bash QUIET=1 cargo run --features 'hotpath,hotpath-alloc' --release --bin mevlog search -b 23263469:23263489 --chain-id 1 --skip-verify-chain-id --native-token-price 5000 --rpc-url https://eth.merkle.io ``` -------------------------------- ### EVM Tracing Filters for Gas Price and Method Calls Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates advanced EVM tracing filters for real gas price and method calls. This allows precise identification of transactions based on their gas expenditure and specific internal function calls. ```bash # Filter by real gas price >= 10 gwei mevlog search -b 5:latest -p 0:5 --real-gas-price ge10gwei --trace rpc # Search txs by sub-method calls (e.g., 'swap') mevlog search -b 5:latest -p 0:5 --calls "/(swap).+/" --trace rpc ``` -------------------------------- ### Filter Search Results by Method Source: https://context7.com/pawurb/mevlog-rs/llms.txt Filter transaction search results based on root methods or internal calls. Supports filtering by method signature, unknown methods, regex patterns, and requires tracing for internal call filtering. ```bash mevlog search -b 10:latest --method "swap(address,uint256)" mevlog search -b 10:latest --method "" mevlog search -b 10:latest --method "/(swap).+" mevlog search -b 10:latest --calls "/(swap).+" --trace revm ``` -------------------------------- ### Connect to Chain using Chain ID (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Shows how to connect mevlog to a specific EVM-compatible chain by using its Chain ID. Mevlog will automatically find and use an appropriate RPC endpoint from ChainList. ```bash mevlog watch --chain-id 1 # Ethereum mainnet mevlog watch --chain-id 137 # Polygon mevlog watch --chain-id 56 # BSC ``` -------------------------------- ### Filter and Format Chain Information Source: https://context7.com/pawurb/mevlog-rs/llms.txt Commands to list blockchain chains with options to filter by name, specify chain IDs, limit results, and control output format (JSON, JSON-pretty). ```bash mevlog chains --filter ethereum mevlog chains --filter arbitrum mevlog chains --filter polygon mevlog chains --chain-id 1 --chain-id 137 mevlog chains --limit 10 mevlog chains --format json mevlog chains --format json-pretty ``` -------------------------------- ### mevlog search - Output Formats Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Explains the different output formats available for the mevlog search command, including streaming and batch options for JSON and text. ```APIDOC ## GET /mevlog/search/output ### Description Configures the output format for the mevlog search results. Supports human-readable text, various JSON formats, and streaming options for real-time or batch processing. ### Method GET (simulated for documentation purposes; actual usage is CLI) ### Endpoint /mevlog/search/output ### Parameters #### Query Parameters - **--format** (string) - Optional - Specifies the output format. Options include: - `text` (default): Human-readable colored output, streaming block by block. - `json`: Compact JSON output, batch processing (all results at once). - `json-pretty`: Pretty-printed JSON output, batch processing. - `json-stream`: Compact JSON output, streaming block by block. - `json-pretty-stream`: Pretty-printed JSON output, streaming block by block. ### Request Example ```bash mevlog search -b 10:latest --format default mevlog search -b 10:latest --format json mevlog search -b 10:latest --format json-pretty-stream ``` ### Response #### Success Response (200) - **output** (string) - The search results formatted according to the specified `--format` option. #### Response Example (Example depends on the chosen output format and the search results.) ``` -------------------------------- ### mevlog Output Formats Source: https://context7.com/pawurb/mevlog-rs/llms.txt Shows how to specify different output formats for mevlog search results, including compact and pretty JSON, with options for streaming output block by block. The default format is human-readable colored text. ```bash mevlog search -b 10:latest --format json mevlog search -b 10:latest --format json-pretty mevlog search -b 10:latest --format json-stream mevlog search -b 10:latest --format json-pretty-stream ``` -------------------------------- ### mevlog search - Basic Usage and Filtering Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md This section covers the basic search command and advanced filtering options for events, ERC20 transfers, ENS, and ERC20 symbols. ```APIDOC ## POST /mevlog/search ### Description Searches for blockchain events and transactions based on specified criteria. Supports filtering by events, ERC20 transfers, and resolution of ENS and ERC20 token symbols. ### Method POST (simulated for documentation purposes; actual usage is CLI) ### Endpoint /mevlog/search ### Parameters #### Query Parameters - **-b, --block-range** (string) - Required - The block range to search within (e.g., `50:latest`). - **--sort** (string) - Optional - Sorting criteria for results. - **--limit** (integer) - Optional - The maximum number of results to return. - **--chain-id** (integer) - Required - The chain ID to query. - **--event** (string) - Optional - Filter by emitted events. Can be a contract address, full event signature, regex pattern, or a combination. - **--not-event** (string) - Optional - Exclude transactions based on emitted events. - **--erc20-transfer** (string) - Optional - Filter ERC20 Transfer events. Can include contract address and amount filtering (e.g., `0xa0b86a33e6ba3bc6c2c5ed1b4b29b5473fd5d2de|ge1000`). - **--erc20-transfer-amount** (boolean) - Optional - Show ERC20 transfer amounts in logs. - **--ens** (boolean) - Optional - Enable ENS name resolution for addresses. - **--erc20-symbols** (boolean) - Optional - Enable ERC20 token symbol lookup. ### Request Example ```bash mevlog search -b 50:latest --sort "erc20Transfer|0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --limit 1 --chain-id 1 --ens --erc20-symbols ``` ### Response #### Success Response (200) - **logs** (array) - An array of log objects matching the search criteria. - **...other fields** (depending on output format) #### Response Example (Example depends on the chosen output format, e.g., JSON, text, etc.) ``` -------------------------------- ### Filter Search Results by Address Source: https://context7.com/pawurb/mevlog-rs/llms.txt Filter transaction search results based on sender or recipient addresses. Supports direct address filtering, ENS name resolution, and filtering for contract creation events. ```bash mevlog search -b 10:latest --from 0xae2fc483527b8ef99eb5d9b44875f005ba1fae13 mevlog search -b 10:latest --from jaredfromsubway.eth --chain-id 1 mevlog search -b 10:latest --to 0xba12222222228d8ba445958a75a0704d566bf2c8 mevlog search -b 10:latest --to CREATE ``` -------------------------------- ### EVM Opcode Trace JSON Output (mevlog) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Provides a structured JSON output for EVM opcode traces. Each opcode entry includes program counter (PC), opcode name (OP), gas cost, and remaining gas after execution. ```json [ { "opcodes": [ {"pc": 0, "op": "PUSH1", "cost": 3, "gas_left": 545253}, {"pc": 2, "op": "PUSH1", "cost": 3, "gas_left": 545250}, {"pc": 4, "op": "MSTORE", "cost": 3, "gas_left": 545247} ] } ] ``` -------------------------------- ### Analyze Single Transaction Data (mevlog) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md This command retrieves and displays information for a specific target transaction on a given chain. It allows for including surrounding transactions using `--before` and `--after` flags and reversing the display order with `--reverse`. ```bash mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --chain-id 1 ``` ```bash mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 -b 1 -a 1 --chain-id 1 ``` -------------------------------- ### RPC Debug Tracing for Transaction Analysis Source: https://context7.com/pawurb/mevlog-rs/llms.txt Utilize the `debug_traceTransaction` RPC method for tracing transactions. This requires debug API access, often unavailable on public endpoints. Supports filtering by storage touchpoints, real gas price, and showing call hierarchy. ```bash mevlog search -b 10:latest --touching 0xba12222222228d8ba445958a75a0704d566bf2c8 --trace rpc mevlog search -b 5:latest -p 0:5 --real-gas-price ge10gwei --trace rpc mevlog search -b 5:latest --show-calls --trace rpc ``` -------------------------------- ### Filter Search Results by Value and Cost Source: https://context7.com/pawurb/mevlog-rs/llms.txt Filter transaction search results based on value transferred, transaction cost, gas price, and real cost (including bribes when tracing). Supports greater than (ge) and less than (le) operators. ```bash mevlog search -b 10:latest --value ge1ether mevlog search -b 10:latest --value le0.1ether mevlog search -b 10:latest --tx-cost ge0.001ether mevlog search -b 10:latest --tx-cost le0.01ether mevlog search -b 10:latest --gas-price ge2gwei mevlog search -b 10:latest --gas-price le5gwei mevlog search -b 10:latest --real-tx-cost ge0.02ether --trace revm mevlog search -b 10:latest --real-gas-price ge10gwei --trace revm ``` -------------------------------- ### Filtering Transactions by Emitted Events Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Demonstrates filtering transactions based on emitted smart contract events using the `--event` and `--not-event` flags. Filters can be applied using contract addresses, full event signatures, regular expressions, or a combination of signatures and addresses. ```bash # Filter by contract address mevlog search --event 0x6982508145454ce325ddbe47a25d4ec3d2311933 # Filter by full event signature mevlog search --event "Transfer(address,uint256)" # Filter by regular expression pattern mevlog search --event "/(?i)(rebase).+/" # Filter by event signature and contract address mevlog search --event "Transfer(address,uint256)|0x6982508145454ce325ddbe47a25d4ec3d2311933" ``` -------------------------------- ### Filter Search Results by Event Source: https://context7.com/pawurb/mevlog-rs/llms.txt Filter transaction search results based on specific events. Supports filtering by event signature, contract address, a combination of both, regex patterns, exclusion of events, and multiple ANDed event filters. ```bash mevlog search -b 10:latest --event "Transfer(address,address,uint256)" mevlog search -b 10:latest --event "0x6982508145454ce325ddbe47a25d4ec3d2311933" mevlog search -b 10:latest --event "Transfer(address,address,uint256)|0x6982508145454ce325ddbe47a25d4ec3d2311933" mevlog search -b 10:latest --event "/(Swap).+" mevlog search -b 10:latest --event "/(?i)(rebase).+" mevlog search -b 10:latest --not-event "/(Swap).+" mevlog search -b 10:latest --event "/(?i)(rebase).+" --event "/(Transfer).+" ``` -------------------------------- ### mevlog search - EVM Tracing Filters Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Details on using EVM tracing filters to query transactions based on more complex conditions like real transaction cost, touched storage slots, real gas price, and method calls. ```APIDOC ## POST /mevlog/search/trace ### Description Extends the search functionality by enabling EVM tracing filters. Allows querying transactions based on real transaction costs, storage slot modifications, gas prices, and contract method calls. ### Method POST (simulated for documentation purposes; actual usage is CLI) ### Endpoint /mevlog/search/trace ### Parameters #### Query Parameters - **-b, --block-range** (string) - Required - The block range to search within. - **--trace** (string) - Required - Specifies the tracing mode (`rpc` or `revm`). - **-p, --pending** (string) - Optional - Filter pending transactions. - **--real-tx-cost** (string) - Optional - Filter by total transaction cost (e.g., `ge0.02ether`). - **--touching** (string) - Optional - Filter transactions that modified storage slots of a specific contract address. - **--real-gas-price** (string) - Optional - Filter by real gas price (e.g., `ge10gwei`). - **--calls** (string) - Optional - Filter by contract method calls using a regex pattern (e.g., `"/(swap).+"/`). ### Request Example ```bash mevlog search -b 5:latest -p 0 --real-tx-cost ge0.02ether --trace revm mevlog search -b 10:latest --touching 0xba12222222228d8ba445958a75a0704d566bf2c8 --trace rpc mevlog search -b 5:latest -p 0:5 --real-gas-price ge10gwei --trace rpc mevlog search -b 5:latest -p 0:5 --calls "/(swap).+/" --trace rpc ``` ### Response #### Success Response (200) - **logs** (array) - An array of log objects matching the trace filtering criteria. - **...other fields** (depending on output format) #### Response Example (Example depends on the chosen output format and specific trace filter used.) ``` -------------------------------- ### Trace EVM Opcodes (mevlog) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Enables tracing of executed EVM opcodes for a transaction, requiring either `--trace rpc` or `--trace revm`. The `--ops` flag activates this feature, providing detailed opcode execution information. Output can be formatted as plain text or JSON. ```bash # Trace opcodes using Revm (works on public RPCs) mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --chain-id 1 --trace revm --ops ``` ```bash # Trace opcodes using RPC (requires debug API access) mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --trace rpc --ops ``` ```bash mevlog tx 0x06fed3f7dc71194fe3c2fd379ef1e8aaa850354454ea9dd526364a4e24853660 --chain-id 1 --trace revm --ops --format json ``` -------------------------------- ### Check RPC Debug Tracing Support Source: https://context7.com/pawurb/mevlog-rs/llms.txt Verifies if an RPC endpoint supports debug tracing, which is necessary for the `--trace rpc` mode. It allows specifying a custom timeout duration. The output is a boolean indicating support. ```bash mevlog debug-available --rpc-url https://eth.llamarpc.com mevlog debug-available --rpc-url http://localhost:8545 mevlog debug-available --rpc-url https://eth.llamarpc.com --timeout-ms 10000 ``` -------------------------------- ### Run mevlog in Watch Mode (Bash) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Executes the mevlog CLI in 'watch' mode, connecting to a specified RPC endpoint to monitor blockchain activity. This command initiates the primary monitoring functionality. ```bash mevlog watch --rpc-url https://eth.merkle.io ``` -------------------------------- ### Seed SQLite Database Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Enables the `seed-db` feature to populate a local SQLite database with chain metadata and signature information. This is useful for development and local testing. ```bash cargo run --features=seed-db --bin mevlog seed-db ``` -------------------------------- ### List Available Blockchain Chains (mevlog) Source: https://github.com/pawurb/mevlog-rs/blob/main/README.md Lists available blockchain chains supported by mevlog. Supports filtering by name using `--filter`, by specific chain IDs with `--chain-id`, limiting results with `--limit`, and specifying output format as 'text', 'json', or 'json-pretty'. ```bash mevlog chains # List all available chains ``` ```bash mevlog chains --filter ethereum # Filter chains containing "ethereum" ``` ```bash mevlog chains --filter polygon # Filter chains containing "polygon" ``` ```bash mevlog chains --chain-id 1 --chain-id 137 # Show specific chains by ID ``` ```bash mevlog chains --limit 5 # Show only first 5 chains ``` ```bash mevlog chains --format json # Output as JSON ``` ```bash mevlog chains --format json-pretty # Output as pretty JSON ``` -------------------------------- ### Search ERC20 Transfers with Amount Filters Source: https://context7.com/pawurb/mevlog-rs/llms.txt Searches for ERC20 token transfers within a specified block range, allowing filtering by token address and transfer amount using greater than (ge) or less than (le) operators. It can also display transfer amounts or filter multiple tokens simultaneously. ```bash mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48|ge1000" mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48|le500gwei" mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" --erc20-transfer-amount mevlog search -b 10:latest --erc20-transfer "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48|ge1000" --erc20-transfer "0x6b175474e89094c44da98b954eedeac495271d0f|ge1ether" ```