Expand description
§When To Use
- Writing
#[encrypted]modules and#[instruction]circuit entrypoints - Working with encrypted values such as
Enc<Shared, T>andEnc<Mxe, T> - Building Arcis circuits that will be compiled with
arcium build
For Solana program integration, use arcium-anchor.
§Installation
[dependencies]
arcis = "0.10.3"§Quick Start
use arcis::*;
#[encrypted]
mod circuits {
use arcis::*;
pub struct InputValues {
v1: u8,
v2: u8,
}
#[instruction]
pub fn add_together(input: Enc<Shared, InputValues>) -> Enc<Shared, u16> {
let values = input.to_arcis();
input.owner.from_arcis(values.v1 as u16 + values.v2 as u16)
}
}§Key Types
| Item | Description |
|---|---|
Enc<C, T> | Encrypted wrapper for circuit inputs and outputs. |
Shared | Secret-shared cipher for MPC execution across nodes. |
Mxe | Cipher scoped to a specific MXE. |
Pack<T> | Packing helper for reducing footprint of structured values. |
ArcisRNG | Circuit-friendly random number generator. |
Reveal | Trait used to explicitly reveal data when the compiler allows it. |
§Common Pitfalls
reveal()cannot be used in runtime-dependent conditional branches.arcis-importsis deprecated; usearcisdirectly for new projects.- Circuit code looks like Rust, but secret-dependent control flow is still compiled under MPC constraints.
§See Also
Modules§
- testing
- Tools to test an
#[instruction].
Macros§
- arcis_
static_ panic - If this macro is ever run by the interpreter, it will produce a compile error.
- assert_
current_ module - Allows to use
crate::in an #[encrypted] module. Use it like this:assert_current_module!(crate::path::to::encrypted::module); - encrypted_
mod - Use another file as a module in an
#[encrypted]module.
Structs§
- Arcis
Ed25519 Signature - Arcis
Math - ArcisRNG
- This struct gives access to randomness operations.
- Arcis
X25519 Pubkey - The Arcis x25519 pubkey.
- Base
Field25519 - Represents integers modulo 2^255 - 19.
- Enc
- Encrypted data that allows to store data on chain which can only be converted by its owner.
- EncData
- Linear
Regression - Logistic
Regression - MXESigning
Key - Mxe
- Owner of secret data. Decrypting data owned by this owner requires participation from all nodes that comprise the MXE cluster.
- Pack
- A struct to pack data together so that they take less place on chain.
- SHA3_
256 - SHA3_
512 - Secret
Key - Serialized
Solana Public Key - Shared
- Owner for shared data between the owner of a public key and the MXE.
- Signing
Key - Solana
Public Key - Verifying
Key
Traits§
- Cipher
- Trait for
SharedandMxe. Provides the.from_arcis(data)method. - Reveal
- Call
.reveal()to tell the compiler to reveal that piece of data. Cannot be called in conditional execution (insideifbranches when the compiler does not know the branch at compile-time).
Functions§
- box_
from_ slice - Creates a
Box<[T]>from a&[T]by cloning all items. - expit
- Standard logistic function.
- logit
- Inverse of the standard logistic function.
Attribute Macros§
- encrypted
- Tells our arcis compiler to create encrypted instructions that mimic the rust module you wrote.
Use
#[instruction]to mark the functions that will be the entry points. - encrypted_
library - Validates an arcis library, trying to find errors.
Allows to build a library that can be used in
#[encrypted]instructions. - instruction
- An
#[instruction]. Should be inside an#[encrypted]module.