Quickstart
1. Create a React + Typescript Project
Let's create a simple vite project with React and Typescript:
npm create vite@latest sdk-test -- --template react-ts2. Install Dependencies
Install shielder-sdk and additional dependencies:
npm install @cardinal-cryptography/[email protected]
npm install @cardinal-cryptography/[email protected]
npm install @cardinal-cryptography/[email protected]
npm install viem @types/node @vitejs/plugin-react3. Configure Vite
Add following code to vite.config.ts :
import * as path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
optimizeDeps: {
exclude: ["@cardinal-cryptography/shielder-sdk-crypto-wasm-light"],
},
});
4. Set Up WASM Cryptography Client
Create a file src/shielderWasm.ts , where we'll set up the wasm engine loading.
Note, that in quickstart guide we use a light wasm client, which is simple to set up, but currently is in alpha stage. Refer to Cryptography Client for production-ready setup details.
PCR values can be found at Github Releases, for example pcr-92cd84c.json
5. Initialize the Shielder SDK Client
Create src/shielder.ts:
6. Verify the Setup
In your main file (e.g. src/main.tsx or src/App.tsx):
At this point, your app is connected to the Shielder network, has synced the private account, and can query its state.\
Next steps:
To shield tokens (i.e. deposit), see: Shielding Tokens
To withdraw tokens back to a public address, see: Withdrawing Tokens
Both operations require working with token approvals, gas fees, and relayer coordination. For a comprehensive understanding of all fee structures and costs involved, see Understanding Fees.
We recommend you handle those through user-facing components in your app UI.
Explore the guides to implement full privacy flow.
Last updated

