Overview
Privy provides simple, secure wallet infrastructure that enables seamless user authentication and wallet management. This guide shows you how to integrate Privy signers with Rhinestone smart accounts to create a smooth, cross-chain wallet experience. How it works: Privy handles user authentication and wallet creation, then provides a wagmi-compatible client that we wrap with Rhinestone’s smart account functionality. You get the best of both worlds - Privy’s seamless onboarding and Rhinestone’s cross-chain capabilities.Prerequisites
- A Privy account and application
- Privy App ID
- React application setup
Installation
Install the required dependencies:Setup Privy Provider
First, set up the Privy provider in your React application:Create a Privy Integration Hook
Create a custom hook that integrates Privy authentication with Rhinestone accounts. This hook demonstrates the key pattern: use wagmi to get the wallet client from Privy, then pass it to Rhinestone as a signer.The
useWalletClient()
hook from wagmi automatically connects to Privy’s embedded wallets and external wallet connections.Usage
Basic Authentication Flow
Use the hook to handle Privy authentication and smart account creation:Cross-Chain Transactions
Send transactions using the Privy-connected wallet:The Integration Pattern
All embedded signer integrations follow the same pattern:- Provider Setup: Configure the embedded wallet provider (Privy, Dynamic, Turnkey)
- Get Wallet Client: Use wagmi hooks (or viem accounts for Turnkey) to access the authenticated wallet
- Pass to Rhinestone: Create a Rhinestone account using the wallet client as a signer
- Use Cross-Chain Features: The resulting account has all of Rhinestone’s capabilities
Authentication Methods
Privy supports multiple authentication methods out of the box:- Email: Users can sign in with their email address
- Social: Google, Twitter, Discord, and other OAuth providers
- Wallet: Connect external wallets like MetaMask
- SMS: Phone number verification
login()
function will show Privy’s authentication modal with all configured methods.
Environment Variables
Make sure to set the following environment variables:Complete Example
Try the full integration in our example repository:- Privy authentication flows (email, social, wallet)
- Embedded wallet creation and management
- Rhinestone smart account integration
- Cross-chain transaction execution
Next Steps
- See it in action: Privy + Rhinestone Example
- Learn more about Privy’s authentication flows
- Explore embedded wallet features
- Explore chain abstraction capabilities
- Check out creating an account for more details