Skip to main content

Overview

Arcium provides three TypeScript SDKs for interacting with Arcium, deployed MXEs (MPC eXecution Environments), and the staking program. Client library @arcium-hq/client:
  • Handles key exchange, encryption, and decryption
  • Derives Arcium PDAs and packs circuit data
  • Waits for computation finalization
Reader library @arcium-hq/reader:
  • Reads MXE data
  • Views computations for a given MXE
Staking SDK @arcium-hq/staking:
  • Derives staking program-derived addresses (PDAs)
  • Reads typed staking accounts and delegated positions
  • Builds staking instructions for a wallet to sign and send
Use the client library to encrypt and pack data, derive PDAs, and wait for finalization. Use the reader library to inspect MXE and network state, and the staking SDK to interact with the staking program. For the full computation flow, see the computation lifecycle.

Installation

Client library:
Reader library:
Staking SDK:

Read staking accounts

With an Anchor AnchorProvider, create a typed staking program client, then read a wallet’s primary stake account and delegated positions:
Single-account readers return null when the account does not exist. Instruction builders return a TransactionInstruction for your wallet to sign and send.

API reference

For complete documentation for all three TypeScript SDKs, see the API reference.

Reclaiming computation rent

Every queued computation allocates a Solana account that holds rent. After the computation lifecycle completes, you should reclaim that rent.

After successful finalization

Once a computation reaches Finalized status (after the callback executes), use claimComputationRent to close the account and reclaim the rent:
The signer must be the original payer who queued the computation. Using a different signer will fail with InvalidAuthority.
Computations that remain in Queued status expire after 180 slots. Expired computations can be reclaimed using the reclaimExpiredComputationFee instruction, which also returns any fees from the fee pool. See the API reference for details.
claimComputationRent only closes per-computation accounts. To close long-lived MXE or computation-definition accounts, see Account lifecycle and closing.

Reading computation fees

The reader library exposes two getters for inspecting a computation’s fee, depending on whether its account is still open:
getComputationFee returns { source: 'account', ... } with the live onchain fee, or null when the account has been closed. getComputationFeeFromQueueTx returns { source: 'queueTx', ... } with the raw queue-time inputs (not lamport amounts) and requires an archive RPC that retains the original transaction and its inner instructions. See the API reference for the full return shapes.

Using the client

Prefer a more step-by-step approach? Get started with learning how to encrypt inputs for encrypted transactions.

What’s next?

Encrypting inputs

Step-by-step guide to encrypting data for encrypted transactions.

Tracking callbacks

Await and process computation results.

Full API reference

Complete TypeScript SDK documentation.