Testing the Wallet Extension
This final section covers loading your wallet extension in Chrome and testing it with the Pod Racing dApp from the webapp tutorial.
Building the Extension
From the webapp-tutorial directory:
# Install dependencies, if the clone steps have not already
./setup.sh 6.0.0 6.0.0
# Build the extension
node esbuild.extension.mjs
You should see:
Extension build complete!
The build creates:
test-extension/dist/background.jstest-extension/dist/content-script.jstest-extension/dist/offscreen.jstest-extension/dist/popup.js
Loading in Chrome
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in top-right corner)
- Click Load unpacked
- Select the
test-extensionfolder (notdist/) - The extension "Aztec Tutorial Wallet" should appear
You should see:
- Extension icon in the toolbar
- "Service Worker" link under "Inspect views"
First launch
Click the extension icon to open the popup:
- On the "Welcome to Aztec Wallet" screen, enter a password (at least 8 characters), confirm it, and click "Continue"
- Under "Create Your First Account", enter an account name and click "Create Account"
The account appears with the status "Not Deployed".
Deploying an account
- Click "Deploy Account"
- Wait for the transaction (it uses SponsoredFPC, so no tokens are needed)
- The status changes to "Deployed"
If the deployment fails, the error appears above the "Deploy Account" button. See Debugging for where to find the logs.
Running the dApp
In another terminal, start the webapp tutorial from the clone's root (aztec-docs):
cd docs/lines/v6/examples/webapp-tutorial
# Start the dev server
yarn dev
Open http://localhost:5173 in Chrome.
Connecting the wallet
- In the dApp, set Network to "Browser Wallet"
- The extension receives a Connection Request from
localhost:5173and shows a badge. Open the popup and click "Connect" - Back in the dApp, click "Connect to Aztec Tutorial Wallet"
- The dApp shows a grid of emojis, and the popup shows Verify Connection with the same emojis. If they match, click "Emojis Match"
- The popup then shows a Capabilities Request listing the permissions the dApp asks for. Click "Approve"
The dApp now shows your account address and the game lobby.
Creating a game
In the dApp, click "Deploy Contract & Create Game". The popup shows a Send Transaction approval for each transaction: first the contract deployment, then create_game. Review the function calls and click "Approve" for each.
Each transaction takes a little while because the proof is generated in the extension (WASM) and then included in a block.
Playing the game
- Set the track sliders (the total must be less than 10) and click "Submit Allocation"
- Approve the
play_roundtransaction in the popup - The dApp moves on to the next round
Each round is a private transaction: your allocation is stored as a private note, and only the round counter is public. To finish a game, a second player joins with the contract address and game ID shown in the dApp.
Debugging
Background Script
- Go to
chrome://extensions/ - Find "Aztec Tutorial Wallet"
- Click "Service Worker" under "Inspect views"
- Check Console for
[background]logs
Offscreen Document
- On the extensions page, look for "Offscreen document"
- Click to open DevTools
- Check Console for
[offscreen]logs
Content Script
- Open DevTools on the dApp page (F12)
- Check Console for
[content-script]logs - May need to filter by extension
Common Issues
"Cannot read properties of undefined"
- PXE (Private eXecution Environment) hasn't initialized yet
- Check offscreen console for initialization errors
"Account not found"
- Account isn't loaded in memory
- Try entering password to unlock
"Transaction rejected"
- Check if the Aztec node is reachable
- Verify SponsoredFPC is registered
Popup doesn't show pending items
- Refresh the popup (close and reopen)
- Check background console for errors
Verifying on Explorer
If your network has a block explorer, you can verify transactions:
- Copy your transaction hash from logs
- Visit the explorer
- Search for the transaction
- Verify it's included in a block
Reloading After Changes
When you modify the extension:
- Rebuild:
node esbuild.extension.mjs - Go to
chrome://extensions/ - Click the refresh icon on the extension
- Reload any open dApp pages
End-to-End Test Flow
Complete test checklist:
- Build extension
- Load in Chrome
- Set a password and create an account in the popup
- Deploy the account (SponsoredFPC)
- Start the dApp
- Connect the wallet (approve the connection, emojis and capabilities in the popup)
- Verify the account address shows in the dApp
- Deploy the Pod Racing contract and create a game (approve in the popup)
- Submit a round (approve the
play_roundtransaction) - Check transactions in explorer
Production Considerations
Before releasing a wallet extension:
- Security audit - Professional review of crypto code
- Key management - Consider hardware wallet support
- Network switching - Support testnet, mainnet
- Error recovery - Graceful handling of failures
- Backup/restore - Seed phrase support
- Multi-account - Better account management UI
- Transaction history - Show past transactions
- Note management - Display synced notes
Summary
You've built a functional wallet extension that:
- Creates and stores encrypted accounts
- Deploys contracts using SponsoredFPC
- Connects to dApps via the wallet SDK protocol
- Approves transactions with a popup UI
- Generates ZK proofs for private transactions
This is the foundation for a production Aztec wallet. The architecture patterns - offscreen documents, message routing, BaseWallet extension - apply to any browser wallet.
What's Next?
- Add more account types (ECDSA, multisig)
- Implement transaction history
- Add network switching
- Build a note browser
- Support hardware wallets
Happy building!