A simplified blockchain implementation with proof-of-work mining, REST API microservice, and React frontend for visualization.
Rahman Azhar
This project implements a basic blockchain with proof-of-work mining and provides both a REST API microservice and a React-based frontend interface. The blockchain maintains data integrity through SHA-256 hashing and includes validation mechanisms to ensure chain consistency.
- Blockchain implementation with proof-of-work mining
- Chain validation system
- REST API endpoints for blockchain interaction
- React frontend for blockchain visualization
- Docker containerization for easy deployment
/pkg/blockchain
: Core blockchain implementation/api
: REST API server implementation/frontend
: React frontend applicationmain.go
: Backend application entry pointDockerfile
&docker-compose.yml
: Container configuration
- Build and start the services:
docker-compose up --build
- Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
Returns the current state of the blockchain and its validity status.
Response format:
{
"blocks": [
{
"timestamp": 1234567890,
"data": "Block Data",
"hash": "block_hash",
"prevHash": "previous_block_hash",
"nonce": 123
}
],
"valid": true
}
Adds a new block to the blockchain.
Request format:
{
"data": "Your block data here"
}
- Backend: Go
- Frontend: React with Chakra UI
- Containerization: Docker & Docker Compose
- Hashing: SHA-256
- State Management: React Hooks
- API Communication: Axios
- Styling: Chakra UI components
To run the services separately for development:
- Backend:
go run main.go
- Frontend:
cd frontend
npm install
npm start
- Real-time blockchain visualization
- Block mining with proof-of-work
- Chain validation checking
- Interactive block addition
- Responsive design
- Automatic chain updates