Skip to content

@lelantos-org/sdk / protocol / sealOutput

Function: sealOutput() ​

ts
function sealOutput(
   J, 
   P, 
   o
): object;

Defined in: @lelantos-org/sdk/dist/bundle/common.d.ts:133

Seal one output: its note, and the clue, ephemeral key and ciphertext published with it.

No random value is drawn. osk (outputSecret) binds the sender's outgoing key, the chain, the note's fields, the recipient's whole address, the spend's nullifiers and the memo; the header of notes/seed.ts defines its preimage and how rseed, rcm, esk and fmdR follow from it. Two calls therefore share an esk only when every one of those is equal. rho must be unique per output: it is the note's nullifier seed.

ECDH and the clue run on the recipient's base g_d = diversifiedBase(d). The clue has FMD_DEFAULT_GAMMA bits, the width a recipient checks. A pad goes through this function like a paying output, to an address drawn for it.

Parameters ​

ParameterTypeDescription
JJubjub-
PPoseidon-
o{ asset: bigint; chainId: bigint; memo?: Uint8Array<ArrayBufferLike>; nullifiers: readonly bigint[]; outgoingKey: Uint8Array; recipient: OutputRecipient; rho: bigint; value: bigint; }-
o.assetbigint-
o.chainIdbigint-
o.memo?Uint8Array<ArrayBufferLike>The memo field of the plaintext (encodeMemo). Omit for none.
o.nullifiersreadonly bigint[]The spend's public nullifiers, one per input slot in slot order, dummy slots included. Empty for a deposit.
o.outgoingKeyUint8ArrayThe sender's outgoing key (deriveOutgoingKey).
o.recipientOutputRecipient-
o.rhobigint-
o.valuebigint-

Returns ​

object

aux ​

ts
aux: OutputAuxWithWitness;

note ​

ts
note: Note;

Throws ​

when outgoingKey is not 32 bytes, memo is not 128 bytes, rho, recipient.pk or a nullifier is not a canonical field element, asset or value is not a uint64, recipient.d is not in [0, 2^128), or recipient.pk_d is not in the prime-order subgroup.