Skip to main content

Crate arcis

Crate arcis 

Source
Expand description

§arcis

Crates.io

A standard library of types and functions for writing MPC circuits with the Arcis framework. This crate provides the essential building blocks for developing encrypted computations, including type definitions, cryptographic primitives, and utility functions commonly needed in MPC circuit development.

§Usage

use arcis::*;

#[encrypted]
mod circuits {
    use arcis::*;

    pub struct InputValues {
        v1: u8,
        v2: u8,
    }

    #[instruction]
    pub fn add_together(input_ctxt: Enc<Shared, InputValues>) -> Enc<Shared, u16> {
        let input = input_ctxt.to_arcis();
        let sum = input.v1 as u16 + input.v2 as u16;
        input_ctxt.owner.from_arcis(sum)
    }
}

§Main Exports

§Types

  • Enc<C, T> - Generic encrypted data wrapper. C can be Shared or Mxe, T can be any supported type.
  • Shared - Shared secret cipher implementation
  • ArcisX25519Pubkey - A X25519 Pubkey used to encrypt and decrypt messages
  • Mxe - MXE (Multi-party eXecution Environment) cipher
  • Pack<T> - Used to pack data so they take less space
  • ArcisRNG - Random number generator

§Re-exports

  • All arcis standard library functions and types
  • Procedural macros #[encrypted] and #[instruction]

Macros§

arcis_static_panic
If this macro is ever run by the interpreter, it will produce a compile error.

Structs§

ArcisEd25519Signature
ArcisMath
ArcisRNG
This struct gives access to randomness operations.
ArcisX25519Pubkey
The Arcis x25519 pubkey.
BaseField25519
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
LinearRegression
LogisticRegression
MXESigningKey
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
SecretKey
SerializedSolanaPublicKey
Shared
Owner for shared data between the owner of a public key and the MXE.
SigningKey
SolanaPublicKey
VerifyingKey

Traits§

Cipher
Trait for Shared and Mxe. 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 (inside if branches 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.