Skip to content

Commit 6c57f73

Browse files
committed
Keep only generated Doxygen documentation
1 parent 2913bb6 commit 6c57f73

File tree

925 files changed

+37370
-5765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

925 files changed

+37370
-5765
lines changed

CMakeLists.txt

Lines changed: 0 additions & 68 deletions
This file was deleted.

README.md

Lines changed: 115 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,118 @@
1-
# mpt-crypto
1+
# MPT-Crypto: Cryptographic Primitives for Confidential Assets
22

3-
This document outlines the mpt-crypto library, a cryptographic toolkit specifically designed to enable confidential Multi-Purpose Token (MPT) transactions on the XRP Ledger.
3+
## Overview
44

5-
It details the implementation of core cryptographic primitives, including:
6-
* **ElGamal encryption** for confidential amounts.
7-
* **Schnorr-based zero-knowledge proofs** for equality and correct encryption.
8-
* **Bulletproofs** for efficient range proofs.
5+
**MPT-Crypto** is a specialized C library implementing the cryptographic building blocks for
6+
**Confidential Multi-Purpose Tokens (MPT)** on the XRP Ledger. It provides implementations of homomorphic encryption, aggregated range proofs, and specialized zero-knowledge proofs.
7+
The library is built on top of `libsecp256k1` for elliptic curve arithmetic and OpenSSL for hashing and randomness.
8+
## Features
99

10-
All operations leverage the **libsecp256k1** framework. The library provides the foundational cryptographic operations necessary for managing private balances and ensuring the integrity of confidential ledger state transitions.
10+
### 1. Confidential Balances (EC-ElGamal)
11+
* **Additive Homomorphic Encryption:** Enables the ledger to aggregate encrypted balances (e.g., `Enc(A) + Enc(B) = Enc(A+B)`) without decryption.
12+
* **Canonical Zero:** Deterministic encryption of zero balances to prevent ledger state bloat and ensure consistency.
13+
14+
### 2. Range Proofs (Bulletproofs)
15+
* **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)$.
16+
* **Inner Product Argument (IPA):** Implements the standard Bulletproofs IPA for succinct verification.
17+
* **Fiat-Shamir:** Secure non-interactive challenge generation with strict domain separation.
18+
19+
### 3. Zero-Knowledge Proofs (Sigma Protocols)
20+
* **Plaintext Equality:** Proves two or more ciphertexts encrypt the same amount under different keys.
21+
* **Linkage Proof:** Proves consistency between an ElGamal ciphertext (used for transfer) and a Pedersen Commitment (used for the range proof).
22+
* **Proof of Knowledge (PoK):** Proves ownership of the secret key during account registration to prevent rogue key attacks.
23+
24+
## Building and Testing
25+
26+
### Prerequisites
27+
28+
Before building, ensure you have the following installed:
29+
30+
- **CMake** (version 3.10 or higher)
31+
- **C Compiler** (GCC, Clang, or AppleClang)
32+
- **OpenSSL 3.x** (development headers and libraries)
33+
34+
On macOS with Homebrew:
35+
```bash
36+
brew install cmake openssl@3
37+
```
38+
39+
On Ubuntu/Debian:
40+
```bash
41+
sudo apt-get install cmake libssl-dev build-essential
42+
```
43+
44+
### Dependency Setup
45+
46+
This library requires `libsecp256k1` as a sibling directory. Clone it from the bitcoin-core repository:
47+
48+
```bash
49+
# From the parent directory of mpt-crypto
50+
cd ..
51+
git clone https://github.com/bitcoin-core/secp256k1.git
52+
```
53+
54+
Your directory structure should look like:
55+
```
56+
Projects/
57+
├── mpt-crypto/
58+
└── secp256k1/
59+
```
60+
61+
### Build Instructions
62+
63+
1. **Create the build directory and configure:**
64+
```bash
65+
cd mpt-crypto
66+
mkdir -p build && cd build
67+
cmake ..
68+
```
69+
70+
2. **Build the library and tests:**
71+
```bash
72+
make -j4
73+
```
74+
75+
#### Platform-Specific Notes
76+
77+
**macOS (Apple Silicon):** If you encounter architecture mismatch errors with OpenSSL, explicitly set the architecture:
78+
```bash
79+
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 ..
80+
```
81+
82+
**macOS (Intel):** Use `x86_64` instead:
83+
```bash
84+
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 ..
85+
```
86+
87+
### Running Tests
88+
89+
After building, run the test suite using CTest:
90+
91+
```bash
92+
cd build
93+
ctest --output-on-failure
94+
```
95+
96+
Or run individual tests directly:
97+
```bash
98+
./tests/test_elgamal
99+
./tests/test_bulletproof_agg
100+
./tests/test_commitments
101+
```
102+
103+
### Expected Results
104+
105+
The following tests should pass:
106+
- `test_bulletproof_agg` - Aggregated Bulletproof range proofs
107+
- `test_commitments` - Pedersen commitments
108+
- `test_elgamal` - ElGamal encryption/decryption
109+
- `test_elgamal_verify` - ElGamal verification
110+
- `test_equality_proof` - Equality proofs
111+
- `test_ipa` - Inner Product Argument (IPA) Core Logic
112+
- `test_link_proof` - Linkage proofs
113+
- `test_pok_sk` - Proof of knowledge of secret key
114+
- `test_same_plaintext` - Same plaintext proofs
115+
- `test_same_plaintext_multi` - Multi-recipient same plaintext proofs
116+
- `test_same_plaintext_multi_shared_r` - Shared randomness variant
117+
118+
**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.

