A simple yet extendable blockchain implementation in Go. This project includes block creation, node synchronization via HTTP/WebSocket, a minimal React dashboard, and local chain persistence.
- Full block and blockchain structure
- Simple Proof-of-Work algorithm
- RESTful API for blockchain access
- Real-time WebSocket broadcasting
- Block mining and syncing
- Persistent storage to
chain.json - Frontend dashboard with React
foundational-blockchain/
├── cmd/ # Main application entry point
│ └── main.go
├── internal/
│ ├── api/ # HTTP and WebSocket logic
│ ├── blockchain/ # Core blockchain logic
│ └── frontend/ # React frontend dashboard
├── pkg/logger/ # Simple logger utility
├── data/ # Persisted blockchain data
├── go.mod / go.sum # Dependencies
└── README.md # This file
- Go 1.24 or higher
- Node.js (for frontend dashboard)
git clone https://github.com/blockchain-city/foundational-blockchain.git
cd foundational-blockchaingo run ./cmd/main.gocurl -X POST http://localhost:8080/mine \
-H "Content-Type: application/json" \
-d '{"data":"your block data"}'curl http://localhost:8080/chainTo build and serve the frontend dashboard:
cd internal/frontend
npm install
npm run buildOnce built, the dashboard will be accessible at:
http://localhost:8080/dashboard
| Endpoint | Method | Description |
|---|---|---|
/mine |
POST | Mine a new block |
/chain |
GET | Get the current blockchain |
/block |
POST | Receive a block from a peer node |
/peers |
GET | List connected peers |
/peers |
POST | Add a new peer node |
/ws |
GET | WebSocket for live updates |
- Add advanced consensus algorithms (PoS, DPoS, Raft)
- Implement public/private key digital signatures
- Add data encryption & transaction validation
- Visualize blockchains in the frontend
Developed by Alireza
Designed with clean architecture principles in mind using Go.
This project is licensed under the MIT License.