Wallet Setup

How to set up and use wallets with NitroGraph

Complete guide to wallet configuration for NitroGraph network.

Supported Wallets: MetaMask, WalletConnect, Ledger, Trezor, and any EVM-compatible wallet

Quick Setup

Step 1

Install MetaMask browser extension

Step 2

Click "Add Network" button below

Step 3

Get testnet tokens from faucet

Network Configuration

Network Name: NitroGraph Testnet
RPC URL: https://rpc-testnet.nitrograph.foundation
Chain ID: 200024
Symbol: NOS
Explorer: https://explorer-testnet.nitrograph.foundation

One-Click Add:

await ethereum.request({
    method: 'wallet_addEthereumChain',
    params: [{
        chainId: '0x30D08',
        chainName: 'NitroGraph Testnet',
        nativeCurrency: {
            name: 'NitroGraph Testnet',
            symbol: 'NOS',
            decimals: 18
        },
        rpcUrls: ['https://rpc-testnet.nitrograph.foundation'],
        blockExplorerUrls: ['https://explorer-testnet.nitrograph.foundation']
    }]
});

Wallet Types

Browser Wallets

MetaMask

Most popular, fully supported:

// Check if installed
if (typeof window.ethereum !== 'undefined') {
    console.log('MetaMask installed');
}

// Connect
const accounts = await ethereum.request({ 
    method: 'eth_requestAccounts' 
});

// Switch to NitroGraph
await ethereum.request({
    method: 'wallet_switchEthereumChain',
    params: [{ chainId: '0x30D08' }]
});

WalletConnect

For mobile and multi-device:

import WalletConnect from "@walletconnect/client";

const connector = new WalletConnect({
    bridge: "https://bridge.walletconnect.org",
    qrcodeModal: QRCodeModal
});

// Create session
if (!connector.connected) {
    await connector.createSession();
}

Hardware Wallets

Ledger

import TransportWebUSB from "@ledgerhq/hw-transport-webusb";
import Eth from "@ledgerhq/hw-app-eth";

// Connect Ledger
const transport = await TransportWebUSB.create();
const eth = new Eth(transport);

// Get address
const result = await eth.getAddress("44'/60'/0'/0/0");
console.log(result.address);

Trezor

import TrezorConnect from 'trezor-connect';

// Initialize
TrezorConnect.init({
    lazyLoad: true,
    manifest: {
        appUrl: 'https://your-app.com',
        email: '[email protected]'
    }
});

// Get address
const result = await TrezorConnect.ethereumGetAddress({
    path: "m/44'/60'/0'/0/0"
});

Mobile Wallets

Trust Wallet

// Deep link to add network
const deepLink = `trust://add_network?
    chainId=200024&
    name=NitroGraph%20Testnet&
    rpc=https://rpc-testnet.nitrograph.foundation&
    symbol=NOS`;

window.location.href = deepLink;

Rainbow

import { 
    getDefaultWallets,
    RainbowKitProvider 
} from '@rainbow-me/rainbowkit';

const { connectors } = getDefaultWallets({
    appName: 'My Agent App',
    chains: [nitrographTestnet]
});

Agent Wallets

Programmatic Wallets

For autonomous agents:

from eth_account import Account
import secrets

# Generate new wallet
priv = secrets.token_hex(32)
private_key = f"0x{priv}"
account = Account.from_key(private_key)

print(f"Address: {account.address}")
print(f"Private Key: {private_key}")

# Save securely
import keyring
keyring.set_password("nitrograph", "agent_key", private_key)

HD Wallets

For managing multiple agents:

import { hdkey } from 'ethereumjs-wallet';
import bip39 from 'bip39';

// Generate mnemonic
const mnemonic = bip39.generateMnemonic();

// Derive wallets
const seed = await bip39.mnemonicToSeed(mnemonic);
const root = hdkey.fromMasterSeed(seed);

// Generate agent wallets
const agents = [];
for (let i = 0; i < 10; i++) {
    const wallet = root.derivePath(`m/44'/60'/0'/0/${i}`).getWallet();
    agents.push({
        address: wallet.getAddressString(),
        privateKey: wallet.getPrivateKeyString()
    });
}

Security Best Practices

Key Management

// DON'T: Store keys in code
const privateKey = "0x123..."; // NEVER DO THIS

// DO: Use environment variables
const privateKey = process.env.PRIVATE_KEY;

// BETTER: Use key management service
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
const client = new SecretManagerServiceClient();
const [version] = await client.accessSecretVersion({
    name: 'projects/123/secrets/private-key/versions/latest',
});
const privateKey = version.payload.data.toString();

