getArciumAccounts
Umbra SDK reference for Get Arcium Accounts.
getArciumAccounts(
computationOffset,computationName):object
Defined in: src/utils/arcium.ts:317
Retrieves all Arcium account addresses required for a computation instance.
Parameters
computationOffset
The 64-bit computation offset used to derive the computation account PDA
computationName
string
The name of the computation definition (in snake_case, e.g., 'share_patient_data')
Returns
object
An object containing all required Arcium account addresses:
computationAccount: The PDA for the specific computation instancecompDefAccount: The PDA for the computation definition accountclusterAccount: The Arcium cluster account addressmxeAccount: The Multi-Execution Environment account addressmempoolAccount: The mempool account address for queuing computationsexecutingPoolAccount: The executing pool account address for active computations
clusterAccount
clusterAccount:
ProgramDerivedAddress
compDefAccount
compDefAccount:
ProgramDerivedAddress
computationAccount
computationAccount:
ProgramDerivedAddress
executingPool
executingPool:
ProgramDerivedAddress
mempoolAccount
mempoolAccount:
ProgramDerivedAddress
mxeAccount
mxeAccount:
ProgramDerivedAddress
Throws
ArciumAccountError When computation name is invalid, account derivation fails, or conversion errors occur
Remarks
This function derives all the account addresses needed to interact with a computation instance in the Arcium Multi-Execution Environment. These accounts are required when building transactions that interact with Arcium computations.
Account Derivation:
- Computation Account: Derived from the program ID and computation offset using
getComputationAccAddress - CompDef Account: Derived from the program ID and computation definition offset using
getCompDefAccAddress - Cluster Account: Predefined constant account for the Arcium cluster
- MXE Account: Predefined constant account for the Multi-Execution Environment
- Mempool Account: Predefined constant account for the computation mempool
- Executing Pool Account: Predefined constant account for the executing computation pool
Computation Offset:
The computation offset uniquely identifies a computation instance. Use generateRandomComputationOffset()
to generate a secure random offset for new computations.
Computation Name: The computation name must match an existing computation definition. It's used to derive the computation definition account address and must be in snake_case format (e.g., 'share_patient_data').
Examples
// Generate a random offset and get all accounts
const offset = generateRandomComputationOffset();
const accounts = getArciumAccounts(offset, 'share_patient_data');
// Use the accounts in a transaction
const transaction = await program.methods
.executeComputation()
.accounts({
computationAccount: accounts.computationAccount,
compDefAccount: accounts.compDefAccount,
clusterAccount: accounts.clusterAccount,
mxeAccount: accounts.mxeAccount,
mempoolAccount: accounts.mempoolAccount,
executingPoolAccount: accounts.executingPoolAccount,
})
.transaction();// Handle errors
try {
const accounts = getArciumAccounts(offset, 'invalid_computation');
} catch (error) {
if (error instanceof ArciumAccountError) {
console.error('Failed to get Arcium accounts:', error.message);
}
}