Skip to content

Creating wallets

ZeroDev supports three types of wallet creation:

  • Passkeys
    • ZeroDev supports on-chain passkeys, where transactions are signed directly with passkeys on your user's device, and the signatures are validated on-chain with either RIP-7212 (if supported by the network) or smart contracts, without reliance on centralized infrastructure. Learn more here.
  • Socials
    • ZeroDev supports social logins natively, but you can also use ZeroDev with third-party auth providers such as Dynamic, Privy, and Magic if your prefer their UI.
  • EOA
    • It's important to note that when a user signs in with an EOA (e.g. MetaMask) through ZeroDev, the EOA is not used as a wallet, but rather as the signer of the ZeroDev smart wallet. Therefore, the address of the smart wallet is different than the address of the user's EOA.

Capabilities API

Capabilities (ERC-5792) are the new standard for DApps to communicate with smart wallets. If you are building a DApp and looking to use ZeroDev as an embedded smart wallet, we recommend that you do it through the capabilities API, in order to be compatible with other smart wallets.

Passkeys

import { useConnect, useConnectors } from "wagmi"
 
function App() {
  const { connect } = useConnect();
  const connectors = useConnectors();
 
  // zerodev passkey connector
  const connector = connectors.find((c) => c.id === 'zerodevPasskeySDK');
  if (!connector) return <p>Connector not found</p>
 
  return (
    <button onClick={() => connect({ connector })}>
      Create Smart Account
    </button>
  )
}

EOA

import { useConnect, useConnectors } from "wagmi"
 
function App() {
  const { connect } = useConnect();
  const connectors = useConnectors();
 
  // wrapped connector
  const connector = connectors.find((c) => c.id === 'metaMaskSDK');
  if (!connector) return <p>Connector not found</p>
 
  return (
    <button onClick={() => connect({ connector })}>
      Create Smart Account
    </button>
  )
}

Social

TODO

React API

Passkeys

You can learn more about how ZeroDev's on-chain passkeys work here.

Create the wallet using useCreateKernelClientPasskey. Use connectRegister to create a new passkey, or connectLogin to use an existing key.

import { useCreateKernelClientPasskey } from "@zerodev/waas"
 
function App() {
  const { connectRegister, connectLogin } = useCreateKernelClientPasskey(
    { version: "v3" }
  );
 
  return (
    <div>
      // username of the passkey
      <button onClick={() => connectRegister({ username: "passkey identifier" })}>
        Register
      </button>
      <button onClick={() => connectLogin()}>
        Login
      </button>
    </div>
  )
}

Socials

Use useCreateKernelClientSocial. Note that you can also use ZeroDev with a third-party auth provider (e.g. Privy/Dynamic) to enable social logins.

import { useCreateKernelClientSocial } from "@zerodev/waas"
 
function App() {
  const { login } = useCreateKernelClientSocial({ version: "v3" });
 
  return (
    <button onClick={() => login("google")}>
      Create Smart Account
    </button>
  )
}

Set Up Social Login

ZeroDev offers two modes for setting up social login: Development and Production. Follow the steps below to configure your social login in our dashboard.

  • Development Mode:

    • Available to all users by default.
    • Functions only when your application is running locally on the localhost URI.
    • Ideal for testing social sign-in features during development.
  • Production Mode:

    • Available to users on the "Growth" plan or higher.
    • To activate, complete the form in the Social Auth section of the ZeroDev dashboard.
    • Submit the form for review; reviews are typically completed within 24 hours.
    • Ensure all sections of the form are completed accurately to facilitate a successful review.
    • ZeroDev uses Magic for its social integration. Links to Magic's documentation are provided in the form to assist with setup (e.g., Google Developer Console).

Production Mode Configuration Steps:

  1. Enter the client ID and client secret from your social provider into the designated fields in the ZeroDev dashboard.
  2. Copy the redirect URI provided by ZeroDev into your social provider’s dashboard.
  3. Ensure that the redirect URI and whitelist URI for your application are input correctly in the form.
  4. Submit the form for review.

For detailed information on how Magic handles the creation of public/private key pairs, integral to the security of the social login process, please refer to Magic's product security documentation.

EOA

If you want to use an EOA wallet as signer to your ZeroDev smart wallet, wrap the ZeroDevProvider inside a Wagmi provider, then use useCreateKernelClientEOA.

import { useCreateKernelClientEOA } from "@zerodev/waas"
import { useConnect } from "wagmi"
 
function App() {
  const { connectors } = useConnect();
  const { connect } = useCreateKernelClientEOA({ version: "v3" });
 
  return (
    <button onClick={() => connect({ connector: connectors[0] })}>
      Create Smart Account
    </button>
  )
}

Core API

Check out these links for using the Core SDK directly: