{"id":30587349,"url":"https://github.com/blockscout/ex_eth_bls","last_synced_at":"2025-08-29T12:09:05.897Z","repository":{"id":309996705,"uuid":"1038287124","full_name":"blockscout/ex_eth_bls","owner":"blockscout","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-15T04:16:04.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-25T09:44:31.633Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockscout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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,"zenodo":null}},"created_at":"2025-08-14T23:43:28.000Z","updated_at":"2025-08-15T04:16:07.000Z","dependencies_parsed_at":"2025-08-15T03:38:43.831Z","dependency_job_id":"6723f39a-8260-4ed4-922c-aa19627db29a","html_url":"https://github.com/blockscout/ex_eth_bls","commit_stats":null,"previous_names":["sl1depengwyn/ex_eth_bls"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/blockscout/ex_eth_bls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Fex_eth_bls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Fex_eth_bls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Fex_eth_bls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Fex_eth_bls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockscout","download_url":"https://codeload.github.com/blockscout/ex_eth_bls/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Fex_eth_bls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272680887,"owners_count":24975360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-08-29T12:09:05.202Z","updated_at":"2025-08-29T12:09:05.888Z","avatar_url":"https://github.com/blockscout.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExEthBls\n\nExEthBls is an Elixir library for BLS signature verification that wraps the highly optimized BLST library used by Ethereum 2.0. This library provides Ethereum-compatible BLS signature operations including signing, verification, and aggregation.\n\n## Features\n\n- ✅ BLS signature generation and verification\n- ✅ Public key aggregation\n- ✅ Signature aggregation\n- ✅ Fast aggregate verification (all signatures on same message)\n- ✅ Aggregate verification (different messages per signature)\n- ✅ Ethereum 2.0 compatible BLS12-381 curve\n- ✅ Uses the same highly optimized BLST library as Ethereum clients\n\n## Installation\n\nAdd `ex_eth_bls` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_eth_bls, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\n### Basic Operations\n\n```elixir\n# Generate a private key from a seed\nseed = :crypto.hash(:sha256, \"my secret seed\")\nprivate_key = ExEthBls.key_gen!(seed)\n\n# Derive the public key\npublic_key = ExEthBls.sk_to_pk!(private_key)\n\n# Sign a message\nmessage = \"Hello, Ethereum!\"\nsignature = ExEthBls.sign!(private_key, message)\n\n# Verify the signature\nExEthBls.verify(public_key, message, signature)\n# =\u003e true\n```\n\n### Signature Aggregation\n\n```elixir\n# Create multiple signers\nsigners = for i \u003c- 1..3 do\n  seed = :crypto.hash(:sha256, \"signer#{i}\")\n  private_key = ExEthBls.key_gen!(seed)\n  public_key = ExEthBls.sk_to_pk!(private_key)\n  {private_key, public_key}\nend\n\nmessage = \"Collective message\"\n\n# Each signer signs the same message\nsigners_with_signatures =\n  signers\n  |\u003e Enum.map(fn {private_key, public_key} -\u003e\n    signature = ExEthBls.sign!(private_key, message)\n    {signature, public_key}\n  end)\n\n{signatures, public_keys} = Enum.unzip(signers_with_signatures)\n\n# Aggregate the signatures and public keys\naggregated_signature = ExEthBls.aggregate_signatures!(signatures)\naggregated_public_key = ExEthBls.aggregate_public_keys!(public_keys)\n\n# Verify the aggregated signature\nExEthBls.verify(aggregated_public_key, message, aggregated_signature)\n# =\u003e true\n\n# Or use fast aggregate verification (more efficient)\nExEthBls.fast_aggregate_verify(public_keys, message, aggregated_signature)\n# =\u003e true\n```\n\n### Different Messages per Signer\n\n```elixir\n# Each signer signs a different message\nmessages = [\"message1\", \"message2\", \"message3\"]\n\nsigners_with_messages =\n  signers\n  |\u003e Enum.zip(messages)\n  |\u003e Enum.map(fn {{private_key, public_key}, message} -\u003e\n    signature = ExEthBls.sign!(private_key, message)\n    {signature, public_key}\n  end)\n\n{signatures, public_keys} = Enum.unzip(signers_with_messages)\naggregated_signature = ExEthBls.aggregate_signatures!(signatures)\n\n# Verify that each signer signed their respective message\nExEthBls.aggregate_verify(public_keys, messages, aggregated_signature)\n# =\u003e true\n```\n\n## API Reference\n\n### Key Generation\n\n- `ExEthBls.key_gen(seed)` - Generate a private key from a seed (≥32 bytes)\n- `ExEthBls.key_gen!(seed)` - Same as above but raises on error\n- `ExEthBls.sk_to_pk(private_key)` - Derive public key from private key\n- `ExEthBls.sk_to_pk!(private_key)` - Same as above but raises on error\n\n### Signing and Verification\n\n- `ExEthBls.sign(private_key, message)` - Sign a message\n- `ExEthBls.sign!(private_key, message)` - Same as above but raises on error\n- `ExEthBls.verify(public_key, message, signature)` - Verify a signature\n\n### Aggregation\n\n- `ExEthBls.aggregate_public_keys(public_keys)` - Aggregate multiple public keys\n- `ExEthBls.aggregate_public_keys!(public_keys)` - Same as above but raises on error\n- `ExEthBls.aggregate_signatures(signatures)` - Aggregate multiple signatures\n- `ExEthBls.aggregate_signatures!(signatures)` - Same as above but raises on error\n\n### Aggregate Verification\n\n- `ExEthBls.fast_aggregate_verify(public_keys, message, signature)` - Verify aggregated signature where all signers signed the same message\n- `ExEthBls.aggregate_verify(public_keys, messages, signature)` - Verify aggregated signature where each signer signed a different message\n\n## Types\n\n- `private_key` - 32-byte binary\n- `public_key` - 48-byte binary (G1 point on BLS12-381)\n- `signature` - 96-byte binary (G2 point on BLS12-381)\n\n## Ethereum Compatibility\n\nThis library is designed to be compatible with Ethereum 2.0 BLS signatures. It uses:\n\n- BLS12-381 elliptic curve\n- G1 for public keys (48 bytes compressed)\n- G2 for signatures (96 bytes compressed)\n- Same domain separation tags as Ethereum 2.0\n\n## Building from Source\n\nIf you need to build the native library from source, set the environment variable:\n\n```bash\nexport EX_ETH_BLS_BUILD=true\nmix deps.compile ex_eth_bls\n```\n\nThis requires:\n\n- Rust toolchain (1.70+)\n- C compiler (for BLST)\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockscout%2Fex_eth_bls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockscout%2Fex_eth_bls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockscout%2Fex_eth_bls/lists"}