rootchain-crypto 1.0.1

Cryptographic primitives for the RootChain ecosystem, including Ed25519 signing and Merkle tree implementations.
Documentation
# rootchain-crypto

[![Crates.io](https://img.shields.io/crates/v/rootchain-crypto.svg)](https://crates.io/crates/rootchain-crypto)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](../../LICENSE)

> **Cryptographic primitives for the RootChain ecosystem.**

This crate provides the core cryptographic building blocks used by the entire RootChain network: Ed25519 key management, Blake3 hashing, and a Sparse Merkle Tree implementation for verifiable state proofs.

---

## What's Inside

| Module | Description |
| :--- | :--- |
| `signing` | Ed25519 keypair generation, signing, and signature verification |
| `hashing` | Blake3 hashing with deterministic output for use in Merkle trees and block headers |
| `smt` | Sparse Merkle Tree (SMT) implementation for state root derivation and inclusion proofs |
| `error` | Unified `CryptoError` type for this crate |

---

## Installation

```toml
[dependencies]
rootchain-crypto = "1.0.1"
```

---

## Usage

### Key Generation & Signing

```rust
use rootchain_crypto::signing::{Keypair, verify_signature};

// Generate a new keypair from a 32-byte seed
let keypair = Keypair::from_seed(&[0u8; 32]);
let address = keypair.public_address();

// Sign a message
let message = b"finalize block #1000";
let signature = keypair.sign(message);

// Verify the signature
assert!(verify_signature(&address, message, &signature).is_ok());
```

### Blake3 Hashing

```rust
use rootchain_crypto::hashing::hash;

let data = b"RootChain block data";
let digest = hash(data); // Returns rootchain_core::types::Hash
```

### Sparse Merkle Tree (State Proofs)

```rust
use rootchain_crypto::smt::SparseMerkleTree;

let mut tree = SparseMerkleTree::new();
tree.update(b"account_key", b"account_value");

let root = tree.root();
let proof = tree.proof(b"account_key");
```

---

## Security

- Uses `ed25519-dalek` v2.x with rejection sampling for secure key generation.
- Uses `blake3` v1.5.x for Merkle hashing (faster than SHA-2, quantum-resistant preimage).

---

## License

MIT — See [LICENSE](../../LICENSE) for details.