# LagomChain CLI

`lagomd` is the all-in-one command-line interface (CLI) for interacting with the LagomChain blockchain. It allows you to run a node, manage wallets, query blockchain data, and submit transactions. This guide will walk you through installing `lagomd`, running a LagomChain node, and interacting with the network.

### Prerequisites[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#prerequisites" id="prerequisites"></a>

**Go**[**​**](broken://pages/OvpSYcvbBk4sC5YKn6Bh)

LagomChain is built using [Go](https://go.dev/dl/) 1.20+. Check your installed version with:

```sh
go version
```

Ensure that your GOPATH is correctly configured by running:

```sh
export PATH=$PATH:$(go env GOPATH)/bin
```

Add this to your shell startup script for persistence.

**jq**[**​**](broken://pages/OvpSYcvbBk4sC5YKn6Bh)

LagomChain scripts are using [jq](https://stedolan.github.io/jq/download/) version `1.6+`. Check your version with:

```sh
jq --version
```

### Installation[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#installation" id="installation"></a>

You can download the latest binaries from the repo and install them, or you can build and install the `lagomd` binaries from source or using Docker.

#### Download the binaries[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#download-the-binaries" id="download-the-binaries"></a>

* Visit the LagomChain GitHub Releases page.
* Select the latest stable release for your OS.
* Download and extract the binaries.
* Move `lagomd` to your system path:

```sh
mv lagomd $(go env GOPATH)/bin
```

* Verify installation:<br>

  ```sh
  lagomd version
  ```

#### Build From Source[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#build-from-source" id="build-from-source"></a>

Clone and build LagomChain from source:

```
git clone https://github.com/lagomchain/lagom.git
cd lagom
git fetch
git checkout <latest-tag>
make install
```

Confirm installation:

```sh
lagomd version
```

If you encounter `command not found`, check that **Go is properly installed and configured**.

#### Docker[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#docker" id="docker"></a>

When it comes to using Docker with LagomChain, there are two options available: Build a binary of the LagomChain daemon inside a dockerized build environment or build a Docker image, that can be used to spin up individual containers running the LagomChain binary. For information on how to achieve this, proceed to the dedicated page on [working with Docker](/lagomchain-cli/working-with-docker.md).

### Running a LagomChain Node[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#run-an-evmos-node" id="run-an-evmos-node"></a>

To interact with LagomChain locally, you can run a full node that produces blocks and exposes both EVM and Cosmos endpoints. This allows you to deploy smart contracts, test transactions, and explore blockchain data.

Run the local node by executing the `local_node.sh` script in the base directory of the repository:

The script stores the node configuration including the local default endpoints under `~/.tmp-lagomd/config/config.toml`. If you have previously run the script, the script allows you to overwrite the existing configuration and start a new local node.

Once running, you should see logs indicating block production:

```sh
12:59PM INF executed block height=1 module=state num_invalid_txs=0 num_valid_txs=0
1:00PM INF indexed block height=7 module=txindex
```

For more information on how to customize a local node, head over to the [Single Node](/lagomchain-cli/single-node.md) page.

### Using `lagomd`[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#using-evmosd" id="using-evmosd"></a>

After installing `lagomd`, you can interact with LagomChain using various commands. To see available options:

```sh
lagomd --help
```

**Managing Multiple Node Configurations**\
If you’re running multiple nodes, specify a config directory using:

```sh
lagomd --home ~/.lagomd
```

#### Manage wallets[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#manage-wallets" id="manage-wallets"></a>

You can use `lagomd` to store private keys, manage accounts, and sign transactions directly via CLI.

#### **View All Wallets**

```sh
lagomd keys list --home ~/.lagomd --keyring-backend test
```

Example Outpu&#x74;**:**

```json
jsonCopyEdit{
  "address": "lagom19xnmslvl0pcmydu4m52h2gf0std5ee5pfgpyuf",
  "name": "dev0",
  "pubkey": "AzKouyoUL0UUS1qRUZdqyVsTPkCAFWwxx3+BTOw36nKp",
  "type": "local"
}
```

#### **Create a New Wallet**

```sh
lagomd keys add [name] --home ~/.lagomd --keyring-backend test
```

#### **Export Private Key for MetaMask**

```sh
lagomd keys unsafe-export-eth-key [name] --home ~/.lagomd --keyring-backend test
```

For more key management options, run:

```sh
lagomd keys --help
```

tip

For more information about the Keyring and its backend options, click [here](/concepts/keyring.md).

#### Interact with a Network[​](broken://pages/OvpSYcvbBk4sC5YKn6Bh) <a href="#interact-with-a-network" id="interact-with-a-network"></a>

You can use `lagomd` to query blockchain data and submit transactions.

#### **Set Network Configuration**

By default, the local node runs on:

```sh
tcp://localhost:26657
```

To view the current node configuration:

```sh
lagomd config --home ~/.lagomd
```

Example Outpu&#x74;**:**

```json
jsonCopyEdit{
  "chain-id": "lagom_986-1",
  "keyring-backend": "test",
  "output": "text",
  "node": "tcp://localhost:26657",
  "broadcast-mode": "sync"
}
```

#### **Change Network Endpoint**

To switch to a mainnet or testnet node, update the RPC endpoint using the new LagomChain RPC URLs:

```sh
lagomd config node http://188.214.128.66:26657 --home ~/.lagomd
```

or

```sh
lagomd config node http://46.166.165.25:26657 --home ~/.lagomd
```

Learn about more node configurations [here](/lagomchain-cli/configuration.md).

**Queries**[**​**](broken://pages/OvpSYcvbBk4sC5YKn6Bh)

You can fetch blockchain data using the `lagomd query` command (short form: `lagomd q`).

#### **Check Account Balance**

```sh
lagomd q bank balances [address] --home ~/.lagomd
```

**Example Output:**

```json
jsonCopyEdit{
  "balances": [
    {
      "amount": "99999000000000000000002500",
      "denom": "alagom"
    }
  ]
}
```

To see all available queries:

```sh
lagomd q
```

For bank-related queries:

```sh
lagomd q bank
```

**Transactions**[**​**](broken://pages/OvpSYcvbBk4sC5YKn6Bh)

You can send transactions using `lagomd tx`.

#### **Send Tokens**

```sh
lagomd tx bank send [from_key_or_address] [to_address] [amount] --home ~/.lagomd --fees 50000000000alagom -b block
```

Example Outpu&#x74;**:**

```json
jsonCopyEdit{
  "txhash": "7BA2618295B789CC24BB13E654D9187CDD264F61FC446EB756EAC07AF3E7C40A"
}
```

To see all available transaction commands:

```sh
lagomd tx
```

For bank transaction commands:

```sh
lagomd tx bank
```

Now that you've learned the basics of how to run and interact with an LagomChain network, head over to [configurations](/lagomchain-cli/configuration.md) for further customization.


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
