> For the complete documentation index, see [llms.txt](https://docs.lagomchain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lagomchain.com/lagomchain-cli/configuration.md).

# Configuration

The following page will guide you through the configuration of a node and a client. The node is used to run the blockchain network, produce blocks and validate transactions. The client is used as a gateway to interact with the blockchain network by sending transactions and querying the state. Additionally we walk through [running the JSON-RPC server](#running-the-json-rpc-server).

These configurations can impact the performance, security, and functionality of your node. Thus, understanding and correctly configuring your node and client is essential.

### Config and data directory[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#config-and-data-directory" id="config-and-data-directory"></a>

By default, your config and data are stored in the folder located at the `~/.lagomd` directory. You can easily change the default directory by using the `--home` flag. It is important to note that you can have multiple home directories that each represent a different blockchain.

```
.                                   # ~/.lagomd
  ├── data/                           # Contains the databases used by the node.
  └── config/
      ├── app.toml                   # Application-related configuration file.
      ├── config.toml                # Tendermint-related configuration file.
      ├── genesis.json               # The genesis file.
      ├── node_key.json              # Private key to use for node authentication in the p2p protocol.
      └── priv_validator_key.json    # Private key to use as a validator in the consensus protocol.
```

To specify the `lagomd` config and data storage directory; you can update it using the global flag `--home <directory>`.

### Node Configuration[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#node-configuration" id="node-configuration"></a>

The Cosmos SDK automatically generates two configuration files inside `~/.lagomd/config`:

* `config.toml` – Configures CometBFT ([Tendermint](https://docs.tendermint.com/v0.34/tendermint-core/configuration.html)) settings, including P2P networking, block creation, and consensus parameters.
* `app.toml` – Manages LagomChain-specific settings like state pruning, telemetry, gRPC, REST, and JSON-RPC configurations.

Both files are heavily commented, please refer to them directly to tweak your node.

One example config to tweak is the `minimum-gas-prices` field inside `app.toml`, which defines the minimum amount the validator node is willing to accept for processing a transaction. It is an anti spam mechanism and it will reject incoming transactions with less than the minimum gas prices.

If it's empty, make sure to edit the field with some value, for example `10token`, or else the node will halt on startup.

```
 # The minimum gas prices a validator is willing to accept for processing a
 # transaction. A transaction's fees must meet the minimum of any denomination
 # specified in this config (e.g. 0.25token1;0.0001token2).
 minimum-gas-prices = "0alagom"
```

#### Pruning of State[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#pruning-of-state" id="pruning-of-state"></a>

There are four strategies for pruning state. These strategies apply only to state and do not apply to block storage. To set pruning, adjust the `pruning` parameter in the `~/.lagomd/config/app.toml` file. The following pruning state settings are available:

* `everything`: Deletes all old states except the current state.
* `nothing`: Stores all blockchain states (Full archival node).
* `default`: Keeps the last 100 states + every 10,000th block.
* `custom`: Allows manual control using `pruning-keep-recent` settings.

By default, every node is in `default` mode which is the recommended setting for most environments. If you would like to change your nodes pruning strategy then you must do so when the node is initialized. Passing a flag when starting `Lagom` will always override settings in the `app.toml` file, if you would like to change your node to the `everything` mode then you can pass the `--pruning everything` flag when you call `lagomd start`.

danger

**IMPORTANT**: When you are pruning state you will not be able to query the heights that are not in your store.

### Client Configuration[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#client-configuration" id="client-configuration"></a>

We can view the default client config setting by using `lagomd config` command:

```
lagomd config
{
 "chain-id": "lagom_986-1",
 "keyring-backend": "os",
 "output": "text",
 "node": "tcp://localhost:26657",
 "broadcast-mode": "sync"
}
```

You can update values dynamically, e.g., changing the chain ID:

```sh
lagomd config chain-id lagom_986-1
```

Alternatively, you can edit `client.toml` directly:

```toml
# LagomChain Client Configuration

chain-id = "lagom_986-1"
keyring-backend = "os"
output = "json"
node = "tcp://localhost:26657"
broadcast-mode = "sync"
```

### Running the JSON-RPC Server[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#running-the-json-rpc-server" id="running-the-json-rpc-server"></a>

This section walks through the steps to enable the JSON-RPC server. JSON-RPC is provided on multiple transports. LagomChain supports JSON-RPC over HTTP and WebSocket. In terms of requirements we recommend a server with minimum 8-core CPU and 64gb of RAM. You must have ports 8545 and 8546 open on your firewall.

tip

**Important**: You cannot use all JSON RPC methods unless your node stores the entire copy of the blockchain locally.

#### Enable Server[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#enable-server" id="enable-server"></a>

To enable RPC server use the following flag (set to true by default).

```
lagomd start --json-rpc.enable
```

#### Defining Namespaces[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#defining-namespaces" id="defining-namespaces"></a>

`Eth`,`Net` and `Web3` namespaces are enabled by default, but for the JSON-RPC you need to add more namespaces. In order to enable other namespaces edit `app.toml` file.

```
# API defines a list of JSON-RPC namespaces that should be enabled
# Example: "eth,txpool,personal,net,debug,web3"
api = "eth,net,web3,txpool,debug,personal"
```

#### Set a Gas Cap[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#set-a-gas-cap" id="set-a-gas-cap"></a>

`eth_call` and `eth_estimateGas` define a global gas cap over rpc for DoS protection. You can override the default gas cap value of 25,000,000 by passing a custom value in `app.toml`:

```
# GasCap sets a cap on gas that can be used in eth_call/estimateGas (0=infinite). Default: 25,000,000.
gas-cap = 25000000
```

#### CORS[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#cors" id="cors"></a>

If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail.

The CORS setting can be updated from the `app.toml`

```
###############################################################################
###                           API Configuration                             ###
###############################################################################

[api]

# ...

# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
enabled-unsafe-cors = true # default false
```

#### Pruning[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#pruning" id="pruning"></a>

For all methods to work correctly, your node must be archival (store the entire copy of the blockchain locally). Pruning must be disabled. The pruning settings can be updated from the `app.toml`

```
###############################################################################
###                           Base Configuration                            ###
###############################################################################

# The minimum gas prices a validator is willing to accept for processing a
# transaction. A transaction's fees must meet the minimum of any denomination
# specified in this config (e.g. 0.25token1;0.0001token2).

# ...

# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals
# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', >
pruning = "nothing"
pruning-keep-recent = "0"
pruning-keep-every = "0"
pruning-interval = "0"
```

#### WebSocket Server[​](broken://pages/nA51291FsYM9VuLy5UQp) <a href="#websocket-server" id="websocket-server"></a>

Websocket is a bidirectional transport protocol. A Websocket connection is maintained by client and server until it is explicitly terminated by one. Most modern browsers support Websocket which means it has good tooling.

Because Websocket is bidirectional, servers can push events to clients. That makes Websocket a good choice for use-cases involving event subscription. Another benefit of Websocket is that after the handshake procedure, the overhead of individual messages is low, making it good for sending high number of requests. The WebSocket Server can be enabled from the `app.toml`

```
# Address defines the EVM WebSocket server address to bind to.
ws-address = "0.0.0.0:8546"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lagomchain.com/lagomchain-cli/configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
