An implementation of "Commit-Reveal²: Randomized Reveal Order Mitigates Last-Revealer Attacks in Commit-Reveal" protocol for distributed consensus applications, following the specifications from Lee and Gee (to appear in ICBC 2025).
- Two-layer Commit-Reveal² protocol preventing last-revealer attacks
- Secure cryptographic primitives (Keccak-256 hashing, ECDSA signatures)
- Randomized reveal order generation
- Hybrid on-chain/off-chain architecture
- Deterministic commitment chain generation
- Participant identity management
- Leader-based communication simulation
- Comprehensive test coverage
- Python (>= 3.10 recommended)
- ecdsa
- pysha3
- merkletools
- pytest
See requirements.txt
for specific package versions.
-
Clone the repository:
git clone https://github.com/ramsyana/commit-reveal cd commit-reveal
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
This project uses pytest
for unit testing. To run the tests:
- Make sure you are in the root directory of the project (where the
pytest.ini
orpyproject.toml
file would be, or just the main project folder). - Ensure your virtual environment is activated.
- Run the following command:
Or for more detailed output:
pytest
pytest -v
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024-2025 Ramsyana/ramsyana.com - ramsyana[at]mac.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Contributions are welcome! Please ensure:
- Tests pass and coverage is maintained
- Code follows project style and conventions
- Documentation is updated for significant changes
Contact maintainers at: ramsyana[at]mac.com
If you're interested in collaborating on the protocol or related research, please don't hesitate to reach out.