How carvajalrjc/boeno-arqui-blockchain works
Project Type and Purpose
• This is a full-stack traceability system built on a private Hyperledger Besu blockchain.
• Frontend: React + Vite dashboard for managing providers, products, movements, and token info.
• Backend: Node.js + Express REST API that validates and relays requests to smart contracts via ethers.js.
• Smart Contracts: Solidity contracts (ERC-20 token + business logic) deployed with Hardhat.
• Blockchain: Three-node Besu network using IBFT 2.0 consensus, run via Docker Compose.
Key Components
a. User / Browser
b. Frontend application (React + Vite)
c. Backend API server (Node.js + Express)
d. Smart Contract layer (TrazaToken.sol, Trazabilidad.sol)
e. Blockchain network (Besu nodes 1, 2, 3)
f. Utility scripts (Hardhat deploy, seed-data)
g. Container orchestration (Docker Compose)
Interactions and Data Flows
• User → Frontend: HTTP(S) via browser (ports 5173).
• Frontend → Backend: REST calls to /api/* (port 3001).
• Backend → Blockchain: JSON-RPC calls through ethers.js to node RPC endpoints (ports 8545-8565).
• Smart Contracts → Blockchain: Deployed bytecode and transaction execution within Besu nodes.
• Besu Node peers: P2P communication under IBFT 2.0 consensus.
• Deployment & Seeding: scripts/deploy/deploy.js runs Hardhat migrations; scripts/seed-data.js populates initial data.
Architectural Patterns and Principles
• Layered architecture: Presentation (React), Application (Express REST), Blockchain (EVM contracts).
• Separation of concerns: UI components live in frontend/src; API logic in backend/server.js; contract logic in contracts/.
• Infrastructure as code: Dockerfiles per service + docker-compose.yml + genesis.json + hardhat.config.js.
• Immutable data store: blockchain ensures tamper-proof records.
Technologies & Frameworks to Call Out
• React 18 + Vite for fast HMR and development server.
• Node.js + Express for RESTful API and validation.
• Ethers.js for Web3 integration.
• Solidity 0.8.19 + OpenZeppelin ERC-20 for token.
• Hyperledger Besu private network with IBFT 2.0 for consensus.
• Docker & Docker Compose for service orchestration.
• Hardhat for contract compilation, testing, and deployment.
Detailed Elements
• Labels on each component (e.g., “React App (5173)”, “Express API (3001)”, “Node1 RPC:8545”).
• Arrowheads indicating call direction and data flow.
• Notes on ports, file locations (e.g., frontend/src, backend/server.js, contracts/).