Wallet integration is usually the first step in turning a web app into a Web3 product. This guide walks through the moving parts, shows a minimal example with Ethers.js, and covers the security and UX details that separate a demo from a production feature.
Two kinds of wallet integration
- Self-custody (user wallets): users connect browser or mobile wallets such as MetaMask or WalletConnect-compatible apps and sign transactions themselves.
- Custodial / institutional: your platform manages wallets on behalf of users through a custody provider such as Fireblocks, with policies, approvals and audit trails.
Connecting a user wallet with Ethers.js
Browser wallets inject a provider into the page. With Ethers.js (v6) you can request accounts and read the connected address:
import { BrowserProvider, formatEther } from 'ethers';
export async function connectWallet() {
if (!window.ethereum) throw new Error('No wallet found — install MetaMask or use WalletConnect');
const provider = new BrowserProvider(window.ethereum);
await provider.send('eth_requestAccounts', []);
const signer = await provider.getSigner();
const address = await signer.getAddress();
const balance = formatEther(await provider.getBalance(address));
return { provider, signer, address, balance };
}Production details that matter
- Network checks. Detect the connected chain and prompt users to switch if it is wrong.
- Account and chain change events. Listen for them and update your UI and session.
- Sign-in with a signature. Verify wallet ownership on your server with a signed, single-use message instead of trusting the address the browser sends.
- Clear transaction states. Show pending, confirmed and failed states — blockchain confirmations are not instant.
- Mobile support. WalletConnect lets users connect mobile wallets by scanning a QR code.
When to use a custody provider
If your platform holds assets for users — exchanges, payment products, treasury tools — a custody provider such as Fireblocks handles key management, transaction policies and approvals. Your application integrates through their APIs instead of managing keys directly.
KYC and compliance
Many Web3 products also need identity verification before users can transact. A KYC flow typically collects documents, runs verification with a provider and stores the result against the user's account and wallet.
Our team leads development across a Web3 product suite that includes a KYC platform, on-chain data services and Fireblocks integration — see the Astra Web3 Suite case study. If you are adding wallets to your product, explore our Web3 and blockchain development service.



