High level BLS12-381 functions for Aiken

Licence Continuous Integration GitHub Pages

Introduction

Welcome to the BLS12-381 library for the Aiken smart-contract language! This library provides a comprehensive implementation of BLS12-381 signatures, enabling advanced cryptographic operations on the Cardano blockchain.

The library implements the three core BLS signature schemes as defined in the IETF BLS Signature draft:

Implementation Status

Currently, this library implements the Minimal-pubkey-size variant as defined in the IETF draft:

This approach is RECOMMENDED for implementations using signature aggregation, since the size of (PK_1, ..., PK_n, signature) is dominated by the public keys even for small n. By keeping public keys in G1 (the smaller group), we minimize the overall size of aggregated verification data.

API Note: The core cryptographic primitives are implemented in the g1/core module, while the public interfaces are exposed through the scheme-specific modules.

Implemented Functions

Core Module (g1/core)

Low-level cryptographic primitives used by all schemes:

FunctionDescription
key_genGenerate secret key from random
sk_to_pkConvert secret key to public key
key_validateValidate a public key
core_signCore signing primitive
vore_verifyCore verification primitive
aggregateAggregate multiple signatures
core_aggregate_verifyCore aggregate verification

Basic Scheme (g1/basic)

Standard BLS signatures as specified in the IETF draft:

FunctionDescription
sk_to_pkConvert secret key to public key
signSign a message with private key
verifyVerify a signature with public key
aggregateCombine multiple signatures
aggregate_verifyVerify aggregated signatures for distinct messages

Message Augmentation Scheme (g1/aug)

Signatures with message augmentation for domain separation:

FunctionDescription
sk_to_pkConvert secret key to public key
signSign a message with private key (augmented)
verifyVerify a signature with public key
aggregateCombine multiple signatures
aggregate_verifyVerify aggregated signatures

Proof of Possession Scheme (g1/pop)

Signatures with PoP for rogue key attack resistance:

FunctionDescription
sk_to_pkConvert secret key to public key
signSign a message with private key
verifyVerify a signature with public key
pop_proveGenerate Proof-of-Possession signature for a public key
pop_verifyVerify a Proof-of-Possession signature
aggregateCombine multiple signatures
aggregate_verifyVerify aggregated signatures

Getting Started

To get started with this library, make sure you have the Aiken environment set up and add this library to your aiken.toml:

[dependencies]
ilap/bls = { version = "x.y.z" }

Usage

Detailed usage examples and API documentation can be found in the lib/bls/tests and docs directory (generated with aiken docs). Here is a quick example to get you started:

use ilap/bls/g1/basic.{ sk_to_pk, sign, verify}

test test_bls () {
  let sk = #"ed69a93f0cf8c9836be3b67c7eeff416612d45ba39a5c099d48fa668bf558c9c"

  let pk = sk_to_pk(sk)
  let message = "Hello, Aiken!"

  let signature = sign(sk, message)

  verify(pk, message, signature)
}

BLS12-381 Technical Brief

Resources

Contributing

We welcome contributions to enhance the functionality and usabilioty of this library. Please refer to the CONTRIBUTING.md file for guidelines on how to contribute.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Search Document