leanstral

Generate Lean 4 proofs to formally verify Solana smart contracts.

5|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/abishekk92/leanstral-solana-skill --skill leanstral
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: leanstral
Source: https://github.com/abishekk92/leanstral-solana-skill/tree/main
Command: npx skills add https://github.com/abishekk92/leanstral-solana-skill --skill leanstral

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Verifying the correctness of Solana smart contracts is complex and time‑consuming, requiring deep expertise in both blockchain logic and formal methods.

Core Features & Use Cases

  • Automated SPEC.md generation from existing IDLs or source code.
  • Lean 4 model and proof construction for access control, state machines, CPI correctness, and arithmetic safety.
  • Iterative compilation with lake build, allowing Claude to refine proofs until they succeed.
  • Hard sub‑goal solving via the Mistral Leanstral model, filling sorry markers automatically.
  • Use case: A developer can run the skill to produce machine‑checked proofs that their escrow program cannot be exploited.

Quick Start

Ask Claude to formally verify my Solana program using the leanstral skill.

Frequently Asked Questions about leanstral

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I formally verify Solana smart contract code for security vulnerabilities?

You can formally verify Solana smart contracts by generating Lean 4 proofs for access control, state machines, and arithmetic safety. This automated process applies to Rust or Anchor programs and produces machine-checked proofs ensuring your contract cannot be exploited.

What do I need to generate Lean 4 proofs for my Rust or Anchor program?

Generating Lean 4 proofs for Rust or Anchor programs requires a Mistral API key alongside the Rust and Lean toolchains. These dependencies are required to compile and validate the formal verification proofs iteratively.

Can I use formal verification to prove an escrow program cannot be exploited?

Yes, formal verification proves an escrow program cannot be exploited by generating machine-checked Lean 4 proofs. The process handles access control, state machines, CPI correctness, and arithmetic safety by iteratively compiling and refining proofs until they succeed.

What is the best way to automate SPEC.md generation for Solana programs?

Automating SPEC.md generation for Solana programs is achieved by deriving specifications directly from existing IDLs or source code. This creates a baseline specification used to construct Lean 4 models and proofs for your smart contract.

How does iterative compilation handle hard sub-goals when verifying arithmetic safety in Solana contracts?

Iterative compilation handles hard sub-goals by using the Mistral Leanstral model to automatically fill `sorry` markers in Lean 4 proofs. This solves difficult arithmetic safety verification steps while running `lake build` to refine proofs until they compile successfully.

Does formal verification for Solana support Anchor programs or only raw Rust?

Formal verification for Solana supports both raw Rust and Anchor programs. It generates Lean 4 proofs to verify access control, state machines, CPI correctness, and arithmetic safety across both program types.