> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sei.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Nodes with seictl

> Install and use the seictl CLI to patch Sei node configuration and genesis files safely with merge-patch workflows.

`seictl` is a purpose-built CLI that helps Sei node patch configuration TOML files (`app.toml`, `client.toml`, `config.toml`) and JSON genesis files.

<Info>You can find the `seictl` GitHub repository [here](https://github.com/sei-protocol/seictl) </Info>

## Features

* **Configuration Management**: Patch Sei daemon configuration files (`app.toml`, `client.toml`, `config.toml`)
* **Genesis Management**: Apply merge patches to genesis JSON files
* **Universal Patching**: Apply merge patches to any TOML or JSON file
* **Smart Target Detection**: Automatically detects which configuration file to modify based on patch content
* **Flexible Output**: Write to stdout, a specific file, or modify files in-place
* **Atomic Writes**: Safe file modifications using atomic write operations
* **Merge Patch Algorithm**: Intelligently merges patches with existing configurations

## Installation

### Pre-built Binaries (Recommended)

Pre-built binaries are available for Linux, macOS, and Windows. Download the latest release from
the [releases page](https://github.com/sei-protocol/seictl/releases).

#### Quick Install

<Accordion title="Linux (x86_64)">
  ```bash theme={"dark"}
  curl -LO https://github.com/sei-protocol/seictl/releases/latest/download/seictl_Linux_x86_64.tar.gz
  tar -xzf seictl_Linux_x86_64.tar.gz
  sudo mv seictl /usr/local/bin/
  ```
</Accordion>

<Accordion title="Linux (ARM64)">
  ```bash theme={"dark"}
  curl -LO https://github.com/sei-protocol/seictl/releases/latest/download/seictl_Linux_arm64.tar.gz
  tar -xzf seictl_Linux_arm64.tar.gz
  sudo mv seictl /usr/local/bin/
  ```
</Accordion>

<Accordion title="Linux (ARMv7)">
  ```bash theme={"dark"}
  curl -LO https://github.com/sei-protocol/seictl/releases/latest/download/seictl_Linux_armv7.tar.gz
  tar -xzf seictl_Linux_armv7.tar.gz
  sudo mv seictl /usr/local/bin/
  ```
</Accordion>

<Accordion title="macOS (Apple Silicon)">
  ```bash theme={"dark"}
  curl -LO https://github.com/sei-protocol/seictl/releases/latest/download/seictl_Darwin_arm64.tar.gz
  tar -xzf seictl_Darwin_arm64.tar.gz
  sudo mv seictl /usr/local/bin/
  ```
</Accordion>

<Accordion title="macOS (Intel)">
  ```bash theme={"dark"}
  curl -LO https://github.com/sei-protocol/seictl/releases/latest/download/seictl_Darwin_x86_64.tar.gz

  tar -xzf seictl_Darwin_x86_64.tar.gz
  sudo mv seictl /usr/local/bin/
  ```
</Accordion>

<Accordion title="Windows (x86_64)">
  ```powershell theme={"dark"}
  # Download from: https://github.com/sei-protocol/seictl/releases/latest/download/seictl_Windows_x86_64.zip
  # Extract and add to PATH
  ```
</Accordion>

#### Verify Installation

```bash theme={"dark"}
seictl --version
```

#### Verify Download (Optional)

All releases include a `checksums.txt` file for verification, e.g.:

```bash theme={"dark"}
# Download checksums
curl -LO https://github.com/sei-protocol/seictl/releases/latest/download/checksums.txt

# Verify (Linux/macOS)
sha256sum -c checksums.txt 2>&1 | grep seictl_Linux_x86_64.tar.gz
```

### Build from Source

If you prefer to build from source or need a specific configuration:

#### Prerequisites

* Go 1.24.5 or higher

#### Build

```bash theme={"dark"}
git clone https://github.com/sei-protocol/seictl.git
cd seictl
go build -o seictl
```

### Install via Go

```bash theme={"dark"}
go install github.com/sei-protocol/seictl@latest
```

## Usage

```
seictl [global options] command [command options] [arguments...]
```

### Global Options

* `--home <path>`: Sei home directory (default: `~/.sei`, can be set via `SEI_HOME` environment variable)

## Commands

### Patch Command

#### `patch`

Apply a merge-patch to any TOML or JSON file. This is a universal patching command that works with any file format, not
just Sei-specific configurations.

```bash theme={"dark"}
seictl patch --target <file-path> [patch-file]
```

**Options:**

* `--target <path>`: Path to the TOML or JSON file to patch (required)
* `-o, --output <path>`: Write output to specified file
* `-i, --in-place-rewrite`: Modify the target file in-place

**Examples:**

```bash theme={"dark"}
# Patch any TOML file
seictl patch --target /path/to/config.toml patch.toml

# Patch any JSON file from stdin
echo '{"new_key": "value"}' | seictl patch --target /path/to/data.json

# Patch and save to a new file
seictl patch --target myconfig.toml patch.toml -o modified.toml

# Patch and modify in-place
seictl patch --target settings.json patch.json -i
```

**Note:** The file extension (`.toml` or `.json`) is used to determine the format automatically.

### Genesis Commands

#### `genesis patch`

Apply a merge-patch to the Sei genesis JSON file.

```bash theme={"dark"}
seictl genesis patch [patch-file]
```

**Options:**

* `-o, --output <path>`: Write output to specified file
* `-i, --in-place-rewrite`: Modify the genesis file in-place

**Examples:**

```bash theme={"dark"}
# Patch from file and output to stdout
seictl genesis patch patch.json

# Patch from stdin
echo '{"chain_id": "atlantic-2"}' | seictl genesis patch

# Patch and save to a new file
seictl genesis patch patch.json -o genesis-modified.json

# Patch and modify the original file in-place
seictl genesis patch patch.json -i
```

### Config Commands

#### `config patch`

Apply a merge-patch to a Sei configuration TOML file.

```bash theme={"dark"}
seictl config [--target <app|client|config>] patch [patch-file]
```

**Options:**

* `--target <type>`: Specify which configuration file to patch (`app`, `client`, or `config`)
  * If not specified, the target is automatically detected based on the patch content
* `-o, --output <path>`: Write output to specified file
* `-i, --in-place-rewrite`: Modify the configuration file in-place

**Examples:**

```bash theme={"dark"}
# Patch with auto-detection
seictl config patch patch.toml

# Explicitly specify the target config
seictl config --target app patch patch.toml

# Patch from stdin and output to stdout
echo 'minimum-gas-prices = "0.02usei"' | seictl config patch

# Patch and modify in-place
seictl config --target app patch patch.toml -i

# Patch and save to specific location
seictl config patch patch.toml -o /path/to/output.toml
```

## Configuration Targets

The `config` command can work with three different configuration files:

### `app.toml`

Application-level configuration including:

* Gas prices and block settings
* State management (state-sync, state-commit, state-store)
* EVM configuration
* Telemetry and monitoring
* API, gRPC, and Rosetta endpoints
* IAVL and WASM settings

### `client.toml`

Client-level configuration including:

* Chain ID
* Keyring backend
* Output format
* Node endpoint
* Broadcast mode

### `config.toml`

Node-level configuration including:

* Proxy app and database settings
* Logging configuration
* RPC and P2P settings
* Mempool and consensus parameters
* State sync and block sync
* Transaction indexing

## Merge Patch Behavior

The merge patch algorithm works as follows:

1. **Nested merging**: Patches are merged recursively into nested structures
2. **Null deletion**: Setting a value to `null` removes that key from the configuration
3. **Addition**: New keys in the patch are added to the configuration
4. **Replacement**: Existing scalar values are replaced with patch values

**Example:**

Original:

```toml theme={"dark"}
[api]
enable = true
address = "tcp://0.0.0.0:1317"
```

Patch:

```toml theme={"dark"}
[api]
address = "tcp://0.0.0.0:1318"
swagger = true
```

Result:

```toml theme={"dark"}
[api]
enable = true
address = "tcp://0.0.0.0:1318"
swagger = true
```

## Examples

<Accordion title="Update Minimum Gas Prices">
  ```bash theme={"dark"}
  echo 'minimum-gas-prices = "0.02usei"' | seictl config patch -i
  ```
</Accordion>

<Accordion title="Enable API Endpoint">
  ```bash theme={"dark"}
  cat > patch.toml << EOF
  [api]
  enable = true
  address = "tcp://0.0.0.0:1317"
  EOF

  seictl config --target app patch patch.toml -i
  ```
</Accordion>

<Accordion title="Modify Genesis Chain ID">
  ```bash theme={"dark"}
  echo '{"chain_id": "pacific-1"}' | seictl genesis patch -i
  ```
</Accordion>

<Accordion title="Update Multiple Configuration Sections">
  ```bash theme={"dark"}
  cat > patch.toml << EOF
  minimum-gas-prices = "0.02usei"

  [telemetry]
  enabled = true
  prometheus-retention-time = 60

  [api]
  enable = true
  swagger = true
  EOF

  seictl config patch patch.toml -i
  ```
</Accordion>

<Accordion title="Patch a Custom TOML Configuration">
  ```bash theme={"dark"}
  # Patch any TOML file outside the Sei directory structure
  cat > custom-patch.toml << EOF
  [database]
  host = "localhost"
  port = 5432
  EOF

  seictl patch --target /etc/myapp/config.toml custom-patch.toml -i
  ```
</Accordion>

<Accordion title="Patch a Custom JSON Data File">
  ```bash theme={"dark"}
  # Modify any JSON file
  echo '{"version": "2.0", "debug": true}' | seictl patch --target /path/to/settings.json -i
  ```
</Accordion>

<Accordion title="Using Custom Sei Home Directory">
  ```bash theme={"dark"}
  # Via environment variable
  export SEI_HOME=/custom/path/.sei
  seictl config patch patch.toml

  # Via flag
  seictl --home /custom/path/.sei config patch patch.toml
  ```
</Accordion>

## Command Comparison

### When to Use Each Command

* **`patch`**: Use for patching any arbitrary TOML or JSON file on your system. Requires explicit `--target` path.
* **`genesis patch`**: Use specifically for Sei genesis files. Automatically uses `$HOME/.sei/config/genesis.json`.
* **`config patch`**: Use specifically for Sei configuration files with automatic target detection. Automatically uses
  files in `$HOME/.sei/config/`.

## File Locations

By default, `seictl` looks for configuration files in the following locations:

* Genesis: `$HOME/.sei/config/genesis.json`
* App config: `$HOME/.sei/config/app.toml`
* Client config: `$HOME/.sei/config/client.toml`
* Node config: `$HOME/.sei/config/config.toml`

Where `$HOME` is the value of the `--home` flag or the `SEI_HOME` environment variable.

## Safety Features

* **Atomic Writes**: All file modifications use atomic write operations (write to temp file, then rename)
* **Permission Preservation**: In-place modifications preserve original file permissions
* **Format Validation**: Validates file extensions before processing (must be `.toml` or `.json`)
* **Target Validation**: Prevents accidental modification of wrong configuration files
* **Auto-detection Safety**: Refuses to proceed if patch could apply to multiple targets
* **Early Validation**: Checks file format and existence before reading patch data
