### Start Casper Node Source: https://docs.casper.network/operators/setup/install-node Command to start the Casper node service. Ensure the node is properly configured before execution. This command typically requires superuser privileges. ```bash sudo casper-node-util start ``` -------------------------------- ### Install Casper Node Launcher using APT Source: https://docs.casper.network/operators/setup/basic-node-configuration Installs the `casper-node-launcher` using the APT package manager. This command updates the package list and then installs the specified package. This is the recommended method for installing the node launcher. ```bash sudo apt update sudo apt install casper-node-launcher ``` -------------------------------- ### Install Required Casper Node Tools (Shell) Source: https://docs.casper.network/operators/setup/install-node Installs essential tools for running a Casper node, including the client, node launcher, sidecar, and `jq` for JSON processing. ```shell sudo apt install -y casper-client casper-node-launcher casper-sidecar jq ``` -------------------------------- ### Install Casper Node Versions with `node_util.py` Source: https://docs.casper.network/operators/setup/basic-node-configuration This command installs and stages current Casper node versions for a specified network. It requires root privileges and the `casper-node-launcher` to be installed. The command creates necessary directories, expands archive files for binaries and configurations, and generates the `config.toml` file. ```bash sudo -u casper /etc/casper/node_util.py stage_protocols ``` -------------------------------- ### Install Zstandard Compression Utility Source: https://docs.casper.network/operators/maintenance/archiving-and-restoring This command installs the Zstandard (zstd) compression utility on Debian-based systems like Ubuntu. Zstd is recommended for its speed and space efficiency with the current LMDB-based database system used by casper-node. Ensure you have sufficient permissions to install system packages. ```bash sudo apt install zstd ``` -------------------------------- ### Generate `config.toml` from Example Source: https://docs.casper.network/operators/setup/basic-node-configuration This script generates a `config.toml` file for a specific Casper node version from its corresponding example configuration. It requires the version number in `m_n_p` format (using underscores). This is typically used after staging a new node version. ```bash /etc/casper/config_from_example.sh [m_n_p] ``` -------------------------------- ### Clean Up Previous Casper Node Installation (Shell) Source: https://docs.casper.network/operators/setup/install-node Removes existing Casper node files and packages to ensure a clean installation. This script stops the node, uninstalls related packages, and removes state and configuration files. ```shell sudo /etc/casper/node_util.py stop sudo apt remove -y casper-client sudo apt remove -y casper-node sudo apt remove -y casper-node-launcher sudo rm /etc/casper/casper-node-launcher-state.toml sudo rm -rf /etc/casper/1_* sudo rm -rf /etc/casper/2_* sudo rm -rf /var/lib/casper/* ``` -------------------------------- ### Stage Protocols for Casper Node (Shell) Source: https://docs.casper.network/operators/setup/install-node Prepares the necessary protocol configurations for the Casper node. This command needs to be run with the appropriate configuration file for Mainnet or Testnet. ```shell sudo -u casper casper-node-util stage_protocols casper.conf ``` ```shell sudo -u casper casper-node-util stage_protocols casper-test.conf ``` -------------------------------- ### Set Up Casper Repository (Shell) Source: https://docs.casper.network/operators/setup/install-node Configures the APT package manager to use the Casper network repository. This involves creating a directory for GPG keys, downloading the repository's public key, and adding the repository source list. ```shell sudo mkdir -m 0755 -p /etc/apt/keyrings/ sudo curl https://repo.casper.network/casper-repo-pubkey.gpg --output /etc/apt/keyrings/casper-repo-pubkey.gpg echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/casper-repo-pubkey.gpg] https://repo.casper.network/releases jammy main" | sudo tee -a /etc/apt/sources.list.d/casper.list sudo apt update ``` -------------------------------- ### Enable Bash Auto-Completion for Casper Client (Shell) Source: https://docs.casper.network/operators/setup/install-node Generates and activates bash auto-completion scripts for the `casper-client` command. This enhances command-line usability by providing suggestions. ```shell sudo casper-client generate-completion source /usr/share/bash-completion/completions/casper-client ``` -------------------------------- ### Start Casper Node Source: https://docs.casper.network/operators/maintenance/moving-node Command to start the Casper node service. This is executed after the keys have been swapped and the era has transitioned. ```shell sudo /etc/casper/node_util.py start ``` -------------------------------- ### Configure Syncing to Genesis Source: https://docs.casper.network/operators/setup/install-node Modify the 'sync_handling' option in Config.toml to 'genesis' to enable syncing all the way back to genesis. This is recommended for nodes used for historical data querying, but should be left at the default 'ttl' for validator nodes to improve performance. ```toml sync_handling = genesis ``` -------------------------------- ### Casper Network: Example Bid Submission for Testnet (CLI) Source: https://docs.casper.network/operators/becoming-a-validator/bonding This is an example command using the Casper Testnet to submit a bid of 10,000 CSPR for a validator slot. It includes specific values for node address, chain name, secret key path, payment amount (in motes), session hash for Testnet, public key, bid amount calculation, and delegation rate. ```bash sudo -u casper casper-client put-deploy \ --node-address http://65.21.75.254:7777 \ --chain-name casper-test \ --secret-key /etc/casper/validator_keys/secret_key.pem \ --payment-amount 2500000000 \ --session-hash hash-93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2 \ --session-entry-point add_bid \ --session-arg "public_key:public_key='01c297d2931fec7e22b2fb1ae3ca5afdfacc2c82ba501e8ed158eecef82b4dcdee'" \ --session-arg "amount:U512='$[10000 * 1000000000]'" \ --session-arg "delegation_rate:u8='10'" ``` -------------------------------- ### Example Bonding Transaction using casper-client Source: https://docs.casper.network/operators/becoming-a-validator/bonding This is a concrete example of a bonding transaction command for the Casper Network, using `add_bid.wasm`. It includes specific values for node address, chain name, payment amount, public key, bidding amount, and delegation rate, demonstrating a typical bonding request. ```bash sudo -u casper casper-client put-deploy \ --node-address http://65.21.235.219:7777 \ --secret-key /etc/casper/validator_keys/secret_key.pem \ --chain-name casper-test \ --payment-amount 3000000000 \ --session-path ~/casper-node/target/wasm32-unknown-unknown/release/add_bid.wasm \ --session-arg "public_key:public_key='01c297d2931fec7e22b2fb1ae3ca5afdfacc2c82ba501e8ed158eecef82b4dcdee'" \ --session-arg "amount:U512='$[10000 * 1000000000]'" \ --session-arg "delegation_rate:u8='10'" ``` -------------------------------- ### Example Auction Info JSON Response Source: https://docs.casper.network/operators/becoming-a-validator/bonding An example of the JSON response structure returned by the `get-auction-info` command. This structure details the bids, including public keys and staked amounts, as well as era validators and their weights. ```json { "jsonrpc": "2.0", "result": { "bids": [ { "bid": { "bonding_purse": "uref-488a0bbc3c3729f5696965da7a3aeee83805392944e36157909da273255fdb85-007", "delegation_rate": 0, "delegators": [], "release_era": null, "reward": "93328432442428418861229954179737", "staked_amount": "10000000000000000" }, "public_key": "013f774a58f4d40bd9b6cce7e306e53646913860ef2a111d00f0fe7794010c4012" }, { "bid": { "bonding_purse": "uref-14e128b099b0c3680100520226e6999b322989586cc22db0630db5ec1329f0a7-007", "delegation_rate": 10, "delegators": [], "release_era": null, "reward": "0", "staked_amount": "9000000000000000" }, "public_key": "01405133e73ef2946fe3a2d76a4c75d305a04ad6b969f3c4a8a0d27235eb260f87" }, { "bid": { "bonding_purse": "uref-6c0bf8cee1c0749dd9766376910867a84b2e826eaf6c118fcb0224c7d8d229dd-007", "delegation_rate": 10, "delegators": [], "release_era": null, "reward": "266185120443441810685787", "staked_amount": "100000000" }, "public_key": "01524a5f3567d7b5ea17ca518c9d0320fb4a75a28a5eab58d06c755c388f20a19f" }, { "bid": { "bonding_purse": "uref-3880b3daf95f962f57e6a4b1589564abf7deef58a1fb0753d1108316bba7b3d7-007", "delegation_rate": 10, "delegators": [], "release_era": null, "reward": "0", "staked_amount": "9000000000000000" }, "public_key": "01a6901408eda702a653805f50060bfe00d5e962747ee7133df64bd7bab50b4643" }, { "bid": { "bonding_purse": "uref-5a777c9cd53456b49eecf25dcc13e12ddff4106175a69f8e24a7c9a4c135df0d-007", "delegation_rate": 0, "delegators": [], "release_era": null, "reward": "93328432442428418861229954179737", "staked_amount": "10000000000000000" }, "public_key": "01d62fc9b894218bfbe8eebcc4a28a1fc4cb3a5c6120bb0027207ba8214439929e" } ], "block_height": 318, "era_validators": [ { "era_id": 20, "validator_weights": [ { "public_key": "013f774a58f4d40bd9b6cce7e306e53646913860ef2a111d00f0fe7794010c4012", "weight": "10000000000000000" }, { "public_key": "01405133e73ef2946fe3a2d76a4c75d305a04ad6b969f3c4a8a0d27235eb260f87", "weight": "9000000000000000" }, { "public_key": "01524a5f3567d7b5ea17ca518c9d0320fb4a75a28a5eab58d06c755c388f20a19f", "weight": "100000000" }, { "public_key": "01a6901408eda702a653805f50060bfe00d5e962747ee7133df64bd7bab50b4643", "weight": "9000000000000000" }, { "public_key": "01d62fc9b894218bfbe8eebcc4a28a1fc4cb3a5c6120bb0027207ba8214439929e", "weight": "10000000000000000" } ] }, { "era_id": 21, "validator_weights": [ { "public_key": "013f774a58f4d40bd9b6cce7e306e53646913860ef2a111d00f0fe7794010c4012", "weight": "10000000000000000" }, { "public_key": "01405133e73ef2946fe3a2d76a4c75d305a04ad6b969f3c4a8a0d27235eb260f87", "weight": "9000000000000000" }, { "public_key": "01524a5f3567d7b5ea17ca518c9d0320fb4a75a28a5eab58d06c755c388f20a19f", "weight": "100000000" }, { "public_key": "01a6901408eda702a653805f50060bfe00d5e962747ee7133df64bd7bab50b4643", "weight": "9000000000000000" }, { "public_key": "01d62fc9b894218bfbe8eebcc4a28a1fc4cb3a5c6120bb0027207ba8214439929e", "weight": "10000000000000000" } ] }, { "era_id": 22, "validator_weights": [ { "public_key": "013f774a58f4d40bd9b6cce7e306e53646913860ef2a111d00f0fe7794010c4012", "weight": "10000000000000000" }, { "public_key": "01405133e73ef2946fe3a2d76a4c75d305a04ad6b969f3c4a8a0d27235eb260f87", "weight": "9000000000000000" }, { "public_key": "01524a5f3567d7b5ea17ca518c9d0320fb4a75a28a5eab58d06c755c388f20a19f", "weight": "100000000" }, { "public_key": "01a6901408eda702a653805f50060bfe00d5e962747ee7133df64bd7bab50b4643", "weight": "9000000000000000" }, { "public_key": "01d62fc9b894218bfbe8eebcc4a28a1fc4cb3a5c6120bb0027207ba8214439929e", "weight": "10000000000000000" } ] } ] } } ``` -------------------------------- ### Run Node Utility Script to Stage Protocols Source: https://docs.casper.network/operators/setup/basic-node-configuration Executes the `node_util.py` script as the `casper` user to stage protocol configurations. This is a crucial step after installing client and node launcher packages, especially when setting up genesis configurations. It prepares the necessary protocol versions for the node. ```bash sudo -u casper /etc/casper/node_util.py stage_protocols casper.conf ``` -------------------------------- ### Generate Validator Keys for Casper Node (Shell) Source: https://docs.casper.network/operators/setup/install-node Creates cryptographic keys required for a validator node on the Casper network. The keys are stored in the specified directory. ```shell sudo -u casper casper-client keygen /etc/casper/validator_keys ``` -------------------------------- ### Force Casper Node Protocol Version on Startup Source: https://docs.casper.network/operators/maintenance/archiving-and-restoring Starts a new Casper node by forcing it to run at a specific protocol version that matches the tip of the provided decompressed database. This is achieved using the node_util.py script. ```bash sudo /etc/casper/node_util.py force_run_version 1_4_5 ``` -------------------------------- ### Monitor Node Synchronization Source: https://docs.casper.network/operators/setup/install-node Command to display detailed information about the Casper node's synchronization process. This output includes block height, peer count, uptime, build version, and reactor state, which helps in diagnosing sync issues. ```bash casper-node-util watch ``` -------------------------------- ### Monitor Node Synchronization with Systemd Source: https://docs.casper.network/operators/setup/install-node This section shows the output of systemd when monitoring the Casper Node Launcher service. It details the service's status, main process ID, resource utilization (memory, CPU), and CGroup information, useful for understanding node health. ```bash ● casper-node-launcher.service - Casper Node Launcher Loaded: loaded (/usr/lib/systemd/system/casper-node-launcher.service; enabled; preset: enabled) Active: active (running) since Wed 2025-08-13 20:41:05 UTC; 1 week 0 days ago Docs: https://docs.casper.network Main PID: 76968 (casper-node-lau) Tasks: 8 (limit: 18921) Memory: 10.2G (peak: 11.0G) CPU: 1d 17h 2min 43.802s CGroup: /system.slice/casper-node-launcher.service ├─76968 /usr/bin/casper-node-launcher └─76971 /var/lib/casper/bin/2_0_3/casper-node validator /etc/casper/2_0_3/config.toml Aug 13 20:41:05 ip-10-0-5-211 systemd[1]: Started casper-node-launcher.service - Casper Node Launcher. ``` -------------------------------- ### Update `config.toml` with Trusted Hash Source: https://docs.casper.network/operators/setup/basic-node-configuration This example demonstrates how to update the `config.toml` file to include a trusted block hash for synchronization. It involves uncommenting a specific line and replacing a placeholder with the actual hash. This is crucial for ensuring nodes synchronize with a reliable network state. ```bash # ================================ # Configuration options for a node # ================================ [node] # trusted_hash = "HEX-FORMATTED BLOCK HASH" ``` -------------------------------- ### Bonding with the System Auction Contract Source: https://docs.casper.network/operators/becoming-a-validator/bonding This section details how to submit a bid to become a validator by calling the `add_bid` entry point of the system auction contract using the `casper-client`. It includes a breakdown of the command-line arguments and an example for the Testnet. ```APIDOC ## POST /auction/add_bid ### Description Submits a bid to become a validator on the Casper network by interacting with the system auction contract. ### Method `POST` (via `casper-client put-deploy`) ### Endpoint N/A (Command-line interaction with the auction contract) ### Parameters #### Command-line Arguments - **`--node-address`** (string) - Required - The IP address and port of a peer on the network (e.g., `http://`). Default port for JSON-RPC is 7777. - **`--secret-key`** (string) - Required - The file path to the account's secret key for signing the deploy. - **`--chain-name`** (string) - Required - The name of the chain (e.g., `casper` for Mainnet, `casper-test` for Testnet). - **`--payment-amount`** (motes) - Required - The amount in motes to pay for the deploy. A fixed cost of 2.5 CSPR (2,500,000,000 motes) is typically required. - **`--session-hash`** (string) - Required - The hex-encoded hash of the stored auction contract. - Testnet: `hash-93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2` - Mainnet: `hash-ccb576d6ce6dec84a551e48f0d0b7af89ddba44c7390b690036257a04a3ae9ea` - **`--session-entry-point`** (string) - Required - Must be set to `add_bid`. - **`--session-arg "public_key:public_key=''"** (string) - Required - The hexadecimal public key of the account submitting the bid. This must match the account associated with the secret key. - **`--session-arg "amount:U512=''"** (U512) - Required - The amount of CSPR (in motes) to bid. Must meet or exceed the `minimum_bid_amount`. - **`--session-arg "delegation_rate:u8=''"** (u8) - Required - The percentage of rewards the node operator retains (0-100). - **`--session-arg "minimum_delegation_amount:u64=''"** (u64) - Optional - The minimum delegation amount in motes. - **`--session-arg "maximum_delegation_amount:u64=''"** (u64) - Optional - The maximum delegation amount in motes. ### Request Example ```bash sudo -u casper casper-client put-deploy \ --node-address http://65.21.75.254:7777 \ --chain-name casper-test \ --secret-key /etc/casper/validator_keys/secret_key.pem \ --payment-amount 2500000000 \ --session-hash hash-93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2 \ --session-entry-point add_bid \ --session-arg "public_key:public_key='01c297d2931fec7e22b2fb1ae3ca5afdfacc2c82ba501e8ed158eecef82b4dcdee'" \ --session-arg "amount:U512='$[10000 * 1000000000]'" \ --session-arg "delegation_rate:u8='10'" ``` ### Response Upon successful submission, the command returns a deploy hash, which can be used to track the transaction's status. #### Success Response (Deploy Hash) - **deploy_hash** (string) - The unique identifier for the submitted deploy transaction. #### Response Example ```json { "deploy_hash": "" } ``` ### Error Handling - Insufficient payment amount. - Invalid session hash or entry point. - Bid amount below the minimum threshold. - Invalid session arguments (e.g., incorrect types, invalid public key format). - Network connectivity issues. ### Notes - The bonding process, from bid submission to inclusion in the validator set, can take a minimum of six hours on the Testnet due to era durations. - The minimum bid amount is defined in `chainspec.toml` and is currently 10,000 CSPR (10,000,000,000,000 motes). - Calling the `add_bid` entry point has a fixed cost of 2.5 CSPR. ``` -------------------------------- ### Fetch Trie Chunk Metrics Source: https://docs.casper.network/operators/setup/install-node Use curl to fetch metrics from the node's metrics endpoint (defaulting to port 8888) and grep for 'trie_or_chunk' related statistics. This helps in monitoring the download progress of trie chunks, indicating synchronization status. ```bash $ curl -s 127.0.0.1:8888/metrics | grep trie_or_chunk # HELP trie_or_chunk_fetch_total number of trie_or_chunk all fetch requests made # TYPE trie_or_chunk_fetch_total counter trie_or_chunk_fetch_total 102647 # HELP trie_or_chunk_found_in_storage number of fetch requests that found trie_or_chunk in local storage # TYPE trie_or_chunk_found_in_storage counter trie_or_chunk_found_in_storage 0 # HELP trie_or_chunk_found_on_peer number of fetch requests that fetched trie_or_chunk from peer # TYPE trie_or_chunk_found_on_peer counter trie_or_chunk_found_on_peer 102263 # HELP trie_or_chunk_timeouts number of trie_or_chunk fetch requests that timed out # TYPE trie_or_chunk_timeouts counter trie_or_chunk_timeouts 0 ``` -------------------------------- ### Set Trusted Hash in Casper Node Config (Shell) Source: https://docs.casper.network/operators/setup/install-node Updates the `trusted_hash` setting in the Casper node's configuration file. This command dynamically fetches a recent block hash and uses `jq` to parse it. ```shell NODE_ADDR=https://node.mainnet.casper.network/rpc PROTOCOL=2_0_0 sudo sed -i "/trusted_hash =/c\trusted_hash = '$(casper-client get-block --node-address $NODE_ADDR | jq -r .result.block_with_signatures.block.Version2.hash | tr -d '\n')'" /etc/casper/$PROTOCOL/config.toml ``` -------------------------------- ### Configure Activation Point in chainspec.toml Source: https://docs.casper.network/operators/maintenance/upgrade This configuration snippet shows how to set the activation point for a new protocol version within the chainspec.toml file. The activation_point determines when the new casper-node version will start running. ```toml [protocol] # This protocol version becomes active at the start of this era. activation_point = 100 ``` -------------------------------- ### Extract Specific Node Status Fields Source: https://docs.casper.network/operators/setup/node-endpoints Retrieves specific fields from the node's status JSON response using `jq`. This example extracts the API version, last added block information, build version, and uptime. ```shell curl -s http://:8888/status | jq -r '.api_version, .last_added_block_info, .build_version, .uptime' ``` -------------------------------- ### Get Node Health Metrics Source: https://docs.casper.network/operators/setup/node-endpoints Retrieves general health metrics from a Casper node. This command sends an HTTP GET request to the /metrics endpoint of the node. The output is raw metrics data. ```shell curl -s http://:8888/metrics ``` -------------------------------- ### Configure SSH Access (Bash) Source: https://docs.casper.network/operators/setup/non-root-user Sets up the .ssh directory and authorized_keys file for the new user, allowing for SSH key-based logins. Permissions are set to ensure security. ```bash sudo su - mkdir .ssh chmod 700 .ssh touch .ssh/authorized_keys ``` -------------------------------- ### GET /metrics Source: https://docs.casper.network/operators/setup/node-endpoints Retrieves general health metrics for the Casper node. This endpoint provides performance and operational data. ```APIDOC ## GET /metrics ### Description Retrieves general health metrics for the Casper node. This endpoint provides performance and operational data. ### Method GET ### Endpoint http://:8888/metrics ### Parameters #### Path Parameters * None #### Query Parameters * None ### Request Example ```bash curl -s http://:8888/metrics ``` ### Response #### Success Response (200) Returns a plain text response containing various metrics about the node's health and performance. #### Response Example ``` # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0.5"} 0.021438005500000002 go_gc_duration_seconds{quantile="0.9"} 0.023022999500000003 go_gc_duration_seconds{quantile="0.99"} 0.023022999500000003 go_gc_duration_seconds 0.021438005500000002 10 ... ``` ``` -------------------------------- ### GET /status Source: https://docs.casper.network/operators/setup/node-endpoints Retrieves the current status of the Casper node, including API version, chain information, peers, and block details. ```APIDOC ## GET /status ### Description Retrieves the current status of the Casper node, including API version, chain information, peers, and block details. The response is in JSON format and can be filtered using `jq`. ### Method GET ### Endpoint http://:8888/status ### Parameters #### Path Parameters * None #### Query Parameters * None ### Request Example ```bash curl -s http://:8888/status ``` ### Response #### Success Response (200) Returns a JSON object containing various details about the node's status. #### Response Example ```json { "api_version": "1.4.15", "chainspec_name": "casper-test", "starting_state_root_hash": "4c3856bd6a95b566301b9da61aaf84589a51ee2980f3cc7bbef78e7745386955", "peers": [ { "node_id": "tls:007e..e14b", "address": "89.58.52.245:35000" }, { "node_id": "tls:00eb..ac11", "address": "65.109.17.120:35000" }, ... { "node_id": "tls:ffc0..555b", "address": "95.217.228.224:35000" } ], "last_added_block_info": { "hash": "7acd2f48b573704e96eab54322f7e91a0624252baca3583ad2aae38229fe1715", "timestamp": "2023-05-10T09:20:10.752Z", "era_id": 9085, "height": 1711254, "state_root_hash": "1ac74071c1e76937c372c8d2ae22ea036a77578aad03821ec98021fdc1c5d06b", "creator": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca" }, "our_public_signing_key": "0107cba5b4826a87ddbe0ba8cda8064881b75882f05094c1a5f95e957512a3450e", "round_length": "32s 768ms", "next_upgrade": null, "build_version": "1.4.15-039d438f2-casper-mainnet", "uptime": "5days 13h 46m 54s 520ms" } ``` ### Filtering the Response The response can be filtered using `jq` with the following keys: * `api_version` - The RPC API version * `chainspec_name` - The chainspec name, used to identify the currently connected network * `starting_state_root_hash` - The state root hash used at the start of the current session * `peers` - The node ID and network address of each connected peer * `last_added_block_info` - The minimal info of the last Block from the linear chain * `our_public_signing_key` - Our public signing key * `round_length` - The next round length if this node is a validator. * `next_upgrade` - Information about the next scheduled upgrade * `build_version` - The compiled node version * `uptime` - Time that has passed since the node has started. #### Example: Retrieving specific fields ```bash curl -s http://:8888/status | jq -r '.api_version, .last_added_block_info, .build_version, .uptime' ``` #### Example: Retrieving `next_upgrade` ```bash curl -s http://:8888/status | jq .next_upgrade ``` #### Example: Retrieving `last_added_block_info` ```bash curl -s http://:8888/status | jq .last_added_block_info ``` ``` -------------------------------- ### SSH Login with Private Key (Bash) Source: https://docs.casper.network/operators/setup/non-root-user Demonstrates how to log into the server using the newly configured non-root user and a specified private SSH key. This replaces traditional root login. ```bash ssh -i @ ``` ```bash ssh -i ~/.ssh/id_rsa casper@10.21.10.200 ``` -------------------------------- ### GET /events Source: https://docs.casper.network/operators/setup/node-events Retrieves the live event stream from a Casper node. This endpoint streams Server Sent Events (SSE). ```APIDOC ## GET /events ### Description Retrieves the live event stream from a Casper node via Server Sent Events (SSE). This is useful for real-time monitoring of node activity. ### Method GET ### Endpoint `/events` ### Query Parameters #### `start_from` (integer) - Optional Specifies the event ID to start replaying the stream from. If set to 0 or an ID not found in the cache, the stream will replay all cached events. If omitted, the stream starts from the latest event. ### Request Example ```bash curl -s http://HOST:PORT/events/ ``` ### Response #### Success Response (200) The response is a stream of Server Sent Events. Each event is formatted as a distinct message. #### Response Example ``` event: state_updated data: {"block_hash": "...", "deploy_hash": "...", ...} event: deploy_processed data: {"deploy_hash": "...", "account": "...", ...} ... ``` ``` -------------------------------- ### Get Last Added Block Information Source: https://docs.casper.network/operators/setup/node-endpoints Retrieves detailed information about the most recently added block to the node's chain. This command filters the status JSON for the `last_added_block_info` field. ```shell curl -s http://:8888/status | jq .last_added_block_info ``` -------------------------------- ### Create Non-Root User (Bash) Source: https://docs.casper.network/operators/setup/non-root-user Creates a new user with no password, relying on SSH key authentication. This is the initial step for setting up a secure, non-root user account. ```bash sudo adduser --disabled-password ``` -------------------------------- ### Get Next Upgrade Information Source: https://docs.casper.network/operators/setup/node-endpoints Retrieves information about the next scheduled network upgrade from the node's status endpoint. It specifically filters the JSON response for the `next_upgrade` field. ```shell curl -s http://:8888/status | jq .next_upgrade ``` -------------------------------- ### Get Block Timestamp with Casper Client Source: https://docs.casper.network/operators/maintenance/moving-node Fetches the timestamp of a specific block using its hash. This helps in identifying the exact time of the last switch block for synchronization. ```shell $ casper-client get-block -b 2487f80a5b1aed5bd36e19f1ccad075a277d5159319da14b07c3d3d954d269dc | jq -r .result.block_with_signatures.block.Version2.header.timestamp 2025-09-03T13:15:58.738Z ``` -------------------------------- ### Get Era Summary Block Hash with Casper Client Source: https://docs.casper.network/operators/maintenance/moving-node Retrieves the block hash of the current era summary using the Casper client. This is the first step in determining the timing for key swaps. ```shell $ casper-client get-era-summary | jq -r .result.era_summary.block_hash 2487f80a5b1aed5bd36e19f1ccad075a277d5159319da14b07c3d3d954d269dc ``` -------------------------------- ### Prepare Validator and Backup Keys Directory Structure Source: https://docs.casper.network/operators/maintenance/moving-node This snippet illustrates the required directory structure for managing validator and backup keys on both the old and new nodes. It ensures keys are organized for easy swapping. ```shell /etc/casper/validator_keys/ ├── public_key.pem ├── public_key_hex ├── secret_key.pem ├── validator │ ├── public_key.pem │ ├── public_key_hex │ └── secret_key.pem └── backup | ├── public_key.pem | ├── public_key_hex | └── secret_key.pem ``` -------------------------------- ### Copy Backup Keys to Active Directory Source: https://docs.casper.network/operators/maintenance/moving-node This command copies the backup keys from the 'backup' subdirectory to the main keys directory. This is used to transition a node to a backup role or if a rollback is needed. ```shell cd /etc/casper/validator_keys/backup sudo -u casper cp * ../ ``` -------------------------------- ### Compress Casper Node Database with Tar and Zstandard Source: https://docs.casper.network/operators/maintenance/archiving-and-restoring This command streams the output of 'tar' (archiving the database directory) directly into 'zstd' for compression. It configures Zstandard with a specified compression level, verbose output, a thread count optimized for the system (T0), and long-distance matching for maximum space savings. The compressed output is saved to a .tar.zst file. ```bash tar -b 4096 -cv --sparse . | zstd -[level] -cv -T[thread count] --long=31 > [path_to]/file.tar.zst ``` ```bash tar -b 4096 -cv --sparse . | zstd -15 -cv -T0 --long=31 > [path_to]/file.tar.zst ``` ```bash tar -b 4096 -cv --sparse . | zstd -5 -cv -T0 --long=31 > [path_to]/file.tar.zst ``` -------------------------------- ### Bonding Transaction Template using casper-client Source: https://docs.casper.network/operators/becoming-a-validator/bonding This command-line template demonstrates how to send a bonding request to the Casper Network using a compiled `add_bid.wasm` file. It requires specifying network connection details, account keys, chain information, payment amount, and parameters for the Wasm session. ```bash sudo -u casper casper-client put-deploy \ --node-address http:// \ --secret-key /etc/casper/validator_keys/secret_key.pem \ --chain-name \ --payment-amount \ --session-path $HOME/casper-node/target/wasm32-unknown-unknown/release/add_bid.wasm \ --session-arg "public_key:public_key=''" \ --session-arg "amount:u512=''" \ --session-arg "delegation_rate:u8=''" \ --session-arg "minimum_delegation_amount:u64=''" \ --session-arg "maximum_delegation_amount:u64=''" ``` -------------------------------- ### Grant Sudo Privileges (Bash) Source: https://docs.casper.network/operators/setup/non-root-user Modifies the sudoers file to grant the new user passwordless sudo access. This allows the non-root user to execute commands with elevated privileges. ```bash sudo visudo # Add the following line below the root entry: ALL=(ALL:ALL) NOPASSWD:ALL ``` -------------------------------- ### Get Node Status Source: https://docs.casper.network/operators/setup/node-endpoints Fetches the current status of a Casper node. This command targets the /status endpoint, which returns a JSON object containing detailed information about the node's operation, including API version, chain information, peers, and block details. ```shell curl -s http://:8888/status ``` -------------------------------- ### Activate Bid using Casper Client (Bash) Source: https://docs.casper.network/operators/becoming-a-validator/recovering This command activates a validator's bid by calling the 'activate_bid' entry point of the system auction contract. It requires specifying node address, secret key, chain name, payment amount, session hash, and validator public key. This method simplifies the process by not requiring custom contract development. ```bash sudo -u casper casper-client put-deploy \ --node-address \ --secret-key \ --chain-name \ --payment-amount \ --session-hash \ --session-entry-point activate_bid \ --session-arg "validator:public_key='$(cat /etc/casper/validator_keys/public_key_hex)'" ``` ```bash sudo -u casper casper-client put-deploy \ --node-address https://node.testnet.casper.network \ --secret-key /etc/casper/validator_keys/secret_key.pem \ --chain-name casper-test \ --payment-amount 2500000000 \ --session-hash hash-93d923e336b20a4c4ca14d592b60e5bd3fe330775618290104f9beb326db7ae2 \ --session-entry-point activate_bid \ --session-arg "validator:public_key='$(cat /etc/casper/validator_keys/public_key_hex)'" ``` ```bash sudo -u casper casper-client put-deploy \ --node-address https://node.mainnet.casper.network \ --secret-key /etc/casper/validator_keys/secret_key.pem \ --chain-name casper \ --payment-amount 2500000000 \ --session-hash hash-ccb576d6ce6dec84a551e48f0d0b7af89ddba44c7390b690036257a04a3ae9ea \ --session-entry-point activate_bid \ --session-arg "validator:public_key='$(cat /etc/casper/validator_keys/public_key_hex)'" ``` -------------------------------- ### Check Current Open Files Limit Source: https://docs.casper.network/operators/setup/open-files Displays the current soft and hard limits for the number of open files ('nofile') for a given process ID. It uses the 'prlimit' command with the PID obtained from 'pgrep'. Requires 'sudo' privileges. ```bash sudo prlimit -n -p ``` ```bash sudo prlimit -n -p $(pgrep "casper-node$") ```