navio-blsct
    Preparing search index...

    Class RangeProof

    Represents a (possibly aggregated) range proof for one or more confidential transaction amounts.

    Examples:

    const { RangeProof, AmountRecoveryReq, AmountRecoveryRes, Point, TokenId } = require('navio-blsct')
    const nonce = Point.random()
    const tokenId = TokenId.default()
    const rp = RangeProof.generate([456], nonce, 'navio', tokenId)
    RangeProof.verifyProofs([rp]) // true
    const req = new AmountRecoveryReq(rp, nonce)
    const res = RangeProof.recoverAmounts([req1])
    res[0].isSucc // true
    res[0].amount // 456
    res[0].message // 'navio'
    rp.get_A() // Point object representing A
    rp.get_A_wip() // Point object representing A_wip
    rp.get_B() // Point object representing B
    rp.get_r_prime() // Scalar object representing r'
    rp.get_s_prime() // Scalar object representing s'
    rp.get_delta_prime() // Scalar object representing delta'
    rp.get_alpha_hat() // Scalar object representing alpha_hat
    rp.get_tau_x() // Scalar object representing tau_x
    const ser = rp.serialize()
    const deser = RangeProof.deserialize(ser)
    ser === deser.serialize() // true

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    obj: any
    objSize: number

    Methods

    • Returns the A point of the range proof.

      Returns Point

      A Point object representing the A point.

    • Returns the A_wip point of the range proof.

      Returns Point

      A Point object representing the A_wip point.

    • Returns the alpha_hat scalar of the range proof.

      Returns Scalar

      A Scalar object representing the alpha_hat scalar.

    • Returns the B point of the range proof.

      Returns Point

      A Point object representing the B point.

    • Returns the tau_x scalar of the range proof.

      Returns Scalar

      A Scalar object representing the tau_x scalar.

    • Returns the r' scalar of the range proof.

      Returns Scalar

      A Scalar object representing the r' scalar.

    • Returns the s' scalar of the range proof.

      Returns Scalar

      A Scalar object representing the s' scalar.

    • Returns the tau_x scalar of the range proof.

      Returns Scalar

      A Scalar object representing the t_aux scalar.

    • Returns the underlying C++ object, transferring ownership from this instance to the caller.

      Returns any

      The underlying object of the instance.

    • Serializes the instance to a hexadecimal string.

      Returns string

      A hexadecimal string representation of the instance.

    • Returns the size of the underlying C++ object.

      Returns number

      The size of the underlying C++ object in bytes.

    • Returns a string representation of the instance.

      Returns string

      A string representation of the instance.

    • Deserializes a hexadecimal string into a RangeProof instance.

      Parameters

      • this: new (obj: any) => RangeProof
      • hex: string

        A hexadecimal string representing the serialized range proof.

      Returns RangeProof

      A new RangeProof instance containing the deserialized data.

    • Constucts a new instance using the provided object.

      Type Parameters

      Parameters

      • this: new (obj: any, objSize?: number) => T
      • obj: any

        The object to use for the new instance.

      Returns T

      A new instance of the class.

    • Constructs a new instance using the provided object and size.

      Type Parameters

      Parameters

      • this: new (obj: any) => T
      • obj: any

        The object to use for the new instance.

      • objSize: number

        The size of the object.

      Returns T

      A new instance of the class.

    • Generates a range proof for the given amounts, nonce, and message.

      Parameters

      • amounts: number[]

        An array of amounts to be included in the range proof.

      • nonce: Point

        A nonce used to generate the range proof.

      • msg: string

        A message associated with the range proof.

      • OptionaltokenId: TokenId

        An optional token ID. If not provided, a default token ID is used.

      Returns RangeProof

      A new RangeProof instance containing the generated range proof.

    • Verifies a list of range proofs.

      Parameters

      • proofs: RangeProof[]

        An array of RangeProof instances to be verified.

      Returns boolean

      true if all proofs are valid, false otherwise.