- Docker Image: aman0907/stakeway-backend:latest
- API Endpoints:
POST /validators
: Creates a new validator request.GET /validators/{request_id}
: Retrieves the status of a specific validator request.GET /health
: Provides a health check for the API.GET /metrics
: Exposes Prometheus metrics for monitoring.
- Database: SQLite is utilized for persistent data storage.(Postgres -> Production))
- Containerization: Docker is employed for easy deployment and scalability.
- Testing: Comprehensive unit and integration tests are implemented.
- Paths:
- API Code:
/code/internal/api/handlers.go
- Database Models:
/code/internal/models/validator.go
- Unit Tests:
/code/tests/unit/service_test.go
,/code/tests/unit/utils_test.go
- Integration Tests:
/code/tests/integration/api_test.go
- API Code:
- Kubernetes Deployment:
- Deployment YAML:
/kubernetes/deployment.yaml
- Service YAML:
/kubernetes/service.yaml
- Deployment YAML:
- Monitoring:
- Prometheus metrics endpoint (
/metrics
). - Grafana dashboard for metric visualization.
- Alertmanager for alert handling.
- Alert Rules:
/kubernetes/prometheus-alert-rules.yaml
.
- Prometheus metrics endpoint (
- Paths:
- PostgreSQL:
/kubernetes/postgresql.yaml
- Grafana:
/kubernetes/grafana.yaml
- Alertmanager:
/kubernetes/alertmanager.yaml
- PostgreSQL:
- Sepolia Testnet:
- Script to simulate Ethereum staking transactions.
- Wallet balance query, ETH transfer, and transaction hash logging.
- Documentation:
- Setup instructions for Sepolia testnet connection.
- Script execution steps.
- Paths:
- Blockchain Code:
/code/blockchain/main.go
- Blockchain Setup:
/code/blockchain/README.md
- Blockchain Code:
- Clone:
git clone && cd stakeway-backend
- Dependencies:
go mod download
- Run:
go run cmd/main.go
- Test:
- Create:
curl -X POST http://localhost:8080/validators -d '{"num_validators": 5, "fee_recipient": "0x1234567890abcdef1234567890abcdef12345678"}'
- Status:
curl http://localhost:8080/validators/{request_id}
- Health:
curl http://localhost:8080/health
- Metrics:
curl http://localhost:8080/metrics
- Create:
- Build:
docker build -t stakeway-backend:latest .
- Run:
docker run -p 8080:8080 stakeway-backend:latest
- Apply YAMLs:
kubectl apply -f kubernetes/deployment.yaml kubectl apply -f kubernetes/service.yaml kubectl apply -f kubernetes/postgresql.yaml kubectl apply -f kubernetes/grafana.yaml kubectl apply -f kubernetes/alertmanager.yaml kubectl apply -f kubernetes/prometheus-alert-rules.yaml
- Access:
- API: Use
stakeway-backend
service's external IP. - Grafana:
http://<grafana-service-ip>:3000
- Alertmanager:
http://<alertmanager-service-ip>:9093
- API: Use
- Dependencies:
go get github.com/ethereum/go-ethereum
- Run:
go run blockchain/main.go
- Follow: Query balance, simulate staking, log transaction hash.
- API Documentation:
/docs/Api_Documentation.md
- Setup Instruction:
/docs/Setup_Instruction.md
- Test Coverage:
/docs/Test_Coverage.md
- Backend API for validator requests.
- Asynchronous task processing.
- Basic validation.
- Unit and integration tests.
- Kubernetes deployment with Prometheus/Grafana.
- Sepolia testnet integration.
- Health check and logging.