Skip to content

Use Dynamic with ZeroDev

Dynamic is a platform that offers Web3 login solutions designed for easy integration and user-friendly experiences. It features passkey embedded wallets, crypto-native login, and profile and multi-wallet management. Additionally, the platform provides tools for authorization, orchestration, and more, aiming to streamline wallet-based authentication and identity management. Dynamic is built to cater to both casual users and crypto-savvy individuals, emphasizing non-custodial, passwordless, and flexible login options.

Set up

To use Dynamic with ZeroDev, you have two options: Dynamic's native integration that utilizes ZeroDev, or a custom integration using Dynamic's Externally Owned Account (EOA) as a signer. Choose the approach that best fits your needs.

Native Integration

Dynamic natively supports account abstraction using ZeroDev. This integration allows you to sponsor gas fees, bundle transactions, recover and transfer accounts, utilize session keys.

Custom Integration

If you would like to use ZeroDev directly with a Dynamic project, you can set up a custom integration using Dynamics's EOA as a signer.

  • Begin by setting up your application with Dynamic, as detailed in the Dynamic documentation.
  • Dynamic also offers a quick start guide and sample apps, available here.

Implementing Custom Integration

Integrating ZeroDev with Dynamic is straightforward once your application is set up. Dynamic provides an EOA wallet to use as a signer with Kernel.

Get the Dynamic wallet's Provider

To begin, ensure your application is integrated with Dynamic. Detailed guidance is available in the Dynamic documentation.

The following example demonstrates the use of Dynamic's React Core SDK. Ensure your React app is already configured with Dynamic; for setup instructions, refer to the tutorial.

import { useDynamicContext } from "@dynamic-labs/sdk-react-core";
 
// Use the `useDynamicContext` hook to get the primary wallet
const { primaryWallet } = useDynamicContext();
 
// Get the dynamicWalletClient, we will use in the next section
const dynamicWalletClient = await primaryWallet?.connector?.getWalletClient();

Use with ZeroDev

Use the WalletClient from Dynamic to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on creating accounts.

import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator"
import { KERNEL_V3_1, getEntryPoint } from "@zerodev/sdk/constants"
import { createPublicClient } from "viem";
import { polygonAmoy } from 'viem/chains';
 
const publicClient = createPublicClient({
  // Use your own RPC provider (e.g. Infura/Alchemy).
  transport: http('https://rpc-amoy.polygon.technology'),
  chain: polygonAmoy,
})
 
// Pass your `smartAccountSigner` to the validator
const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
  signer: dynamicWalletClient,
  entryPoint: getEntryPoint("0.7"),
  kernelVersion: KERNEL_V3_1
})
 
// You can now use this ECDSA Validator to create a Kernel account

Starter Template

A user has helpfully created a starter template for Dynamic + ZeroDev.