{"id":47857835,"url":"https://github.com/xrplf/mpt-crypto","last_synced_at":"2026-04-03T23:01:35.576Z","repository":{"id":332288605,"uuid":"1114779728","full_name":"XRPLF/mpt-crypto","owner":"XRPLF","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-31T16:50:54.000Z","size":533,"stargazers_count":3,"open_issues_count":4,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-31T18:41:29.146Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XRPLF.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-11T21:52:44.000Z","updated_at":"2026-03-31T16:51:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/XRPLF/mpt-crypto","commit_stats":null,"previous_names":["xrplf/mpt-crypto"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/XRPLF/mpt-crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLF%2Fmpt-crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLF%2Fmpt-crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLF%2Fmpt-crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLF%2Fmpt-crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XRPLF","download_url":"https://codeload.github.com/XRPLF/mpt-crypto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRPLF%2Fmpt-crypto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31381007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T21:40:47.592Z","status":"ssl_error","status_checked_at":"2026-04-03T21:40:05.436Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":"2026-04-03T23:01:34.793Z","updated_at":"2026-04-03T23:01:35.563Z","avatar_url":"https://github.com/XRPLF.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MPT-Crypto: Cryptographic Primitives for Confidential Assets\n\n## Overview\n\n**MPT-Crypto** is a specialized C library implementing the cryptographic building blocks for\n**Confidential Multi-Purpose Tokens (MPT)** on the XRP Ledger. It provides implementations of homomorphic encryption, aggregated range proofs, and specialized zero-knowledge proofs.\nThe library is built on top of `libsecp256k1` for elliptic curve arithmetic and OpenSSL for hashing and randomness.\n\n## Features\n\n### 1. Confidential Balances (EC-ElGamal)\n\n- **Additive Homomorphic Encryption:** Enables the ledger to aggregate encrypted balances (e.g., `Enc(A) + Enc(B) = Enc(A+B)`) without decryption.\n- **Canonical Zero:** Deterministic encryption of zero balances to prevent ledger state bloat and ensure consistency.\n\n### 2. Range Proofs (Bulletproofs)\n\n- **Aggregated Proofs:** Supports proving that $m$ values are within the range $[0, 2^{64})$ in a single proof with logarithmic size $\\mathcal{O}(\\log n)$.\n- **Inner Product Argument (IPA):** Implements the standard Bulletproofs IPA for succinct verification.\n- **Fiat-Shamir:** Secure non-interactive challenge generation with strict domain separation.\n\n### 3. Zero-Knowledge Proofs (Sigma Protocols)\n\n- **Plaintext Equality:** Proves two or more ciphertexts encrypt the same amount under different keys.\n- **Linkage Proof:** Proves consistency between an ElGamal ciphertext (used for transfer) and a Pedersen Commitment (used for the range proof).\n- **Proof of Knowledge (PoK):** Proves ownership of the secret key during account registration to prevent rogue key attacks.\n\n## Building and Testing\n\n### Prerequisites\n\nBefore building, ensure you have the following installed:\n\n- **CMake** (version 3.10 or higher)\n- **C Compiler** (GCC, Clang, or AppleClang)\n\nOn macOS with Homebrew:\n\n```bash\nbrew install cmake\n```\n\nOn Ubuntu/Debian:\n\n```bash\nsudo apt-get install cmake build-essential\n```\n\n### Dependency Setup\n\nSet up Conan using [xrpld's BUILD.md](https://github.com/XRPLF/rippled/blob/develop/BUILD.md#steps)\n\n### Build Instructions\n\nRun following commands to build the library\n\n1. Create build directory:\n\n   ```bash\n   mkdir build \u0026\u0026 cd build\n   ```\n\n2. Buld dependencies:\n\n   ```bash\n   conan install .. --build=missing -o \"\u0026:tests=True\"\n   ```\n\n3. Run CMake:\n\n   ```bash\n   cmake .. \\\n      -DCMAKE_BUILD_TYPE=Release \\\n      -G Ninja \\\n      -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake\n   ```\n\n4. **Build the library and tests:**\n\n   ```bash\n   ninja\n   ```\n\n### Running Tests\n\nAfter building, run the test suite using CTest from the build directory:\n\n```bash\nctest --output-on-failure\n```\n\nOr run individual tests directly:\n\n```bash\n./tests/test_elgamal\n./tests/test_bulletproof_agg\n./tests/test_commitments\n```\n\n### Expected Results\n\nThe following tests should pass:\n\n- `test_bulletproof_agg` - Aggregated Bulletproof range proofs\n- `test_commitments` - Pedersen commitments\n- `test_elgamal` - ElGamal encryption/decryption\n- `test_elgamal_verify` - ElGamal verification\n- `test_equality_proof` - Equality proofs\n- `test_ipa` - Inner Product Argument (IPA) Core Logic\n- `test_link_proof` - Linkage proofs\n- `test_pok_sk` - Proof of knowledge of secret key\n- `test_same_plaintext` - Same plaintext proofs\n- `test_same_plaintext_multi` - Multi-recipient same plaintext proofs\n- `test_same_plaintext_multi_shared_r` - Shared randomness variant\n\n**Note:** `test_bulletproof.c` is excluded from the build because the aggregated implementation (bulletproof_aggregated.c) is fully general; verifying the m=1 case is now covered by test_bulletproof_agg.c.\n\n## Documentation\n\nTwo public documents cover the design choices and integration details:\n\n- **XLS-0096 Standard Specification:** [XRPL Standards – XLS-0096](https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0096-confidential-mpt)\n  The specification covers the protocol design and how it integrates with the XRPL ledger.\n\n- **Research Paper:** [ePrint 2026/602](https://eprint.iacr.org/2026/602)\n  The paper provides a deeper dive into the cryptographic design choices and security analysis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrplf%2Fmpt-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxrplf%2Fmpt-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrplf%2Fmpt-crypto/lists"}