### Docker Compose Setup for Pathfinder Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Sets up Pathfinder using Docker Compose. This involves creating a directory, copying an environment file, and starting the services defined in docker-compose.yaml. Remember to replace the placeholder for the Ethereum API URL. ```bash mkdir -p pathfinder # Replace the value of PATHFINDER_ETHEREUM_API_URL with the URL of your Ethereum node's endpoint cp example.pathfinder-var.env pathfinder-var.env docker-compose up -d ``` -------------------------------- ### Start Local Development Server Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/README.md Starts a local development server for live preview and hot-reloading. ```bash yarn start ``` -------------------------------- ### Install Build Tools Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Installs essential build tools like Curl and Git on a Debian-based Linux system, which are prerequisites for building Pathfinder from source. ```bash sudo apt update sudo apt upgrade sudo apt install curl git ``` -------------------------------- ### Source: Configure Environment Variables Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder directly from source and configuring it using environment variables. ```bash RUST_LOG=debug PATHFINDER_NETWORK=sepolia-testnet cargo run --release --bin pathfinder ``` -------------------------------- ### Start Optional Juno P2P Node Source: https://github.com/equilibriumco/pathfinder/blob/main/nodes/README.md Starts an optional Juno P2P node using Docker Compose. This node connects to both Pathfinder nodes. This step is optional. ```bash docker-compose up -d juno ``` -------------------------------- ### starknet_call Example Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md Example of how to call a contract function using the JSON-RPC API. ```APIDOC ## starknet_call ### Description Executes a contract function call without creating a transaction on-chain. ### Method POST ### Endpoint `/rpc/v0_7` ### Parameters #### Request Body - **jsonrpc** (string) - Required - "2.0" - **method** (string) - Required - "starknet_call" - **params** (array) - Required - An array containing the call request object and block identifier. - **request** (object) - Required - Details of the contract call. - **contract_address** (string) - Required - The address of the contract. - **entry_point_selector** (string) - Required - The selector of the entry point to call. - **calldata** (array) - Optional - An array of calldata arguments. - **block_id** (string or object) - Required - The block identifier (e.g., "latest", or an object with `hash` or `number`). - **id** (integer) - Required - Request identifier. ### Request Example ```json { "jsonrpc": "2.0", "method": "starknet_call", "params": [ { "request": { "contract_address": "0x1234...", "entry_point_selector": "0xabc...", "calldata": [ "0x1", "0x2" ] }, "block_id": "latest" } ], "id": 1 } ``` ### Response #### Success Response (200) - **jsonrpc** (string) - The JSON-RPC protocol version. - **id** (integer) - The identifier of the request. - **result** (string) - The result of the contract call as a hexadecimal string. ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/README.md Installs project dependencies using Yarn. ```bash yarn ``` -------------------------------- ### Docker: Configure Environment Variables Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder in Docker and configuring it using environment variables. ```bash sudo docker run \ --name pathfinder \ --restart unless-stopped \ --detach \ -p 9545:9545 \ -v $HOME/pathfinder:/usr/share/pathfinder/data \ -e "PATHFINDER_ETHEREUM_API_URL=wss://sepolia.infura.io/ws/v3/" \ -e "PATHFINDER_NETWORK=sepolia-testnet" \ -e "RUST_LOG=debug" \ eqlabs/pathfinder:latest ``` -------------------------------- ### Start Pathfinder P2P Node Source: https://github.com/equilibriumco/pathfinder/blob/main/nodes/README.md Starts the pathfinder P2P node using Docker Compose. This node connects to the proxy node and syncs blocks over P2P. ```bash docker-compose up -d pathfinder-p2p ``` -------------------------------- ### Configure Environment Variables for Pathfinder Source: https://github.com/equilibriumco/pathfinder/blob/main/nodes/README.md Before starting the nodes, create a `pathfinder-var.env` file and set your testnet Ethereum node URL. ```bash PATHFINDER_ETHEREUM_API_URL= ``` -------------------------------- ### Run Pathfinder with Docker Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder using Docker, setting environment variables and command-line arguments. ```bash docker run \ --name pathfinder \ --detach \ --restart unless-stopped \ -p 9545:9545 \ --user "$(id -u):$(id -g)" \ -e RUST_LOG=info \ -e PATHFINDER_ETHEREUM_API_URL="wss://sepolia.infura.io/ws/v3/" \ -v $HOME/pathfinder:/usr/share/pathfinder/data \ eqlabs/pathfinder:latest \ --network mainnet \ --monitor-address=0.0.0.0:9000 \ --rpc.websocket.enabled \ ``` -------------------------------- ### Install Build Dependencies Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Installs necessary libraries for compiling Pathfinder from source on a Debian-based Linux system, including C++ build tools, pkg-config, OpenSSL, and Protobuf. ```bash sudo apt install build-essential pkg-config libssl-dev protobuf-compiler libzstd-dev ``` -------------------------------- ### Finite Field Setup and Parsing Functions Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/spec/poseidon.ipynb Sets up the finite field GF(p) and defines helper functions to parse vectors and matrices into the finite field's representation. ```python p = 2^251 + 17*2^192 + 1 Fp. = GF(p) def parse_vector(v): return vector([Fp(v[0]), Fp(v[1]), Fp(v[2])]) def parse_matrix(m): for i in range(len(m)): m[i] = parse_vector(m[i]) return Matrix(m) ``` -------------------------------- ### Run Updated Pathfinder from Source Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/updating-pathfinder.md Command to start the Pathfinder node after rebuilding it from source. Replace `` with your specific configuration. ```bash cargo run --release --bin pathfinder -- ``` -------------------------------- ### Start Pathfinder Proxy Node Source: https://github.com/equilibriumco/pathfinder/blob/main/nodes/README.md Starts the pathfinder proxy node using Docker Compose. This node connects to the sequencer gateway and stores blocks. ```bash docker-compose up -d pathfinder-proxy ``` -------------------------------- ### WebSocket Connection Example in Node.js Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/websocket-api.md Demonstrates how to establish a WebSocket connection to the Pathfinder RPC endpoint and send a JSON-RPC request. This example uses the native WebSocket API available in Node.js environments. ```javascript const ws = new WebSocket("ws://127.0.0.1:9545/ws/rpc/v0_8"); ws.onopen = () => { const message = JSON.stringify({ jsonrpc: "2.0", method: "starknet_chainId", params: [], id: 1 }); ws.send(message); }; ws.onmessage = (event) => { console.log("Received response:", event.data); }; ``` -------------------------------- ### starknet_chainId Example Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md Example of how to query the chain ID using the JSON-RPC API. ```APIDOC ## starknet_chainId ### Description Queries the current Starknet chain ID. ### Method POST ### Endpoint `/rpc/v0_8` ### Parameters #### Request Body - **jsonrpc** (string) - Required - "2.0" - **method** (string) - Required - "starknet_chainId" - **params** (array) - Required - Empty array `[]`. - **id** (integer) - Required - Request identifier, e.g., `1`. ### Request Example ```json { "jsonrpc": "2.0", "method": "starknet_chainId", "params": [], "id": 1 } ``` ### Response #### Success Response (200) - **jsonrpc** (string) - The JSON-RPC protocol version. - **id** (integer) - The identifier of the request. - **result** (string) - The chain ID as a hexadecimal string. ``` -------------------------------- ### Example Prometheus Metrics Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Illustrates valid examples of Prometheus metrics that can be scraped from the Pathfinder node. These examples show different combinations of labels for gateway requests. ```text gateway_requests_total{method="get_block"} gateway_requests_total{method="get_block", tag="latest"} gateway_requests_failed_total{method="get_state_update"} gateway_requests_failed_total{method="get_state_update", tag="pending"} gateway_requests_failed_total{method="get_state_update", tag="pending", reason="starknet"} gateway_requests_failed_total{method="get_state_update", reason="rate_limiting"} ``` -------------------------------- ### Run Pathfinder from Source with Cargo Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder built from source using Cargo, passing command-line arguments after '--'. ```bash cargo run --release --bin pathfinder -- \ --network mainnet \ --monitor-address=0.0.0.0:9000 ``` -------------------------------- ### Run Pathfinder with Docker Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md This command starts the Pathfinder Docker container, mapping ports, setting environment variables for Ethereum API URL and logging, and mounting a volume for data persistence. Ensure the data directory exists and is writable. ```bash mkdir -p $HOME/pathfinder docker run \ --name pathfinder \ --restart unless-stopped \ --detach \ -p 9545:9545 \ --user "$(id -u):$(id -g)" \ -e RUST_LOG=info \ -e PATHFINDER_ETHEREUM_API_URL="wss://sepolia.infura.io/ws/v3/" \ -v $HOME/pathfinder:/usr/share/pathfinder/data \ eqlabs/pathfinder ``` -------------------------------- ### Force Mainnet Network Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of forcing Pathfinder to use the mainnet network. ```bash --network mainnet ``` -------------------------------- ### Systemd Service Management Commands Source: https://github.com/equilibriumco/pathfinder/blob/main/utils/pathfinder-probe/README.md Manage the Pathfinder-Probe systemd service using standard systemctl commands. This includes reloading the daemon, enabling the service to start on boot, starting the service, and viewing its logs. ```bash sudo systemctl daemon-reload sudo systemctl enable pathfinder-probe sudo systemctl start pathfinder-probe journalctl -u pathfinder-probe -b ``` -------------------------------- ### Prune State Trie with Docker Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder with Docker and pruning state tries to keep the latest 101 blocks. ```bash sudo docker run \ --name pathfinder \ --detach \ -p 9545:9545 \ -e RUST_LOG=info \ eqlabs/pathfinder:latest \ --network mainnet \ --storage.state-tries=100 ``` -------------------------------- ### Docker: Prune Blockchain History Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder in Docker and pruning older blocks, keeping the latest 101 blocks. ```bash sudo docker run \ --name pathfinder \ --detach \ -p 9545:9545 \ -e RUST_LOG=info \ eqlabs/pathfinder:latest \ --network mainnet \ --storage.blockchain-history=100 ``` -------------------------------- ### Initialize and Run Pathfinder Consensus Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/consensus/README.md Demonstrates how to create, configure, and run the main consensus loop. Handles starting at a specific height, processing events like proposal requests and decisions, and broadcasting network messages. ```rust use pathfinder_consensus::*; // Create and start consensus let config = Config::new(my_address); let mut consensus: DefaultConsensus = Consensus::new(config); consensus.handle_command(ConsensusCommand::StartHeight(1, validator_set)); // Main loop loop { if let Some(event) = consensus.next_event().await { match event { ConsensusEvent::RequestProposal { height, round } => { // Build and submit proposal consensus.handle_command(ConsensusCommand::Propose(proposal)); } ConsensusEvent::Decision { height, round, value } => { // Commit the decided value } ConsensusEvent::Gossip(msg) => { // Broadcast to peers } ConsensusEvent::Error(e) => { // Handle error } } } } ``` -------------------------------- ### Check Cargo Version Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Verifies that the installed Rust Cargo version meets the minimum requirement of 1.80 for building Pathfinder. ```bash cargo --version ``` -------------------------------- ### Pathfinder-Probe Systemd Service File Configuration Source: https://github.com/equilibriumco/pathfinder/blob/main/utils/pathfinder-probe/README.md Configure the Pathfinder-Probe service by defining its unit, service, and install sections. Ensure correct paths, user, group, and environment variables are set. ```systemd [Unit] Description=Pathfinder-Probe Wants=network-online.target After=network-online.target [Service] Type=simple User=pathfinder Group=pathfinder ExecReload=/bin/killall pathfinder-probe Environment="RUST_LOG=info" ExecStart=/var/lib/pathfinder/pathfinder-probe \ 0.0.0.0:19999 \ https://alpha-mainnet.starknet.io \ http://127.0.0.1:9545/rpc/v0.5 \ 5 SyslogIdentifier=pathfinder-probe Restart=always [Install] WantedBy=multi-user.target ``` -------------------------------- ### Check Protobuf Compiler Version Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Ensures the installed Protocol Buffers compiler (protoc) version is 3.15 or higher, a requirement for compiling Pathfinder. ```bash protoc --version ``` -------------------------------- ### Source: Prune Blockchain History Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder from source and pruning older blocks, keeping only the most recent block's data. ```bash cargo run --release --bin pathfinder -- \ --network testnet \ --storage.blockchain-history=0 ``` -------------------------------- ### Configure Logging with RUST_LOG Environment Variable Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of setting the RUST_LOG environment variable when running Pathfinder with Docker to configure logging levels. ```bash docker run --name pathfinder [...] -e RUST_LOG= eqlabs/pathfinder:latest ``` -------------------------------- ### Call a Contract Function using JSON-RPC v0.7 Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md Example of how to call a contract function using the starknet_call method via the v0.7 JSON-RPC endpoint. This includes specifying the contract address, entry point selector, calldata, and block ID. ```bash curl -X POST \ -H "Content-Type: application/json" \ -d '{ "jsonrpc":"2.0", "method":"starknet_call", "params":[{ "request": { "contract_address":"0x1234...", "entry_point_selector":"0xabc...", "calldata":[ "0x1", "0x2" ] }, "block_id":"latest" }], "id":1 }' \ http://127.0.0.1:9545/rpc/v0_7 ``` -------------------------------- ### Successful Chain ID Response Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md Example of a successful JSON-RPC response containing the chain ID. ```json { "jsonrpc": "2.0", "id": 1, "result": "0x534e5f4d41494e" } ``` -------------------------------- ### Query Chain ID using JSON-RPC v0.8 Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md Example of how to query the chain ID using the starknet_chainId method via the v0.8 JSON-RPC endpoint. ```bash curl -X POST \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"starknet_chainId","params":[],"id":1}' \ http://127.0.0.1:9545/rpc/v0_8 ``` -------------------------------- ### Prune State Trie from Source Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Example of running Pathfinder from source and pruning state tries to keep only the most recent block's trie. ```bash cargo run --release --bin pathfinder -- \ --network testnet \ --storage.state-tries=0 ``` -------------------------------- ### Implement Custom Proposer Selection Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/consensus/README.md Provides an example of implementing the `ProposerSelector` trait to override the default round-robin proposer selection logic. This is useful for custom validator prioritization based on specific criteria. ```rust #[derive(Clone)] struct WeightedSelector; impl ProposerSelector for WeightedSelector { fn select_proposer<'a>( &self, validator_set: &'a ValidatorSet, height: u64, round: u32, ) -> &'a Validator { // Custom selection logic &validator_set.validators[round as usize % validator_set.count()] } } let consensus = Consensus::with_proposer_selector(config, WeightedSelector); ``` -------------------------------- ### Generate Usage Instructions Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/load-test/readme.md Run this command from the load test tool's directory to generate usage instructions. ```rust cargo run --release ``` -------------------------------- ### Build Static Website Content Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/README.md Generates static website content for deployment. ```bash yarn build ``` -------------------------------- ### Configure Custom Network and Gateway Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Sample command to configure Pathfinder for a custom Starknet network using gateway URLs and a chain ID. ```bash cargo run --release --bin pathfinder -- \ --network custom \ --gateway-url https://my-custom-network/gateway \ --feeder-gateway-url https://my-custom-network/feeder \ --chain-id SN_MYNETWORK ``` -------------------------------- ### Sync P2P Protocol Definitions Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/p2p_proto/README.md Fetches the latest protocol definitions from the starknet-p2p-specs repository and updates the Rust module structure. Requires Python 3.10+ and Git. ```bash make sync ``` -------------------------------- ### List Snapshot Files with Rclone Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Use this command to list available snapshot files in the remote storage. ```bash rclone ls pathfinder-snapshots:pathfinder-snapshots/ ``` -------------------------------- ### Deploy Website Using SSH Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/README.md Deploys the website using SSH, typically for GitHub Pages. ```bash USE_SSH=true yarn deploy ``` -------------------------------- ### Download Snapshot via HTTPS with Wget Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Use wget to download a snapshot file directly via HTTPS. The --continue flag allows resuming interrupted downloads. ```bash wget --continue https://rpc.pathfinder.equilibrium.co/snapshots/latest/mainnet.sqlite.zst ``` -------------------------------- ### Copy Snapshot File with Rclone Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Download a specific snapshot file using Rclone. The -P flag shows progress. ```bash rclone copy -P pathfinder-snapshots:pathfinder-snapshots/mainnet_0.18.0_1674344.sqlite.zst . ``` -------------------------------- ### Readiness Check Endpoint Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Use this endpoint to determine if Pathfinder has completed all startup tasks, such as database migrations and network checks. A 200 OK response means the node is ready to serve JSON-RPC requests. ```bash curl -i http://localhost:9000/ready ``` -------------------------------- ### Readiness Check Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Indicates whether Pathfinder has completed all startup tasks, such as database migrations and network checks, and is ready to serve requests. ```APIDOC ## GET /ready ### Description Verifies if Pathfinder has completed its initialization and is ready to serve JSON-RPC requests. ### Method GET ### Endpoint /ready ### Response #### Success Response (200 OK) The node is fully initialized and ready to serve JSON-RPC requests. #### Error Response (503 Service Unavailable) The node is still starting up or failing a prerequisite task. ``` -------------------------------- ### Calculate Pedersen Hash Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/README.md Demonstrates how to compute the Pedersen hash of two Felt elements using the pathfinder_crypto crate. Ensure the necessary imports are included. ```rust use pathfinder_crypto::algebra::field::Felt; use pathfinder_crypto::hash::pedersen_hash; fn main() { let (a, b) = (Felt::ZERO, Felt::ZERO); let hash = pedersen_hash(a, b); println!("a: {a}"); println!("b: {b}"); println!("pedersen_hash(a,b): {hash}"); } ``` -------------------------------- ### Enable Monitoring API with Docker Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Enables the monitoring API by setting the monitor address environment variable when running Pathfinder using Docker. ```bash docker run \ --name pathfinder \ --restart unless-stopped \ --detach \ -p 9545:9545 \ -p 9000:9000 \ --user "$(id -u):$(id -g)" \ -e RUST_LOG=info \ -e PATHFINDER_ETHEREUM_API_URL="wss://sepolia.infura.io/ws/v3/" \ eqlabs/pathfinder \ --monitor-address 0.0.0.0:9000 ``` -------------------------------- ### Enable Monitoring API with Cargo Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Enables the monitoring API by specifying the monitor address when running Pathfinder from source using Cargo. ```bash cargo run --release --bin pathfinder -- \ --monitor-address 0.0.0.0:9000 \ --some-other-options ``` -------------------------------- ### Enable Native Execution Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Enable native execution to improve Cairo execution performance by compiling Cairo classes into platform-specific binaries. ```bash --rpc.native-execution true ``` -------------------------------- ### Prometheus Configuration for Pathfinder Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md A sample Prometheus configuration file (`prometheus.yml`) to scrape metrics from a Pathfinder node running on the default port 9000. ```yaml scrape_configs: - job_name: 'pathfinder' static_configs: - targets: ['localhost:9000'] ``` -------------------------------- ### Supported Log Levels Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md List of supported log levels for Pathfinder, from most to least verbose. ```bash trace debug info # default warn error ``` -------------------------------- ### Configure Pathfinder Consensus Timeouts Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/consensus/README.md Shows how to customize consensus timeouts for proposing, prevoting, precommitting, and committing. This allows tuning the responsiveness and stability of the consensus engine. ```rust let config = Config::new(my_address) .with_wal_dir("/path/to/wal") .with_history_depth(10) .with_timeouts(TimeoutValues { propose_timeout: Duration::from_secs(3), prevote_timeout: Duration::from_secs(1), precommit_timeout: Duration::from_secs(1), commit_timeout: Duration::from_secs(1), }); ``` -------------------------------- ### Configure State Trie Pruning to Archive Mode Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Command-line option to configure Pathfinder to keep the entire history of state tries. ```bash --storage.state-tries=archive ``` -------------------------------- ### Specify Network for Pathfinder Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Command-line option to explicitly set the Starknet network for Pathfinder. ```bash --network ``` -------------------------------- ### Rebuild Pathfinder from Source Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/updating-pathfinder.md Command to compile the Pathfinder node after pulling the latest source code changes. ```bash cargo build --release --bin pathfinder ``` -------------------------------- ### Deploy Website Without SSH Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/README.md Deploys the website without using SSH, requiring your GitHub username. ```bash GIT_USER= yarn deploy ``` -------------------------------- ### Check Docker Compose Logs Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md View the logs for services managed by Docker Compose to monitor Pathfinder's operation. ```bash docker-compose logs -f ``` -------------------------------- ### Verify Snapshot Checksum Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Calculate the SHA256 checksum of the downloaded snapshot file to ensure data integrity. ```bash sha256sum mainnet.sqlite.zst ``` -------------------------------- ### Check Pathfinder Docker Logs Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md View the real-time logs of the running Pathfinder Docker container to monitor its status and troubleshoot issues. ```bash docker logs -f pathfinder ``` -------------------------------- ### Replace Existing Database File Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Move the extracted SQLite database file to the Pathfinder data directory, replacing the old one. Ensure paths and filenames match your network configuration. ```bash mv mainnet.sqlite /path/to/your/pathfinder/data/mainnet.sqlite ``` -------------------------------- ### Clone Pathfinder Repository Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Clones the Pathfinder source code from GitHub and checks out the latest release tag. Replace `` with the actual tag. ```bash git clone https://github.com/equilibriumco/pathfinder.git cd pathfinder git checkout ``` -------------------------------- ### Synced Status Endpoint Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md This endpoint extends the readiness check by confirming that Pathfinder is within six blocks of the network's current tip. A 200 OK response signifies that the node is ready and nearly fully synced. ```bash curl -i http://localhost:9000/ready/synced ``` -------------------------------- ### Recreate Pathfinder Docker Container Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/updating-pathfinder.md Command to create a new Pathfinder container using the latest Docker image, preserving data and configuration. ```bash docker run \ --name pathfinder \ --restart unless-stopped \ --detach \ -p 9545:9545 \ --user "$(id -u):$(id -g)" \ -e RUST_LOG=info \ -e PATHFINDER_ETHEREUM_API_URL="wss://sepolia.infura.io/ws/v3/" \ -v $HOME/pathfinder:/usr/share/pathfinder/data \ eqlabs/pathfinder ``` -------------------------------- ### Poseidon Round Keys Constants Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/spec/poseidon.ipynb Defines the round keys used in the Starkware Poseidon hash function implementation. These constants are essential for the correct functioning of the algorithm. ```python RoundKeys = [ [ 2950795762459345168613727575620414179244544320470208355568817838579231751791, 1587446564224215276866294500450702039420286416111469274423465069420553242820, 1645965921169490687904413452218868659025437693527479459426157555728339600137, ], [ 2782373324549879794752287702905278018819686065818504085638398966973694145741, 3409172630025222641379726933524480516420204828329395644967085131392375707302, 2379053116496905638239090788901387719228422033660130943198035907032739387135, ], [ 2570819397480941104144008784293466051718826502582588529995520356691856497111, 3546220846133880637977653625763703334841539452343273304410918449202580719746, 2720682389492889709700489490056111332164748138023159726590726667539759963454, ], [ 1899653471897224903834726250400246354200311275092866725547887381599836519005, 2369443697923857319844855392163763375394720104106200469525915896159690979559, 2354174693689535854311272135513626412848402744119855553970180659094265527996, ], [ 2404084503073127963385083467393598147276436640877011103379112521338973185443, 950320777137731763811524327595514151340412860090489448295239456547370725376, 2121140748740143694053732746913428481442990369183417228688865837805149503386, ], [ 2372065044800422557577242066480215868569521938346032514014152523102053709709, 2618497439310693947058545060953893433487994458443568169824149550389484489896, 3518297267402065742048564133910509847197496119850246255805075095266319996916, ], [ 340529752683340505065238931581518232901634742162506851191464448040657139775, 1954876811294863748406056845662382214841467408616109501720437541211031966538, 813813157354633930267029888722341725864333883175521358739311868164460385261, ], [ 71901595776070443337150458310956362034911936706490730914901986556638720031, 2789761472166115462625363403490399263810962093264318361008954888847594113421, 2628791615374802560074754031104384456692791616314774034906110098358135152410, ], [ 3617032588734559635167557152518265808024917503198278888820567553943986939719, 26240123602099661173322788103333497793082705816015202046036057821340914061980, 149101987103211771991327927827692640556911620408176100290586418839323044234, ], [ 1039927963829140138166373450440320262590862908847727961488297105916489431045, 2213946951050724449162431068646025833746639391992751674082854766704900195669, 2792724903541814965769131737117981991997031078369482697195201969174353468597, ], [ 3212031629728871219804596347439383805499808476303618848198208101593976279441, 3343514080098703935339621028041191631325798327656683100151836206557453199613, 614054702436541219556958850933730254992710988573177298270089989048553060199, ], [ 148148081026449726283933484730968827750202042869875329032965774667206931170, 1158283532103191908366672518396366136968613180867652172211392033571980848414, 1032400527342371389481069504520755916075559110755235773196747439146396688513, ], [ 806900704622005851310078578853499250941978435851598088619290797134710613736, 462498083559902778091095573017508352472262817904991134671058825705968404510, 1003580119810278869589347418043095667699674425582646347949349245557449452503, ], [ 619074932220101074089137133998298830285661916867732916607601635248249357793, 2635090520059500019661864086615522409798872905401305311748231832709078452746, 978252636251682252755279071140187792306115352460774007308726210405257135181, ], [ 1766912167973123409669091967764158892111310474906691336473559256218048677083, 1663265127259512472182980890707014969235283233442916350121860684522654120381, 3532407621206959585000336211742670185380751515636605428496206887841428074250, ], [ 2507023127157093845256722098502856938353143387711652912931112668310034975446, 3321152907858462102434883844787153373036767230808678981306827073335525034593, 3039253036806065280643845548147711477270022154459620569428286684179698125661, ], [ 103480338868480851881924519768416587261556021758163719199282794248762465380, 2394049781357087698434751577708655768465803975478348134669006211289636928495, 2660531560345476340796109810821127229446538730404600368347902087220064379579, ], [ 3603166934034556203649050570865466556260359798872408576857928196141785055563, ``` -------------------------------- ### Synced Status Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Extends the readiness check by ensuring Pathfinder is within six blocks of the network's current tip, confirming it is both ready and nearly fully synced. ```APIDOC ## GET /ready/synced ### Description Checks if Pathfinder is ready and closely tracking the network's latest blocks (within six blocks). ### Method GET ### Endpoint /ready/synced ### Response #### Success Response (200 OK) The node is ready for requests and closely tracking the chain’s latest blocks. #### Error Response (503 Service Unavailable) The node is still starting or more than six blocks behind the network tip. ``` -------------------------------- ### Pull Latest Source Changes Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/updating-pathfinder.md Use this command to fetch the latest updates from the Pathfinder source code repository. ```bash git pull ``` -------------------------------- ### Pull Latest Docker Image Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/updating-pathfinder.md Use this command to fetch the most recent Pathfinder Docker image from the registry. ```bash docker pull eqlabs/pathfinder ``` -------------------------------- ### Configure Rclone for Pathfinder Snapshots Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Add this configuration to your Rclone config file to connect to the snapshot storage. ```ini [pathfinder-snapshots] type = s3 provider = Cloudflare env_auth = false access_key_id = 7635ce5752c94f802d97a28186e0c96d secret_access_key = 529f8db483aae4df4e2a781b9db0c8a3a7c75c82ff70787ba2620310791c7821 endpoint = https://cbf011119e7864a873158d83f3304e27.r2.cloudflarestorage.com acl = private ``` -------------------------------- ### Enable Archive Mode for Blockchain History Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Use this option to keep the entire blockchain history. This can be storage-intensive. ```bash --storage.blockchain-history=archive ``` -------------------------------- ### Recover Pathfinder Consensus State Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/consensus/README.md Demonstrates how to recover the consensus state from a write-ahead log (WAL) after a node restart. This ensures continuity of consensus operations by loading the last committed state. ```rust let validator_sets = Arc::new(StaticValidatorSetProvider::new(validator_set)); let highest_committed = storage.get_highest_block()?; // Your storage layer let consensus = Consensus::recover(config, validator_sets, highest_committed)?; ``` -------------------------------- ### Mainnet Incident Timeline Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/incidents/2023-06-17_mainnet_incident.md A chronological log of events during the 2023-06-17 mainnet incident, from the initial block failure to the incident's resolution. This timeline includes specific times, block numbers, and key actions taken. ```text 2023-06-17 18:05 Block `84 448` is created, Pathfinder nodes start failing 2023-06-17 19:10 Issue reported by Francesco via Telegram DM 2023-06-17 19:20 Test case replicating the failure created 2023-06-17 19:22 Issue raised with Starkware, at this point severity still unclear 2023-06-17 20:10 Reach out to others in the ecosystem for help, notably Jonathan Lei 2023-06-17 20:30 Follow potential leads given by Starkware engineers, unfortunately without success 2023-06-18 03:00 Jonathan Lei determines the root cause 2023-06-18 05:23 Jonathan Lei PR submitted with fix 2023-06-18 06:00 PR merged 2023-06-18 06:05 Pathfinder release build v0.5.7 initiated 2023-06-18 06:55 Pathfinder release build v0.5.7 completed 2023-06-18 07:00 Pathfinder release build v0.6.1 initiated 2023-06-18 08:30 Pathfinder release build v0.6.1 completed 2023-06-18 08:30 API services start upgrading 2023-06-18 10:30 API services upgraded 2023-06-18 11:30 API services back in sync and online 2023-06-18 11:30 incident over ``` -------------------------------- ### Extract Zstd Compressed Snapshot Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/database-snapshots.md Decompress the zstd-compressed snapshot file to obtain the SQLite database. Requires zstd version 1.5 or later. ```bash zstd -T0 -d mainnet.sqlite.zst -o mainnet.sqlite ``` -------------------------------- ### Poseidon Permutation Zero-Test Vector Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/spec/poseidon.ipynb Tests the Poseidon permutation function with a zero vector [0,0,0] to verify its correctness against a known output. ```python poseidon_permute(parse_vector([0,0,0])) ``` -------------------------------- ### Configure State Trie Pruning to Pruned Mode Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Command-line option to configure Pathfinder to keep only recent state tries, specified by the number of blocks 'k'. ```bash --storage.state-tries= ``` -------------------------------- ### Pathfinder Sync Error: Class Hash Mismatch Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/incidents/2023-06-17_mainnet_incident.md This log indicates a critical error during the L2 sync process where Pathfinder encountered a class hash mismatch. It shows the expected hash versus the received hash for a specific block, halting the sync. ```log WARN L2 sync process terminated with: Handling newly declared classes for block BlockNumber(84448) Caused by: 0: Downloading class 0x00801AD5DC7C995ADDF7FBCE1C4C74413586ACB44F9FF44BA903A08A6153FA80 1: Class hash mismatch, 0x05294AB04A4BDFAEBBAE72688888D465AA4C5FD232D979A61AF1217215E1455A instead of 0x00801AD5DC7C995ADDF7FBCE1C4C74413586ACB44F9FF44BA903A08A6153FA80 ``` -------------------------------- ### Health Check Endpoint Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Use this endpoint to verify if the Pathfinder process is active and not in a fatal error state. A 200 OK response indicates the process is running. ```bash curl -i http://localhost:9000/health ``` -------------------------------- ### Update Rust Toolchain Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Updates the Rust toolchain to the latest stable version, ensuring compatibility with Pathfinder's build requirements. ```bash rustup update ``` -------------------------------- ### JSON-RPC Request Structure Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md A standard JSON-RPC 2.0 request format used for interacting with the API. ```APIDOC ## JSON-RPC Request Structure ### Description A standard JSON-RPC 2.0 request format used for interacting with the API. ### Request Body - **jsonrpc** (string) - Required - Specifies the JSON-RPC protocol version, typically "2.0". - **method** (string) - Required - The name of the method to be invoked. - **params** (array) - Optional - An array of parameters to be passed to the method. - **id** (integer or string) - Required - An identifier for the request, used to match responses to requests. ``` -------------------------------- ### Stop and Remove Docker Container Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/updating-pathfinder.md Commands to stop and remove the existing Pathfinder Docker container before updating. ```bash docker stop pathfinder docker rm pathfinder ``` -------------------------------- ### Pathfinder JSON Extensions Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md Pathfinder provides additional JSON-RPC extension methods for advanced use cases. ```APIDOC ## Pathfinder JSON Extensions ### Description Pathfinder offers custom extensions beyond the standard JSON-RPC specification for advanced functionalities. ### Endpoint `/rpc/pathfinder/v0_1` ### Usage Refer to the [Pathfinder repository](https://github.com/equilibriumco/pathfinder/blob/main/specs/rpc/pathfinder_rpc_api.json) for the complete specification of these extension methods. ``` -------------------------------- ### Enable Pruned Mode for Blockchain History Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/configuration.md Use this option to preserve only recent blocks, keeping the last k+1 blocks. 'k' is a configurable number. ```bash --storage.blockchain-history= ``` -------------------------------- ### JSON-RPC Request Structure Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/interacting-with-pathfinder/json-rpc-api.md A typical JSON-RPC request structure used for interacting with the API. ```json { "jsonrpc": "2.0", "method": "", "params": [...], "id": 1 } ``` -------------------------------- ### Poseidon Constants Definition Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/spec/poseidon.ipynb Defines the constants used in the Poseidon permutation, including Rate, Capacity, FullRounds, PartialRounds, and the MDS matrix. ```python Rate = 2 Capacity = 1 FullRounds = 8 PartialRounds = 83 MDS = [[3, 1, 1], [1, -1, 1], [1, 1, -2]] ``` -------------------------------- ### Poseidon Permutation Function Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/spec/poseidon.ipynb Defines the full Poseidon permutation by applying a sequence of full and partial rounds to the state. ```python def poseidon_permute(state): idx = 0 for _ in range(FullRounds/2): state = poseidon_round(state,idx,true) idx += 1 for _ in range(PartialRounds): state = poseidon_round(state,idx,false) idx += 1 for _ in range(FullRounds/2): state = poseidon_round(state,idx,true) idx += 1 return state ``` -------------------------------- ### Health Check Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/monitoring-and-metrics.md Confirms that the Pathfinder process is active and not in a fatal error state. A successful response indicates the process is running, but not necessarily synchronized or ready. ```APIDOC ## GET /health ### Description Checks if the Pathfinder process is running and responsive. ### Method GET ### Endpoint /health ### Response #### Success Response (200 OK) The node process is running and can respond to HTTP requests. #### Error Response 4xx or 5xx: The endpoint is unreachable, or the node is encountering a critical error. ``` -------------------------------- ### Stop Pathfinder Docker Container Source: https://github.com/equilibriumco/pathfinder/blob/main/docs/docs/getting-started/running-pathfinder.md Gracefully stops the running Pathfinder Docker container. ```bash docker stop pathfinder ``` -------------------------------- ### Poseidon Permutation Round Function Source: https://github.com/equilibriumco/pathfinder/blob/main/crates/crypto/spec/poseidon.ipynb Implements a single round of the Poseidon permutation, applying round keys, S-box, and the Mix-Layer (MDS matrix). The S-box application depends on whether it's a full or partial round. ```python def poseidon_round(state,idx,full): state = state + RK[idx] state[2] = state[2]^3 if full: state[1] = state[1]^3 state[0] = state[0]^3 return M * state ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.