Expand description
CHIE Protocol - Decentralized, privacy-preserving file sharing with zero-knowledge proofs.
This is the meta crate that re-exports all CHIE Protocol components for convenient access.
§Overview
CHIE (Collective Hybrid Intelligence Ecosystem) is a decentralized content distribution system with cryptographic incentive mechanisms. This crate provides a unified API to all CHIE components:
shared: Common types, errors, and utilitiescrypto: Cryptographic primitives (encryption, signatures, ZK proofs)core: Node implementation and content managementp2p: P2P networking layer using rust-libp2p
§Quick Start
ⓘ
use chie::prelude::*;
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a content node
let config = NodeConfig {
storage_path: PathBuf::from("./chie-data"),
max_storage_bytes: 50 * 1024 * 1024 * 1024, // 50 GB
max_bandwidth_bps: 100 * 1024 * 1024 / 8, // 100 Mbps
coordinator_url: "https://coordinator.chie.network".to_string(),
};
let mut node = ContentNode::with_storage(config).await?;
// Generate cryptographic keys
let keypair = KeyPair::generate();
println!("Public key: {:?}", keypair.public_key());
Ok(())
}§Features
§Cryptography
use chie::crypto::{KeyPair, generate_key, generate_nonce, encrypt, decrypt};
// Generate keys
let keypair = KeyPair::generate();
let encryption_key = generate_key();
let nonce = generate_nonce();
// Encrypt/decrypt data
let plaintext = b"Hello, CHIE!";
let ciphertext = encrypt(plaintext, &encryption_key, &nonce).unwrap();
let decrypted = decrypt(&ciphertext, &encryption_key, &nonce).unwrap();
assert_eq!(plaintext.as_slice(), decrypted.as_slice());§Content Management
ⓘ
use chie::shared::{ContentMetadataBuilder, ContentCategory, ContentStatus};
use uuid::Uuid;
let metadata = ContentMetadataBuilder::new()
.cid("QmExampleCID123")
.title("My Content")
.description("A sample content item")
.category(ContentCategory::ThreeDModels)
.size_bytes(1024 * 1024)
.price(100)
.creator_id(Uuid::new_v4())
.status(ContentStatus::Active)
.build()
.expect("Failed to build metadata");§P2P Networking
use chie::p2p::{CompressionManager, CompressionAlgorithm, CompressionLevel};
let manager = CompressionManager::new(CompressionAlgorithm::Lz4, CompressionLevel::Fast);
let data = b"Data to compress";
let compressed = manager.compress(data).unwrap();
let decompressed = manager.decompress(&compressed).unwrap();
assert_eq!(data.as_slice(), decompressed.as_slice());§Module Structure
Re-exports§
pub use chie_crypto as crypto;pub use chie_core as core;pub use chie_p2p as p2p;
Modules§
- prelude
- Prelude module for convenient imports.