{"id":14187322,"url":"https://github.com/ilap/bls","last_synced_at":"2026-02-15T06:00:31.831Z","repository":{"id":241296675,"uuid":"806233954","full_name":"ilap/bls","owner":"ilap","description":"Aiken library implementing high level BLS12-381 cryptographic functions","archived":false,"fork":false,"pushed_at":"2026-02-08T10:08:00.000Z","size":358,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-08T13:06:43.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilap.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-26T18:37:17.000Z","updated_at":"2026-02-08T09:58:08.000Z","dependencies_parsed_at":"2024-08-18T15:04:57.781Z","dependency_job_id":"a8480130-fa1c-4417-849e-bad063407c02","html_url":"https://github.com/ilap/bls","commit_stats":null,"previous_names":["ilap/bls"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ilap/bls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilap%2Fbls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilap%2Fbls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilap%2Fbls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilap%2Fbls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilap","download_url":"https://codeload.github.com/ilap/bls/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilap%2Fbls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29471139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T05:26:30.465Z","status":"ssl_error","status_checked_at":"2026-02-15T05:26:21.858Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-18T15:01:07.518Z","updated_at":"2026-02-15T06:00:31.807Z","avatar_url":"https://github.com/ilap.png","language":"Gleam","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# High level BLS12-381 functions for Aiken\n\n[![Licence](https://img.shields.io/github/license/aiken-lang/stdlib?style=for-the-badge)](https://github.com/ilap/bls/blob/main/LICENSE)\n[![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)\n[![GitHub Pages](https://img.shields.io/badge/GitHub_Pages-Online-brightgreen?style=for-the-badge)](https://ilap.github.io/bls/)\n\n## Introduction\n\nWelcome 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.\n\nThe library implements the three core BLS signature schemes as defined in the [IETF BLS Signature draft](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bls-signature):\n\n- **Basic** (`g1/basic`): Standard BLS signatures\n- **Message Augmentation** (`g1/aug`): Signatures with message augmentation for domain separation\n- **Proof of Possession** (`g1/pop`): Signatures with PoP for rogue key attack resistance\n\n### Implementation Status\n\nCurrently, this library implements the **Minimal-pubkey-size** variant as defined in the IETF draft:\n\n- **Public keys**: Points in **G1** (48 bytes)\n- **Signatures**: Points in **G2** (96 bytes)\n\nThis 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.\n\n**_API Note_**: The core cryptographic primitives are implemented in the `g1/core` module, while the public interfaces are exposed through the scheme-specific modules.\n\n## Implemented Functions\n\n### Core Module (`g1/core`)\n\nLow-level cryptographic primitives used by all schemes:\n\n| Function                | Description                      |\n| ----------------------- | -------------------------------- |\n| `sk_to_pk`              | Convert secret key to public key |\n| `validate_key`          | Validate a public key            |\n| `core_sign`             | Core signing primitive           |\n| `vore_verify`           | Core verification primitive      |\n| `aggregate`             | Aggregate multiple signatures    |\n| `core_aggregate_verify` | Core aggregate verification      |\n\n### Basic Scheme (`g1/basic`)\n\nStandard BLS signatures as specified in the IETF draft:\n\n| Function           | Description                                        |\n| ------------------ | -------------------------------------------------- |\n| `sk_to_pk`         | Convert secret key to public key                   |\n| `sign`             | Sign a message with private key                    |\n| `verify`           | Verify a signature with public key                 |\n| `aggregate`        | Combine multiple signatures                        |\n| `aggregate_verify` | Verify aggregated signatures for distinct messages |\n\n### Message Augmentation Scheme (`g1/aug`)\n\nSignatures with message augmentation for domain separation:\n\n| Function           | Description                                 |\n| ------------------ | ------------------------------------------- |\n| `sk_to_pk`         | Convert secret key to public key            |\n| `sign`             | Sign a message with private key (augmented) |\n| `verify`           | Verify a signature with public key          |\n| `aggregate`        | Combine multiple signatures                 |\n| `aggregate_verify` | Verify aggregated signatures                |\n\n### Proof of Possession Scheme (`g1/pop`)\n\nSignatures with PoP for rogue key attack resistance:\n\n| Function           | Description                                             |\n| ------------------ | ------------------------------------------------------- |\n| `sk_to_pk`         | Convert secret key to public key                        |\n| `sign`             | Sign a message with private key                         |\n| `verify`           | Verify a signature with public key                      |\n| `pop_prove`        | Generate Proof-of-Possession signature for a public key |\n| `pop_verify`       | Verify a Proof-of-Possession signature                  |\n| `aggregate`        | Combine multiple signatures                             |\n| `aggregate_verify` | Verify aggregated signatures                            |\n\n## Getting Started\n\nTo get started with this library, make sure you have the Aiken environment set up and add this library to your `aiken.toml`:\n\n```toml\n[dependencies]\nilap/bls = { version = \"0.4.0\" }\n```\n\n## Usage\n\nDetailed usage examples and API documentation can be found in the [lib/bls/tests](https://github.com/ilap/bls/tree/main/lib/bls/tests) and docs directory (generated with `aiken docs`). Here is a quick example to get you started:\n\n```aiken\nuse ilap/bls/g1/basic.{ sk_to_pk, sign, verify}\n\ntest test_bls () {\n  let sk = #\"ed69a93f0cf8c9836be3b67c7eeff416612d45ba39a5c099d48fa668bf558c9c\"\n\n  let pk = sk_to_pk(sk)\n  let message = \"Hello, Aiken!\"\n\n  let signature = sign(sk, message)\n\n  verify(pk, message, signature)\n}\n```\n\n## BLS12-381 Technical Brief\n\n- **Embedding degree**: 12 i.e. the complexity of the pairing operation.\n- **Field Size (𝑝)**: A large prime number defining the finite field i.e. 𝔽𝑝. The prime in the finite field is 381-bit.\n- **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.\n- **Security level**: BLS12-381 provides an approximate 128-bit security level, given that its complexity is around `≈√𝑟` i.e. `𝑟≈2^256`.\n- **Private key**: A scalar in `𝔽𝑝` which means `∈{0,𝑝−1}`. The size is 381 bits ~48 bytes.\n- **Identity Element**: The multiplicative identity (1).\n- **Bilinear pairing** : A function `𝑒:𝐺1×𝐺2→𝐺𝑇` with the following properties:\n  - **Non-degeneracy**: `𝑒(𝑔1,𝑔2)≠1` for some `𝑔1∈𝐺1` and `𝑔2∈𝐺2`.\n  - **Bilinearity**: `𝑒(𝑎𝑔1,𝑏𝑔2)=𝑒(𝑔1,𝑔2)𝑎𝑏` for all `𝑎,𝑏∈𝔽𝑝` and `𝑔1∈𝐺1` and `𝑔2∈𝐺2`.\n  - **Computability**: There exists an efficient algorithm to compute `𝑒(𝑔1,𝑔2)` for all `𝑔1∈𝐺1` and `𝑔2∈𝐺2`.\n\n- **Group Definitions**:\n  - **G1**: This group consists of points on the elliptic curve over the base field `𝐹𝑝` (`𝑦^2=𝑥^3+4`).\n  - **G2**:: This group consists of points on the twisted curve over an extension field `𝐹𝑝^2` (`𝑦^2=𝑥^3+4(1+i)`).\n  - **GT**: This is the multiplicative group of a larger field `𝐹𝑝12`, used as the result of the pairing operation.\n\n## Resources\n\n- [BLS Signatures Specification](https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bls-signature)\n\n## Contributing\n\nWe 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.\n\n## License\n\nThis project is licensed under the `Apache 2.0 License` - see the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filap%2Fbls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filap%2Fbls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filap%2Fbls/lists"}