Create a Rhinestone smart account and configure its owners.
A Rhinestone smart account is a smart contract wallet. It doesn’t hold keys. Instead, you configure one or more signers that are authorised to control it. The account is deployed on the first transaction, not at creation time.
Pass the owner signer when calling createAccount. Here’s an example using an external wallet (MetaMask) via Viem:
import { RhinestoneSDK, walletClientToAccount } from '@rhinestone/sdk'import { createWalletClient, custom } from 'viem'import { sepolia } from 'viem/chains'const walletClient = createWalletClient({ chain: sepolia, transport: custom(window.ethereum!),})const rhinestone = new RhinestoneSDK({ apiKey: process.env.RHINESTONE_API_KEY as string,})const signer = walletClientToAccount(walletClient)const account = await rhinestone.createAccount({ owners: { type: 'ecdsa', accounts: [signer], },})const accountAddress = account.getAddress()
The SDK derives a deterministic account address from the owner configuration. The same owners always produce the same address, with no deployment transaction required upfront.
Creating an account only computes a counterfactual address. The smart contract is not deployed until you send the first outbound transaction on a given chain. Receiving tokens (funding the address) does not trigger deployment.
The smart account address is not the same as the signer address. If you look up your signer (EOA) on a block explorer, it will appear as a regular account. The smart account is a separate contract address derived from the owner configuration.
By default, the SDK uses a nonce of 0 to derive the account address. Pass a custom nonce to get a different address for the same set of owners. This is useful when you need multiple accounts per signer.
There is no importAccount method. The SDK derives the account address deterministically from the owner configuration, so calling createAccount with the same owners (and nonce) always returns the same account. To restore an account in a new session or on a different device, just call createAccount again with the original signer:
// Same signer + same nonce = same account address, every timeconst account = await rhinestone.createAccount({ owners: { type: 'ecdsa', accounts: [signer], },})
No state is lost. The account’s onchain history, balances, and modules are all tied to the deterministic address, not to the SDK instance.
The example above uses an ECDSA signer (external wallet). Rhinestone supports several signer types: passkeys, embedded wallets, external wallets, and multi-factor combinations.
Signer types
Choose the right signer for your use case: native keys, embedded wallets, or external wallets.
EIP-7702
Add smart account features to an existing EOA without changing its address.