Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
feat: Create consensus traits and implement praos vrf
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewWestberg committed Oct 3, 2024
1 parent 8c23ba5 commit c9d9c7b
Show file tree
Hide file tree
Showing 13 changed files with 548 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md

on:
push: { }

name: Validate

jobs:
check:
name: Check
strategy:
fail-fast: false
matrix:
os: [ windows-latest, ubuntu-latest, macOS-latest ]
rust: [ stable ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}

- name: Run cargo check
run: cargo check

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Run cargo test
run: cargo test

test-windows:
name: Test Suite Windows
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Run cargo test
run: cargo test

lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy

- name: Run cargo fmt
run: cargo fmt --all -- --check

- name: Run cargo clippy
run: cargo clippy -- -D warnings
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
**/Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/


# Added by cargo

/target
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[workspace]
resolver = "2"
members = [
"ouroboros",
"ouroboros-praos",
]
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
Initial Commit
# Ouroboros

![Build Status](https://github.com/pragma-org/ouroboros/actions/workflows/validate.yml/badge.svg?branch=main)

Ouroboros is a family of proof-of-stake (PoS) consensus protocols used in blockchain technology. It was designed to be secure, scalable, and energy-efficient. Ouroboros is notable for being the first PoS protocol to be mathematically proven secure and for being the consensus algorithm behind the Cardano blockchain. Key features of Ouroboros include:

**Proof-of-Stake**: Unlike proof-of-work (PoW) systems, Ouroboros relies on stakeholders to validate transactions and create new blocks, which significantly reduces energy consumption.

**Security**: Ouroboros has been rigorously analyzed and proven secure under certain cryptographic assumptions.

**Scalability**: The protocol is designed to support a large number of transactions per second, making it suitable for large-scale applications.

**Incentives**: It includes mechanisms to incentivize honest behavior among participants, ensuring the network remains secure and efficient.
Ouroboros operates in epochs, which are divided into slots. In each slot, a slot leader is elected to add a block to the blockchain. The election process is based on the stake each participant holds, with higher stakes increasing the probability of being selected as a slot leader.

## Repository Layout

The ouroboros crate contains the generic traits related to any Ouroboros consensus protocol. The sub-libraries contain the specific implementations of Ouroboros, such as Ouroboros TPraos, Ouroboros Praos, and Ouroboros Genesis.
18 changes: 18 additions & 0 deletions ouroboros-praos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "ouroboros-praos"
version = "0.1.0"
edition = "2021"

[dependencies]
hex = "0.4"
ouroboros = { path = "../ouroboros" }
pallas-crypto = { git = "https://github.com/txpipe/pallas", rev = "4caa94ecc8c7dbc7cbbb9230139a436a73bafb58" }
pallas-math = { git = "https://github.com/txpipe/pallas", rev = "4caa94ecc8c7dbc7cbbb9230139a436a73bafb58" }
pallas-primitives = { git = "https://github.com/txpipe/pallas", rev = "4caa94ecc8c7dbc7cbbb9230139a436a73bafb58" }
tracing = "0.1"

[dev-dependencies]
ctor = "0.2"
mockall = "0.13"
pallas-traverse = { git = "https://github.com/txpipe/pallas", rev = "4caa94ecc8c7dbc7cbbb9230139a436a73bafb58" }
tracing-subscriber = "0.3"
Loading

0 comments on commit c9d9c7b

Please sign in to comment.