1.9 KiB
1.9 KiB
Claude - blockchain-core
Projet
Rust workspace : blockchain core library + REST API node. Partie d'un ecosysteme de 3 repos (blockchain-core, blockchain-cli, blockchain-flutter).
Architecture
blockchain-core/ (Rust workspace)
├── core/ Library crate - blockchain primitives
│ └── src/ block, chain, wallet, transaction, mining, state, persistence, config, error
├── node/ Binary crate - axum REST API (port 3000)
│ └── src/ main, state (Arc<RwLock>), api/ (blocks, transactions, wallets, mining, chain, errors)
└── tests/ Integration tests
Decisions techniques
- Account-based (HashMap<Address, Balance>), pas UTXO
- SHA-256 (sha2) pour hashing
- Ed25519 (ed25519-dalek) pour signatures
- axum 0.8 pour l'API REST
- JSON files pour persistence (pas de DB)
- u64 pour montants (comme satoshis, pas de floats)
API Endpoints (port 3000)
GET /api/blocks- List blocks (paginated)GET /api/blocks/:hash- Block by hashPOST /api/transactions- Submit signed txGET /api/transactions/pending- Pending poolPOST /api/wallets- Generate walletGET /api/wallets/:address/balance- Balance + noncePOST /api/mine- Mine blockGET /api/mining/status- Difficulty, rewardGET /api/chain/info- Chain infoPOST /api/chain/validate- Validate chainGET /api/health- Health check
Commandes
cargo build # Build tout
cargo test # Tests unitaires
cargo run -p blockchain-node # Lancer le node
cargo clippy # Lint
Phase actuelle
Phase 1-3 complètes : core lib + node API implémentés. Prochaine étape : installer Rust, compiler, lancer les tests.
Repos liés
- blockchain-cli (Rust CLI, HTTP only)
- blockchain-flutter (Flutter app, HTTP only)