Connect Wallet
This guide will help you connect various wallets to OPN Chain. We support all major Ethereum wallets thanks to our full EVM compatibility.
Supported Wallets
MetaMask
✅
✅
✅
✅
Trust Wallet
❌
✅
✅
❌
Coinbase Wallet
✅
✅
✅
❌
Rainbow
❌
✅
✅
❌
Ledger
✅
❌
❌
✅
Trezor
✅
❌
❌
✅
WalletConnect
✅
✅
❌
❌
MetaMask Setup
MetaMask is the most popular and recommended wallet for OPN Chain.
Browser Extension
Install MetaMask
Create or Import Wallet
Follow MetaMask's setup wizard
Securely store your seed phrase
Never share your private key or seed phrase
Add OPN Network
Option A: Automatic (Recommended)
// Add this to your website async function addOPNNetwork() { try { await window.ethereum.request({ method: 'wallet_addEthereumChain', params: [{ chainId: '0x3d8', chainName: 'OPN Testnet', nativeCurrency: { name: 'Test OPN', symbol: 'OPN', decimals: 18 }, rpcUrls: ['https://testnet-rpc.iopn.tech'], blockExplorerUrls: [] }] }); } catch (error) { console.error('Failed to add network:', error); } }
Option B: Manual
Click the network dropdown
Select "Add Network"
Click "Add a network manually"
Enter:
Network Name: OPN Testnet
RPC URL: https://testnet-rpc.iopn.tech
Chain ID: 984
Currency Symbol: OPN
Mobile Setup
Download MetaMask Mobile
Import or Create Wallet
Use same seed phrase as desktop for sync
Or create new mobile-only wallet
Add OPN Network
Go to Settings → Networks
Tap "Add Network"
Enter the network details above
Connecting Hardware Wallets
MetaMask supports Ledger and Trezor hardware wallets:
Connect Hardware Wallet
Plug in your device
In MetaMask, go to Settings → Advanced
Enable "Use hardware wallets"
Add Hardware Account
Click account dropdown → Connect hardware wallet
Select your device type
Follow on-screen instructions
Use with OPN Chain
Ensure OPN network is selected
Hardware wallet will sign transactions
Trust Wallet Setup
Trust Wallet is popular for mobile users.
Mobile Setup
Add Custom Network
Go to Settings → Networks
Tap the + icon
Select "Custom Network"
Enter:
Network: OPN Testnet RPC URL: https://testnet-rpc.iopn.tech Chain ID: 984 Symbol: OPN Block Explorer: https://testnet.iopn.tech
Browser Extension
Install Trust Wallet Extension
Available for Chrome, Brave, Edge
Configure Network
Click settings icon
Select "Custom Networks"
Add OPN details
Coinbase Wallet Setup
Browser Extension
Install Extension
Add Network
Click Settings → Networks
Add Custom Network
Enter OPN details
Mobile Setup
Configure Network
Settings → Networks → Add Network
Enter OPN configuration
WalletConnect Integration
WalletConnect allows you to connect any compatible wallet to DApps.
For DApp Developers
import WalletConnectProvider from "@walletconnect/web3-provider";
import Web3 from "web3";
// Initialize WalletConnect
const provider = new WalletConnectProvider({
rpc: {
984: "https://testnet-rpc.iopn.tech",
},
chainId: 984,
});
// Enable session
await provider.enable();
// Create Web3 instance
const web3 = new Web3(provider);
// Now you can use web3 as normal
const accounts = await web3.eth.getAccounts();
For Users
Open DApp that supports WalletConnect
Click Connect Wallet → WalletConnect
Scan QR Code with your mobile wallet
Approve Connection in your wallet
Programmatic Wallet Connection
Detect Installed Wallets
// Check for injected wallets
function getInstalledWallets() {
const wallets = [];
if (typeof window.ethereum !== 'undefined') {
// MetaMask or compatible
if (window.ethereum.isMetaMask) {
wallets.push('MetaMask');
}
// Coinbase Wallet
if (window.ethereum.isCoinbaseWallet) {
wallets.push('Coinbase Wallet');
}
// Trust Wallet
if (window.ethereum.isTrust) {
wallets.push('Trust Wallet');
}
}
return wallets;
}
Universal Connection Handler
class WalletConnector {
constructor() {
this.provider = null;
this.accounts = [];
this.chainId = null;
}
async connect() {
// Check if wallet is installed
if (typeof window.ethereum === 'undefined') {
throw new Error('No wallet detected. Please install MetaMask!');
}
try {
// Request account access
this.accounts = await window.ethereum.request({
method: 'eth_requestAccounts'
});
// Get chain ID
this.chainId = await window.ethereum.request({
method: 'eth_chainId'
});
// Check if on OPN Chain
if (parseInt(this.chainId, 16) !== 984) {
await this.switchToOPN();
}
// Set provider
this.provider = window.ethereum;
// Setup event listeners
this.setupEventListeners();
return this.accounts[0];
} catch (error) {
console.error('Failed to connect:', error);
throw error;
}
}
async switchToOPN() {
try {
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x3d8' }],
});
} catch (switchError) {
// Chain not added yet
if (switchError.code === 4902) {
await this.addOPNNetwork();
}
}
}
async addOPNNetwork() {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0x3d8',
chainName: 'OPN Testnet',
nativeCurrency: {
name: 'Test OPN',
symbol: 'OPN',
decimals: 18
},
rpcUrls: ['https://testnet-rpc.iopn.tech'],
blockExplorerUrls: []
}],
});
}
setupEventListeners() {
window.ethereum.on('accountsChanged', (accounts) => {
this.accounts = accounts;
console.log('Accounts changed:', accounts);
});
window.ethereum.on('chainChanged', (chainId) => {
this.chainId = chainId;
console.log('Chain changed:', chainId);
// Reload page on chain change
window.location.reload();
});
}
async disconnect() {
// Note: There's no real "disconnect" in injected wallets
// This is more for cleaning up state
this.provider = null;
this.accounts = [];
this.chainId = null;
}
}
// Usage
const wallet = new WalletConnector();
const account = await wallet.connect();
console.log('Connected account:', account);
Security Best Practices
For Users
Verify Network Details
Always double-check RPC URL
Confirm Chain ID is 984
Only use official URLs
Protect Your Keys
Never share private keys
Never enter seed phrase on websites
Use hardware wallets for large amounts
Check Transaction Details
Verify recipient address
Check gas fees
Understand what you're signing
For Developers
Always Request Permissions
// Bad - assumes permission const accounts = await web3.eth.getAccounts(); // Good - requests permission const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });
Handle Network Changes
window.ethereum.on('chainChanged', (chainId) => { if (parseInt(chainId, 16) !== 984) { alert('Please switch to OPN Network'); } });
Validate User Input
function isValidAddress(address) { return /^0x[a-fA-F0-9]{40}$/.test(address); }
Common Issues
MetaMask Not Detected
// Wait for page load
if (document.readyState !== 'loading') {
detectMetaMask();
} else {
document.addEventListener('DOMContentLoaded', detectMetaMask);
}
function detectMetaMask() {
if (typeof window.ethereum !== 'undefined') {
console.log('MetaMask detected!');
} else {
console.log('Please install MetaMask!');
window.open('https://metamask.io/download/', '_blank');
}
}
Network Addition Failed
async function forceAddNetwork() {
try {
// Try to switch first
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x3d8' }],
});
} catch (error) {
if (error.code === 4902) {
// Add network with retry
let retries = 3;
while (retries > 0) {
try {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [OPN_NETWORK_CONFIG],
});
break;
} catch (addError) {
retries--;
if (retries === 0) throw addError;
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
}
}
}
Mobile Connection Issues
For mobile DApps, use deep linking:
function connectMobileWallet() {
const dappUrl = window.location.href;
const metamaskAppUrl = `https://metamask.app.link/dapp/${dappUrl}`;
// Detect mobile
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
if (isMobile && !window.ethereum) {
window.location.href = metamaskAppUrl;
}
}
Need help? Join our Discord
Last updated