Skip to main content

L3 Staking

L3 provides full graph privacy — hiding both sender and recipient by breaking the on-chain link between deposits and withdrawals.

All methods are on wallet.USD (or any currency accessor).

Stake (L2 → L3)

Create an anonymous stake commitment from your encrypted balance:

const stake = await wallet.USD.stake(1000_000000n, {
onProgress: (stage, p) => console.log(`${stage}: ${p * 100}%`),
useRelayer: true,
});

Returns a Stake object with id, amount, leafIndex, and status.

Get Stakes

const all = await wallet.USD.getStakes();
const active = await wallet.USD.getStakes({ status: 'active' });

Unstake (L3 → L2)

Burn stakes to any BPK — breaking the link between the original staker and the recipient:

await wallet.USD.unstake(
[stake.id],
freshWallet.BPK,
{ useRelayer: true }
);

Transfer from Stealth

Move funds from a stealth address back to your main wallet:

await wallet.USD.transferFromStealth(0);
await wallet.USD.transferFromStealth(0, 500_000000n);