Skip to content

FractionEstate/cardano-base-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cardano-base-rust

A pure-Rust port of selected components from the Haskell cardano-base project. The workspace provides cryptographic primitives (VRF, KES, DSIGN), Cardano-specific slotting utilities, CBOR serialisation helpers, and strictness libraries that underpin Rust services in the Cardano ecosystem.

Highlights

  • Cryptography: Ed25519, Ed25519 (mlocked), ECDSA secp256k1, Schnorr secp256k1, and Praos VRF implementations in cardano-crypto-class.
  • Key Evolving Signatures: SingleKes, Sum{0-7}Kes, and compact variants with Blake2b hashing and serialisation helpers.
  • VRF reference implementation ✅: Draft-03 and Draft-13 VRFs over Curve25519 in cardano-vrf-pure with byte-for-byte parity to Cardano libsodium. See VRF_PARITY_COMPLETE.md.
  • CBOR tooling: Strict CBOR serialisation with tag-24 helpers in cardano-binary.
  • Slotting primitives: Epoch and time arithmetic in cardano-slotting.
  • Strictness utilities: Strict containers, NoThunks, NFData, and deriving helpers for predictable evaluation.

Build and test

Prerequisites: Rust 1.70 or newer with cargo, installed via rustup.

cargo build --workspace
cargo test --workspace
cargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings

The full test suite includes VRF and KES golden tests that depend on vectors in test_vectors/.

Dev Container (VS Code)

The repository ships with .devcontainer/devcontainer.json, preloading the mcr.microsoft.com/devcontainers/base:bookworm image and the official Rust feature. To (re)build the environment in VS Code:

  1. Install the Dev Containers extension.
  2. Open the command palette and choose Dev Containers: Rebuild and Reopen in Container.
  3. Wait for the Rust toolchain to install automatically (no manual rustup steps required).

The container bundles the same tool versions used in CI, ensuring repeatable cargo builds and tests.

Documentation

Authoritative documentation lives under docs/:

Code Audit and Compatibility

Comprehensive audit documentation comparing this Rust implementation with the official Haskell cardano-base:

Security and conduct policies remain at the repository root: SECURITY.md and CODE-OF-CONDUCT.md.

Workspace crates

Crate Description
cardano-crypto-class Cryptographic primitives, secure memory, hashing
cardano-vrf-pure Curve25519 VRF implementations
cardano-binary CBOR serialisation helpers
cardano-slotting Epoch and slot arithmetic
cardano-base Feature-flag wiring
cardano-strict-containers Strict container types
deepseq, nothunks Evaluation traits
measures, heapwords Measurement helpers
base-deriving-via, orphans-deriving-via Deriving utilities
cardano-git-rev Embeds build git revision

See docs/architecture.md for crate relationships and feature flags.

Contributing

Please read CONTRIBUTING.md for workflow guidance. Pull requests should:

  • Update documentation alongside code changes where relevant.
  • Pass cargo fmt, cargo clippy, and the full test suite shown above.
  • Include new tests or vectors when introducing cryptographic behaviour changes.

Security-sensitive reports should follow SECURITY.md.

License

Dual-licensed under the Apache License, Version 2.0 and the MIT license. See LICENSE and NOTICE for details.

About

Pure Rust implementation of Cardano's foundational cryptographic primitives - VRF, KES, DSIGN, and CBOR serialization

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •