Use Portal with ZeroDev
Portal is an embedded blockchain infrastructure company that powers companies with an end to end platform for key management for self-custodial wallets (MPC and AA), security firewall, and web3 protocol connect kit.
Set up
To use Portal with ZeroDev, you have two options: Portal's native integration using ZeroDev, or a custom integration using Portal's Externally Owned Account (EOA) as a signer for ZeroDev. Choose the approach that best fits your needs.
Native Integration
Portal natively supports account abstraction using ZeroDev. This integration allows your organization to sponsor gas fees for your clients using specific policies and chains, with additional features coming soon.
- For more information, visit the Portal Account Abstraction documentation
Custom Integration
If you require ZeroDev functionality not yet supported natively by Portal, a custom integration using Portal's EOA as a signer might be preferable.
- Begin by setting up your application with Portal, as detailed in the Portal documentation.
- Portal also offers a quick start guide for their web SDK, available here.
Implementing Custom Integration
Integrating ZeroDev with Portal is straightforward once your application is set up. Portal provides an EOA wallet to use as a signer with Kernel.
Create the Portal object
After following the Portal documentation, you will have access to a Portal
object as shown below:
import Portal, { type PortalOptions } from "@portal-hq/web";
// Config options here will be specific to your project. See the Portal docs for more info.
const portalOptions: PortalOptions = { ... };
const portal = new Portal(portalOptions);
Use with ZeroDev
Use the provider from Portal 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';
// Get the Provider from Portal
const portalProvider = portal.provider;
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: portalProvider,
entryPoint: getEntryPoint("0.7"),
kernelVersion: KERNEL_V3_1
})
// You can now use this ECDSA Validator to create a Kernel account