Overview
Turnkey provides secure key management infrastructure that enables you to create and manage signing keys for your users. This guide shows you how to integrate Turnkey signers with Rhinestone smart accounts for secure, non-custodial wallet experiences. How it works: Unlike Privy and Dynamic, Turnkey operates at a lower level. You create a viem-compatible account that uses Turnkey’s signing infrastructure, then pass that account to Rhinestone. Turnkey handles the secure key management while Rhinestone adds cross-chain capabilities.Prerequisites
- A Turnkey account and organization
- Turnkey API credentials (API public/private key pair)
- Your organization ID from Turnkey
Installation
Install the required dependencies:Create a Signer Wallet
Using the Turnkey dashboard or API, create a new Ethereum (EVM) wallet. This wallet will be the owner of the Rhinestone smart account.- Log into your Turnkey dashboard
- Navigate to the Wallets section
- Create a new Ethereum wallet
- Note the wallet address for the next step
Create a Turnkey Signer
Create a viem Account instance that integrates with Turnkey for signing. This creates a viem-compatible signer that Rhinestone can use, similar to how wagmi provides wallet clients in the other examples.Turnkey provides
@turnkey/viem
which creates viem-compatible accounts that work seamlessly with Rhinestone.Initialize Rhinestone Account
Create a new Rhinestone account using the Turnkey signer. This is the same pattern as with other providers - pass the signer to Rhinestone, and it wraps it with cross-chain functionality:Usage
Send a Cross-chain Transaction
The Rhinestone account will automatically use the Turnkey signer for all transactions:Don’t forget to fund the account before making any transactions.
Environment Variables
Make sure to set the following environment variables:Complete Example
Try the full integration in our example repository:- Turnkey API key configuration
- Secure wallet creation and management
- Rhinestone smart account integration
- Enterprise-grade key management practices
Next Steps
- See it in action: Turnkey + Rhinestone Example
- Learn about sending cross-chain transactions for more transaction details
- Explore chain abstraction capabilities
- Check out creating an account for more details