Skip to main content

Development Environment

A comprehensive guide for developers to set up a local Mandala parachain network using Zombienet for testing and development.

Overview

Zombienet allows you to spawn a local multi-node network with Mandala parachain connected to a relay chain. This setup provides a complete testing environment with pre-funded development accounts.

Prerequisites

Before setting up the Mandala zombienet network, ensure you have the following prerequisites installed:

System Requirements:

  • Linux (Ubuntu 20.04+ recommended) or macOS (10.15+)
  • 16+ GB RAM
  • 100+ GB free disk space
  • Multi-core processor (Minimum 8 cores recommended)

Install Rust and Cargo:

# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Source the environment
source ~/.cargo/env

# Verify installation
rustc --version
cargo --version

Configure Rust for Polkadot development:

# Set default toolchain
rustup default stable
rustup update

# Add WebAssembly target
rustup target add wasm32-unknown-unknown

# Install required components
rustup component add rust-src

Install Development Dependencies:

On Ubuntu/Debian:

sudo apt update
sudo apt install -y \
build-essential \
git \
clang \
curl \
libssl-dev \
llvm \
libudev-dev \
protobuf-compiler

On macOS:

# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install dependencies
brew install openssl cmake llvm protobuf

Clone Mandala Repository:

# Clone the Mandala parachain repository
git clone https://github.com/MandalaChain/Mandala-Node.git
cd Mandala-Node

Verify Installation:

# Quick build test (optional)
cargo check

# Verify WebAssembly target
rustup target list --installed | grep wasm32-unknown-unknown

Quick Start

1. Build the Project

First, build the parachain binary:

cargo b

2. Navigate to Scripts Directory

cd parachain/scripts

3. Setup Zombienet

Run the setup script to prepare the zombienet environment:

./setup-zombienet.sh

This script will:

  • Download zombienet binary if not present
  • Generate necessary chain specifications
  • Prepare configuration files

4. Start the Network

Launch the local network:

./run-zombienet.sh

Network Information

Once the network starts, you'll see a summary table with the following information:

Relay Chain Nodes:

  • Alice: Relay chain validator
  • Bob: Relay chain validator

Parachain Nodes:

  • mandala-collator01: Mandala parachain collator

Node Access Points:

Each node provides multiple access methods:

Access TypePurposeExample URL
Direct Link (pjs)Polkadot.js Apps interfacehttps://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9933#/explorer
Direct Link (papi)PAPI Explorerhttps://dev.papi.how/explorer#networkId=custom&endpoint=ws://127.0.0.1:9933
Prometheus LinkMetrics monitoringhttp://127.0.0.1:54126/metrics
Log CmdView node logstail -f /var/folders/.../zombie-[hash]_44995-3...

Using the Network

Access Polkadot.js Apps:

  1. Click on the Direct Link (pjs) for mandala-collator01
  2. Default URL: https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9933#/explorer
  3. The network comes with development accounts pre-loaded with KPGT tokens

Pre-funded Development Accounts:

  • ALICE: 0.1529 KPGT
  • ALICE_STASH: 1.1529 KPGT
  • BOB: 1.1529 KPGT
  • BOB_STASH: 1.1529 KPGT
  • CHARLIE: 1.1529 KPGT
  • DAVE: 1.1529 KPGT
  • EVE: 1.1529 KPGT
  • FERDIE: 2.1529 KPGT

Account Summary:

  • Total Balance: 9.2233 KPGT
  • Total Transferable: 9.2233 KPGT
  • Total Locked: 0.0000 KPGT

account-summary.png

Testing Transactions:

  1. Navigate to Accounts tab in Polkadot.js Apps, select an account to send funds

    accounts.png

  2. Use any of the pre-funded development accounts

    pre-funded-development-account.png

  3. Send test transactions between accounts

    authorize-transaction.png

    authorize-transaction-done.png

  4. Monitor transaction status in the Explorer tab

    explorer.png

Developer Tools Access:

  1. Network Tab: View network information and statistics

    network-tab.png

  2. Developer Tab: Access RPC calls, chain state, and extrinsics

    developer-tab.png

  3. Settings Tab: Configure the interface and connections

    settings-tab.png

Monitoring & Troubleshooting

Prometheus Metrics:

Access metrics for monitoring:

  • Alice: http://127.0.0.1:54120/metrics
  • Bob: http://127.0.0.1:54123/metrics
  • Mandala-collator01: http://127.0.0.1:54126/metrics

Common Issues:

Network Won't Start:

  • Ensure all dependencies are built: cargo b
  • Check if ports are available (9933, 9900, 9901, etc.)
  • Verify scripts have executable permissions: chmod +x *.sh

Cannot Connect to Node:

  • Verify the WebSocket URL is correct
  • Check if the node is running using the log command
  • Ensure firewall isn't blocking the ports

Accounts Not Showing:

  • Refresh the Polkadot.js Apps page
  • Verify you're connected to the correct network
  • Check the network tab for connection status

Prerequisites Issues:

Rust compilation errors:

# Update Rust toolchain
rustup update

# Clear cargo cache
cargo clean

Missing system dependencies:

# Ubuntu: Install missing packages
sudo apt install build-essential

# macOS: Install Xcode command line tools
xcode-select --install

WebAssembly target issues:

# Reinstall wasm32 target
rustup target remove wasm32-unknown-unknown
rustup target add wasm32-unknown-unknown

Stopping the Network

To stop the zombienet:

# Use Ctrl+C in the terminal where run-zombienet.sh is running
# Or kill the zombienet process
pkill -f zombienet

Next Steps

With your local Mandala network running, you can:

  • Deploy and test smart contracts
  • Test parachain functionality
  • Develop and test dApps

For more advanced configurations and custom setups, refer to the Zombienet documnetation