Skip to main content
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.

Create an account

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.

Custom nonce

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.
const account = await rhinestone.createAccount({
  owners: {
    type: 'ecdsa',
    accounts: [signer],
  },
  account: {
    nonce: 1n,
  },
})
Different nonce = different account address, even with identical owners.

Choose a signer type

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.