A web application to connect to Canton Network testnet and view your wallet balance. Built with Auth0 authentication and configured for Palladium Labs testnet.
- Connect to Canton Network: Uses OAuth2 authentication through the Canton Network Quickstart
- Display User Info: Shows your party ID, wallet URL, and authentication status
- View Balance: Links to your Canton Network wallet to view Canton Coin balance
- Clean UI: Simple, modern interface built with React + TypeScript + Vite
Before running this app, you need:
-
Canton Network Quickstart running locally
- Located at:
~/Documents/cn-quickstart/cn-quickstart/quickstart - Must be built and started:
cd quickstart && make build && make start - Backend should be accessible at:
http://app-provider.localhost:3000
- Located at:
-
Node.js and npm installed
- Node.js v24+ (you already have this!)
- npm v11+ (you already have this!)
# In a separate terminal
cd ~/Documents/cn-quickstart/cn-quickstart/quickstart
make startWait for all containers to be healthy (especially splice, backend-service, nginx).
- Open: http://app-provider.localhost:3000
- Login with credentials:
- Username:
app-providerorapp-user - Password: (provided by quickstart)
- Username:
- This creates an authenticated session
# In this directory
npm install # Already done!
npm run devThe app will start at: http://localhost:5173
- Open http://localhost:5173 in your browser
- Click "Check Connection Status" to verify connection
- If not authenticated, click "Login with Canton Network"
- Once connected, you'll see:
- Your username
- Your party ID (Canton Network address)
- Link to your wallet
- Admin status
Browser (localhost:5173)
↓ fetch('/api/user')
Vite Dev Server (proxy)
↓ proxies to http://app-provider.localhost:3000/api
Canton Quickstart Backend
↓ queries via gRPC
Canton Network Participant Node
- Vite Proxy: Configured in
vite.config.tsto forward/apirequests to the quickstart backend - CORS Handling: Proxy handles CORS issues automatically
- Session Cookies: Authentication cookies from quickstart backend are preserved
- Type Safety: Full TypeScript support with proper interfaces
canton-balance-app/
├── src/
│ ├── App.tsx # Main component with wallet connection logic
│ ├── App.css # Styling
│ ├── main.tsx # React entry point
│ └── vite-env.d.ts # Vite type definitions
├── vite.config.ts # Vite configuration with proxy
├── package.json # Dependencies
└── README.md # This file
The app connects to the quickstart backend via Vite proxy:
// vite.config.ts
server: {
proxy: {
'/api': {
target: 'http://app-provider.localhost:3000',
changeOrigin: true,
secure: false,
}
}
}When you get Canton Network testnet access:
- Update
vite.config.tsproxy target to testnet URL - Update OAuth login URL in
App.tsx - Configure testnet authentication credentials
- Cause: Quickstart backend not running
- Fix: Make sure
make startcompleted successfully in quickstart directory - Check: Visit http://app-provider.localhost:3000 directly
- Cause: No active session with quickstart
- Fix:
- Visit http://app-provider.localhost:3000
- Login with
app-providerorapp-user - Return to http://localhost:5173 and click "Check Connection Status"
- Cause: Vite proxy not working
- Fix: Restart the dev server (
npm run dev)
- Cause: Another app using port 5173
- Fix: Change port in
vite.config.tsor kill the other process
To actually query Canton Coin balance (not just link to wallet), you'll need to:
-
Understand Canton Coin Contract Structure
- Find the Template ID for Canton Coin
- Learn the contract schema (fields, parties, amount)
-
Query Contracts via Backend
- Option A: Add a new endpoint to quickstart backend that queries CC contracts
- Option B: Query Participant Query Store (PQS) directly if accessible
-
Display Balance
- Parse contract data
- Sum up all Canton Coin contracts owned by user's party
- Display total balance
Example pseudocode:
const queryBalance = async (partyId: string) => {
const response = await fetch('/api/canton-coin/balance', {
method: 'POST',
body: JSON.stringify({ party: partyId })
});
const data = await response.json();
return data.totalBalance;
}When ready to deploy:
- Build the app:
npm run build - Deploy
dist/folder to:- Vercel:
vercel --prod - Netlify:
netlify deploy --prod - GitHub Pages: Push to gh-pages branch
- Vercel:
- Update proxy/API configuration for testnet
- Canton Network Docs: https://docs.digitalasset.com
- Canton Network Quickstart:
~/Documents/cn-quickstart/cn-quickstart/quickstart/README.md - Vite Docs: https://vite.dev
- React Docs: https://react.dev
Built for Canton Network development. Free to use and modify.
Built with: React + TypeScript + Vite Connects to: Canton Network Quickstart (Local) Future: Deploy to Canton Network Testnet