Skip to main content
Ground is the cash management layer for stablecoins and lets your app offer RWA yield through gtokens held in user-owned Privy wallets. Users authorize your developer signer once; your Node.js backend then discovers sources, allowlists their wallets, and executes deposits and withdrawals on their behalf.

Resources

Ground gtoken docs

Official documentation for gtokens, deposits, and redemptions.

Privy developer signer quickstart

Generate an authorization key and let users add it to their wallet.
The example below uses gUSTB and USDC on Ethereum Sepolia, Ground’s sandbox network for this walkthrough. gUSTB is the receipt token of a Ground vault that holds Superstate’s USTB, a tokenized fund providing exposure to short-duration U.S. Treasury bills.

Before you start

1

Create a Ground account and API key

Create an account in the Ground Developer Portal. Once your account is set up, select the sandbox environment and open API Keys to generate a key. Copy it when shown and store it securely — it is displayed only once.
2

Install dependencies and configure environment variables

Install the server-side dependencies:
Configure these environment variables. Keep all secrets on your backend:
3

Set up a Privy app with a user-owned wallet and your developer signer

Create a Privy app and enable user-owned embedded Ethereum wallets. Following the signer quickstart, generate a P-256 authorization key and register its public key in a 1-of-1 key quorum. Keep the authorization private key on your backend as base64-encoded PKCS8 without PEM headers, and attach policies permitting Ground’s Admission signature, USDC approval, and vault calls on Sepolia.Have the logged-in user add the signer to their wallet:
4

Fund the user's wallet

Fund the user’s wallet with 10 sandbox USDC and some Sepolia ETH for gas. Get test ETH from a Sepolia faucet.

Discover sources and allowlist the wallet

1

1. Discover available yield sources

Fetch the sources available to your organization. Each catalogue row identifies a source, network, vault address, deposit asset, and contract interface. Fetch each environment’s catalogue separately, and discover addresses from the catalogue instead of hardcoding the vault.
Always verify the identity token and confirm the selected wallet belongs to the authenticated user before taking any action on it. Fund the selected user-owned wallet before continuing to deposits.
2

2. Allowlist the wallet

Fetch Ground’s authorization challenge and use the developer signer to sign it for the user-owned Privy wallet that will hold gUSTB. Submit the signed proof to Ground:
Enable deposits only when the GET returns allowed: true. HTTP 202 means the request is pending — poll GET from your backend. Stop and surface failed or reconciliation_required rather than polling forever. If the signature expires before submission, fetch and sign a new challenge.

Transact with the developer signer

Use Node.js 22 or later with TypeScript. The snippets share the user-owned wallet, authorization context, and catalogue source above; put imports at module scope and execute steps in order inside an async function. Download the selected vault’s verified implementation ABI from the Ground contracts resource into ground-ustb-abi.json.
1

3. Approve USDC

2

4. Deposit and receive gUSTB

After access and approval are confirmed, deposit USDC with the wallet as receiver. The gUSTB shares stay in the user’s wallet:
Use convertToShares(assets) for an estimate and confirmed deposit events for actual minted shares. The deposit method does not enforce a minimum-share output.
3

5. Check balances

Show wallet-held investments, unsettled withdrawals, and claimable USDC separately. Under the USTB escrow implementation, requested shares leave the wallet, so balanceOf alone excludes that withdrawal value.
These reads require the deployed escrow-enabled USTB ABI. pendingRedeemShares includes settled, unclaimed shares, so subtract settledShares before estimating unsettled value. Claimable USDC is the actual settled amount; do not also count settled shares in the estimates. Format asset amounts using the deposit token’s decimals and share amounts using the vault’s decimals().
4

6. Withdraw to the wallet

For an immediate exit, check current capacity and redeem. USDC returns to the same user wallet:
For a queued exit, call requestRedeem(owner, shares) through the same server send helper and save the request ID decoded from the confirmed event. After processing, call claimRedeem(owner, requestId) using the verified ABI. Check that request’s state or simulate its claim before submitting. Refresh balances after confirmed requests and claims; withdrawal completes when proceeds reach the wallet. See the Ground deposit and redeem docs.

Conclusion

Privy makes it straightforward to offer Ground RWA yield from user-owned wallets your users control. For more detail, refer to the Ground gtoken docs, or reach out in Slack.
Your app is now ready to deposit into and redeem Ground gtokens with Privy user-owned wallets!