Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilap/bls
Aiken library implementing high level BLS12-381 cryptographic functions
https://github.com/ilap/bls
Last synced: 12 days ago
JSON representation
Aiken library implementing high level BLS12-381 cryptographic functions
- Host: GitHub
- URL: https://github.com/ilap/bls
- Owner: ilap
- License: apache-2.0
- Created: 2024-05-26T18:37:17.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-09-08T09:59:04.000Z (3 months ago)
- Last Synced: 2024-09-09T10:16:33.415Z (3 months ago)
- Language: Gleam
- Size: 185 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-aiken - ilap/bls - High-level BLS12-381 cryptographic functions (Libraries)
README
# High level BLS12-381 functions for Aiken
[![Licence](https://img.shields.io/github/license/aiken-lang/stdlib?style=for-the-badge)](https://github.com/ilap/bls/blob/main/LICENSE)
[![Continuous Integration](https://img.shields.io/github/actions/workflow/status/aiken-lang/stdlib/continuous-integration.yml?style=for-the-badge)](https://github.com/ilap/bls/actions/workflows/ci.yml)
[![GitHub Pages](https://img.shields.io/badge/GitHub_Pages-Online-brightgreen?style=for-the-badge)](https://ilap.github.io/bls/)## Introduction
Welcome to the BLS12-381 library for the Aiken Cardano smart-contract language! This library is designed to simplify the use of BLS12-381 signatures in Aiken by extending the language built-ins with a comprehensive suite of data types, functions, constants, and aliases.
With this library, you can seamlessly implement advanced smart contracts on the Cardano blockchain utilizing the BLS12-381 signature scheme.
## TODOS
Core Functions Implemented
- [ ] **keygen**: Generate private key.
- [x] **skToPk**: Convert secret key to public key.
- [x] **sign**: Sign messages with private key.
- [x] **verify**: Verify signatures with the public key.
- [x] **aggregate_signatures**: Combine multiple signatures.
- [x] **aggregate_publickeys**: Combine multiple public keys.
- [x] **aggregate_verify**: Verify aggregated signatures.Aug Functions Implemented
- [ ] **TBD**
PoP functions Implemented
- [ ] **TBD**
## Getting Started
To get started with this library, make sure you have the Aiken environment set up and follow the installation instructions provided in the documentation.
## Usage
Detailed usage examples and API documentation can be found in the docs directory. Here is a quick example to get you started:
```gleam
import ilap/bls.{ skToPk, sign, verify}test test_bls () {
let sk = #"ed69a93f0cf8c9836be3b67c7eeff416612d45ba39a5c099d48fa668bf558c9c"let pk = skToPk(sk)
let message = "Hello, Aiken!"let signature = sign(sk, message)
verify(pk, message, signature)
}
```## BLS12-381 Technical Brief
- **Embedding degree**: 12 i.e. the complexity of the pairing operation.
- **Field Size (π)**: A large prime number defining the finite field i.e. π½π. The prime in the finite field is 381-bit.
- **Prime Order (r)**: The number of points on the curve e.g. `π¦^2=π₯^3+4` for `π₯β{0,π½πβ1}`. The number of points on the elliptic curve (excluding the point at infinity) is a prime number.
- **Security level**: BLS12-381 provides an approximate 128-bit security level, given that its complexity is around `ββπ` i.e. `πβ2^256`.
- **Private key**: A scalar in `π½π` which means `β{0,πβ1}`. The size is 381 bits ~48 bytes.
- **Identity Element**: The multiplicative identity (1).
- **Bilinear pairing** : A function `π:πΊ1ΓπΊ2βπΊπ` with the following properties:- **Non-degeneracy**: `π(π1,π2)β 1` for some `π1βπΊ1` and `π2βπΊ2`.
- **Bilinearity**: `π(ππ1,ππ2)=π(π1,π2)ππ` for all `π,πβπ½π` and `π1βπΊ1` and `π2βπΊ2`.
- **Computability**: There exists an efficient algorithm to compute `π(π1,π2)` for all `π1βπΊ1` and `π2βπΊ2`.- **Group Definitions**:
- **G1**: This group consists of points on the elliptic curve over the base field `πΉπ` (`π¦^2=π₯^3+4`).
- **G2**:: This group consists of points on the twisted curve over an extension field `πΉπ^2` (`π¦^2=π₯^3+4(1+i)`).
- **GT**: This is the multiplicative group of a larger field `πΉπ12`, used as the result of the pairing operation.## Resources
- [BLS Signatures Specification](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bls-signature)
## Contributing
We welcome contributions to enhance the functionality and usabilioty of this library. Please refer to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for guidelines on how to contribute.
## License
This project is licensed under the `Apache 2.0 License` - see the [LICENSE](./LICENSE) file for details.