# Using Quorum Network with MetaMask ## Overview Your Quorum test network is running in WSL2, and the RPC endpoints are accessible from Windows. Here's how to configure MetaMask to connect to your local network. ## WSL2 Networking **Good News**: WSL2 automatically forwards ports to Windows! Services listening on `localhost` in WSL2 are accessible from Windows via `localhost`. **No Firewall Configuration Needed**: WSL2 handles port forwarding automatically. Docker containers with port mappings like `0.0.0.0:8545->8545/tcp` are accessible from Windows. ## Available RPC Endpoints ### Primary Endpoints (Recommended for MetaMask): 1. **JSON-RPC HTTP**: `http://localhost:8545` - This is the main RPC endpoint (rpcnode) - **Use this for MetaMask** 2. **EthSigner Proxy**: `http://localhost:18545` - Alternative endpoint with transaction signing - Can also be used with MetaMask ### Validator Endpoints (Optional): - Validator 1: `http://localhost:21001` - Validator 2: `http://localhost:21002` - Validator 3: `http://localhost:21003` - Validator 4: `http://localhost:21004` ## Setting Up MetaMask ### Step 1: Add Custom Network 1. Open MetaMask in your browser 2. Click the network dropdown (top of MetaMask) 3. Click "Add Network" or "Add a network manually" ### Step 2: Enter Network Details Fill in the following information: ``` Network Name: Quorum Test Network New RPC URL: http://localhost:8545 Chain ID: 1337 Currency Symbol: ETH Block Explorer URL: http://localhost:25000/explorer/nodes ``` **Important Fields:** - **RPC URL**: `http://localhost:8545` (or `http://localhost:18545` for EthSigner) - **Chain ID**: `1337` (as configured in your network) - **Currency Symbol**: `ETH` (or any name you prefer) - **Block Explorer**: `http://localhost:25000/explorer/nodes` (Quorum Explorer) ### Step 3: Save and Connect 1. Click "Save" 2. MetaMask will switch to your Quorum network 3. You should see the network name in the dropdown ## Testing the Connection ### From Windows Browser/Command Prompt: 1. **Test RPC Endpoint** (from Windows PowerShell or CMD): ```powershell curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545 ``` 2. **Or use a browser**: - Open: http://localhost:25000/explorer/nodes (Quorum Explorer) - Open: http://localhost:26000 (Blockscout) - Open: http://localhost:3000 (Grafana) ### From WSL2: ```bash # Test RPC endpoint curl -X POST -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ http://localhost:8545 # Should return something like: # {"jsonrpc":"2.0","id":1,"result":"0x..."} ``` ## Troubleshooting ### If MetaMask Can't Connect: 1. **Verify RPC is Running**: ```bash # In WSL2 docker compose ps | grep rpcnode ``` 2. **Check Port Binding**: ```bash # In WSL2 docker ps | grep 8545 ``` Should show: `0.0.0.0:8545->8545/tcp` 3. **Test from Windows**: - Open Windows PowerShell - Run: `Test-NetConnection -ComputerName localhost -Port 8545` - Should show `TcpTestSucceeded : True` 4. **Windows Firewall** (if needed): - Windows Firewall should allow localhost connections by default - If blocked, add exception for port 8545 - Or temporarily disable firewall to test 5. **WSL2 Port Forwarding**: - WSL2 should forward ports automatically - If not working, restart WSL: `wsl --shutdown` (from Windows PowerShell) ### Alternative: Use WSL2 IP Address If `localhost` doesn't work, you can use the WSL2 IP address: 1. **Find WSL2 IP** (from WSL2): ```bash hostname -I # Example output: 192.168.0.3 ``` 2. **Use in MetaMask**: - RPC URL: `http://192.168.0.3:8545` - Replace `192.168.0.3` with your actual WSL2 IP 3. **Note**: This IP may change when WSL2 restarts ## Network Information - **Chain ID**: 1337 - **Network Name**: Quorum Dev Quickstart - **Consensus**: QBFT (Quorum Byzantine Fault Tolerance) - **Genesis Block**: Pre-configured with validators ## Getting Test ETH Since this is a local test network, you'll need to: 1. **Import a Pre-funded Account**: - The network has pre-configured accounts with ETH - Check the `config/nodes/` directory for account files - Import the private key into MetaMask 2. **Or Mine/Generate ETH**: - Validators are already running - You can create new accounts in MetaMask - Use the network's faucet or transfer from validator accounts ## Additional Resources - **Quorum Explorer**: http://localhost:25000/explorer/nodes - **Blockscout**: http://localhost:26000 - **Grafana Dashboard**: http://localhost:3000 - **Prometheus Metrics**: http://localhost:9090 ## Security Note ⚠️ **This is a test network** - Never use real private keys or real ETH on this network. It's only for development and testing purposes.