# 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[​](https://docs.lagomchain.com/broken-reference) <a href="#prerequisites" id="prerequisites"></a>

**Go**[**​**](https://docs.lagomchain.com/broken-reference)

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**[**​**](https://docs.lagomchain.com/broken-reference)

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

```sh
jq --version
```

### Installation[​](https://docs.lagomchain.com/broken-reference) <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[​](https://docs.lagomchain.com/broken-reference) <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[​](https://docs.lagomchain.com/broken-reference) <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[​](https://docs.lagomchain.com/broken-reference) <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](https://docs.lagomchain.com/lagomchain-cli/working-with-docker).

### Running a LagomChain Node[​](https://docs.lagomchain.com/broken-reference) <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](https://docs.lagomchain.com/lagomchain-cli/single-node) page.

### Using `lagomd`[​](https://docs.lagomchain.com/broken-reference) <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[​](https://docs.lagomchain.com/broken-reference) <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](https://docs.lagomchain.com/concepts/keyring).

#### Interact with a Network[​](https://docs.lagomchain.com/broken-reference) <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](https://docs.lagomchain.com/lagomchain-cli/configuration).

**Queries**[**​**](https://docs.lagomchain.com/broken-reference)

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**[**​**](https://docs.lagomchain.com/broken-reference)

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](https://docs.lagomchain.com/lagomchain-cli/configuration) for further customization.
