<div align="center">
  <img src="https://raw.githubusercontent.com/arcium-hq/.github/refs/heads/main/profile/arcium.svg" alt="Arcium" width="200"/>

<h1>arcis</h1>

<p>Standard library for writing multi-party computation (MPC) circuits with Arcis.</p>

[![Crates.io](https://img.shields.io/crates/v/arcis.svg)](https://crates.io/crates/arcis)
[![Docs.rs](https://docs.rs/arcis/badge.svg)](https://docs.rs/arcis)

**[Developer Docs](https://docs.arcium.com/developers/arcis)**

</div>

## When To Use

- Writing `#[encrypted]` modules and `#[instruction]` circuit entrypoints
- Working with encrypted values such as `Enc<Shared, T>` and `Enc<Mxe, T>`
- Building Arcis circuits that will be compiled with `arcium build`

For Solana program integration, use [`arcium-anchor`](https://crates.io/crates/arcium-anchor).

## Installation

```toml
[dependencies]
arcis = "0.11.0"
```

## Quick Start

```rust
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 (MPC eXecution Environment). |
| `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.
- Circuit code looks like Rust, but secret-dependent control flow is still compiled under MPC constraints.

## See Also

- [`arcium-anchor`](https://crates.io/crates/arcium-anchor)
- [`arcium-macros`](https://crates.io/crates/arcium-macros)
- [`arcis-compiler`](https://crates.io/crates/arcis-compiler)
- [Developer Docs](https://docs.arcium.com/developers/arcis)
