### Install Vegeta Benchmarking Tool Source: https://github.com/erigontech/erigon/blob/main/cmd/rpctest/Readme.md Installs the Vegeta benchmarking tool using go get. Ensure Go is installed and configured in your PATH. ```bash go get -u github.com/tsenart/vegeta ``` -------------------------------- ### Run Erigon with RPC Enabled Source: https://github.com/erigontech/erigon/blob/main/docs/site/static/llms-full.txt Example command to start an Erigon node with RPC access enabled for web3 wallet integration. ```bash /build/bin/erigon --http.addr="0.0.0.0" --http.api=eth,web3,net,debug,trace,txpool ``` -------------------------------- ### Navigate to Erigon Directory (Built from Source) Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/basic-usage.mdx Before starting Erigon when built from source, navigate to the Erigon installation directory using this command. ```bash cd erigon ``` -------------------------------- ### Handle Installation Method Selection Source: https://github.com/erigontech/erigon/blob/main/docs/site/static/llms-full.txt This JavaScript code handles the logic for selecting and displaying installation methods. It manages the opening and closing of details elements and updates the URL history to reflect the selected installation section. ```javascript const sectionForMethod = { 'install-docker': 'all-operating-systems', 'install-prebuilt': 'linuxmacos', 'install-source': 'linuxmacos', 'install-native': 'windows', 'install-wsl': 'windows', }; if (e) e.preventDefault(); const el = document.getElementById(id); if (!el) return; document.querySelectorAll('details[id^="install-"]').forEach(d => { if (d !== el && d.open) { const s = d.querySelector('summary'); if (s) s.click(); else d.open = false; } }); if (!el.open) { const summary = el.querySelector('summary'); if (summary) summary.click(); else el.open = true; } const sectionId = sectionForMethod[id]; if (sectionId) { history.replaceState(null, '', '#' + sectionId); } const resolveTarget = () => { let t = sectionId && document.getElementById(sectionId); if (!t) { let cursor = el.previousElementSibling; while (cursor && !/^H[1-6]$/.test(cursor.tagName)) { cursor = cursor.previousElementSibling; } t = cursor || el; } return t; }; let lastHeight = document.body.scrollHeight; let stableFrames = 0; let totalFrames = 0; const waitForStableLayout = () => { const h = document.body.scrollHeight; if (h === lastHeight) stableFrames++; else totalFrames++; if (stableFrames >= 6 || totalFrames >= 90) { resolveTarget().scrollIntoView(); } else { requestAnimationFrame(waitForStableLayout); } }; requestAnimationFrame(waitForStableLayout); ``` -------------------------------- ### Run Erigon Client Source: https://github.com/erigontech/erigon/blob/main/agents.md Commands to run the Erigon client. The first example starts Erigon on the mainnet, while the second starts it in PoS dev mode. ```bash ./build/bin/erigon --datadir=./data --chain=mainnet ``` ```bash ./build/bin/erigon --datadir=dev --chain=dev # PoS dev mode ``` -------------------------------- ### Configure Erigon with Command Line Flags Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/configuring-erigon.mdx Example of starting Erigon with specific command-line flags. Use this to customize network, data directory, and JSON-RPC settings. ```bash ./build/bin/erigon --chain=holesky --datadir=/data/erigon --http --http.port=8545 ``` -------------------------------- ### Start Erigon (Pre-Built Binaries) Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/basic-usage.mdx Use this command to start Erigon when using pre-built binaries. Replace '[options]' with your desired command-line flags. ```text erigon [options] ``` -------------------------------- ### Start Development Server with npm Source: https://github.com/erigontech/erigon/blob/main/docs/site/README.md Starts the development server with hot reload. Accessible at http://localhost:3000. Run this command in the docs/site/ directory. ```bash npm run start ``` -------------------------------- ### Syncing Hoodi Testnet with Erigon Source: https://github.com/erigontech/erigon/blob/main/README.md Example command to clone the Erigon repository, build the client, and start syncing the Hoodi testnet. Ensure to replace `` with your desired data directory. ```sh git clone https://github.com/erigontech/erigon.git cd erigon make erigon ./build/bin/erigon --datadir= --chain=hoodi --prune.mode=full ``` -------------------------------- ### Set Upload Start Location to Latest Source: https://github.com/erigontech/erigon/blob/main/cmd/utils/app/README.md Use this flag to start uploading from the latest available block when initializing with an empty drive. ```shell --upload.from=latest ``` -------------------------------- ### Example TOML Configuration File Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/configuring-erigon.mdx This is an example of a TOML configuration file for Erigon, similar to the YAML example. ```toml datadir = 'your datadir' chain = "mainnet" http = true "http.api" = ["eth","debug","net"] ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/about/contributing.md Install the necessary Node.js dependencies for building and previewing the Erigon documentation locally. Navigate to the docs/site directory first. ```bash git clone https://github.com/erigontech/erigon.git cd erigon/docs/site npm install ``` -------------------------------- ### Start Erigon with Caplin Enabled Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/layer-2-networks.md Use the `--caplin.blobs-immediate-backfill` flag when starting Erigon if Caplin is the consensus layer. This ensures backfilling of blobs for proper synchronization with an op-node, especially when starting from a snapshot. ```bash ./build/bin/erigon --caplin.blobs-immediate-backfill ``` -------------------------------- ### Install Dependencies with npm Source: https://github.com/erigontech/erigon/blob/main/docs/site/README.md Installs project dependencies using npm. Run this command in the docs/site/ directory. ```bash npm install ``` -------------------------------- ### Example YAML Configuration File Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/configuring-erigon.mdx This is an example of a YAML configuration file for Erigon, specifying data directory, chain, and enabled APIs. ```yaml datadir : 'your datadir' chain : "mainnet" http : true http.api : ["eth","debug","net"] ``` -------------------------------- ### Start Erigon (Built from Source) Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/basic-usage.mdx Start Erigon after building it from source. This command assumes you are in the Erigon directory. Replace '[options]' with your desired command-line flags. ```shell ./build/bin/erigon [options] ``` -------------------------------- ### Lookup Algorithm Walkthrough Example Source: https://github.com/erigontech/erigon/blob/main/docs/plans/20260324-bpstree-prefix-index-spec.md Illustrates a step-by-step walkthrough of the prefix index lookup algorithm for a specific key (`0x02ab...`) in a large file, showing L1 and L2 narrowing, binary search results, and the final intersection. ```text Step 1: L1 lookup l1[0x02] = 500,000 (first key starting with 0x02) l1[0x03] = 700,000 (first key starting with 0x03) → L1 range: [500000, 700000) — 200k keys Step 2: L2 lookup l2[0x02][0xab] = 531,250 (first key starting with 0x02ab) l2[0x02][0xac] = 532,050 (first key starting with 0x02ac) → L2 range: [531250, 532050) — 800 keys Step 3: bs() cached nodes bs(key) returns dl=531,400, dr=531,650 → bs range: [531400, 531650) — 250 keys Step 4: Intersection l = max(531250, 531400) = 531400 r = min(532050, 531650) = 531650 → Final range: [531400, 531650) — 250 keys → Binary search: log2(250) ≈ 8 comparisons Without prefix index: bs() alone gives [531400, 531650), then 8 comparisons. With prefix index: same result here, BUT bs() itself was faster because the prefix index can skip the bs() entirely when it gives tighter bounds. ``` -------------------------------- ### Trace Get Request Example Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/trace.md Example RPC request to the trace_get method using curl. This shows how to specify the transaction hash and trace index to fetch a particular trace. ```bash curl --data '{"method":"trace_get","params":["0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3",["0x0"]],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 ``` -------------------------------- ### Run Downloader with Data Directory and API Address Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/modules/downloader.mdx Example of how to run the downloader with a specified data directory and downloader API address. This is useful for custom configurations. ```go go run ./cmd/downloader --datadir --downloader.api.addr 127.0.0.1:9093 ``` -------------------------------- ### Trace Get Response Example Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/trace.md Example JSON response from the trace_get method, detailing a single trace entry. It includes the action performed, block and transaction context, and the result of the trace. ```json { "id": 1, "jsonrpc": "2.0", "result": { "action": { "callType": "call", "from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750", "gas": "0x13e99", "input": "0x16c72721", "to": "0x2bd2326c993dfaef84f696526064ff22eba5b362", "value": "0x0" }, "blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add", "blockNumber": 3068185, "result": { "gasUsed": "0x183", "output": "0x0000000000000000000000000000000000000000000000000000000000000001" }, "subtraces": 0, "traceAddress": [ 0 ], "transactionHash": "0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3", "transactionPosition": 2, "type": "call" } } ``` -------------------------------- ### Launch Monitoring Stack with Docker Compose Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/creating-a-dashboard.md Use Docker Compose to easily start the Prometheus and Grafana services. Ensure you have Docker and Docker Compose installed. ```sh docker compose up -d prometheus grafana ``` -------------------------------- ### Open MDBX Database with Customization Source: https://github.com/erigontech/erigon/blob/main/db/kv/Readme.md Shows how to open an MDBX database with a specified path and custom bucket configurations. This allows for tailored database setups. ```go db, err := ethdb.NewMDBX().Path(path).WithBucketsConfig(config).Open() if err != nil { // handle error } ``` -------------------------------- ### Get KV Service API Version Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/grpc.md Connect to the Erigon gRPC endpoint and query the KV service's API version. This is a basic example to verify connectivity. ```bash # Connect to gRPC endpoint grpcurl -plaintext localhost:9090 remote.KV/Version ``` -------------------------------- ### Display TxPool Help Information Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/modules/txpool.md Use the --help flag to display all available command-line options for the TxPool executable. This is useful for understanding the full range of configurable parameters. ```bash ./build/bin/txpool --help ``` -------------------------------- ### Start Erigon Docker Container Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/get-started/installation/index.mdx Run the Erigon Docker container with specified flags. The example includes common flags for chain selection, pruning mode, and data directory. ```sh docker run -it erigontech/erigon: ``` ```sh docker run -it erigontech/erigon:v{ERIGON_VERSION} --chain=hoodi --prune.mode=minimal --datadir /erigon-data ``` -------------------------------- ### Start Erigon with Snapshots Support (Default) Source: https://github.com/erigontech/erigon/blob/main/cmd/downloader/readme.md Run Erigon with the `--snapshots` flag to enable the downloader service. This is the default behavior when the flag is present. ```shell erigon --snapshots --datadir= ``` -------------------------------- ### Display Downloader Help Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/fundamentals/modules/downloader.mdx Use the `--help` flag to view all available command-line options for the downloader. ```bash ./build/bin/downloader --help ``` -------------------------------- ### Get Root Hash for Block Range Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/bor.md Retrieve the root hash for a specified range of blocks. This is useful for checkpoint verification and state synchronization. Ensure the start and end block numbers are valid. ```bash curl -s --data '{"jsonrpc":"2.0","method":"bor_getRootHash","params":["0x1", "0x100"],"id":"1"}' -H "Content-Type: application/json" -X POST http://localhost:8545 ``` -------------------------------- ### Retrieve Storage Range at Block Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/debug.md Use debug_storageRangeAt to get information about a range of storage locations for a contract at a specific block and transaction index. Specify the contract address, starting storage key, and the maximum number of results. ```bash curl -s --data '{"jsonrpc":"2.0","method":"debug_storageRangeAt","params":["0xd3f185...",1,"0xb734c7...","0x00",2],"id":"1"}' -H "Content-Type: application/json" -X POST http://localhost:8545 ``` -------------------------------- ### Build and Help for Standalone MCP Server Source: https://github.com/erigontech/erigon/blob/main/cmd/mcp/README.md Build the standalone MCP server binary and view its help information. ```bash make mcp ./build/bin/mcp --help ``` -------------------------------- ### Get Modified Accounts by Block Hash Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/debug.md Use debug_getModifiedAccountsByHash to retrieve a list of account addresses modified within a block range specified by start and end block hashes. This method returns an array of 20-byte account addresses. ```bash curl -s --data '{"jsonrpc":"2.0","method":"debug_getModifiedAccountsByHash","params":["0x2a1af0...","0x4e3d3e..."],"id":"1"}' -H "Content-Type: application/json" -X POST http://localhost:8545 ``` -------------------------------- ### Install and Run Tracer Test Generator Source: https://github.com/erigontech/erigon/blob/main/execution/tracing/tracers/internal/tracetest/testgenerator/README.md Install dependencies and run the test generator with specified RPC URL, transaction hash, trace configuration, and output file path. ```bash cd execution/tracing/tracers/internal/tracetest/testgenerator npm install npm start -- \ --rpcUrl=http://localhost:8545 \ --txnHash=0x5c08231a3c34bd1be6ac7df553d451246175f3dad3245ab5e4413cde35ace52e \ --traceConfig='{"tracer": "prestateTracer", "tracerConfig": { "diffMode": true } }' \ --outputFilePath=../testdata/prestate_tracer_with_diff_mode/create_with_value.json ``` -------------------------------- ### Get Modified Accounts by Block Number Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/debug.md Use debug_getModifiedAccountsByNumber to obtain a list of account addresses that were modified within a specified block range, defined by start and end block numbers or tags. This returns an array of 20-byte account addresses. ```bash curl -s --data '{"jsonrpc":"2.0","method":"debug_getModifiedAccountsByNumber","params":["0xccccd","0xcccce"],"id":"1"}' -H "Content-Type: application/json" -X POST http://localhost:8545 ``` -------------------------------- ### Fast Block Production Example Source: https://github.com/erigontech/erigon/blob/main/docs/DEV_CHAIN.md Configures Erigon for faster development iteration by setting a 2-second slot time and enabling common JSON-RPC APIs. ```bash ./build/bin/erigon --chain=dev --datadir=dev \ --beacon.api=beacon,validator,node,config \ --dev.slot-time=2 \ --http.api=eth,erigon,web3,net,debug,trace,txpool ``` -------------------------------- ### Install Build Tools with Chocolatey Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/get-started/installation/index.mdx Install essential build tools including cmake, make, and mingw using Chocolatey. Be aware of potential false positives from antivirus software during MinGW installation. ```bash choco install cmake make mingw ``` -------------------------------- ### Monolithic vs. Component Integration (Go) Source: https://github.com/erigontech/erigon/blob/main/node/components/downloader/README.md Illustrates the shift from a monolithic integration of the snapshot downloader in `backend.go` to a component-based approach. The component-based method simplifies wiring and event handling. ```go backend.setUpSnapDownloader(ctx, ...) // 50 lines of inline wiring backend.initDownloader(ctx, ...) // 30 lines of conditional logic backend.chainDB.OnFilesChange(...) // callback registration ``` ```go dlProvider := downloadercomp.New(config) dlProvider.Initialize(ctx) domain.Register(dlProvider) // Events handle the rest — no manual callback wiring ``` -------------------------------- ### Phase 2: Node Selection Example Source: https://github.com/erigontech/erigon/blob/main/docs/plans/20260326-prefix-index-standalone-spec.md Illustrates the calculation of evenly-spaced key positions within a prefix bucket for node selection. If the count is less than or equal to 8, all keys are selected; otherwise, 8 positions are calculated based on spacing. ```go Example: prefix 0x02ab has keys at DI 531250..532049 (800 keys) Spacing: 800/8 = 100 Selected DIs: 531250, 531364, 531478, 531592, 531706, 531821, 531935, 532049 Each node.key read from .kv via ef.Get(di) → offset → reader.Reset(offset) → reader.Next() ``` -------------------------------- ### erigon_forks Example with cast Source: https://github.com/erigontech/erigon/blob/main/docs/site/static/llms-full.txt Example of calling the erigon_forks method using the cast tool. ```APIDOC cast rpc erigon_forks ``` -------------------------------- ### Serve Production Build Locally with npm Source: https://github.com/erigontech/erigon/blob/main/docs/site/README.md Serves the production build of the documentation site locally. Run this command in the docs/site/ directory. ```bash npm run serve ``` -------------------------------- ### Display Help and Stage Information Source: https://github.com/erigontech/erigon/blob/main/cmd/integration/Readme.md Use these commands to view available integration commands and list all stages. ```shell integration --help integration print_stages ``` -------------------------------- ### debug_traceTransaction Example with cast Source: https://github.com/erigontech/erigon/blob/main/docs/site/static/llms-full.txt Example of calling the debug_traceTransaction method using the cast tool. ```APIDOC cast rpc debug_traceTransaction ``` -------------------------------- ### admin_nodeInfo Example with cast Source: https://github.com/erigontech/erigon/blob/main/docs/site/static/llms-full.txt Example of calling the admin_nodeInfo method using the cast tool. ```APIDOC cast rpc admin_nodeInfo ``` -------------------------------- ### Build Production Version with npm Source: https://github.com/erigontech/erigon/blob/main/docs/site/README.md Creates a production build of the documentation site in the build/ directory. Run this command in the docs/site/ directory. ```bash npm run build ``` -------------------------------- ### Go gRPC Client Example Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/grpc.md Demonstrates establishing a gRPC connection to the Erigon backend using Go. It uses `grpc.WithInsecure()` for simplicity, which is not recommended for production environments. The client can then be used for database operations. ```go conn, err := grpc.Dial("localhost:9090", grpc.WithInsecure()) if err != nil { log.Fatal(err) } defer conn.Close() client := remote.NewKVClient(conn) // Use client for database operations ``` -------------------------------- ### Check Chocolatey Installation Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/get-started/installation/index.mdx Verify that Chocolatey, a package manager for Windows, is installed correctly by checking its version. ```bash choco -v ``` -------------------------------- ### Get Backtest Help Source: https://github.com/erigontech/erigon/blob/main/execution/commitment/backtester/README.md Displays all available command-line flags and options for the commitment backtester. ```bash erigon backtest-commitment --help ``` -------------------------------- ### Trace Block Request Example Source: https://github.com/erigontech/erigon/blob/main/docs/site/docs/interacting-with-erigon/trace.md An example curl request for the trace_block method, specifying a block number to retrieve its traces. ```bash curl --data '{"method":"trace_block","params":["0x2ed119"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 ``` -------------------------------- ### Create Seedbox to Support Network (Basic) Source: https://github.com/erigontech/erigon/blob/main/cmd/downloader/readme.md This command initiates a downloader instance configured as a seedbox, capable of supporting the network. It can be run on an empty datadir. ```bash downloader --datadir= --chain=mainnet ```