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 ā
Component | Requirement |
---|---|
OS | Desktop or laptop running recent versions of Mac OS X or Linux |
Storage | 1 TB free disk space, minimum read/write speed of 100 MB/s |
CPU | 4 cores |
Memory (RAM) | 12 GB |
Network | Broadband connection, upload/download at least 1 MB/s |
Recommended System Requirements ā
Component | Recommended Specification |
---|---|
Processor (CPU) | 16-core CPU |
Memory (RAM) | 64 GB |
Storage | 3 TB SSD |
Network | Stable 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:
git clone git@github.com:MocaFoundation/moca.git
# checkout stable version a382e3cĀ
git checkout tags/v12.0.0-alpha.1
2. Build the binaries ā
# 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.
mocad init mynode --chain-id moca_222888-1 --default-denom amoca
4. Pull Live genesis file ā
Fetch the current testnet genesis file.
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:
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.
# 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 ā
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.
curl -s http://127.0.0.1:26657/status | jq -r ".result.sync_info.latest_block_height"
# Expect block height greater than 0