Multi-Signature Setup

For high-value operations:

// Deploy Gnosis Safe
const safe = await SafeFactory.create({
    ethAdapter,
    contractNetworks
});

const safeAccountConfig = {
    owners: [owner1, owner2, owner3],
    threshold: 2,  // 2 of 3 required
};

const safeSdk = await safe.deploySafe({ safeAccountConfig });

Token Management

Adding Tokens

Add NitroGraph tokens to wallet:

// Add NITRO token
await ethereum.request({
    method: 'wallet_watchAsset',
    params: {
        type: 'ERC20',
        options: {
            address: '0x1234...', // NITRO contract
            symbol: 'NITRO',
            decimals: 18,
            image: 'https://nitrograph.foundation/nitro.png'
        }
    }
});

// Add NUSDC
await ethereum.request({
    method: 'wallet_watchAsset',
    params: {
        type: 'ERC20',
        options: {
            address: '0x5678...', // NUSDC contract
            symbol: 'NUSDC',
            decimals: 6,
            image: 'https://nitrograph.foundation/nusdc.png'
        }
    }
});

Token Balances

Check all token balances:

from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://rpc-testnet.nitrograph.foundation'))

# Native balance (NOS/NITRO)
balance_wei = w3.eth.get_balance(address)
balance = w3.from_wei(balance_wei, 'ether')

# Token balances
def get_token_balance(token_address, wallet_address):
    contract = w3.eth.contract(address=token_address, abi=ERC20_ABI)
    return contract.functions.balanceOf(wallet_address).call()

nitro_balance = get_token_balance(NITRO_ADDRESS, wallet)
nusdc_balance = get_token_balance(NUSDC_ADDRESS, wallet)
xp_balance = get_token_balance(XP_ADDRESS, wallet)

Transaction Management

Gas Estimation

// Estimate gas for transaction
const gasEstimate = await contract.methods
    .transfer(recipient, amount)
    .estimateGas({ from: account });

// Add 10% buffer
const gasLimit = Math.ceil(gasEstimate * 1.1);

// Get current gas price
const gasPrice = await web3.eth.getGasPrice();

// Calculate total cost
const totalCost = gasLimit * gasPrice;
console.log(`Transaction will cost: ${web3.utils.fromWei(totalCost)} NITRO`);

Transaction Monitoring

# Watch for confirmations
def wait_for_confirmation(tx_hash, confirmations=3):
    receipt = None
    while True:
        try:
            receipt = w3.eth.get_transaction_receipt(tx_hash)
            if receipt and receipt.blockNumber:
                current = w3.eth.block_number
                if current - receipt.blockNumber >= confirmations:
                    return receipt
        except Exception:
            pass
        time.sleep(1)

# Send and monitor
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
receipt = wait_for_confirmation(tx_hash)
print(f"Confirmed in block {receipt.blockNumber}")

Wallet Recovery

From Mnemonic

import { ethers } from 'ethers';

// Recover from mnemonic
const mnemonic = "your twelve word mnemonic phrase here";
const wallet = ethers.Wallet.fromMnemonic(mnemonic);

console.log(`Recovered address: ${wallet.address}`);

From Keystore

# Recover from keystore file
import json
from eth_account import Account

with open('keystore.json') as f:
    keystore = json.load(f)

password = input("Enter password: ")
private_key = Account.decrypt(keystore, password)
account = Account.from_key(private_key)

print(f"Recovered: {account.address}")

Common Issues

Wrong Network

// Check current network
const chainId = await ethereum.request({ 
    method: 'eth_chainId' 
});

if (chainId !== '0x30D08') {
    // Switch to NitroGraph
    try {
        await ethereum.request({
            method: 'wallet_switchEthereumChain',
            params: [{ chainId: '0x30D08' }],
        });
    } catch (error) {
        // Network not added, add it
        if (error.code === 4902) {
            await addNitroGraphNetwork();
        }
    }
}

Insufficient Balance

def ensure_balance(amount_needed):
    balance = w3.eth.get_balance(address)
    
    if balance < amount_needed:
        deficit = amount_needed - balance
        print(f"Need {w3.from_wei(deficit, 'ether')} more NITRO")
        
        # Options
        print("1. Get from faucet (testnet)")
        print("2. Bridge from another chain")
        print("3. Buy on DEX")
        
        return False
    return True

Resources

Faucets

Block Explorers

Support


Your keys, your agents, your economy.

Last updated