How to use the blspy.AggregationInfo.from_msg function in blspy

To help you get started, we’ve selected a few blspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereum / trinity / eth2 / _utils / bls / backends / chia / api.py View on Github external
len_pubkeys = len(pubkeys)

    if len_pubkeys != len_msgs:
        raise ValueError(
            "len(pubkeys) (%s) should be equal to len(message_hashes) (%s)" % (
                len_pubkeys, len_msgs
            )
        )

    message_hashes_with_domain = [
        combine_domain(message_hash, domain)
        for message_hash in message_hashes
    ]
    pubkeys_chia = map(_pubkey_from_bytes, pubkeys)
    aggregate_infos = [
        AggregationInfo.from_msg(pubkey_chia, message_hash)
        for pubkey_chia, message_hash in zip(pubkeys_chia, message_hashes_with_domain)
    ]
    merged_info = AggregationInfo.merge_infos(aggregate_infos)

    signature_chia = _signature_from_bytes(signature)
    signature_chia.set_aggregation_info(merged_info)
    return cast(bool, signature_chia.verify())