Arcium LogoArcium TS SDK Docs

@arcium-hq/client

Classes

ClassDescription
Aes128CipherAES-128 cipher in Counter (CTR) mode, using HKDF-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 HKDF-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 HKDF-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.
MatrixMatrix class over FpField. Data is row-major.
RescueCipherThe Rescue cipher 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. Used with fixed m = 6 and capacity = 1 (rate = 5). According to Section 2.2, this offers log2(CURVE25519_BASE_FIELD.ORDER) / 2 bits of security against collision, preimage, and second-preimage attacks. See the referenced paper for further details.

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.
FpFieldField type for Curve25519 base field.

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_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.
compressUint128Compresses an array of bytes into 128-bit bigints.
decompressUint128Decompresses an array of 128-bit bigints into a flattened byte array.
deserializeLEDeserializes a little-endian Uint8Array to a bigint.
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.
getArciumProgAddressReturns the public key of the deployed Arcium program on Solana.
getArciumProgramReturns an Anchor program instance for the Arcium program.
getArciumProgramIdReturns the public key of the deployed Arcium program on Solana.
getArciumProgramReadonlyReturns a read-only Anchor program instance for the Arcium program.
getArxAccPDAReturns the PDA (program-derived address) for an ArxNode account given the program ID and node offset.
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 MXE program ID and offset.
getExecutingPoolAccAddressDerives the executing pool account address for a given MXE program ID.
getExecutingPoolAccDataFetches and decodes the executing pool account data for any pool size.
getMempoolAccAddressDerives the mempool account address for a given MXE program ID.
getMempoolAccDataFetches and decodes the mempool account data for any mempool account size.
getMXEAccAddressDerives the MXE account address for a given MXE program ID.
getMXEPublicKeyFetches and extracts the MXE public key from the MXE account.
getStakingPoolAccAddressDerives the staking pool account address.
positiveModuloComputes the positive modulo of a over m.
randMatrix-
serializeLESerializes a bigint to a little-endian Uint8Array of the specified length.
sha256Computes the SHA-256 hash of an array of Uint8Arrays.
toVec-
uploadCircuitUploads a circuit to the blockchain, splitting it into multiple accounts if necessary.