LazorKit is a high-performance, security-focused Smart Wallet contract on Solana. It enables advanced account abstraction features like multi-signature support, session keys, and role-based access control (RBAC) with minimal on-chain overhead.
- Ed25519: Native Solana key support for standard wallets.
- Secp256r1 (P-256): Native support for Passkeys (WebAuthn) and Apple Secure Enclave, enabling biometric signing directly on-chain.
Granular permission management for every key with strictly separated PDAs:
- Owner (Role 0): Full control. Can add/remove authorities and transfer ownership.
- Admin (Role 1): Can create Sessions and add Spenders. Cannot remove Owners.
- Spender (Role 2): Limited to executing transactions. Ideal for hot wallets or automated bots.
- Create temporary, time-bound keys with specific expiry (
expires_atdefined by absolute slot height). - Great for dApps (games, social) to offer "Log in once, act multiple times" UX without exposing the main key.
- Zero-Copy Serialization: Built on
pinocchiocasting raw bytes to Rust structs for maximum CU efficiency. - No-Padding Layout: Optimized data structures (
NoPadding) to reduce rent costs and ensure memory safety. - SlotHashes Nonce: Secp256r1 replay protection uses the
SlotHashessysvar as a "Proof of Liveness" (valid within 150 slots) instead of expensive on-chain counters. - Transaction Compression: Uses
CompactInstructionsto fit complex multi-call payloads into standard Solana transaction limits.
The contract uses a highly modular PDA (Program Derived Address) architecture for separated storage and deterministic validation:
| Account Type | Description |
|---|---|
| Wallet PDA | The main identity anchor. Derived from ["wallet", user_seed]. |
| Vault PDA | Holds assets (SOL/SPL Tokens). Only the Wallet PDA can sign for it. |
| Authority PDA | Separate PDA for each authorized key (unlimited distinct authorities). Stores role. Derived from ["authority", wallet_pda, id_hash]. |
| Session PDA | Temporary authority (sub-key) with absolute slot-based expiry. Derived from ["session", wallet_pda, session_key]. |
See docs/Architecture.md for deeper technical details.
program/src/: Main contract source code.processor/: Instruction handlers (create_wallet,execute,manage_authority, etc.).auth/: Authentication logic for Ed25519 and Secp256r1 (withslothashesnonce).state/: Account data structures (Wallet,Authority,Session).
tests-e2e/: Comprehensive End-to-End Test Suite.scenarios/: Test scenarios covering Happy Path, Failures, and Audit Retro.scenarios/audit/: Dedicated regression tests for security vulnerabilities.
# Build SBF program
cargo build-sbfRun the comprehensive E2E test suite (LiteSVM-based):
cd tests-e2e
cargo run --bin lazorkit-tests-e2eLazorKit V2 has undergone a rigorous internal audit and security review.
Status: ✅ 17/17 Security Issues Resolved
We have fixed and verified vulnerabilities including:
- Critical: Cross-Wallet Authority Deletion.
- High: Signature Replay, DoS prevention, OOB Reads.
- Medium: Rent Theft protections and Signature Binding.
- CPI Protection: Explicit
stack_heightchecks prevent authentication instructions from being called maliciously via CPI.
- Discriminator Checks: All PDAs are strictly validated by type constant.
- Signature Binding: Payloads are strictly bound to target accounts and instructions to prevent replay/swapping attacks.
- Reentrancy Guards: Initialized to prevent CPI reentrancy.
MIT