RAILGUN Reloaded
    Preparing search index...

    Represents an Unshield note for converting private RAILGUN notes back into public assets. This is the exit point for funds leaving the privacy system, sending tokens to a public destination address on-chain. Extends Note with a toAddress, a Poseidon hash, and an allowOverride flag.

    Can be created directly, deserialized from msgpack-encoded bytes, or constructed from on-chain unshield data via UnshieldNote.fromUnshield.

    Hierarchy (View Summary)

    Index
    • Validates that random value is the correct length (16 bytes).

      Parameters

      • random: string

        The random value to validate (hex string)

      Returns void

      If validation fails

    • Validates the caller input of an outbound note factory.

      Parameters

      • params: NoteCreateParams

        The value, token data, optional random, and optional master public key

      • tokenTypes: TokenType[]

        The token types the factory accepts

      Returns void

      If a parameter is invalid

    • Computes the note hash from npk, token hash, and value.

      Parameters

      • npk: Uint8Array

        The note public key as a Uint8Array

      • tokenHash: Uint8Array

        The token hash as a Uint8Array

      • value: bigint

        The note value as a bigint

      Returns Uint8Array

      The note hash as a Uint8Array

      If initializeCryptographyLibs() has not been called.

    • Computes the note public key (NPK) from a master public key and random value. NPK = poseidon(masterPublicKey, random)

      Parameters

      • masterPublicKey: Uint8Array

        The receiver's master public key as a Uint8Array

      • random: Uint8Array

        The note random value as a Uint8Array (16 bytes)

      Returns Uint8Array

      The note public key as a Uint8Array

      If initializeCryptographyLibs() has not been called.

    • Computes the nullifier for a note at a given leaf index. The nullifier uniquely identifies a note when it is spent.

      Parameters

      • nullifyingKey: Uint8Array

        The wallet's nullifying key as a Uint8Array

      • leafIndex: bigint

        The note's position in the merkle tree

      Returns Uint8Array

      The nullifier as a Uint8Array

      If initializeCryptographyLibs() has not been called.

    • Creates an UnshieldNote from unshield data. The note hash is computed from amount + fee combined, matching the engine's behavior. NOTE: Requires cryptography libraries to be initialized first via initializeCryptographyLibs()

      Parameters

      • unshield: Unshield

        The Unshield object

      • random: string

        Random value (16 bytes hex string)

      Returns UnshieldNote

      A new UnshieldNote instance

      If required fields are missing or poseidon is not initialized

    • Computes the amount and fee from a total value and fee basis points.

      Parameters

      • value: bigint

        The total value (amount + fee)

      • feeBasisPoints: bigint

        The fee in basis points (e.g. 25 = 0.25%)

      Returns { amount: bigint; fee: bigint }

      The amount and fee

    notePublicKey: string

    The note public key (npk) as a hex string

    value: bigint

    The note value as a bigint

    tokenData: TokenData

    The token data containing address, type, and subID

    tokenHash: string

    The token hash as a hex string

    random: string

    Random value (16 bytes hex string)

    toAddress: string

    The destination address for unshielding

    hash: bigint

    The note hash as a bigint

    allowOverride: boolean

    Whether to allow override