cmake/Findsecp256k1.cmake

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/_r_e_a_d_m_e_8md.html

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5+
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
6+
<meta name="generator" content="Doxygen 1.16.1"/>
7+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
8+
<title>mpt-crypto: README.md File Reference</title>
9+
<link href="tabs.css" rel="stylesheet" type="text/css"/>
10+
<script type="text/javascript" src="jquery.js"></script>
11+
<script type="text/javascript" src="dynsections.js"></script>
12+
<script type="text/javascript" src="clipboard.js"></script>
13+
<link href="navtree.css" rel="stylesheet" type="text/css"/>
14+
<script type="text/javascript" src="navtreedata.js"></script>
15+
<script type="text/javascript" src="navtree.js"></script>
16+
<script type="text/javascript" src="cookie.js"></script>
17+
<link href="search/search.css" rel="stylesheet" type="text/css"/>
18+
<script type="text/javascript" src="search/searchdata.js"></script>
19+
<script type="text/javascript" src="search/search.js"></script>
20+
<script type="text/x-mathjax-config">
21+
MathJax.Hub.Config({
22+
extensions: ["tex2jax.js"],
23+
jax: ["input/TeX","output/HTML-CSS"],
24+
});
25+
</script>
26+
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
27+
<link href="doxygen.css" rel="stylesheet" type="text/css" />
28+
</head>
29+
<body>
30+
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
31+
<div id="titlearea">
32+
<table cellspacing="0" cellpadding="0">
33+
<tbody>
34+
<tr id="projectrow">
35+
<td id="projectalign">
36+
<div id="projectname">mpt-crypto
37+
</div>
38+
<div id="projectbrief">Confidential Multi-Purpose Tokens Cryptographic Library</div>
39+
</td>
40+
</tr>
41+
</tbody>
42+
</table>
43+
</div>
44+
<!-- end header part -->
45+
<!-- Generated by Doxygen 1.16.1 -->
46+
<script type="text/javascript">
47+
var searchBox = new SearchBox("searchBox", "search/",'.html');
48+
</script>
49+
<script type="text/javascript">
50+
$(function() { codefold.init(); });
51+
</script>
52+
<script type="text/javascript" src="menudata.js"></script>
53+
<script type="text/javascript" src="menu.js"></script>
54+
<script type="text/javascript">
55+
$(function() {
56+
initMenu('',true,false,'search.php','Search',true);
57+
$(function() { init_search(); });
58+
});
59+
</script>
60+
<div id="main-nav"></div>
61+
</div><!-- top -->
62+
<div id="side-nav" class="ui-resizable side-nav-resizable">
63+
<div id="nav-tree">
64+
<div id="nav-tree-contents">
65+
<div id="nav-sync" class="sync"></div>
66+
</div>
67+
</div>
68+
<div id="splitbar" style="-moz-user-select:none;"
69+
class="ui-resizable-handle">
70+
</div>
71+
</div>
72+
<script type="text/javascript">
73+
$(function(){initNavTree('_r_e_a_d_m_e_8md.html','',''); });
74+
</script>
75+
<div id="container">
76+
<div id="doc-content">
77+
<!-- window showing the filter options -->
78+
<div id="MSearchSelectWindow"
79+
onmouseover="return searchBox.OnSearchSelectShow()"
80+
onmouseout="return searchBox.OnSearchSelectHide()"
81+
onkeydown="return searchBox.OnSearchSelectKey(event)">
82+
</div>
83+
84+
<!-- iframe showing the search results (closed by default) -->
85+
<div id="MSearchResultsWindow">
86+
<div id="MSearchResults">
87+
<div class="SRPage">
88+
<div id="SRIndex">
89+
<div id="SRResults"></div>
90+
<div class="SRStatus" id="Loading">Loading...</div>
91+
<div class="SRStatus" id="Searching">Searching...</div>
92+
<div class="SRStatus" id="NoMatches">No Matches</div>
93+
</div>
94+
</div>
95+
</div>
96+
</div>
97+
98+
<div class="header">
99+
<div class="headertitle"><div class="title">README.md File Reference</div></div>
100+
</div><!--header-->
101+
<div class="contents">
102+
</div><!-- contents -->
103+
</div><!-- doc-content -->
104+
<div id="page-nav" class="page-nav-panel">
105+
<div id="page-nav-resize-handle"></div>
106+
<div id="page-nav-tree">
107+
<div id="page-nav-contents">
108+
</div><!-- page-nav-contents -->
109+
</div><!-- page-nav-tree -->
110+
</div><!-- page-nav -->
111+
</div><!-- container -->
112+
<!-- start footer part -->
113+
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
114+
<ul>
115+
<li class="navelem"><a href="_r_e_a_d_m_e_8md.html">README.md</a></li>
116+
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1 </li>
117+
</ul>
118+
</div>
119+
</body>
120+
</html>

0 commit comments

Comments
 (0)