blockchain-core/CLAUDE.md

56 lines
1.9 KiB
Markdown

# 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 hash
- `POST /api/transactions` - Submit signed tx
- `GET /api/transactions/pending` - Pending pool
- `POST /api/wallets` - Generate wallet
- `GET /api/wallets/:address/balance` - Balance + nonce
- `POST /api/mine` - Mine block
- `GET /api/mining/status` - Difficulty, reward
- `GET /api/chain/info` - Chain info
- `POST /api/chain/validate` - Validate chain
- `GET /api/health` - Health check
## Commandes
```bash
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)
## Gitea
https://git.etheryale.com/StillHammer/blockchain-core