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

Commit 36b4f01

Browse files
feat: Create consensus traits and implement praos vrf
1 parent 8c23ba5 commit 36b4f01

16 files changed

+584
-1
lines changed

.github/discord.svg

+7
Loading

.github/workflows/validate.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
2+
3+
on:
4+
push: { }
5+
6+
name: Validate
7+
8+
jobs:
9+
check:
10+
name: Check
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ windows-latest, ubuntu-latest, macOS-latest ]
15+
rust: [ stable ]
16+
17+
runs-on: ${{ matrix.os }}
18+
19+
steps:
20+
- name: Checkout sources
21+
uses: actions/checkout@v2
22+
23+
- name: Install stable toolchain
24+
uses: dtolnay/rust-toolchain@stable
25+
with:
26+
toolchain: ${{ matrix.rust }}
27+
28+
- name: Run cargo check
29+
run: cargo check
30+
31+
test:
32+
name: Test Suite
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout sources
36+
uses: actions/checkout@v2
37+
38+
- name: Install stable toolchain
39+
uses: dtolnay/rust-toolchain@stable
40+
with:
41+
toolchain: stable
42+
43+
- name: Run cargo test
44+
run: cargo test
45+
46+
test-windows:
47+
name: Test Suite Windows
48+
runs-on: windows-latest
49+
steps:
50+
- name: Checkout sources
51+
uses: actions/checkout@v2
52+
53+
- name: Install stable toolchain
54+
uses: dtolnay/rust-toolchain@stable
55+
with:
56+
toolchain: stable
57+
58+
- name: Run cargo test
59+
run: cargo test
60+
61+
lints:
62+
name: Lints
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Checkout sources
66+
uses: actions/checkout@v2
67+
68+
- name: Install stable toolchain
69+
uses: dtolnay/rust-toolchain@stable
70+
with:
71+
toolchain: stable
72+
components: rustfmt, clippy
73+
74+
- name: Run cargo fmt
75+
run: cargo fmt --all -- --check
76+
77+
- name: Run cargo clippy
78+
run: cargo clippy -- -D warnings

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug/
4+
target/
5+
6+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8+
**/Cargo.lock
9+
10+
# These are backup files generated by rustfmt
11+
**/*.rs.bk
12+
13+
# MSVC Windows builds of rustc generate these, which store debugging information
14+
*.pdb
15+
16+
# RustRover
17+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19+
# and can be added to the global gitignore or merged into this file. For a more nuclear
20+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
21+
.idea/
22+
23+
24+
# Added by cargo
25+
26+
/target

Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[workspace]
2+
resolver = "2"
3+
members = [
4+
"ouroboros",
5+
"ouroboros-praos",
6+
]

README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
Initial Commit
1+
# Ouroboros
2+
3+
![Build Status](https://github.com/pragma-org/ouroboros/actions/workflows/validate.yml/badge.svg?branch=main)
4+
5+
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:
6+
7+
**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.
8+
9+
**Security**: Ouroboros has been rigorously analyzed and proven secure under certain cryptographic assumptions.
10+
11+
**Scalability**: The protocol is designed to support a large number of transactions per second, making it suitable for large-scale applications.
12+
13+
**Incentives**: It includes mechanisms to incentivize honest behavior among participants, ensuring the network remains secure and efficient.
14+
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.
15+
16+
## Repository Layout
17+
18+
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.

ouroboros-praos/Cargo.toml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[package]
2+
name = "ouroboros-praos"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
hex = "0.4"
8+
ouroboros = { path = "../ouroboros" }
9+
pallas-crypto = { git = "https://github.com/txpipe/pallas", rev = "252714d58a93d58bf2cd7ada1156e3ace10a8298" }
10+
pallas-math = { git = "https://github.com/txpipe/pallas", rev = "252714d58a93d58bf2cd7ada1156e3ace10a8298" }
11+
pallas-primitives = { git = "https://github.com/txpipe/pallas", rev = "252714d58a93d58bf2cd7ada1156e3ace10a8298" }
12+
tracing = "0.1"
13+
14+
[dev-dependencies]
15+
ctor = "0.2"
16+
insta = { version = "1.40.0", features = ["yaml"] }
17+
mockall = "0.13"
18+
pallas-traverse = { git = "https://github.com/txpipe/pallas", rev = "252714d58a93d58bf2cd7ada1156e3ace10a8298" }
19+
tracing-subscriber = "0.3"

0 commit comments

Comments
 (0)