Kernel
Kernel Account Factory Compatibility
In addition to supporting LightAccount, the Notus API is also compatible with Kernel Account. Kernel is a minimal and extensible smart contract account designed for ERC-4337 wallets, offering a modular architecture that allows developers to customize and enhance wallet functionalities through plugins.
Key Features of Kernel Account
-
ERC-4337 Compatibility: Fully adheres to the ERC-4337 standard, ensuring seamless integration within the account abstraction ecosystem.
-
Modular Design: Supports the addition of plugins, enabling developers to extend wallet capabilities without modifying the core contract.
-
Gas Efficiency: Engineered to optimize gas consumption during wallet operations, reducing transaction costs for users.
Security and Audits
The Kernel Account has undergone thorough security audits to ensure its robustness and reliability. You can review the audit reports here.
Factory Deployments
The Kernel Account Factory has been deployed across multiple chains, ensuring deterministic wallet addresses and consistent behavior. For a comprehensive list of deployment addresses and supported networks, visit this page.
Additional Resources
For more details on Kernel Account’s architecture, updates, and developer documentation, visit the Kernel GitHub Repository.
How to create a Kernel Account with Notus API
Create a directory
mkdir my-smart-wallet
cd my-smart-wallet
touch index.js
Init project
npm init -y
pnpm init -y
yarn init -y
bun init -y
Install viem
We’ll use viem, a library for blockchain interactions, to simplify our integration. Install it by running:
npm i viem
pnpm add viem
yarn add viem
bun add viem
Initialize Wallet Account
Use your private key to initialize a wallet account. This will allow you to sign messages and interact with the blockchain.
import { privateKeyToAccount } from 'viem/accounts'
const BASE_URL = "https://api.notus.team/api/v1"
const API_KEY = "<api-key>"
const privateKey = '0x<private-key>'
const account = privateKeyToAccount(privateKey)
Register a Smart Wallet Address
Register and retrieve the smart wallet address used for Account Abstraction.
async function main() {
const FACTORY_ADDRESS = "0x7a1dBAB750f12a90EB1B60D2Ae3aD17D4D81EfFe"
const externallyOwnedAccount = account.address
const res = await fetch(`${BASE_URL}/wallets/register`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY,
},
body: JSON.stringify({
externallyOwnedAccount: externallyOwnedAccount,
factory: FACTORY_ADDRESS,
salt: "0",
}),
});
if (!res?.ok) {
return
}
const response = await res.json();
const smartWalletAddress = response.wallet.accountAbstraction
}
Note: At this stage, the smart wallet address is not yet deployed onchain. Deployment happens automatically with the user's first onchain transaction (e.g., swap or transfer) via a UserOperation.