A high-performance Ethereum JSON-RPC facade that provides a Geth-compatible API interface with support for multiple blockchain backends.
- Geth Compatibility: 95% compatible with official Geth JSON-RPC API
- Modern Ethereum Support: EIP-1559, EIP-2930, EIP-4844, EIP-4895
- High Performance: Built with Gin framework for optimal HTTP handling
- WebSocket Support: Real-time subscriptions for blockchain events
- Multiple Backends: Support for custom blockchain implementations
- Health Monitoring: Built-in health and readiness checks
- Comprehensive Testing: Full test suite with CI/CD support
jmdt-geth-facade/
โโโ Types/ # Data structures and type definitions
โโโ Services/ # Business logic and service implementations
โโโ Tests/ # Testing scripts and documentation
โโโ Scripts/ # Deployment scripts and examples
โโโ main.go # Application entry point
โโโ README.md # This file
- Types/: Core data structures that mirror Geth's implementation
- Services/: HTTP/WebSocket servers, handlers, and backend implementations
- Tests/: Comprehensive testing scripts for all functionality
- Scripts/: Docker configuration and example implementations
- Go 1.19 or later
- Git
git clone https://github.com/jupitermetalabs/jmdt-geth-facade.git
cd jmdt-geth-facade
go build -o jmdt-geth-facadedocker build -t jmdt-geth-facade .
docker run -p 8545:8545 -p 8546:8546 jmdt-geth-facade# Start with default settings (memory backend)
./jmdt-geth-facade
# Start with custom ports
./jmdt-geth-facade -http ":8545" -ws ":8546"
# Start with custom chain ID
./jmdt-geth-facade -chainid "0xaa36a7"# Health check
curl http://localhost:8545/health
# Get chain ID
curl -X POST http://localhost:8545/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
# Get latest block
curl -X POST http://localhost:8545/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":2}'web3_clientVersion- Client version informationnet_version- Network versioneth_chainId- Chain IDeth_blockNumber- Latest block number
eth_getBlockByNumber- Get block by numbereth_getBlockByHash- Get block by hasheth_getBlockTransactionCountByNumber- Transaction count by block numbereth_getBlockTransactionCountByHash- Transaction count by block hash
eth_getBalance- Get account balanceeth_getCode- Get contract codeeth_getStorageAt- Get storage valueeth_getTransactionCount- Get nonce
eth_gasPrice- Get gas priceeth_estimateGas- Estimate gas usageeth_call- Execute calleth_sendRawTransaction- Send raw transactioneth_getTransactionByHash- Get transaction by hasheth_getTransactionReceipt- Get transaction receipt
net_peerCount- Peer countnet_listening- Listening statuseth_syncing- Sync status
eth_mining- Mining statuseth_hashrate- Hash rate
eth_getUncleCountByBlockNumber- Uncle count by block numbereth_getUncleCountByBlockHash- Uncle count by block hasheth_getUncleByBlockNumberAndIndex- Get uncle by block number and indexeth_getUncleByBlockHashAndIndex- Get uncle by block hash and index
eth_getLogs- Get event logs
eth_subscribe- Subscribe to eventseth_unsubscribe- Unsubscribe from events
newHeads- New block headerslogs- Event logspendingTransactions- Pending transactions
# Basic API tests
./Tests/test-basic.sh
# Comprehensive tests (requires Python)
./Tests/test-apis.sh
# WebSocket tests
./Tests/test-websocket.sh
# CI/CD tests
./Tests/test-ci.sh- โ All JSON-RPC methods
- โ Error handling scenarios
- โ WebSocket functionality
- โ Performance testing
- โ Health monitoring
HTTP_PORT- HTTP server port (default: 8545)WS_PORT- WebSocket server port (default: 8546)LOG_LEVEL- Logging level (debug, info, warn, error)BACKEND_TYPE- Backend type (memory, custom)
-http- HTTP listen address (default: :8545)-ws- WebSocket listen address (default: :8546)-chainid- Chain ID in hex or decimal (default: 11155111)
The facade uses a pluggable backend architecture:
type Backend interface {
// Basic info
ClientVersion(ctx context.Context) (string, error)
ChainID(ctx context.Context) (*big.Int, error)
BlockNumber(ctx context.Context) (*big.Int, error)
// Block operations
BlockByNumber(ctx context.Context, num *big.Int, fullTx bool) (*Block, error)
BlockByHash(ctx context.Context, hash []byte, fullTx bool) (*Block, error)
// Account operations
Balance(ctx context.Context, addr []byte, block *big.Int) (*big.Int, error)
GetCode(ctx context.Context, addr []byte, block *big.Int) ([]byte, error)
// ... and more
}All data structures mirror the official Geth implementation:
- Block: Complete block with header, transactions, ommers, withdrawals
- BlockHeader: Detailed header with all Ethereum fields
- Transaction: Comprehensive transaction with EIP support
- Receipt: Transaction receipt with logs and status
- Log: Event log with topics and data
See Scripts/examples/custom-backend/ for a complete example of implementing a custom backend.
- HTTP Throughput: 10,000+ requests/second
- WebSocket Connections: 1,000+ concurrent connections
- Memory Usage: < 50MB baseline
- Response Time: < 1ms for cached operations
- CORS Support: Configurable cross-origin resource sharing
- Input Validation: Comprehensive input sanitization
- Error Handling: Secure error responses without information leakage
- Rate Limiting: Planned for future releases
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
- Use standardized comments:
//debugging,//future,//test,//conversions - Follow Go best practices
- Include comprehensive tests
- Update documentation
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: See individual folder README files
- Issues: GitHub Issues for bug reports and feature requests
- Testing: Use the comprehensive test suite in
Tests/
- Rate Limiting: API rate limiting and throttling
- Authentication: JWT-based authentication
- Metrics: Prometheus metrics integration
- Caching: Redis-based response caching
- Load Balancing: Multiple backend support
- Monitoring: Grafana dashboards
- v1.0.0: Initial release with Geth-compatible API
- v1.1.0: Added Gin framework and WebSocket support
- v1.2.0: Restructured codebase with standardized organization
Note: This is a development/testing tool. For production use, implement proper security measures and use a real blockchain backend.