Calldata Compression Analyzer
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Calldata Compression Analyzer is a read-only developer tool that analyzes EVM smart contract calldata patterns to identify compression and packing opportunities for reducing transaction gas costs. It examines on-chain transaction histories to extract real calldata, calculates size statistics per function, detects zero-padding waste, identifies repeated address and small number patterns, and estimates potential byte savings from packing or compression techniques. The tool provides actionable insights including per-function calldata size averages, min/max ranges, variance, and specific implementation recommendations like tight packing, using smaller integer types, or passing indices instead of full addresses.
HOW TO USE
Connect your EVM-compatible wallet via the BGWallet bridge and select the network where your contract is deployed. Enter the contract address and specify the number of recent transactions to analyze (1-50). Click "Analyze Calldata Compression" to start the analysis. The tool fetches transaction logs using chunked scanning that automatically halves request ranges if RPCs reject full-range queries, retrieves transaction details and receipts, extracts calldata from each transaction, and performs statistical analysis per function selector. Results include total calldata size, average per function, min/max ranges, detected zero-padding and repeated patterns, estimated compression savings, and specific implementation recommendations for each function. All analysis is read-only—no signatures or transactions are submitted.
TECHNICAL MECHANISM
The tool uses ethers.js v5.7.2 with a chunked log fetching strategy to handle provider-specific eth_getLogs limits. It first fetches contract bytecode via provider.getCode(address) and extracts function selectors using the PUSH4 opcode pattern (0x63). For transaction history, the tool constructs a log filter for the contract address and fetches logs using a recursive chunking algorithm—starting from a large block range, if a request fails due to response size limits, it halves the range and recursively fetches both halves until successful. From each transaction, the tool extracts the function selector (first 4 bytes of calldata), total calldata size, and gas used. It groups transactions by selector and calculates per-function statistics: call count, average calldata size, min/max sizes, and variance. Compression opportunity detection includes: zero-padding analysis (scanning for trailing zeros beyond the 4-byte selector), repeated pattern detection (identifying 20-byte address patterns and small numbers padded to 32 bytes), and variable size analysis (assessing if calldata size varies widely within the same function). Estimated savings are calculated based on bytes that could be removed through packing—e.g., converting uint256 to uint128 saves 16 bytes per parameter, packing multiple small values into one slot saves the full slot size. Implementation recommendations are generated based on the detected patterns.
WHAT IT CANNOT SEE
This tool has fundamental limitations that users must understand. It cannot propose or implement actual compression algorithms without manual specification—the tool identifies patterns but cannot automatically generate code. It cannot predict gas savings for compression that requires off-chain decompression or on-chain decoding overhead—some compression schemes may add more gas in decoding than they save in calldata. It cannot analyze calldata for functions that have never been called on-chain—the tool relies on historical transaction data, so functions with no calls produce no analysis. It cannot determine optimal compression strategy without understanding business logic and parameter value distributions—some parameters may look compressible but require full 32-byte precision. It cannot detect compression opportunities in functions with no real transaction data. It cannot account for calldata that is not decodeable or belongs to non-standard function dispatch patterns. It cannot analyze the impact of compression on code readability, maintainability, or contract deployment costs. The tool's savings estimates are approximate and based on byte-level analysis, not on actual EVM gas costs after compression.
PLEASE NOTE
This tool only supports EVM-compatible blockchains (Ethereum, Polygon, BSC, Avalanche C-Chain, Optimism, Arbitrum, and their testnets). Solana, Tron, Starknet, SUI, TON, Aptos, Bitcoin, Cosmos, and XRP are not supported. The tool is free, open-source, requires no API keys, and uses the wallet's native provider for all read operations. Always validate compression changes with thorough testing and gas measurement before deploying to production.