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
Go
LagomChain is built using Go 1.20+. Check your installed version with:
go version
Ensure that your GOPATH is correctly configured by running:
export PATH=$PATH:$(go env GOPATH)/bin
Add this to your shell startup script for persistence.
jq
LagomChain scripts are using jq version 1.6+
. Check your version with:
jq --version
Installation
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
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:
mv lagomd $(go env GOPATH)/bin
Verify installation:
lagomd version
Build From Source
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:
lagomd version
If you encounter command not found
, check that Go is properly installed and configured.
Docker
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.
Running a LagomChain Node
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:
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 page.
Using lagomd
lagomd
After installing lagomd
, you can interact with LagomChain using various commands. To see available options:
lagomd --help
Managing Multiple Node Configurations If you’re running multiple nodes, specify a config directory using:
lagomd --home ~/.lagomd
Manage wallets
You can use lagomd
to store private keys, manage accounts, and sign transactions directly via CLI.
View All Wallets
lagomd keys list --home ~/.lagomd --keyring-backend test
Example Output:
jsonCopyEdit{
"address": "lagom19xnmslvl0pcmydu4m52h2gf0std5ee5pfgpyuf",
"name": "dev0",
"pubkey": "AzKouyoUL0UUS1qRUZdqyVsTPkCAFWwxx3+BTOw36nKp",
"type": "local"
}
Create a New Wallet
lagomd keys add [name] --home ~/.lagomd --keyring-backend test
Export Private Key for MetaMask
lagomd keys unsafe-export-eth-key [name] --home ~/.lagomd --keyring-backend test
For more key management options, run:
lagomd keys --help
tip
For more information about the Keyring and its backend options, click here.
Interact with a Network
You can use lagomd
to query blockchain data and submit transactions.
Set Network Configuration
By default, the local node runs on:
tcp://localhost:26657
To view the current node configuration:
lagomd config --home ~/.lagomd
Example Output:
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:
lagomd config node http://188.214.128.66:26657 --home ~/.lagomd
or
lagomd config node http://46.166.165.25:26657 --home ~/.lagomd
Learn about more node configurations here.
Queries
You can fetch blockchain data using the lagomd query
command (short form: lagomd q
).
Check Account Balance
lagomd q bank balances [address] --home ~/.lagomd
Example Output:
jsonCopyEdit{
"balances": [
{
"amount": "99999000000000000000002500",
"denom": "alagom"
}
]
}
To see all available queries:
lagomd q
For bank-related queries:
lagomd q bank
Transactions
You can send transactions using lagomd tx
.
Send Tokens
lagomd tx bank send [from_key_or_address] [to_address] [amount] --home ~/.lagomd --fees 50000000000alagom -b block
Example Output:
jsonCopyEdit{
"txhash": "7BA2618295B789CC24BB13E654D9187CDD264F61FC446EB756EAC07AF3E7C40A"
}
To see all available transaction commands:
lagomd tx
For bank transaction commands:
lagomd tx bank
Now that you've learned the basics of how to run and interact with an LagomChain network, head over to configurations for further customization.
Last updated