Skip to main content
Magic offers client-side embedded wallets and server wallets. Both can provide the ECDSA signatures required by a Rhinestone smart account, but they use different trust boundaries.
Use this path when Magic authenticates and signs in the browser.
1

Install and initialize Magic

The Magic key in this snippet is publishable. Keep the Rhinestone API key and any Magic secret key server-side.
2

Authenticate and create a viem account

Magic embedded wallets do not support wallet_switchEthereumChain, which the Rhinestone signing flow can request. Ignore only chain add and switch requests, and forward every other RPC method to Magic. The wrapper also converts bigint values before typed-data signing.
3

Create the Rhinestone account

Authenticate the browser SDK with short-lived JWTs from your backend:
See security for secure token issuance and sponsored-intent extension tokens.
For sponsored transactions, follow sponsorship setup. For the transaction lifecycle, continue to send a transaction.