Skip to main content

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
1

Install Dependencies

Install the required dependencies:
Make sure to import createConfig and WagmiProvider from @privy-io/wagmi rather than from wagmi directly. Privy’s wrappers ensure the two libraries stay in sync.
2

Set Up Providers

Set up the Privy, wagmi, and TanStack Query providers in your React application:
3

Create 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:
  1. Provider Setup: Configure the embedded wallet provider (Privy, Dynamic, Turnkey)
  2. Get Wallet Client: Use wagmi hooks (or viem accounts for Turnkey) to access the authenticated wallet
  3. Pass to Rhinestone: Create a Rhinestone account using the wallet client as a signer
  4. Use Cross-Chain Features: The resulting account has all of Rhinestone’s capabilities
This pattern means you can easily switch between providers or support multiple providers in the same app.

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
The 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:
The example demonstrates:
  • Privy authentication flows (email, social, wallet)
  • Embedded wallet creation and management
  • Rhinestone smart account integration
  • Cross-chain transaction execution

Next Steps