Skip to main content
Build cross-chain smart accounts using Para’s embedded wallets and Rhinestone — enabling intent-based transactions, automatic bridging, and gas abstraction across EVM chains. The useRhinestoneSmartAccount hook handles account creation, orchestrator setup, and Pimlico bundler configuration automatically.

Prerequisites

  • Para API key from the Para Developer Portal
  • Rhinestone API key from the Rhinestone team
  • Optionally a Pimlico API key for bundler/paymaster infrastructure
  • Node.js 18+ and Next.js development environment

Installation

npm install @getpara/react-sdk viem @tanstack/react-query

Setup Para Provider

Configure the Para provider:
"use client";

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ParaProvider } from "@getpara/react-sdk";

const queryClient = new QueryClient();

export default function Providers({ children }: { children: React.ReactNode }) {
  return (
    <QueryClientProvider client={queryClient}>
      <ParaProvider
        paraClientConfig={{
          apiKey: process.env.NEXT_PUBLIC_PARA_API_KEY!,
          env: "BETA",
        }}
        config={{ appName: "Global Wallet Demo" }}
      >
        {children}
      </ParaProvider>
    </QueryClientProvider>
  );
}

Usage

Use the useRhinestoneSmartAccount hook to create and manage a Rhinestone smart account. The hook handles Para signer creation, Rhinestone account setup, and orchestrator configuration internally.
"use client";

import { useRhinestoneSmartAccount } from "@getpara/react-sdk";
import { useMutation } from "@tanstack/react-query";
import { sepolia } from "viem/chains";
import { parseEther } from "viem";

const RHINESTONE_API_KEY = process.env.NEXT_PUBLIC_RHINESTONE_API_KEY!;
const PIMLICO_API_KEY = process.env.NEXT_PUBLIC_PIMLICO_API_KEY!;

export function RhinestoneDemo() {
  const { smartAccount, isLoading, error } = useRhinestoneSmartAccount({
    chain: sepolia,
    rhinestoneApiKey: RHINESTONE_API_KEY,
    pimlicoApiKey: PIMLICO_API_KEY,
  });

  const {
    mutate: sendTransaction,
    isPending: isSending,
    error: sendError,
  } = useMutation({
    mutationFn: async () => {
      if (!smartAccount) throw new Error("Smart account not ready");
      return smartAccount.sendTransaction({
        to: "0xRecipient",
        value: parseEther("0.01"),
      });
    },
    onSuccess: (receipt) => {
      console.log("Transaction hash:", receipt.transactionHash);
    },
  });

  const {
    mutate: sendBatch,
    isPending: isBatching,
    error: batchError,
  } = useMutation({
    mutationFn: async () => {
      if (!smartAccount) throw new Error("Smart account not ready");
      return smartAccount.sendBatchTransaction([
        { to: "0xRecipientA", value: parseEther("0.01") },
        { to: "0xRecipientB", data: "0xencodedCallData" },
      ]);
    },
    onSuccess: (receipt) => {
      console.log("Batch tx hash:", receipt.transactionHash);
    },
  });

  if (isLoading) return <p>Setting up smart account...</p>;
  if (error) return <p>Error: {error.message}</p>;
  if (!smartAccount) return null;

  return (
    <div>
      <h2>Rhinestone Smart Account</h2>
      <p>Address: {smartAccount.smartAccountAddress}</p>
      <p>Mode: {smartAccount.mode}</p>

      <button onClick={() => sendTransaction()} disabled={isSending}>
        {isSending ? "Sending..." : "Send Transaction"}
      </button>
      {sendError && <p style={{ color: "red" }}>{sendError.message}</p>}

      <button onClick={() => sendBatch()} disabled={isBatching}>
        {isBatching ? "Batching..." : "Send Batch"}
      </button>
      {batchError && <p style={{ color: "red" }}>{batchError.message}</p>}
    </div>
  );
}
Rhinestone only supports EIP-4337 mode. Both rhinestoneApiKey and pimlicoApiKey are optional but recommended for production use. For advanced cross-chain use cases with automatic bridging, see the Rhinestone documentation.

Key Features

  • Cross-chain smart accounts: Single account across multiple EVM chains
  • Intent-based transactions: Automatic execution of cross-chain operations
  • Gas abstraction: Sponsored transactions without users managing gas fees
  • Automatic bridging: Seamless asset transfers between chains
  • Para wallet management: Embedded wallet infrastructure with MPC security

Complete Example

Para + Rhinestone Example

View the complete working example in Para’s Examples Hub

Next Steps

Rhinestone Documentation

Explore Rhinestone’s features and advanced use cases

Account Abstraction Guide

See all supported AA providers and the unified SmartAccount interface