Skip to main content

WebNode

The WebNode is an experimental implementation of the Mina Rust node compiled to WebAssembly, enabling users to run a fully functional Mina node directly in their web browser. This groundbreaking approach eliminates the need for native software installation and pushes the boundaries of decentralized infrastructure.

Overview

WebNode leverages WebAssembly (WASM) technology to bring the full power of the Mina Rust node to web browsers. This enables block production, transaction validation, and network participation without traditional infrastructure requirements.

Features

  • Browser-based node - Run a complete Mina node in Chrome, Firefox, or Edge
  • Block production - Participate in consensus directly from your browser
  • P2P networking - Connect to other nodes using WebRTC
  • State management - Maintain blockchain state in browser storage
  • Zero installation - No software installation or system configuration required

Building WebNode

Build the WebNode version of the frontend:

scripts/frontend/build-webnode.sh
# Build the WebNode version of the frontend
cd frontend

# Build with WebNode configuration
make build-webnode
Frontend Build Only

These Makefile commands only build the frontend portion of the WebNode. The WebAssembly module build is not included in these commands.

Running WebNode

Development Mode

Start the WebNode development server:

scripts/frontend/start-webnode-local.sh
# Start the WebNode development server
cd frontend

# Start WebNode locally
make start-webnodelocal

Access the WebNode at http://localhost:4200

Production Deployment

Deploy WebNode to a web server:

scripts/frontend/deploy-webnode.sh
# Deploy WebNode to a web server
cd frontend

# Build for production
make build-webnode

# Deploy to static hosting
# Note: Adjust the destination path as needed for your hosting setup
cp -r dist/frontend/browser/* /var/www/webnode/

Docker deployment

WebNode can be deployed using Docker with automatic WASM file management.

Environment configuration

The MINA_FRONTEND_ENVIRONMENT=webnode setting configures the frontend for WebAssembly-based node operation:

  • WebRTC networking - Enables peer-to-peer connections through WebRTC for browser-based networking
  • WASM integration - Configures the frontend to load and interact with the pre-built WebAssembly node
  • Circuit file management - Automatically downloads required cryptographic circuit files for proof verification
  • Browser optimization - Optimizes the build for in-browser execution and resource management
  • WebNode-specific APIs - Enables WebNode-specific GraphQL endpoints and state management

Build Docker image

scripts/frontend/docker-build-webnode.sh
# Build Docker image for WebNode

# Generate .env.docker with current git information (required for WASM build)
frontend/docker/generate-docker-env.sh

# Build the Docker image (from project root)
docker build -t mina-frontend -f frontend/Dockerfile .

Run with Docker

scripts/frontend/docker-run-webnode.sh
# Run WebNode with webnode configuration
# This enables WASM node functionality and downloads circuit files
docker run -p 4200:80 \
-e MINA_FRONTEND_ENVIRONMENT=webnode \
mina-frontend
WebNode Docker Features

The Docker image for WebNode:

  • Pre-includes WASM files - WebAssembly files are built during image creation
  • Runtime configuration - Builds the frontend at container startup with WebNode-specific settings

Resources