Skip to main content
Privy handles authentication and embedded wallet creation. Convert its connected wagmi wallet client to a viem account, then use that account as a Rhinestone owner.

Prerequisites

  • A Privy application and app ID
  • A React application
  • A backend that issues short-lived Rhinestone JWTs
1

Install the dependencies

2

Configure Privy and wagmi

Import createConfig and WagmiProvider from @privy-io/wagmi so Privy and wagmi share connection state.
The Privy app ID is public application configuration. It is not your Rhinestone API key.
3

Configure browser authentication

Do not put RHINESTONE_API_KEY in a NEXT_PUBLIC_* variable. When the SDK runs in the browser, fetch short-lived tokens from your backend:
See security for the server boundary and sponsored-intent extension tokens.
4

Create the Rhinestone account

Wait until Privy is ready and wagmi returns a connected wallet client. walletClientToAccount requires that client to have an active account.
For sponsored transactions, follow sponsorship setup. For transaction preparation and submission, continue to send a transaction. See the Privy documentation for additional login methods and embedded wallet settings.