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 testnet.

šŸ”’ Repo not publicly available

Please reach out to us if you would like to run this code.

šŸ“¢ Mainnet Target Launch: 2025 Q4

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 ​

āš ļø Links may not work as it is linked to private repos and may need adjustments.

Prerequisites ​

  • Git
  • Go 1.21+ and jq (native run)
  • macOS or Linux

1. Clone the Repo ​

Clone the repository can navigate the the base:

bash
git clone git@github.com:MocaFoundation/moca.git

# checkout stable version a382e3cĀ 
git checkout tags/v12.0.0-alpha.1

2. Build the binaries ​

bash
# Build mocad
make build

# <optionally> Add mocad to local bin
cp ./build/mocad /usr/local/bin

# Verify
mocad --help

3. Initialize Node# ​

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

bash
mocad init mynode --chain-id moca_222888-1 --default-denom amoca

4. Pull Live genesis file ​

Fetch the current testnet genesis file.

bash
RPC=https://testnet-lcd.mocachain.org
curl -s "$RPC/genesis" | jq -r '.result.genesis' > ~/.mocad/config/genesis.json

5. Add peers ​

Copy the testnet RPCs peers:

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. (Optional) 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 ​

bash
mocad start --chain-id=moca_222888-1

The node will take some time to full 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