Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Create createAggSig, verifyAggSig and verifyWeightedAggSig function #6472

Closed
nazarhussain opened this issue Jun 7, 2021 · 0 comments · Fixed by #6484
Closed

Create createAggSig, verifyAggSig and verifyWeightedAggSig function #6472

nazarhussain opened this issue Jun 7, 2021 · 0 comments · Fixed by #6484
Assignees
Milestone

Comments

@nazarhussain
Copy link
Contributor

nazarhussain commented Jun 7, 2021

Description

Create three functions createAggSig, verifyAggSig and verifyWeightedAggSig as stated in the LIP in lisk-cryptography

createAggSig(keysList, pubKeySignaturePairs):
    aggregationBits = byte string of length ceil(length(keyList)/8) with all bytes set to 0
    signatures = []
    for pair in pubKeySignaturePairs: 
        signatures.append(pair.sig)
        index = keysList.index(pair.pubkey)
        set bit at position index to 1 in aggregationBits
    signature = Aggregate(signatures)
    return (aggregationBits, signature)

verifyAggSig(keysList, aggregationBits, signature, tag, networkIdentifier, message):
    taggedMessage = convert2BLSSignatureInput(tag, networkIdentifier, message)
    keys = []
    for every i in [0, …, ceil(length(keyList)/8)]:
        if i-th bit of aggregationBits is set to 1:
            keys.append(keysList[i])
    return FastAggregateVerify(keys, taggedMessage, signature)


verifyWeightedAggSig(keysList, aggregationBits, signature, tag, networkIdentifier, weights, threshold, message):
    taggedMessage = convert2BLSSignatureInput(tag, networkIdentifier, message)
    keys = []
    weightSum = 0
    for every i in [0, …, ceil(length(keyList)/8)]:
        if i-th bit of aggregationBits is set to 1:
            keys.append(keysList[i])
            weightSum += weights[i]
    if weightSum < threshold:
        return INVALID
    return FastAggregateVerify(keys, taggedMessage, signature)

Motivation

Generate aggregated compact signatures with with BLS signature scheme.

Acceptance Criteria

  • lisk-crytography would have two functions defined above
  • These functions must be covered with few test scenarios

Additional Information

  • We can use eth-2 test vectors or our own test vector to cover tests for above
  • blst-ts wrapper library already contains the implementation of aggregated signatures and verification. So we need to double check if its the same as we have then we can reuse.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants