Skip to content

input-output-hk/ouroboros-phalanx-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ouroboros Phalanx

Breaking the Economics of Grinding Attacks

Ouroboros Phalanx is a protocol-level extension of Ouroboros Praos that tackles a subtle weaknesses in proof-of-stake blockchains: grinding attacks. In Praos, adversaries can exploit their leadership slots to bias the randomness that drives future leader elections. While this does not make Praos insecure, it inflates settlement times because the system must be conservatively parameterized against such attacks.

Phalanx breaks this dynamic by making every grinding attempt computationally expensive. By embedding a verifiable delay function (VDF) into the randomness pipeline, Phalanx raises the cost of adversarial bias by orders of magnitude. This shifts the economics of attack: what was once a feasible strategy becomes prohibitively expensive, while honest participants experience negligible additional cost.

The result is a protocol that preserves Ouroboros security guarantees while also enabling faster settlement times, creating a more efficient and more robust foundation for Cardano.

⚠️ Important Note This repository does not contain a Cardano node implementation. Instead, it provides the protocol definition of Ouroboros Phalanx, including:

The actual integration of Phalanx into the Cardano node will be handled by the consensus/ledger teams in coordination with Intersect and IOG. This repository serves as the research and specification baseline for such work, not as a runnable node.

Getting Started

You can read the local copies of the CIP and CPS included in this repository,
or consult their official versions on the Cardano Foundation CIPs repository.

This repository also provides an implementation of the VDF-based cryptographic primitive recommended in those documents.

  • If you are moving forward with implementing the Phalanx protocol, we recommend using this implementation as the reference.
  • Below you’ll find the instructions to build and run benchmarks on it.

Clone Repository

git clone https://github.com/input-output-hk/ouroboros-phalanx.git
cd ouroboros-phalanx
git submodule update --init --recursive

Build Dependencies

Compiling chiavdf requires cmake, boost, and GMP/MPIR.

macOS (via Homebrew):

brew install gmp boost cmake

Debian/Ubuntu:

sudo apt-get install libgmp-dev libboost-all-dev cmake

You may need to update your PATH.

Run Benchmarks

Move into the chiavdf directory and run the benchmark suite.

  • Default discriminant size: 4,096 bits.
  • Class group elements (forms) are encoded in 388B.
  • To use a different discriminant, update BQFC_MAX_D_BITS in chiavdf/src/bqfc.h.
    • This automatically adjusts form size.
    • Benchmarks and test files must be updated accordingly.

Python benchmarks

We provide simple VDF benchmarks on different discriminant sizes in python. First, we need to create a virtual environment and generate a wheel.

python3 -m venv venv
source venv/bin/activate

pip install wheel setuptools_scm pybind11
pip wheel .

After installing the resulting wheel (<>.whl file) with pip and tabulate pip install tabulate, we can run the benchmarks as follows:

python3 python3 tests/benches.py

Rust benchmarks

We provide more comprehensive benchmarks, on both VDF functions as well as aggregation, with Rust code using Criterion. As chiavdf library is written in C++, we need the nightly flag to compile the bindings.

cd rust_bindings/
cargo build
cargo +nightly bench

Note that criterion saves the benchmarks output in target/criterion in the root directory and can be read with a HTML viewer, e.g. using firefox:

firefox target/criterion/report/index.html

Contributing

Thank you for your interest in this repository!

This repository is published by IOG R&D Innovation to share early-stage research and technology validation work with the Cardano community.

Community Engagement Model

  • Status: Open, but not actively maintained by R&D Innovation.
  • Contributions: We are not accepting feature requests or code contributions.
  • Questions / Comments:
    • You are welcome to open issues for clarifications or questions.
    • Please understand that responses may be limited, as this repository is not under active development.

Ownership

The repository is owned and managed by IOG R&D Innovation with contributions from cryptographers, protocol engineers, and community reviewers. It is published to benefit the Cardano community by sharing insights, ideas, and experimental implementations.

Disclaimer

Important Disclaimer & Acceptance of Risk
This repository contains research code and specifications. It has not been security audited.
It is provided as is, for research and educational purposes only.
Do not use in production systems without conducting your own thorough review.
By using this repository, you acknowledge and accept all associated risks.

License

This project is licensed under Apache-2.0.

About

Documentation, Specification, and Design for an Extended Anti-Grinding Feature in Ouroboros Praos and Beyond

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages