Basic dApp
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.
What You'll Build
Provider setup with RainbowKit + Seismic
Wallet connection via RainbowKit's
ConnectButtonShielded write to a contract (encrypted calldata)
Signed read from a contract (authenticated query)
Prerequisites
Node.js 18+
A WalletConnect project ID
Install dependencies:
npm install seismic-react seismic-viem wagmi viem @rainbow-me/rainbowkit @tanstack/react-queryStep 1: wagmi Config
Create the wagmi configuration with the Seismic testnet chain:
// config.ts
import { getDefaultConfig } from "@rainbow-me/rainbowkit";
import { seismicTestnet } from "seismic-react/rainbowkit";
export const config = getDefaultConfig({
appName: "Seismic Basic dApp",
projectId: "YOUR_WALLETCONNECT_PROJECT_ID",
chains: [seismicTestnet],
});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:
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
Next Steps
Hooks Reference - Full API for all hooks
Wallet Guides - Use AppKit or Privy instead of RainbowKit
Chains - Configure Seismic testnet or local Sanvil
See Also
ShieldedWalletProvider - Provider configuration options
useShieldedWriteContract - Shielded write hook API
useSignedReadContract - Signed read hook API
Installation - Full dependency setup
Last updated

