@orbinum/protocol
@orbinum/protocol is the public TypeScript package for Orbinum: chain access, address handling,
encoding, payment slips and proofs, disclosure keys, private staking reads and the precompile
bindings. It runs in browsers, Node, React Native and edge workers. This page is its reference,
together with the two packages that generate proofs. To install it and make a first read, see
Get Started.
Packages
| Package | License | What it is |
|---|---|---|
@orbinum/protocol | MIT | Chain client, encodings, payment slips and proofs, disclosure keys, Merkle geometry, runtime event fields |
@orbinum/proof-generator | GPL-3.0-or-later | The Groth16 prover and its artifact loaders |
@orbinum/circuits | GPL-3.0-or-later | Proving and verifying artifacts for the three circuits |
@orbinum/protocol is published as ESM and CJS with type definitions. Its peer dependencies,
polkadot-api and @polkadot/util-crypto, must be installed for any import:
npm install @orbinum/protocol polkadot-api @polkadot/util-crypto
Entry points
| Import | What it holds |
|---|---|
@orbinum/protocol | Everything on this page unless a row says otherwise |
@orbinum/protocol/browser | Browser wallet extensions: hasInjectedExtensions, getInjectedExtensions, connectInjectedExtension, getSubstrateSignerFromExtension and the types SignPayload, SignRaw. Kept out of the root so a Node host never loads polkadot-api/pjs-signer; off-page every function reports no extension instead of throwing |
@orbinum/protocol/internal | Curve and memo primitives Orbinum's wallet builds on (fastMulBase, fastMulPoint, secretMulPoint, isInPrimeSubgroup, MemoFormat, bytesToBjjScalar). No compatibility promise across minor versions; a dApp or backend never needs it |
The browser helpers are not exported from the root: an import of connectInjectedExtension
from @orbinum/protocol fails to compile.
The memo format the pool enforces: MEMO_FORMAT_OFFSET,
MEMO_FORMAT_TAGGED, MEMO_FORMAT_HANDSHAKE, MEMO_TAG_OFFSET, MEMO_TAG_SIZE and
memoFormatOf(memo), the format a full 180-byte memo declares or null. See
The memo format and its tags.
Orbinum's wallet takes every formula it shares with a verifier from @orbinum/protocol
(noteCommitment, stealthOwnerPk, memoViewTag, encodePrivacyAddress, decodePrivacyAddress
and the sender claims), so a wallet and a verifier compute them from one definition.
@orbinum/proof-generator depends on one exact @orbinum/circuits release, and pins the SHA-256
of the prover's WebAssembly binary and of every circuit artifact at build time. A browser checks
each download against those pins, so a CDN or a mirror cannot serve a different proving key.
The custody boundary
The public packages hold no keys. Anything that needs a user's spending key or viewing key runs in the user's wallet. The public package opens a note only to verify a payment: with the payer's proof and a public address, or with a viewing key a backend was given on purpose.
| The public packages | The wallet |
|---|---|
| Read chain state, pool state and events | Derives the user's keys from a signature |
| Compute a note commitment from its four fields | Chooses a note's owner key and blinding |
| Generate a shield proof | Seals the 180-byte encrypted memo of a note |
| Submit a shield (signed) and submit a spend whose proof is already built | Builds the witness and the proof of a transfer or unshield |
| Seal a payment slip toward a recipient's viewing key | Opens memos, finds its notes, decides which notes to spend |
| Create and verify disclosure keys from a note's preimage | Derives the one-time keys of notes the chain mints |
| Verify a payment proof with the recipient's public address, or a slip with a viewing key | Builds the bound spends that enter and exit a private pool |
| Read private pools and price their shares | Keeps the vault: notes, channels and key counters, encrypted |
A dApp, a backend or an auditor needs only the left column; a private payment, a spend or a private
stake is something it asks the user to make in their wallet. @orbinum/protocol encodes and decodes
orbpriv3: privacy addresses (encodePrivacyAddress, decodePrivacyAddress,
decodePaymentAddress).
What the wallet does on the right is specified, not hidden, so anyone can check what it publishes:
| Topic | Where |
|---|---|
| The keys and what each one can do | Keys & Identity |
| A note, its commitment and nullifier, the memo envelope | Notes |
| How the wallet finds its notes: memo format and tags, channels, scanning, the compact restore | Note Discovery |
| What a spend must satisfy | Spend Validity |
| What the vault holds and how it is protected, from the user's side | Private Vault |
| What is visible, and to whom | Privacy Architecture |
Connecting
OrbinumClient.connect(config) opens one connection and hangs every module from it.
import { OrbinumClient } from '@orbinum/protocol';
const client = await OrbinumClient.connect({
substrateWs: 'wss://rpc.testnet.orbinum.io',
evmRpc: 'https://rpc.testnet.orbinum.io',
});
const stats = await client.privacy.getPoolStats();
console.log(stats.commitmentCount, 'leaves');
client.destroy();
| Field | Meaning |
|---|---|
substrateWs | WebSocket URL of a node. The client opens the connection and destroy() closes it |
connectTimeoutMs | Handshake timeout with substrateWs. Default 15_000 |
metadataCache | With substrateWs only: a MetadataCache (get(codeHash), set(codeHash, metadata)) that keeps the runtime metadata, hundreds of KB, between connections. It is downloaded again only when the runtime's code hash changes; a failing cache reads as a miss and never fails the connection. Entries are scoped to the endpoint |
papi | An already-connected polkadot-api client, used instead of substrateWs. destroy() leaves it running |
substrateHttp | With papi only: an HTTP endpoint for substrate.batchRequest |
evmRpc | EVM JSON-RPC URL. Without it evm, evmExplorer and precompiles are null |
evmRpcPeer | A second EVM endpoint, used only to tell a pending EVM transaction from one stranded on evmRpc |
connect throws when the node does not answer within the timeout, or when it runs a runtime older
than MIN_SPEC_VERSION, whose calls the package does not encode:
Unsupported runtime: spec N, this SDK needs spec M or later. Endpoints and chain constants are in
Network & Tooling.
Long-lived applications
OrbinumClient has no heartbeat and no reconnection: a dropped connection shows up only as failing
requests. OrbinumClientProvider wraps one with both.
import { OrbinumClientProvider } from '@orbinum/protocol';
const provider = new OrbinumClientProvider({ substrateWs: 'wss://rpc.testnet.orbinum.io' });
const unsubscribe = provider.onStatusChange(({ status, error }) => console.log(status, error ?? ''));
provider.connect();
const client = await provider.getOrbinumClient();
| Behaviour | Value |
|---|---|
| Status | idle, connecting, connected, disconnected, reconnecting |
| Heartbeat | system_health every 5 s (heartbeatIntervalMs), 4 s timeout (heartbeatTimeoutMs) |
| Teardown | After 2 consecutive failed probes, or 6 while a transaction awaits finalization |
| Reconnect | Exponential backoff from 3 s to 30 s with jitter (reconnectBaseMs, reconnectMaxMs); the backoff resets after 10 s of stable connection (stableAfterMs) |
| Handshake | connectTimeoutMs, default 8_000 |
| Metadata | metadataCache, as for connect |
getOrbinumClient() returns the live client or the attempt in flight, and throws in any other
state. tryGetOrbinumClient() returns null instead. reset() returns to idle.
Client modules
| Module | Covers | Without evmRpc |
|---|---|---|
client.substrate | The shared transport: request, batchRequest, getBlockHash, getBlock, queryBlockEvents, and polkadotClient for raw polkadot-api access | Available |
client.shieldedPool | The pool's extrinsics (boundSpend included), plus minSpendFee(), pendingFees(account, assetId), isKnownRoot(root, { minBlocksLeft }), treeSize() (leaves over every tree), leaf(index) (the commitment at a leaf, or null) and taggedMemosFromLeaf() (the first leaf under the memo-format rule, or null while none is recorded; a value that is not a u32 throws) | Available |
client.privacy | The privacy_* RPC: roots, Merkle proofs, subtree roots, nullifier status, pool statistics; getFinalizedLeafIndex(commitmentHex) reads a commitment's leaf at the finalized head | Available |
client.balances | account(address): free, reserved, frozen and nonce at the best block; transferKeepAlive(dest, value, signer) | Available |
client.staking | Staking reads (account, config, admission, exposure, pendingPayouts, autoPayout…) and calls (bond, nominate, validate, payoutStakersByPage…). See Staking | Available |
client.pools | Nomination pools: reads, member calls and the roles' calls, including createWithPoolId, updateRoles(id, roles, signer) and setMetadata(id, profile, signer) | Available |
client.privateStaking | Private pools: pool, pools, poolOfAsset, minEntry, quote, exitUnbondingEras, memberAddress, entryRefusal, exitRefusal, and the root's setPrivate. See Private Staking with the SDK | Available |
client.chain | isValidator(ss58), through chain_isValidator | Available |
client.zkVerifier | getAllCircuitVersions(), getCircuitVersionInfo(circuitId): active and accepted versions and their VK hashes. verificationStats(circuitId, version) and allVerificationStats(): how many proofs each key checked. proofSystem(circuitId, version): the system a key is for (Groth16) | Available |
client.ismp | Read-only ISMP queries: latestHeight, challengePeriod, requests, responses, events, childTrieProof, channelHeight | Available |
client.evm | EVM JSON-RPC: balances, calls, gas, receipts, sendRawTransaction | null |
client.evmExplorer | Blocks, transactions, address and token-transfer queries over EVM RPC | null |
client.precompiles | shieldedPool (shield, estimateShieldGas) and crypto (ECRecover, SHA-256, RIPEMD-160, identity, Curve25519) | null |
How to read pool state with these modules is in Reading Pool State.
Shielded-pool calls
| Method | Origin | Arguments |
|---|---|---|
shield(params, signer) | Signed: the signer is the public depositor | ShieldParams |
shieldBatch({ items }, signer) | Signed | Up to 20 ShieldParams |
claimFees({ assetId, amount }, signer) | Signed by the validator account | Pays its pending spend fees to it. See Spend Fees |
privateTransfer(params) | Unsigned | Two nullifiers, two outputs, merkleRoots, fee, proof |
unshield(params) | Unsigned | Nullifier, root, amount, recipient, fee, optional change, proof |
boundSpend(params) | Unsigned | BoundSpendParams: an unshield's arguments without recipientAddress, plus the action the proof commits to. See ZK-NPoS: Private Staking |
ShieldParams is { assetId, amount, commitment, encryptedMemo, proof, circuitVersion }:
amount in planck as a bigint, commitment as 32-byte little-endian hex, encryptedMemo as
180 bytes, proof as the 128-byte compressed proof. The signer is a SubstrateSigner — see
Signers.
The three spends take no signer: the chain accepts them only unsigned, and the proof authorises
them. Every signing path in the package refuses a spend, including one nested in a utility.batch
or sudo, and assertNotSignedSpend(tx) runs the same check for a host with its own signing path. Every check a
spend must pass is in Spend Validity. From an EVM wallet,
client.precompiles.shieldedPool.shield(params, signer) sends the same deposit through the
precompile, where signer is (tx: { to, data, value?, gasPrice? }) => Promise<txHash>; see
ShieldedPool precompile.
Signers
Signed calls take a SubstrateSigner. Which constructor builds it depends on the account's key type:
| Export | Entry point | Builds the signer of |
|---|---|---|
getSubstrateSigner | root | An sr25519 or ECDSA keypair held by the host |
getEcdsaTextSigner(evmAddress, sign) | root | An EVM account: sign is the wallet's personal_sign (EIP-191) over the transaction's readable text |
getEd25519TextSigner(address, sign) | root | An ed25519 account: a local keypair, a Solana wallet's signMessage, or an extension's signRaw |
getSubstrateSignerFromExtension | /browser | An sr25519 or ECDSA account of a browser wallet extension |
connectInjectedExtension(name, origin?) | /browser | Connects an extension. Its ed25519 accounts already carry a getEd25519TextSigner signer as txCreator; other accounts are unchanged |
The runtime accepts an ed25519 signature only over the readable text of the transaction, never
over the raw signing payload. getEd25519TextSigner renders that text, naming calls from the
transaction's own metadata, and passes it to sign. It then verifies the signature locally and
tags it by what the key signed:
| Signed form | Typical source | Tag |
|---|---|---|
| The bare text | A keypair, Solana signMessage | 0x03 (Ed25519Text) |
The text wrapped in <Bytes> | An extension's signRaw | 0x04 (Ed25519WrappedText) |
A signature by another key or over other bytes throws Ed25519TextSignatureError, and nothing is
sent. The text format and the signature variants are in
EVM ↔ Substrate Mapping.
Transaction results and errors
Every extrinsic method resolves on finalization with a TxResult:
type TxResult = {
txHash: string;
blockHash: string;
blockNumber: number;
ok: boolean; // false when the extrinsic was included but its dispatch failed
error?: string; // e.g. 'Module(ShieldedPool.InsufficientPendingFees)', only when ok is false
fee?: string; // planck, decimal: the inclusion's TransactionFeePaid. Absent for an unsigned spend
};
ok describes the dispatch, not the submission. An included extrinsic that the pallet rejected
resolves with a real txHash and ok: false; it does not throw. The method throws when the
transaction never reaches a block: the node refuses it at admission, the signer declines, or the
connection fails.
Every call takes an optional last argument, SubmitOptions. onSigned(txHash) is called once the
transaction is signed, before anything can drop it, so a host can record the hash it will look for
after a lost connection; onBroadcast() fires when the node accepts it; resolveAt: 'best'
resolves at best-block inclusion instead of finalization.
Refusals before signing
A call the chain would refuse, and still charge a fee for, is refused before signing: a minimum not
met, a role the signer lacks, a pool that is not open. The method throws a ProtocolRefusal:
import { protocolRefusal } from '@orbinum/protocol';
try {
await client.privateStaking.setPrivate(poolId, true, signer);
} catch (error) {
const refusal = protocolRefusal(error); // ProtocolRefusal | null
if (!refusal) throw error;
console.log(refusal.call, refusal.reason, refusal.detail); // 'setPrivate', 'NotRoot', { poolId }
}
| Field | Contents |
|---|---|
call | The SDK call refused: bond, nominate, setCommission, setPrivate… |
reason | A RefusalReason, named as the chain's error: BelowMinimumBond, NotRoot, PoolNotOpen, NotPrivate… |
detail | The numbers behind it: minimum, targets, bound, left, role, field, poolId |
protocolRefusal(error) also recognises a refusal thrown by a second copy of the package, which an
instanceof check would miss. Malformed arguments are not refusals: they throw a plain Error.
Classifying errors
| Helper | Use |
|---|---|
classifyChainError(raw) | Maps a raw error or TxResult.error to a PalletErrorKind: already-spent, ghost-note, stale-proof, amount, asset, shape, proof, capacity, balance, unknown |
extractPalletError(raw) | The pallet error name inside a raw error, or null |
parseModuleError(raw) | { pallet, error } from a Module(Pallet.Error) string, or null |
dispatchErrorPath(value) | The Pallet.Error path of a decoded dispatch error, or null |
classifyTxError(raw) | A failure outside the pallets, as a TxErrorKind: dropped, pending, outdated, cannot-pay-fees, bad-signature, disconnected |
extractPoolRejection(raw), poolRejectionKind(raw) | The admission code of a refused unsigned spend (Custom error: N) and its kind. Codes are in Spend Validity |
isServerBusyError(error) | The node refused a Merkle proof request as busy (-32009) |
isConnectionLossError(error), txLandedAfterError(error, landed), recoveredTxResult(txHash) | Tell whether a transaction landed after the connection died while watching it |
MIN_SPEND_FEE exports the fee floor, 0.001 ORB in planck, for offline use;
client.shieldedPool.minSpendFee() reads the runtime's value.
Payment slips
A payment slip is an orbslip1: string that the sender of a private transfer gives the
recipient after the transfer lands. It points the recipient's wallet at the note it was paid,
so the wallet adds it without scanning the pool.
A slip carries only data that is already public on chain, sealed toward the recipient:
| Field | Contents |
|---|---|
commitmentHex | The recipient output's commitment, 32-byte little-endian hex |
encryptedMemo | That output's 180-byte encrypted memo, as hex |
leafIndex | Optional. Its leaf index, informational |
txHash | Optional. The transfer's hash, a reference the recipient can show |
The fields are public, but pairing them off chain reveals that this recipient expects this payment, so the slip is encrypted. A slip grants no spend power, and a forged one adds nothing: the recipient's wallet recomputes the commitment from the opened memo and checks it against the chain.
Sealing
import { encodePaymentSlip, fromHex, sealPaymentSlip } from '@orbinum/protocol';
const envelope = sealPaymentSlip(fromHex(recipientIvkHex), {
commitmentHex, // the recipient's output, from CommitmentsInserted
encryptedMemo, // its memo, as 0x hex
leafIndex,
txHash,
});
const slip = encodePaymentSlip(envelope); // 'orbslip1:…'
recipientIvkHex is the 32-byte packed viewing public key, the ivk field of the recipient's
privacy address.
decodePrivacyAddress(address)?.viewingPublicKeyHex reads it from an orbpriv3: string after
checking its checksum and its points. sealPaymentSlip throws for a key that is not exactly 32
bytes or is not a point of Baby JubJub's prime-order subgroup.
Opening
import { decodePaymentSlip, openPaymentSlip } from '@orbinum/protocol';
const envelope = decodePaymentSlip(slip);
const fields = envelope && openPaymentSlip(recipientIvsk, envelope); // PaymentSlipFields | null
Opening takes the recipient's incoming viewing secret key, so it runs in the recipient's
wallet. Both functions return null and never throw: a wrong scheme, a bad checksum, a wrong key, a
truncated slip, a commitment that is not 32 bytes, a memo that is not 180 bytes or an invalid
leafIndex all give null. A malformed txHash is dropped and the rest is kept. Turning the
fields into a spendable note means opening the memo, which is wallet work. The user flow is in
Payment Slips.
Wire format
orbslip1:<payload>:<checksum>
| Part | Contents |
|---|---|
| Scheme | orbslip1: (PAYMENT_SLIP_SCHEME). The version is in the name |
payload | base64url of the envelope written as 0x-prefixed hex text |
checksum | 8 lowercase hex characters: the first 4 bytes of SHA-256 over orbslip1: + payload. It catches typos and truncation, not tampering |
| Envelope | ephPk(32) ‖ nonce_suffix(8) ‖ ciphertext ‖ MAC(16), at most 4,096 bytes |
| Cipher | ChaCha20-Poly1305 over the JSON fields. Key: HKDF-SHA256 of the ECDH shared secret with info = "orbinum-payment-slip-v1". Nonce: "SLP1" ‖ the 8-byte suffix |
A fresh ephemeral key is generated for every slip. A full slip is about 1,670 characters.
QR_SINGLE_CODE_MAX_CHARS (1,800) is the capacity of one QR code at error correction level M; the
encoder does not enforce it, so check the length before rendering a slip as a single QR code.
Verifying a slip on a backend
verifyPayment(slip, { key, tree, expected, finality? }) checks a slip on a server that holds the
recipient's viewing key (decodeViewingKey('orbview1:…')): the note opens, is the key's owner's,
pays exactly expected, and is in the note tree. It returns the payment's commitmentHex, value,
asset, sender and leaf index; it does not return the slip's txHash or stated leaf index,
which whoever sealed the slip could set freely. A slip proves that a note to you exists, not
who made it, so orders from the public settle on payment proofs instead. See
Verifying Payments.
Payment proofs
A payment proof is an orbproof1: string that the payer's wallet makes beside the slip. A
recipient's server checks it with the recipient's public orbpriv3: address alone: no secret
on the server.
orbproof1:<commitment>:<encryptedMemo>:<ephemeralSecretKey>:<checksum>
| Part | Contents |
|---|---|
commitment | The payment note's commitment, 32-byte little-endian hex |
encryptedMemo | Its 180-byte encrypted memo, hex |
ephemeralSecretKey | The 32-byte ephemeral secret the memo was sealed with. With it and the address's viewing public key, the server reaches the shared secret the recipient's wallet reaches |
checksum | 8 hex characters: the first 4 bytes of SHA-256 over everything before it. A typo guard, not authentication |
A proof holds no transaction hash, leaf index or label: nothing a payer could change to make one payment settle two orders. It is not sealed, so whoever holds it reads that one payment's amount, asset and declared sender, and nothing about the payer's other notes or keys.
| Export | Use |
|---|---|
verifyPaymentProof(proof, { address, tree, expected, finality? }) | The full check: the proof's ephemeral is the memo's ([ephSk]·B), the memo's view tag matches, the note opens to address and recomputes to the commitment, the asset and amount are exactly expected, and the commitment is in the tree. Reasons: invalid-proof, wrong-asset, wrong-amount, not-on-chain, not-final |
checkPaymentProof(proof, { address, expected }) | The same without the chain, for a caller that asks its node itself |
encodePaymentProof(fields), decodePaymentProof(text) | The wire format. decodePaymentProof returns null for anything malformed and writes hex in lower case, so one payment has one commitmentHex |
decodePaymentAddress(text) | An orbpriv3: address with its points, or null for a bad checksum, an off-curve owner key or a viewing key outside the prime subgroup |
encodeViewingKey(key), decodeViewingKey(text) | The orbview1: export of a viewing key, for verifyPayment |
finality defaults to 'finalized': the commitment must be in a finalized block, and a payment
that has landed but is not final yet is reported as not-final. 'best' accepts the node's best
block, which a reorganisation can revert. A note whose sender is named by address is refused as
invalid-proof, since only a viewing key proves that claim.
Each GitHub release of the package also attaches orbinum-verify.wasm, a WASI command that runs
checkPaymentProof from any language. The backend flow, the WASI module and the checks to make
before shipping are in Verifying Payments.
Proofs
@orbinum/proof-generator builds Groth16 proofs over BN254 from the artifacts in
@orbinum/circuits. Without custody it can prove a shield: the shield circuit's private inputs
are the note's owner key and blinding, which the depositor chooses. Transfer and unshield proofs
need the spending key, so the wallet builds them.
generateProof(circuitType, inputs, options?): Promise<{
proof: string; // 0x hex of the 128-byte compressed proof
publicSignals: string[]; // 0x hex, 32-byte little-endian
circuitType: CircuitType;
}>
| Option | Meaning |
|---|---|
provider | Where artifacts come from. Default: NodeArtifactProvider under Node, WebArtifactProvider in a browser or worker |
circuitVersion | Must equal the version the provider resolves, or generateProof throws CircuitVersionMismatchError before proving |
backend | 'snarkjs' (default) or 'arkworks' |
singleThread | Prove on one thread instead of one worker per core. Needed on memory-constrained devices |
| Circuit | Active version on chain | Public inputs | Private inputs |
|---|---|---|---|
shield | 1 | commitment, value, asset_id | owner_pubkey, blinding |
transfer | 3 | See Transfer Circuit | Wallet only |
unshield | 3 | See Unshield Circuit | Wallet only |
The chain's active versions are readable at run time with client.zkVerifier.getAllCircuitVersions().
Generating a shield proof
import { CircuitType, NodeArtifactProvider, generateProof } from '@orbinum/proof-generator';
import { commitmentHexOf, fromHex, type ShieldParams } from '@orbinum/protocol';
import { poseidon4 } from 'poseidon-lite';
const value = 10n ** 18n; // 1 ORB
const assetId = 0n;
const ownerPk = 123456789n; // the note owner's Baby JubJub Ax, chosen by the wallet
const blinding = 987654321n; // a random field element, chosen by the wallet
const commitment = poseidon4([value, assetId, ownerPk, blinding]);
const { proof } = await generateProof(
CircuitType.Shield,
{
commitment: commitment.toString(),
value: value.toString(),
asset_id: assetId.toString(),
owner_pubkey: ownerPk.toString(),
blinding: blinding.toString(),
},
{ provider: new NodeArtifactProvider(), circuitVersion: 1, singleThread: true },
);
const params: ShieldParams = {
assetId: 0,
amount: value,
commitment: commitmentHexOf(commitment),
encryptedMemo: new Uint8Array(180), // the wallet seals the real memo
proof: fromHex(proof),
circuitVersion: 1,
};
The chain accepts any 180-byte memo, but a note shielded without a memo sealed to its owner cannot
be found by a scan. In a one-shot Node script, singleThread: true lets the process exit: the
multi-threaded prover keeps worker threads alive after it returns.
Artifacts and the WebAssembly prover
| Export | Package | Use |
|---|---|---|
NodeArtifactProvider({ packageRoot?, circuitVersions? }) | proof-generator | Reads the installed @orbinum/circuits through its manifest.json and checks each file's SHA-256 |
WebArtifactProvider({ baseUrl?, circuitVersions? }) | proof-generator | Fetches from the pinned @orbinum/circuits release on unpkg, or a mirror at baseUrl, and checks each file against the SHA-256 pinned at build time |
initWasm({ wasmUrl? }), setWasmUrl(url) | proof-generator | Where a browser loads groth16_proofs_bg.wasm. Default: the pinned CDN. The bytes must match the pinned SHA-256. Node reads the file from node_modules |
compressSnarkjsProofWasm(proof) | proof-generator | Compresses a proof made directly with snarkjs ({ pi_a, pi_b, pi_c }) to the 128-byte form the chain takes |
getCircuitPaths(circuit, version?) | circuits | Absolute paths of one version's wasm, r1cs, zkey, ark and verificationKey (Node). Default: the active version |
CIRCUITS | circuits | ['transfer', 'unshield', 'shield'] |
circuitVersions pins a circuit to a version other than the manifest's active one, for example
{ unshield: 3 }.
Other helpers
| Area | Exports | Owner page |
|---|---|---|
| Disclosure keys | createNoteDisclosureKey, decodeNoteDisclosureKey, commitmentHexOf | Verifying Disclosure Keys |
| Merkle forest | treeIdOf({ leafIndex }), isValidLeafIndex, LEAVES_PER_TREE, blockPath, SubtreeRootTree, buildLocalPath, verifyPath | Merkle Forest |
| Addresses | evmToSubstrate, substrateToEvm, addressToAccountIdHex, accountIdHexToSs58, substrateSs58ToAccountIdHex, isUnifiedAddress, isImplicitEvmAccount, solanaToSs58, ss58ToSolana, ORBINUM_SS58_PREFIX | EVM ↔ Substrate Mapping |
| Pallet accounts | palletAccountId, palletSubAccountId, isPalletAccount, ORBINUM_PALLET_IDS, SHIELDED_POOL_ACCOUNT, ISMP_TREASURY_ACCOUNT, privateMemberAddress(poolId), privateMemberPoolId(account), poolAccounts(id) | ZK-NPoS: Private Staking |
| Note formulas | noteCommitment, ownerPkPoint, stealthScalar, stealthOwnerPk, isOwnedBy, memoEncryptionKey, memoViewTag, memoEphPk, encodePrivacyAddress, decodePrivacyAddress, the sender claims (decodeSenderClaim, senderAddressClaim…) | Note Discovery |
| Bound spends | boundSpendDigest(genesisHash, action, changeMemo), encodeBoundAction, decodeBoundAction | ZK-NPoS: Private Staking |
| Runtime events | EVENT_FIELDS (every pallet's events and their field names, generated from the runtime's metadata; EVENT_FIELDS_SPEC is its spec), eventFieldNames(pallet, event), and the types RuntimePallet, RuntimeEvent, EventFieldName, EventFields: a field the runtime does not declare fails to compile | Indexing Events |
| Decoders | insertedLeaves, mintedLeaves, decodeShieldBatchOperation, decodeSessionKeys, authorFromSlot, timestampFromExtrinsics, parseTransactionText | Indexing Events |
| EVM token logs | ERC_EVENT_TOPICS, ercEventName, ERC_SELECTORS, decodeTokenTransfers(log) (ERC-20, ERC-721, ERC-1155 single and batch), decodeAbiString, decodeAbiUint | EVM Compatibility |
| Privacy RPC | client.privacy.* | Reading Pool State |
| Amounts | formatBalance(raw, { decimals, symbol, showSymbol, precision }), parseAmount(input, decimals), formatPercent | — |
Related
- Get Started — install, connect and make a first read
- Network & Tooling — endpoints, chain constants and EVM tooling
- Reading Pool State —
client.privacy, fees and circuit versions - Indexing Events — the shielded pool's events and how to follow them
- Verifying Payments — payment proofs and slips on a backend
- Private Staking with the SDK — reading private pools, entering and exiting
- Keys & Identity — what each key unlocks and the privacy address
- ZK Proofs — the proof system and the circuits