Opertus

SDK overview

Choose the Opertus package that owns each part of a shielded transaction.

The SDK is split by responsibility:

PackageDirect SDK dependencyPrimary responsibility
@opertus/cryptoNoneCryptographic primitives for commitments, nullifiers, stealth ownership, and clone salts
@opertus/wallet@opertus/cryptoKeys, encrypted note creation and scanning, and local note state
@opertus/core@opertus/cryptoPool synchronization, note selection, proving, and contract-call construction
@opertus/sdkOptional viemTyped requests to the installed wallet extension

Core does not import wallet. It accepts wallet notes and encrypted payloads structurally, so the two packages share protocol data without a code dependency. @opertus/sdk does not import crypto, wallet, or core. It talks to window.opertus. Dapps that integrate the installed wallet start at @opertus/sdk.

Not published to npm

The packages are not on a registry yet, so npm install @opertus/core will not resolve. Install them from the private GitHub repos at the latest release tag, as shown in getting started. The crypto, wallet, and core manifests export TypeScript source directly. @opertus/sdk publishes built JavaScript and type declarations.

How the packages fit together

import { KeyManager, Sender } from '@opertus/wallet';
import { OpertusBuilder, OpertusClient, createProver } from '@opertus/core';

const wallet = KeyManager.fromMnemonic(mnemonic);
const client = new OpertusClient({ publicClient, poolAddress, prover: createProver(buildDir) });
const domain = {
  chainId: BigInt(await publicClient.getChainId()),
  poolAddress: BigInt(poolAddress),
};

const amount = 1_000_000n;
const noteValue = OpertusBuilder.predictShieldNote(amount, 0n, await client.getDepositFeeBps());
const recipient = await Sender.prepareSend(wallet.getMetaAddress(), BigInt(tokenAddress), noteValue, domain);

const depositCall = client.deposit({ recipient, amount, token: tokenAddress });

Sender.prepareSend creates an encrypted note locally; client.deposit turns it into a pool call that you sign and send with your own wallet client. The note value is the net after the pool's deposit fee; the second argument to predictShieldNote is the token's own transfer fee, if it has one.

Security boundary

Read the protocol architecture for note and transaction semantics and the privacy model before deciding where view keys, spend keys, proving artifacts, and decrypted notes may live.

On this page