Constructs a new ShieldNote instance.
The shield note parameters
StaticassertProtected StaticassertValidates the caller input of an outbound note factory.
The value, token data, optional random, and optional master public key
The token types the factory accepts
StaticgetComputes the note hash from npk, token hash, and value.
The note public key as a Uint8Array
The token hash as a Uint8Array
The note value as a bigint
The note hash as a Uint8Array
StaticcomputeComputes the note public key (NPK) from a master public key and random value. NPK = poseidon(masterPublicKey, random)
The receiver's master public key as a Uint8Array
The note random value as a Uint8Array (16 bytes)
The note public key as a Uint8Array
StaticcomputeComputes the nullifier for a note at a given leaf index. The nullifier uniquely identifies a note when it is spent.
The wallet's nullifying key as a Uint8Array
The note's position in the merkle tree
The nullifier as a Uint8Array
StaticcreateCreates a new ShieldNote for a recipient identified by their master public key. Supports ERC20 and ERC721 token data. Derives the note public key from the master public key and the note random, generating a fresh 16-byte random when one is not supplied. The note carries the full pre-fee shield value; the shield fee is deducted on-chain.
The creation parameters
A new ShieldNote instance
Serializes the shield note to a Uint8Array using msgpack encoding.
The serialized shield note
StaticdeserializeDeserializes a shield note from a Uint8Array.
The serialized shield note data
A new ShieldNote instance
StaticfromCreates a ShieldNote from a GeneratedCommitment (V1). The random is encrypted in encryptedRandom using AES-GCM with the viewing private key. encryptedRandom layout: [0] = ivTag (32 bytes: iv 16 + tag 16) [1] = encrypted random data (16 bytes)
The GeneratedCommitment object
The wallet's viewing private key for decryption
The master public key
A new ShieldNote instance, or null if decryption fails (wrong viewing key) or the preimage does not hash to the commitment
StaticfromCreates a ShieldNote from a ShieldCommitment (V2+). The random is encrypted in encryptedBundle and must be decrypted using ECDH(viewingPrivateKey, shieldKey). NOTE: shieldKey is the shielder's public viewing key (used only for ECDH), NOT the master public key. NOTE: Requires cryptography libraries to be initialized first via initializeCryptographyLibs()
The ShieldCommitment object
The wallet's viewing private key for ECDH decryption
The wallet's master public key
A new ShieldNote instance, or null if decryption fails (not addressed to this wallet) or the preimage does not hash to the commitment
The note public key (npk) as a hex string
The note value as a bigint
The token data containing address, type, and subID
The token hash as a hex string
Random value (16 bytes hex string)
The master public key as a Uint8Array (32 bytes)
Optional shield fee
Optional block number
Represents a Shield note for converting public assets into private RAILGUN notes. This is the entry point for funds entering the privacy system via on-chain shield transactions. Extends Note with a masterPublicKey that identifies the receiving wallet.
Can be created directly, deserialized from msgpack-encoded bytes, or reconstructed from on-chain commitment data (GeneratedCommitment or ShieldCommitment).