Skip to main content

Recommended: JavaScript SDK with React Hooks

For new React apps, we recommend the JavaScript SDK with React Hooks (@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.
This guide is currently React only.

Setup Instructions

1

Create Dynamic Environment

  1. Visit the Dynamic Dashboard
  2. Create a new app or select an existing one
  3. Enable the Embedded Wallets feature
  4. Copy your Environment ID from the dashboard
2

Get Gelato API Key

  1. Visit the Gelato App
  2. Navigate to Paymaster & Bundler > API Keys
  3. Create a new API Key and select your required networks
  4. Copy the generated API Key
3

Create app with the React Quickstart

Scaffold Next.js with create-next-app, then follow the React Quickstart Custom setup path: Ethereum (EVM) with Wagmi and viem. In the Dynamic dashboard, enable Embedded wallets and Ethereum under Chains & Networks, and add your dev origin under SecurityAllowed Origins.
4

Install Gelato Smart Wallet SDK

From your project root, install the Gelato Smart Wallet SDK:
5

Set Environment Variables

In the scaffolded project, create a .env.local file in the project root:

Implementation

1

Configure providers (lib/providers.tsx)

In the scaffolded app, update your providers to include Dynamic, Wagmi, and React Query. If your project already has a lib/providers.tsx, edit it; otherwise create it and use it in your root layout.
2

Create Smart Wallet Client (components/SendTransactionButton.tsx)

3

Use the button (e.g., app/page.tsx)

4

Execute Transactions

Execute transactions using different payment methods:

Additional Resources

Last modified on June 25, 2026