Skip to content

Running a Node

This section teaches you how to run a Moca Chain Node.

⚠️ This section may change without prior notice

Critical information in this section may be subject to change given we are currently in private mainnet.

🔓 Public Repository

The Moca Chain source code is publicly available on GitHub: mocachain/moca.

Network Information

NetworkChain IDEVM Chain IDRPC (Tendermint)
Mainnetmoca_2288-12288https://tm-rpc.mocachain.dev
Testnetmoca_222888-1222888https://testnet-lcd.mocachain.org

Mainnet Access

Mainnet RPC access requires an API key. Contact the Moca Chain team to obtain your key.

Node Information

Minimum System Requirements

ComponentRequirement
OSDesktop or laptop running recent versions of Mac OS X or Linux
Storage1 TB free disk space, minimum read/write speed of 100 MB/s
CPU4 cores
Memory (RAM)12 GB
NetworkBroadband connection, upload/download at least 1 MB/s
ComponentRecommended Specification
Processor (CPU)16-core CPU
Memory (RAM)64 GB
Storage3 TB SSD
NetworkStable high-speed internet, minimum 5 MB/s

Setting Up a New Node

Prerequisites

For Docker (Option A):

  • Docker
  • jq

For Manual Cosmovisor (Option B):

  • Git
  • Go 1.23+
  • jq
  • macOS or Linux

1. Clone the Repo (Option B only)

TIP

Skip this step if using the Docker image (Option A).

Clone the repository and checkout the latest stable version:

bash
git clone https://github.com/mocachain/moca.git
cd moca

# checkout latest stable version
git checkout tags/v1.1.2

2. Install Cosmovisor

Cosmovisor is a process manager for Cosmos SDK nodes that automatically handles chain upgrades. It is the recommended way to run a Moca Chain node.

The official Docker image is available on GitHub Container Registry. This image comes with the genesis binary preinstalled and runs mocad with Cosmovisor.

bash
# Pull the latest image
docker pull ghcr.io/mocachain/mocad:v1.1.2

# For specific architecture
# linux/amd64
docker pull ghcr.io/mocachain/mocad:v1.1.2-amd64

# linux/arm64
docker pull ghcr.io/mocachain/mocad:v1.1.2-arm64

Option B: Manual Cosmovisor Setup

If you prefer to run Cosmovisor manually without Docker, follow these steps.

Install Cosmovisor

bash
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest

Build or Download the Binary

You can either build from source or download pre-compiled binaries from GitHub Releases.

bash
# Option 1: Build from source
make build

# Option 2: Download pre-compiled binary (Linux arm64)
wget https://github.com/mocachain/moca/releases/download/v1.1.2/mocad_linux_arm64.tar.gz
tar -xzf mocad_linux_arm64.tar.gz
chmod +x mocad
mv mocad ./build/mocad

Setup Cosmovisor Directory Structure

bash
mkdir -p ~/.mocad/cosmovisor/genesis/bin
cp ./build/mocad ~/.mocad/cosmovisor/genesis/bin/mocad

3. Initialize Node

This will initialize your local moca node home directory ~/.mocad containing chain data configuration.

Using Docker (Option A)

bash
docker run --rm -v ~/.mocad:/root/.mocad ghcr.io/mocachain/mocad:v1.1.2 \
  mocad init mynode --chain-id moca_2288-1 --default-denom amoca
bash
docker run --rm -v ~/.mocad:/root/.mocad ghcr.io/mocachain/mocad:v1.1.2 \
  mocad init mynode --chain-id moca_222888-1 --default-denom amoca

Using Manual Cosmovisor (Option B)

bash
~/.mocad/cosmovisor/genesis/bin/mocad init mynode --chain-id moca_2288-1 --default-denom amoca
bash
~/.mocad/cosmovisor/genesis/bin/mocad init mynode --chain-id moca_222888-1 --default-denom amoca

4. Pull Live genesis file

Fetch the genesis file for your target network.

bash
RPC=https://tm-rpc.mocachain.dev
curl -s "$RPC/genesis?key=<YOUR_ACCESS_KEY>" | jq -r '.result.genesis' > ~/.mocad/config/genesis.json
bash
RPC=https://testnet-lcd.mocachain.org
curl -s "$RPC/genesis" | jq -r '.result.genesis' > ~/.mocad/config/genesis.json

5. Add peers

Fetch and configure peers from the network:

bash
PEERS=$(curl -s "$RPC/net_info" | jq -r '.result.peers[] | select(.node_info.id and .remote_ip) | "\(.node_info.id)@\(.remote_ip):26656"' | paste -sd, -)

# Update config with peers
[ -n "$PEERS" ] && \
  sed -i '' 's/seeds = ".*"/seeds = ""/' ~/.mocad/config/config.toml && \
  sed -i '' "s/persistent_peers = \".*\"/persistent_peers = \"$PEERS\"/" ~/.mocad/config/config.toml && \
  sed -i '' 's/addr_book_strict = true/addr_book_strict = false/' ~/.mocad/config/config.toml

Alternatively you can provide your own list of peers.

6. Fast sync state

State sync quickly bootstraps your node by trusting a recent block header (light client verification) and downloading a snapshot of the application state at that height, instead of replaying all historical blocks.

bash
# Get current height
HEIGHT=$(($(curl -s "$RPC/block" | jq -r '.result.block.header.height') - 1000))
HASH=$(curl -s "$RPC/block?height=$HEIGHT" | jq -r '.result.block_id.hash')

# Set trusted height and hash to sync from in your node configuration files
sed -i '' 's/^enable *= *.*/enable = true/' ~/.mocad/config/config.toml
sed -i '' "s|^rpc_servers *= *.*|rpc_servers = \"$RPC,$RPC\"|" ~/.mocad/config/config.toml
sed -i '' "s/^trust_height *= *.*/trust_height = $HEIGHT/" ~/.mocad/config/config.toml
sed -i '' "s/^trust_hash *= *.*/trust_hash = \"$HASH\"/" ~/.mocad/config/config.toml
sed -i '' 's/^trust_period *= *.*/trust_period = "168h0m0s"/' ~/.mocad/config/config.toml

7. Run the node

Using Docker (Option A)

Run the Docker container with a mounted volume for persistent data:

bash
docker run -d \
  --name mocad \
  -v ~/.mocad:/root/.mocad \
  -p 26656:26656 \
  -p 26657:26657 \
  -p 1317:1317 \
  -p 8545:8545 \
  ghcr.io/mocachain/mocad:v1.1.2
bash
docker run -d \
  --name mocad \
  -v ~/.mocad:/root/.mocad \
  -p 26656:26656 \
  -p 26657:26657 \
  -p 1317:1317 \
  -p 8545:8545 \
  ghcr.io/mocachain/mocad:v1.1.2

Using Manual Cosmovisor (Option B)

bash
export DAEMON_NAME=mocad
export DAEMON_HOME=$HOME/.mocad
cosmovisor run start --chain-id=moca_2288-1
bash
export DAEMON_NAME=mocad
export DAEMON_HOME=$HOME/.mocad
cosmovisor run start --chain-id=moca_222888-1

The node will take some time to fully sync up to the current chain height.

Verify Syncing

You can verify if state sync is done by curl localhost:26657/status several times and see whether latest_block_height is increasing in response.

bash
curl -s http://127.0.0.1:26657/status | jq -r ".result.sync_info.latest_block_height"
# Expect block height greater than 0