Build confidential dApps on Solana using Inco Lightning encryption — encrypted balances, private transfers, and attested decryption
npx skills add https://github.com/sendaifun/skills --skill inco-svm
Inco Lightning is a confidentiality layer for Solana that enables developers to build applications where sensitive data remains encrypted even during computation. It uses Trusted Execution Environments (TEEs) to deliver verifiable confidential compute — no new chain, no new wallet required.
> Note: Inco SVM is currently in beta on Solana devnet. Features are subject to change.
Euint128 and Ebool handles representing encrypted values stored off-chain@inco/solana-sdk for encryption, decryption, and utility helpersClient Solana Program Inco Covalidator (TEE)
│ │ │
├─ encryptValue() ──────────►│ │
│ ├─ CPI: new_euint128 ─────────►│
│ │◄─── handle (u128) ──────────┤
│ ├─ CPI: e_add / e_sub / ... ──►│
│ │◄─── result handle ──────────┤
│ ├─ CPI: allow() ──────────────►│
│ │ │
├─ decrypt([handle]) ───────────────────────────────────────►│
│◄─── plaintext + Ed25519 attestation ──────────────────────┤
Inco Lightning Program ID: 5sjEbPiqgZrYwR31ahR6Uk9wf5awoX61YGg7jExQSwaj
Rust Crate (on-chain):
Add to your Cargo.toml:
[dependencies]
inco-lightning = { version = "0.1", features = ["cpi"] }
Add to Anchor.toml:
[programs.devnet]
inco_lightning = "5sjEbPiqgZrYwR31ahR6Uk9wf5awoX61YGg7jExQSwaj"
JavaScript SDK (client-side):
npm install @inco/solana-sdk
use anchor_lang::prelude::*;
use inco_lightning::cpi::accounts::Operation;
use inco_lightning::cpi::{e_add, e_sub, e_ge, e_select, new_euint128, as_euint128};
use inco_lightning::types::{Euint128, Ebool};
use inco_lightning::ID as INCO_LIGHTNING_ID;
declare_id!("YOUR_PROGRAM_ID");
#[program]
pub mod my_confidential_program {
use super::*;
pub fn deposit(ctx: Context<Deposit>, ciphertext: Vec<u8>) -> Result<()> {
let cpi_ctx = CpiContext::new(
ctx.accounts.inco_lightning_program.to_account_info(),
Operation {
signer: ctx.accounts.authority.to_account_info(),
},
);
// Create encrypted handle from client ciphertext
let amount: Euint128 = new_euint128(cpi_ctx.clone(), ciphertext, 0)?;
// Add to existing balance
let new_balance = e_add(cpi_ctx, ctx.accounts.vault.balance, amount, 0)?;
ctx.accounts.vault.balance = new_balance;
Ok(())
}
}
#[derive(Accounts)]
pub struct Deposit<'info> {
#[account(mut)]
pub authority: Signer<'info>,
#[account(mut)]
pub vault: Account<'info, Vault>,
/// CHECK: Inco Lightning program
#[account(address = INCO_LIGHTNING_ID)]
pub inco_lightning_program: AccountInfo<'info>,
}
#[account]
pub struct Vault {
pub balance: Euint128,
}
import { encryptValue } from "@inco/solana-sdk/encryption";
import { decrypt } from "@inco/solana-sdk/attested-decrypt";
// Encrypt a value before sending to program
const encrypted = await encryptValue(1000n);
await program.methods
.deposit(Buffer.from(encrypted, "hex"))
.accounts({ authority: wallet.publicKey, vault: vaultPda, incoLightningProgram: INCO_LIGHTNING_ID })
.rpc();
// Decrypt a handle (requires wallet signature)
const result = await decrypt([handleString], {
address: wallet.publicKey,
signMessage: wallet.signMessage,
});
console.log("Decrypted:", result.plaintexts[0]);
Handles are 128-bit references to encrypted values stored off-chain in the covalidator network.
| Type | Description | Rust Definition |
|------|-------------|-----------------|
| Euint128 | Encrypted unsigned 128-bit integer | pub struct Euint128(pub u128) |
| Ebool | Encrypted boolean | pub struct Ebool(pub u128) |
Store handles directly in account structs:
#[account]
pub struct ConfidentialAccount {
pub balance: Euint128,
pub is_active: Ebool,
}
| Function | Description |
|----------|-------------|
| new_euint128(ctx, ciphertext, input_type) | Create from client-encrypted ciphertext |
| new_ebool(ctx, ciphertext, input_type) | Create encrypted bool from ciphertext |
| as_euint128(ctx, value) | Trivial encryption of plaintext u128 (for constants like zero) |
| as_ebool(ctx, value) | Trivial encryption of plaintext bool |
All operations require a CPI context and return new handles.
let cpi_ctx = CpiContext::new(
ctx.accounts.inco_lightning_program.to_account_info(),
Operation { signer: ctx.accounts.authority.to_account_info() },
);
let result = e_add(cpi_ctx, a, b, 0)?;
The last parameter (scalar_byte) is 0 for encrypted-encrypted operations, 1 when the left operand is plaintext.
Euint128e_add, e_sub, e_mul, e_rem
Eboole_ge, e_gt, e_le, e_lt, e_eq
Euint128e_and, e_or, e_not, e_shl, e_shr
// Cannot use if/else on encrypted values — use e_select instead
let result = e_select(cpi_ctx, condition, if_true, if_false, 0)?;
let random_value = e_rand(cpi_ctx, 0)?;
See resources/rust-sdk-reference.md for the complete API.
Decryption permissions are managed through Allowance PDAs derived from [handle.to_le_bytes(), allowed_address].
use inco_lightning::cpi::accounts::Allow;
use inco_lightning::cpi::allow;
let cpi_ctx = CpiContext::new(
ctx.accounts.inco_lightning_program.to_account_info(),
Allow {
allowance_account: ctx.accounts.allowance_account.to_account_info(),
signer: ctx.accounts.authority.to_account_info(),
allowed_address: ctx.accounts.user.to_account_info(),
system_program: ctx.accounts.system_program.to_account_info(),
},
);
allow(cpi_ctx, handle.0, true, user_pubkey)?;
Important: Operations produce new handles, and allowance PDAs depend on the handle value. You must simulate the transaction first to get the result handle, derive the PDA, then submit with remaining_accounts.
See resources/access-control.md for the full simulation-then-submit pattern.
Two modes:
| Mode | Purpose | Returns |
|------|---------|---------|
| Attested Reveal | Display values in UI | result.plaintexts |
| Attested Decrypt | Verify values on-chain | result.ed25519Instructions + program IX |
import { decrypt } from "@inco/solana-sdk/attested-decrypt";
const result = await decrypt([handle], {
address: wallet.publicKey,
signMessage: wallet.signMessage,
});
// Reveal: use plaintext directly
console.log(result.plaintexts[0]);
// Decrypt: verify on-chain
const tx = new Transaction();
result.ed25519Instructions.forEach(ix => tx.add(ix));
tx.add(yourProgramVerifyInstruction);
await sendTransaction(tx);
On-chain verification:
use inco_lightning::cpi::is_validsignature;
use inco_lightning::cpi::accounts::VerifySignature;
let cpi_ctx = CpiContext::new(
ctx.accounts.inco_lightning_program.to_account_info(),
VerifySignature {
instructions: ctx.accounts.instructions.to_account_info(),
signer: ctx.accounts.authority.to_account_info(),
},
);
is_validsignature(cpi_ctx, 1, Some(handles), Some(plaintext_values))?;
A full privacy-preserving token implementation. See resources/confidential-spl-token.md.
Key functions: initialize_mint, create_account, mint_to, transfer, approve
// Encrypt and transfer
const encrypted = await encryptValue(500_000_000n);
await program.methods
.transfer(Buffer.from(encrypted, "hex"), 0)
.accounts({ source: srcAta, destination: destAta, authority: wallet.publicKey })
.rpc();
allow() after operations that produce handles you want to decrypt laterremaining_accounts to pass allowance PDAs and grant access in the same transactione_select) instead of if/else on encrypted conditionsinco/
├── SKILL.md # This file — main reference
├── docs/
│ └── troubleshooting.md # Common issues and solutions
├── examples/
│ ├── basic-operations/
│ │ └── encrypted-operations.ts # Arithmetic, comparison, select
│ ├── confidential-spl-token/
│ │ ├── mint-and-transfer.ts # Mint & transfer confidential tokens
│ │ └── reveal-balance.ts # Decrypt and reveal token balance
│ └── private-raffle/
│ └── raffle-client.ts # Full raffle lifecycle client
├── resources/
│ ├── rust-sdk-reference.md # Complete Rust CPI API
│ ├── js-sdk-reference.md # JS SDK encryption & decryption
│ ├── access-control.md # Allowance PDAs & simulation pattern
│ └── confidential-spl-token.md # SPL token program reference
└── templates/
└── inco-svm-setup.ts # Starter template with helpers
Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
This skill should be used when the user asks to "perform cloud penetration testing", "assess Azure or AWS or GCP security", "enumerate cloud resources", "exploit cloud misconfigurations", "test O365 security", "extract secrets from cloud environments", or "audit cloud infrastructure". It provides comprehensive techniques for security assessment across major cloud platforms.
You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.
Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges
This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.
Expert malware analyst specializing in defensive malware research, threat intelligence, and incident response. Masters sandbox analysis, behavioral analysis, and malware family identification. Handles static/dynamic analysis, unpacking, and IOC extraction. Use PROACTIVELY for malware triage, threat hunting, incident response, or security research.
This skill should be used when the user asks to "use Metasploit for penetration testing", "exploit vulnerabilities with msfconsole", "create payloads with msfvenom", "perform post-exploitation", "use auxiliary modules for scanning", or "develop custom exploits". It provides comprehensive guidance for leveraging the Metasploit Framework in security assessments.
Expert in secure mobile coding practices specializing in input validation, WebView security, and mobile-specific security patterns. Use PROACTIVELY for mobile security implementations or mobile security code reviews.
Take sendaifun/inco-svm from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.