Skip to main content

Account Structs

When making CPI calls to Inco Lightning, you need to pass specific account structures. This guide explains each account struct and when to use it.

Overview

Operation

The simplest account struct, used for most encrypted operations.
When to use: Any encrypted computation - arithmetic (e_add, e_sub, e_mul, e_rem), comparisons (e_ge, e_gt, e_le, e_lt, e_eq), bitwise operations (e_and, e_or, e_not, e_shl, e_shr), random generation (e_rand), input functions (new_euint128, new_ebool, as_euint128, as_ebool), and conditional selection (e_select).

Allow

Used to grant or revoke decryption permissions for a handle.
When to use: When you need to grant an address permission to decrypt a handle, or revoke previously granted permission.

Allowance PDA Derivation

The allowance account is a PDA derived from the handle and allowed address:
Client-side (TypeScript):

Usage

IsAllowed

Used to check if an address has decryption permission.
When to use: When you need to verify if an address can decrypt a handle before performing an action.

VerifySignature

Used to verify Ed25519 signatures from the covalidator network for attested decryption.
When to use: When verifying that decrypted values came from the covalidator network (attested decryption).

Setting Up Your Instruction

Your instruction’s account struct needs to include the Inco Lightning program:
For access control operations, include additional accounts:
For signature verification, include the instructions sysvar: