@arcium-hq/client
Classes
| Class | Description |
|---|---|
| Aes128Cipher | AES-128 cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret. See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode. |
| Aes192Cipher | AES-192 cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret. See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode. |
| Aes256Cipher | AES-256 cipher in Counter (CTR) mode, using SHA3-256 to derive the key from a shared secret. See: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf (Section 6.5) for details on CTR mode. |
| ArcisModule | - |
| ArcisType | - |
| ArcisValueField | - |
| CSplRescueCipher | The Rescue cipher over Curve25519's scalar field in Counter (CTR) mode, with a fixed block size m = 5. See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287 |
| IntegerInfo | - |
| Matrix | Matrix class over FpField. Data is row-major. |
| RescueCipher | The Rescue cipher over Curve25519's base field in Counter (CTR) mode, with a fixed block size m = 5. See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287 |
| RescueDesc | Description and parameters for the Rescue cipher or hash function, including round constants, MDS matrix, and key schedule. See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287 |
| RescuePrimeHash | The Rescue-Prime hash function, as described in https://eprint.iacr.org/2020/1143.pdf, offering 256 bits of security against collision, preimage and second-preimage attacks for any field of size at least 102 bits. We use the sponge construction with fixed rate = 7 and capacity = 5 (i.e., m = 12), and truncate the output to 5 field elements. |
Interfaces
| Interface | Description |
|---|---|
| FieldInfo | - |
| MempoolPriorityFeeStats | Statistics about priority fees for computations in a mempool. |
| Packer | Type-safe packer interface for generated code. |
Type Aliases
| Type Alias | Description |
|---|---|
| ArciumIdlType | Program IDL in camelCase format in order to be used in JS/TS. |
| ArciumLocalEnv | Structure representing the local Arcium environment variables required for local development or testing. |
| ComputationErrorType | Represents possible error messages that can occur during computation processing or transaction handling. |
| ComputationReference | Reference to a computation in a mempool or executing pool. Contains the computation offset and priority fee information. |
| ExecutingPoolAccount | Represents an executing pool account of any size (tiny, small, medium, or large). Executing pools manage parallel computation execution with account locking. Each size supports different maximum parallel computations: - Tiny: 1 parallel computation - Small: 3 parallel computations - Medium: 10 parallel computations - Large: 100 parallel computations |
| FpField | Field type. |
| MempoolAccount | Represents a mempool account of any size (tiny, small, medium, or large). Mempools store pending computations prioritized by fee, with a time-to-live of 180 slots. Each size supports different maximum heap capacities: - Tiny: 1 computation - Small: 3 computations - Medium: 10 computations - Large: 100 computations |
Variables
| Variable | Description |
|---|---|
| arcisEd25519 | Ed25519 curve instance using SHA3-512 for hashing, suitable for MPC (ArcisEd25519 signature scheme). This is essentially Ed25519 but with SHA3-512 instead of SHA-512 for lower multiplicative depth. See: https://datatracker.ietf.org/doc/html/rfc8032#section-5.1 |
| ARCIUM_ADDR | The deployed address of the Arcium program, as specified in the IDL. |
| ARCIUM_IDL | The Anchor-generated IDL JSON object for the Arcium program. |
| CURVE25519_BASE_FIELD | Curve25519 base field as an IField instance. |
| CURVE25519_SCALAR_FIELD | Curve25519 scalar field as an IField instance. |
| CURVE25519_SCALAR_FIELD_MODULUS | Scalar field prime modulus for Curve25519: 2^252 + 27742317777372353535851937790883648493 |
| x25519 | ECDH using curve25519 aka x25519. |
Functions
| Function | Description |
|---|---|
| awaitComputationFinalization | Waits for the finalization of a computation by listening for the finalizeComputationEvent. Resolves with the transaction signature once the computation is finalized. |
| buildFinalizeCompDefTx | Builds a transaction to finalize a computation definition. |
| createPacker | Creates a type-safe packer from field definitions. Use as const on the fields array for compile-time field name validation. |
| deserializeLE | Deserializes a little-endian Uint8Array to a bigint. |
| finalizeKeyRecoveryExecution | Finalizes key recovery execution after the submission threshold is met. This queues the key_recovery_final MPC computation on the backup cluster. |
| generateRandomFieldElem | Generates a random value within the field bound by q. |
| getArciumAccountBaseSeed | Returns the base seed for an Arcium account, given its name. |
| getArciumEnv | Reads local Arcium environment information from environment variables. Only available in Node.js and when testing locally. |
| getArciumProgram | Returns an Anchor program instance for the Arcium program. |
| getArciumProgramId | Returns the public key of the deployed Arcium program on Solana. |
| getArxNodeAccAddress | Derives the ArxNode account address for a given offset. |
| getClockAccAddress | Derives the clock account address. |
| getClusterAccAddress | Derives the cluster account address for a given offset. |
| getCompDefAccAddress | Derives the computation definition account address for a given MXE program ID and offset. |
| getCompDefAccOffset | Computes the offset for a computation definition account, based on the circuit name. |
| getComputationAccAddress | Derives the computation account address for a given cluster and computation offset. |
| getComputationsInMempool | Returns all computation references in the mempool for a given account. Only non-stake computations are included. |
| getExecutingPoolAccAddress | Derives the executing pool account address for a given cluster. |
| getExecutingPoolAccInfo | Fetches and decodes the executing pool account info for any pool size. |
| getFeePoolAccAddress | Derives the fee pool account address. |
| getMempoolAccAddress | Derives the mempool account address for a given cluster. |
| getMempoolAccInfo | Fetches and decodes the mempool account info for any mempool account size. |
| getMempoolPriorityFeeStats | Calculates priority fee statistics for computations in a mempool. |
| getMXEAccAddress | Derives the MXE account address for a given MXE program ID. |
| getMXEArcisEd25519VerifyingKey | Fetches and extracts the MXE arcis ed25519 verifying key from the MXE account. |
| getMXEPublicKey | Fetches and extracts the MXE x25519 public key from the MXE account. |
| getMxeRecoveryAccAddress | Derives the MXE recovery account address for a key recovery session. |
| getRecoveryClusterAccAddress | Derives the recovery cluster account address for a given MXE program ID. |
| initKeyRecoveryExecution | Initializes key recovery execution by creating the MxeRecoveryAccount and registering the key_recovery_final computation definition on the backup MXE. This is split into two parts due to Solana's 10KB per-instruction allocation limit. |
| initMxePart1 | Initializes an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit, this only partially allocates recovery_cluster_acc. Call initMxePart2 afterwards to finish allocation and add keygen to mempool. |
| initMxePart2 | Finishes MXE initialization (part 2). Reallocates recovery_cluster_acc to full size, initializes recovery_peers, and adds the keygen computation to the mempool. |
| isNullRef | Checks if a computation reference is null (all zeros). |
| positiveModulo | Computes the positive modulo of a over m. |
| queueKeyRecoveryInit | - |
| randMatrix | - |
| recoverMxe | Sets an MXE to Recovery status, initiating the key recovery process. |
| serializeLE | Serializes a bigint to a little-endian Uint8Array of the specified length. |
| sha256 | Computes the SHA-256 hash of an array of Uint8Arrays. |
| submitKeyRecoveryShare | Submits a re-encrypted key recovery share from a recovery peer. Recovery peers must decrypt shares using their X25519 private key and re-encrypt them for the backup MXE before submission. |
| toVec | - |
| uploadCircuit | Uploads a circuit to the blockchain, splitting it into multiple accounts if necessary. |