Arcium LogoArcium TS SDK Docs

@arcium-hq/client

Classes

ClassDescription
Aes128CipherAES-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.
Aes192CipherAES-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.
Aes256CipherAES-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-
CSplRescueCipherThe 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-
MatrixMatrix class over FpField. Data is row-major.
RescueCipherThe 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
RescueDescDescription 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
RescuePrimeHashThe 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

InterfaceDescription
FieldInfo-
MempoolPriorityFeeStatsStatistics about priority fees for computations in a mempool.
PackerType-safe packer interface for generated code.

Type Aliases

Type AliasDescription
ArciumIdlTypeProgram IDL in camelCase format in order to be used in JS/TS.
ArciumLocalEnvStructure representing the local Arcium environment variables required for local development or testing.
ComputationErrorTypeRepresents possible error messages that can occur during computation processing or transaction handling.
ComputationReferenceReference to a computation in a mempool or executing pool. Contains the computation offset and priority fee information.
ExecutingPoolAccountRepresents 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
FpFieldField type.
MempoolAccountRepresents 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

VariableDescription
arcisEd25519Ed25519 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_ADDRThe deployed address of the Arcium program, as specified in the IDL.
ARCIUM_IDLThe Anchor-generated IDL JSON object for the Arcium program.
CURVE25519_BASE_FIELDCurve25519 base field as an IField instance.
CURVE25519_SCALAR_FIELDCurve25519 scalar field as an IField instance.
CURVE25519_SCALAR_FIELD_MODULUSScalar field prime modulus for Curve25519: 2^252 + 27742317777372353535851937790883648493
x25519ECDH using curve25519 aka x25519.

Functions

FunctionDescription
awaitComputationFinalizationWaits for the finalization of a computation by listening for the finalizeComputationEvent. Resolves with the transaction signature once the computation is finalized.
buildFinalizeCompDefTxBuilds a transaction to finalize a computation definition.
createPackerCreates a type-safe packer from field definitions. Use as const on the fields array for compile-time field name validation.
deserializeLEDeserializes a little-endian Uint8Array to a bigint.
finalizeKeyRecoveryExecutionFinalizes key recovery execution after the submission threshold is met. This queues the key_recovery_final MPC computation on the backup cluster.
generateRandomFieldElemGenerates a random value within the field bound by q.
getArciumAccountBaseSeedReturns the base seed for an Arcium account, given its name.
getArciumEnvReads local Arcium environment information from environment variables. Only available in Node.js and when testing locally.
getArciumProgramReturns an Anchor program instance for the Arcium program.
getArciumProgramIdReturns the public key of the deployed Arcium program on Solana.
getArxNodeAccAddressDerives the ArxNode account address for a given offset.
getClockAccAddressDerives the clock account address.
getClusterAccAddressDerives the cluster account address for a given offset.
getCompDefAccAddressDerives the computation definition account address for a given MXE program ID and offset.
getCompDefAccOffsetComputes the offset for a computation definition account, based on the circuit name.
getComputationAccAddressDerives the computation account address for a given cluster and computation offset.
getComputationsInMempoolReturns all computation references in the mempool for a given account. Only non-stake computations are included.
getExecutingPoolAccAddressDerives the executing pool account address for a given cluster.
getExecutingPoolAccInfoFetches and decodes the executing pool account info for any pool size.
getFeePoolAccAddressDerives the fee pool account address.
getMempoolAccAddressDerives the mempool account address for a given cluster.
getMempoolAccInfoFetches and decodes the mempool account info for any mempool account size.
getMempoolPriorityFeeStatsCalculates priority fee statistics for computations in a mempool.
getMXEAccAddressDerives the MXE account address for a given MXE program ID.
getMXEArcisEd25519VerifyingKeyFetches and extracts the MXE arcis ed25519 verifying key from the MXE account.
getMXEPublicKeyFetches and extracts the MXE x25519 public key from the MXE account.
getMxeRecoveryAccAddressDerives the MXE recovery account address for a key recovery session.
getRecoveryClusterAccAddressDerives the recovery cluster account address for a given MXE program ID.
initKeyRecoveryExecutionInitializes 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.
initMxePart1Initializes 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.
initMxePart2Finishes MXE initialization (part 2). Reallocates recovery_cluster_acc to full size, initializes recovery_peers, and adds the keygen computation to the mempool.
isNullRefChecks if a computation reference is null (all zeros).
positiveModuloComputes the positive modulo of a over m.
queueKeyRecoveryInit-
randMatrix-
recoverMxeSets an MXE to Recovery status, initiating the key recovery process.
serializeLESerializes a bigint to a little-endian Uint8Array of the specified length.
sha256Computes the SHA-256 hash of an array of Uint8Arrays.
submitKeyRecoveryShareSubmits 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-
uploadCircuitUploads a circuit to the blockchain, splitting it into multiple accounts if necessary.