https://github.com/usexfg/xfg-stark
βοΈ Winterfell-based STARKs for zero-knowledge COLD collateral proofs and XFG burn proofs π₯
https://github.com/usexfg/xfg-stark
cd cold embers fire fuego heat stark winterfell xfg zero-knowledge-proofs zk-collateral zk-starks zkstark
Last synced: about 2 months ago
JSON representation
βοΈ Winterfell-based STARKs for zero-knowledge COLD collateral proofs and XFG burn proofs π₯
- Host: GitHub
- URL: https://github.com/usexfg/xfg-stark
- Owner: usexfg
- License: mit
- Created: 2025-09-09T02:54:45.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-02-16T01:03:37.000Z (2 months ago)
- Last Synced: 2026-02-16T08:46:36.914Z (2 months ago)
- Topics: cd, cold, embers, fire, fuego, heat, stark, winterfell, xfg, zero-knowledge-proofs, zk-collateral, zk-starks, zkstark
- Language: Rust
- Homepage:
- Size: 2.07 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
XFG STARKs
[](https://www.rust-lang.org)
[](https://opensource.org/licenses/MIT)
[](https://github.com/ColinRitman/xfgwinter)

**βοΈWinterfell based zkSTARKs for XFG collateral burn proofsπ₯**
A fortress of cryptographic strength, implementing STARK (Scalable Transparent Argument of Knowledge) proofs with the unyielding security of Winterfell's walls, memory safety as solid as the castle's foundation, and zero-cost abstractions that would make even the most cunning Lannister envious.
## βοΈ The XFG Winterfell Arsenal
### π‘οΈ Core Defenses
- **βοΈ Field Arithmetic**: Type-safe field element operations with constant-time implementations that would make the Night's Watch proud
- **π Polynomial Operations**: Efficient polynomial arithmetic and evaluation, more precise than even MΓ¦ster Luwin's calculations
- **π° STARK Proof System**: Complete STARK proof generation and verification- the cryptographic equivalent of Winterfell's defenses
- **π· Type System**: Comprehensive type definitions for all cryptographic operations, as thorough as the Stark family tree
### π‘οΈ Security Fortifications
- Constant-time cryptographic operations that never reveal their secrets
- Secure secret management with zeroization.
- Type-level prevention of timing attacks, more reliable than the Wall's magic
- Memory safety through Rust's type system as strong as Valyrian steel
- Comprehensive error handling with Result types as true as the word of Ned Stark's son.
### β‘ Performance ~~Weapons~~ Tools
- Zero-cost abstractions for all operations as efficient as Arya's water dancing
- Optimized field arithmetic implementations as fast as direwolves
- Efficient polynomial evaluation algorithms as precise as one of The L3-eyed Raven's visions
- Minimal runtime overhead for type safety as light as a crow's feather
## β« Building Winterfell
### Prerequisites
#### The forge of the North
- Rust 1.70+ ([Install Rust](https://rustup.rs/)) -
- Cargo (comes with Rust)
### Construction
```bash
# Clone the repository
git clone https://github.com/ColinRitman/xfgwinter.git
cd xfgwinter
# Build the project
cargo build
# Run tests
cargo test
# Run benchmarks
cargo bench
```
## π° Citadelian Architecture
```
xfgwinter/
βββ src/
β βββ lib.rs # Main library entry point - The Great Hall
β βββ types/ # Type system definitions - The Crypts
β β βββ mod.rs # Type system module - The Master's Chamber
β β βββ field.rs # Field element types - The Armory
β β βββ polynomial.rs # Polynomial types - The Library
β β βββ stark.rs # STARK proof types - The Godswood
β β βββ secret.rs # Secret management types - The Secret Chambers
β βββ field/ # Field arithmetic implementations - The Training Yard
β βββ polynomial/ # Polynomial arithmetic implementations - The Maester's Tower
β βββ stark/ # STARK proof implementations - The Watchtower
β βββ utils/ # Utility functions - The Kitchens
βββ agents/ # Background agent specifications - The Council Chamber
βββ background-agents/ # Background agent system - The War Room
βββ tests/ # Integration tests - The Training Grounds
βββ benches/ # Performance benchmarks - The Tourney Grounds
βββ docs/ # Documentation - The Archives
```
## βοΈ Wielding XFG-STARK's Power
### Basic Field Operations
```rust
use xfg_stark::types::field::PrimeField64;
// Create field elements - Forging the weapons
let a = PrimeField64::new(5);
let b = PrimeField64::new(3);
// Perform arithmetic operations - The art of war
let sum = a + b;
let product = a * b;
let inverse = a.inverse().unwrap();
// Constant-time operations - The way of the North
let ct_sum = a.add_constant_time(&b);
let ct_product = a.mul_constant_time(&b);
```
### Polynomial Operations
```rust
use xfg_stark::types::polynomial::FieldPolynomial;
use xfg_stark::types::field::PrimeField64;
// Create polynomials - Crafting the spells
let coeffs = vec![PrimeField64::new(1), PrimeField64::new(2), PrimeField64::new(1)];
let poly = FieldPolynomial::new(coeffs);
// Evaluate polynomial - Casting the magic
let result = poly.evaluate(PrimeField64::new(3));
// Polynomial arithmetic - The maester's calculations
let poly2 = FieldPolynomial::constant(PrimeField64::new(1));
let sum = poly.add(&poly2);
let product = poly.multiply(&poly2);
```
### STARK Proof Components
```rust
use xfg_stark::types::stark::{StarkProof, ExecutionTrace, Air};
use xfg_stark::types::field::PrimeField64;
// Create execution trace - The witness of the North
let trace = ExecutionTrace {
columns: vec![vec![PrimeField64::new(1), PrimeField64::new(2)]],
length: 2,
num_registers: 1,
};
// Create AIR constraints - The laws of the realm
let air = Air {
constraints: vec![],
transition: TransitionFunction {
coefficients: vec![vec![PrimeField64::new(1)]],
degree: 1,
},
boundary: BoundaryConditions { constraints: vec![] },
security_parameter: 128,
};
// Create STARK proof - The seal of Winterfell
let proof = StarkProof {
trace,
air,
commitments: vec![],
fri_proof: FriProof {
layers: vec![],
final_polynomial: vec![PrimeField64::new(1)],
queries: vec![],
},
metadata: ProofMetadata {
version: 1,
security_parameter: 128,
field_modulus: "0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47".to_string(),
proof_size: 1024,
timestamp: 1234567890,
},
};
```
## πβοΈ Testing Winterfell's Defenses
### Run All Tests
```bash
cargo test
```
### Run Specific Test Categories
```bash
# Field arithmetic tests - Testing the armory
cargo test field
# Polynomial tests - Testing the library
cargo test polynomial
# STARK proof tests - Testing the watchtower
cargo test stark
# Secret management tests - Testing the secret chambers
cargo test secret
```
### Run Benchmarks
```bash
cargo bench
```
## π The Library Tower
### API Documentation
Generate and view API documentation:
```bash
cargo doc --open
```
### Mathematical Background
This implementation is based on:
- **[STARK Proofs](https://eprint.iacr.org/2018/046.pdf&ved=2ahUKEwjftqeb0sqPAxXAM2IAHR3DMWsQFnoECCEQAQ&usg=AOvVaw3U0RHxBdGk62bzwjc2PIju)**: Scalable Transparent Arguments of Knowledge - The ancient magic of the North
- **[Field Arithmetic](https://www.anubhavprasadsharma.com/files/Sharma_FiniteFieldArithmeticAndItsApplicationsToCryptography.pdf&ved=2ahUKEwiH6eHq0sqPAxXvFVkFHZDMDiMQFnoECBcQAQ&usg=AOvVaw14hLfV867hrCUdFhfS-eJg)**: Finite field operations for cryptographic security - The foundation of Winterfell
- **[Polynomial Commitment Schemes](https://eprint.iacr.org/2020/081.pdf)**: Efficient polynomial evaluation and commitment - The maester's wisdom
- **[FRI Protocol](https://eprint.iacr.org/2024/1161)**: Fast Reed-Solomon Interactive Oracle Proof - The raven's message system
## Acknowledgments
- **[Winterfell by Meta](https://github.com/facebook/winterfell)**: cryptographic primitives and STARK implementation patterns
## π§βπ» Join the Citadel
We welcome new maesters to xfgwin! Please see Archmæster or [How to become a mæster](https://github.com/usexfg) for details.
## π Links
- [Repository](https://github.com/usexfg/xfg-stark)
- [Issues](https://github.com/usexfg/xfg-stark/issues)
- [Discussions](https://github.com/usexfg/xfg-stark/discussions)
- [Wiki](https://github.com/usexfg/xfg-stark/wiki)
---
Built with β€οΈβπ₯ for the Fuego community
**2025 Β© Ξlderfire Privacy Group**
**2025 Β© USΞXFβ²**
Winter Is Coming