Skip to main content

Mina Protocol Mainnet Commands

This page provides useful commands for managing your Mina Protocol node on the mainnet. These commands help you monitor, troubleshoot, and maintain your node effectively.

Node Management Commands

Check Node Status

# Check if container is running
docker ps | grep mina

# Check node status
docker exec mina-node mina client status

# Check sync status
docker exec mina-node mina client status | grep "Sync Status"

# Check peer connections
docker exec mina-node mina client status | grep "Peers"

View Logs

# View real-time logs
docker compose logs -f

# View recent logs (last 100 lines)
docker compose logs --tail=100

# View logs with timestamps
docker compose logs -t

# Check for errors
docker compose logs | grep -i error

# View logs for specific time period
docker compose logs --since "1 hour ago"

Container Management

# Start the node
docker compose up -d

# Stop the node
docker compose down

# Restart the node
docker compose restart

# Check container status
docker compose ps

# View container resource usage
docker stats mina-node

Wallet and Key Management

Generate New Key Pair

# Create keys directory
mkdir -pv /data/mina/keys
cd /data/mina/keys

# Generate new key pair using Docker
docker run --rm --entrypoint "" \
-v $(pwd):/keys \
-e "MINA_PRIVKEY_PASS=your_secure_password" \
$DOCKER_IMAGE \
mina advanced generate-keypair --privkey-path /keys/my-wallet

# Set proper permissions
chmod -R 600 /data/mina/keys

Import Existing Key

# Copy your existing key to the keys directory
cp /path/to/your/existing-key /data/mina/keys/my-wallet

# Set proper permissions
chmod -R 700 /data/mina/keys

Network and Connectivity

Check Network Status

# Check if ports are open
ss -tulpn | grep :8302
ss -tulpn | grep :6060

# Test external connectivity
curl -s http://localhost:6060/metrics | head -10

# Check peer connections
docker exec mina-node mina client status | grep "Peers"

Network Diagnostics

# Check network interfaces
ip addr show

# Test DNS resolution
nslookup api.minaexplorer.com

# Check firewall status
ufw status

# Test connectivity to seed peers
ping -c 3 storage.googleapis.com

Block Production and Staking

Check Block Producer Status

# Check if block producer is running
docker exec mina-node mina client status | grep "Block Producer Running"

# Check your wallet balance
docker exec mina-node mina client status | grep "Balance"

# Check delegation status
docker exec mina-node mina client status | grep "Delegate"

Staking Commands

# Check staking information
docker exec mina-node mina client status | grep -A 5 -B 5 "Staking"

# View account details
docker exec mina-node mina client status | grep -A 10 "Account"

System Monitoring

Resource Usage

# Check disk usage
df -h /data/mina

# Check memory usage
free -h

# Check CPU usage
top -p $(pgrep -f mina)

# Check system load
uptime

Performance Monitoring

# Monitor container resources
docker stats mina-node --no-stream

# Check system performance
htop

# Monitor disk I/O
iotop

# Check network usage
iftop

Troubleshooting Commands

Common Issues

Container Won't Start

# Check detailed error messages
docker compose logs

# Verify configuration files
cat /data/mina/.mina-env

# Check Docker daemon status
systemctl status docker

Node Not Syncing

# Check sync status
docker exec mina-node mina client status

# Check peer connections
docker exec mina-node mina client status | grep "Peers"

# Check network connectivity
docker exec mina-node mina client status | grep "Network"

Permission Issues

# Fix key file permissions
chmod 600 /data/mina/keys/my-wallet
chmod 600 /data/mina/.mina-env

# Fix directory permissions
chmod 700 /data/mina/keys
chmod 700 /data/mina

# Check ownership
ls -la /data/mina/

Log Analysis

# Search for specific errors
docker compose logs | grep -i "error"

# Search for warnings
docker compose logs | grep -i "warn"

# Search for sync-related messages
docker compose logs | grep -i "sync"

# Search for peer-related messages
docker compose logs | grep -i "peer"

Maintenance Commands

Cleanup Commands

# Clean up old logs
docker system prune -f

# Clean up unused images
docker image prune -a

# Clean up unused volumes
docker volume prune

# Clean up everything
docker system prune -a --volumes

Check Commands

docker exec mina-node mina version

Environment Variables

Set Environment Variables

# Export common variables
export NODE_DIR="/data/mina"
export MINA_PRIVKEY_PASS="your_secure_password"
export P2P_PORT="8302"
export METRICS_PORT="6060"

# Add to shell profile
echo 'export NODE_DIR="/data/mina"' >> ~/.bashrc
echo 'export MINA_PRIVKEY_PASS="your_secure_password"' >> ~/.bashrc
source ~/.bashrc

Check Environment

# Check current environment
env | grep MINA

# Check Docker environment
docker exec mina-node env | grep MINA

Quick Reference

Essential Commands

CommandPurpose
docker compose logs -fView real-time logs
docker exec mina-node mina client statusCheck node status
docker compose restartRestart the node
docker ps | grep minaCheck if container is running
ss -tulpn | grep :8302Check if P2P port is open

Status Indicators

StatusMeaning
BootstrapNode is downloading initial data
CatchupNode is catching up to latest blocks
SyncedNode is fully synchronized
Block Producer RunningNode is producing blocks

info

These commands are for the Mina Protocol mainnet. For testnet commands, please refer to the testnet documentation.

tip

Pro Tips:

  • Always backup your keys before making changes
  • Monitor logs regularly for any issues
  • Keep your system updated
  • Use strong passwords for your wallet
  • Join the community for support