Guides

Guide

Creating Passkey-Based Wallets with Lazorkit

Traditional wallets rely on seed phrases, browser extensions, and long onboarding flows. This is fragile, intimidating, and easy to mess up.

Lazorkit lets you create passkey-enabled wallets — secured by the device itself and usable directly inside your app.

No extensions. No seed phrases. Just passkeys.

Prerequisites

  • Node.js v20+
  • Any modern IDE (VS Code, Zed, Cursor)
  • Chrome (recommended for passkeys)

Step 1 — Create a New Next.js App

Open a terminal in your preferred directory and run:

code
npx create-next-app@latest passkey_build

This creates a fresh Next.js project configured for modern React.

Step 2 — Install Lazorkit & Solana Dependencies

code
cd passkey_build
npm install @lazorkit/wallet@^3.4.1 @solana/web3.js@^1.99.0 @solana/spl-token
Lazorkit handles wallet creation and signing. Solana libraries handle chain interaction.

Step 3 — Wrap Your App with LazorkitProvider

Lazorkit must wrap your application to manage wallets and passkeys. Replace the contents of app/layout.tsx with:

code
"use client";

import { LazorkitProvider } from "@lazorkit/wallet";

export const CONFIG = {
  RPC_URL: "https://api.devnet.solana.com",
  PORTAL_URL: "https://portal.lazor.sh",
  PAYMASTER: {
    paymasterUrl: "https://kora.devnet.lazorkit.com",
  },
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <LazorkitProvider
          rpcUrl={CONFIG.RPC_URL}
          portalUrl={CONFIG.PORTAL_URL}
          paymasterConfig={CONFIG.PAYMASTER}
          cluster="devnet"
        >
          {children}
        </LazorkitProvider>
      </body>
    </html>
  );
}
Always use devnet while testing. Never deploy with test RPCs in production.

Step 4 — Add Wallet Connection Logic

Connecting a wallet in Lazorkit is one function call.

code
"use client";

import { useWallet } from "@lazorkit/wallet";

export default function WalletConnect() {
  const { connect, disconnect, isConnected, isConnecting, wallet } = useWallet();

  if (isConnected && wallet) {
    return (
      <div className="flex justify-center mt-20">
        <button
          onClick={disconnect}
          className="px-6 py-2 bg-black text-white rounded-md"
        >
          Disconnect
        </button>
      </div>
    );
  }

  return (
    <div className="flex justify-center mt-20">
      <button
        onClick={connect}
        className="px-6 py-2 bg-black text-white rounded-md"
      >
        {isConnecting ? "Connecting..." : "Connect Wallet"}
      </button>
    </div>
  );
}
Once connected, a passkey-secured wallet is created automatically.

Step 5 — Access the Wallet Address

The address to show, fund and send from isvaultPubkey. That's the vault, where the funds live.

Don't use smartWalletPubkey as the user's address. Since @lazorkit/wallet 3.0 it is the internal wallet PDA, and nothing can spend from it. Funds sent there are stuck.
code
import { useWallet } from "@lazorkit/wallet";

export default function AddressButton() {
  const { vaultPubkey } = useWallet();

  const copy = () => {
    navigator.clipboard.writeText(
      vaultPubkey?.toString() || ""
    );
    alert("Address copied");
  };

  return (
    <span
      onClick={copy}
      className="font-mono text-sm cursor-pointer border px-3 py-2"
    >
      {vaultPubkey?.toString()}
    </span>
  );
}
Fund your wallet using the Solana Faucet or Circle Faucet.

Next Steps

You’re ready to send transactions using this wallet.

Triggering Gasless Transactions →

References