Complete minimal dApp with shielded writes and signed reads
This example builds a complete minimal dApp that connects a wallet, sends a shielded write transaction, and performs a signed read -- all using seismic-react hooks.
Replace YOUR_WALLETCONNECT_PROJECT_ID with your actual project ID from WalletConnect Cloud.
Step 2: Provider Wrapper
Wrap your app with the required providers. ShieldedWalletProvider must be nested inside the wagmi and React Query providers:
Step 3: Contract Interaction Component
Create a component that uses useShieldedWriteContract and useSignedReadContract to interact with a shielded counter contract:
Replace CONTRACT_ADDRESS with the address of a deployed shielded contract on Seismic testnet. The ABI above is for a simple counter -- adapt it to match your contract.
Step 4: App Component
Combine the wallet connection button with the counter component. The counter only renders once the shielded wallet is ready:
What's Happening
RainbowKit handles wallet connection and chain switching
ShieldedWalletProvider automatically creates shielded clients when a wallet connects, performing the ECDH key exchange with the TEE
useShieldedWriteContract encrypts calldata before sending the transaction, ensuring on-chain privacy
useSignedReadContract attaches a signature proving caller identity, allowing the contract to return private data only to authorized readers