Skip to main content

Web Node

The web node 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 eliminates the need for native software installation and pushes the boundaries of decentralized infrastructure.

Just want to run a web node?

See the Docker deployment guide for the easiest way to run a web node without building from source.

Overview

The web node 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, Edge, or Safari
  • 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

Architecture

The web node consists of two main components:

  1. WebAssembly module - The Mina Rust node compiled to WASM, providing core blockchain functionality
  2. Frontend application - An Angular application that hosts the WASM module and provides the user interface

Prerequisites

Rust toolchain

Install the Rust toolchain (required for WASM compilation):

website/docs/developers/scripts/setup/install-rustup.sh
# Install rustup with default stable toolchain
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.92

# Setup the current shell
source "$HOME/.cargo/env"

Node.js

We recommend using the latest Node.js version specified in the .nvmrc file at the root of the repository. As of this writing, You can use a Node.js version manager like nvm to easily switch to the correct version.

For more information on how to install Node.js, please refer to the official Node.js documentation.

Building from source

Clone the repository

git clone https://github.com/o1-labs/mina-rust.git
cd mina-rust/

Install nightly toolchain and WASM tooling

website/docs/developers/scripts/setup/make-setup-wasm.sh
make setup-wasm

Download circuit files

The web node requires circuit files for proof verification:

website/docs/developers/scripts/setup/download-circuits.sh
make download-circuits

Build the WebAssembly module

make build-wasm
Why nightly Rust?

The web node WASM build requires nightly Rust for certain unstable features used in the WebAssembly compilation. The build process automatically handles the toolchain selection.

Install frontend dependencies

website/docs/developers/scripts/frontend/install-dependencies.sh
cd frontend
make install-deps

Running the web node

Development mode

Start the development server:

cd frontend/
make start-webnode

Access the web node at http://localhost:4200

Production build

Build an optimized production bundle:

website/docs/developers/scripts/frontend/build-webnode.sh
# Enter frontend directory
cd frontend

# Build with Web Node production configuration
make build-webnode-production

The built files will be in frontend/dist/ and can be served by any static web server.

Block producer mode (optional)

By default, the web node runs in observer mode. To produce blocks, you need to generate an encrypted keypair and supply it to the interface upon starting the web node. Run this from the repository root:

website/docs/developers/scripts/generate-encrypted-keypair-cargo.sh
#!/bin/bash

set -eou pipefail

# This creates `web-node-key.zip` containing:
#
# - `producer-key` (encrypted private key)
# - `producer-key.pub` (public key)
# - `producer-key-password` (password file)

# Create temporary working directory
mkdir producer-key-tmp

# Create password file
echo "mypassword" > producer-key-tmp/producer-key-password

# Generate encrypted key pair
cargo run -r --bin mina -- misc mina-encrypted-key \
--file producer-key-tmp/producer-key \
"$(cat producer-key-tmp/producer-key-password)"

# Package into ZIP for upload through the web interface and clean up intermediates
cd producer-key-tmp
zip web-node-key.zip producer-key producer-key.pub producer-key-password
mv web-node-key.zip ../
cd ../
rm -rf producer-key-tmp

Update the script to set your desired password. The encrypted key will be stored in web-node-key.zip and can be imported into the web node interface.

External resources