[][src]Function lnpbp::lnpbp1::verify

pub fn verify(
    verified_pubkey: PublicKey,
    original_keyset: &BTreeSet<PublicKey>,
    target_pubkey: PublicKey,
    protocol_tag: &Hash,
    message: &impl AsRef<[u8]>
) -> bool

Function verifies commitment created according to LNPBP-1.

Parameters

  • verified_pubkey: public key containing LNPBP-1 commitment, i.e. the one modified by commit() procedure as its second parameter target_key
  • original_keyset: set of public keys provided to the commit() procedure. This set must include orignal pubkey specified in the next parameter taget_pubkey
  • target_pubkey: one of public keys included into the original keyset and that was provided to the commit() procedure as target_pubkey. This must be an original version of public key from the verified_pubkey parameter before the tweak was applied
  • protocol_tag: protocol-specific tag in form of 32-byte hash
  • message: message to commit to, which must be representable as a byte slice using AsRef::as_ref()

Returns

  • true, if verification succeeds,
  • false, if verification fails, indicating that the provided verified_pubkey is not committed to the data given in the rest of function parameters.

Procedure

Please refer to the original document for the general algotirhm: https://github.com/LNP-BP/LNPBPs/blob/master/lnpbp-0001.md

Function verifies commitment by running LNPBP-1 commitment procedure once again with the provided data as a source data, and comparing the result of the commitment to the verified_pubkey. If the commitment function fails, it means that it was not able to commit with the provided data, meaning that the commitment was not created. Thus, we return that verification have not passed, and not a error. Verification succeeds if the commitment procedure produces public key equivalent to the verified_pubkey.