| Crates.io | chie |
| lib.rs | chie |
| version | 0.1.0 |
| created_at | 2026-01-18 14:17:32.282485+00 |
| updated_at | 2026-01-18 14:17:32.282485+00 |
| description | CHIE Protocol - Decentralized, privacy-preserving file sharing with zero-knowledge proofs |
| homepage | https://github.com/cool-japan/chie |
| repository | https://github.com/cool-japan/chie |
| max_upload_size | |
| id | 2052412 |
| size | 137,546 |
CHIE Protocol - Decentralized, privacy-preserving file sharing with zero-knowledge proofs.
CHIE (Collective Hybrid Intelligence Ecosystem / 知恵) is a next-generation decentralized content distribution protocol combining IPFS-based storage with innovative incentive mechanisms.
This is the meta crate that re-exports all CHIE Protocol components for convenient access:
| Module | Crate | Description |
|---|---|---|
[shared] |
chie-shared |
Common types, errors, validation, and utilities |
[crypto] |
chie-crypto |
Cryptographic primitives (encryption, signatures, ZK proofs) |
[core] |
chie-core |
Node implementation, storage, and content management |
[p2p] |
chie-p2p |
P2P networking layer using rust-libp2p |
Add this to your Cargo.toml:
[dependencies]
chie = "0.1"
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(())
}
chie::crypto)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());
Capabilities:
chie::shared)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");
chie::p2p)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());
Capabilities:
chie::core)use chie::core::{ContentNode, NodeConfig, ChunkStorage};
use chie::prelude::*;
// Create bandwidth proof for verified transfers
let proof = create_bandwidth_proof(
session_id,
provider_id,
requester_id,
content_cid,
bytes_transferred,
latency_ms,
)?;
Capabilities:
For convenience, import commonly used types with the prelude:
use chie::prelude::*;
This includes:
| Category | Types |
|---|---|
| Types | BandwidthProof, ChunkRequest, ChunkResponse, ContentMetadata, ContentCategory |
| Errors | ChieError, ChieResult |
| Crypto | KeyPair, PublicKey, SecretKey, encrypt, decrypt, hash |
| Node | ContentNode, NodeConfig, ChunkStorage |
| P2P | CompressionManager, BootstrapManager, ContentRouter, GossipConfig |
The core innovation is the cryptographically verifiable bandwidth proof:
1. Requester → Provider: ChunkRequest
- content_cid, chunk_index, challenge_nonce, timestamp
2. Provider → Requester: ChunkResponse
- encrypted_chunk, chunk_hash, provider_signature, challenge_echo
3. Both parties generate BandwidthProof:
- Dual signatures (provider + requester)
- session_id, bytes_transferred, latency_ms
- Submitted to coordinator for verification
| Component | Library | Purpose |
|---|---|---|
| P2P Networking | libp2p 0.54 | Swarm, Kademlia DHT, Gossipsub |
| Encryption | chacha20poly1305 | AEAD content encryption |
| Signing | ed25519-dalek | Digital signatures |
| Hashing | blake3 | Fast cryptographic hashing |
| Key Derivation | hkdf | HKDF-SHA256 |
| Async Runtime | Tokio 1.x | Full-featured async runtime |
Rust 1.83 or later is required.
chie-shared - Shared types and utilitieschie-crypto - Cryptographic primitiveschie-core - Core protocol logicchie-p2p - P2P networking layerchie-coordinator - Central coordinator serverUNLICENSED - All Rights Reserved
COOLJAPAN OU