- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
240 lines
5.4 KiB
Markdown
240 lines
5.4 KiB
Markdown
# API Method Support Update - Complete
|
|
|
|
**Date**: 2026-01-05
|
|
**Status**: ✅ **COMPLETE**
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
Updated the RPC Translator to fully support both **public network** and **private network** Besu API methods, based on the official Besu documentation:
|
|
|
|
- [Besu Public Networks API Reference](https://besu.hyperledger.org/public-networks/reference/api)
|
|
- [Besu Private Networks API Reference](https://besu.hyperledger.org/private-networks/reference/api)
|
|
|
|
---
|
|
|
|
## Changes Made
|
|
|
|
### 1. RPC Handler Updates
|
|
|
|
**File**: `src/handlers/rpc-handler.ts`
|
|
|
|
- **Separated** private network methods from denied methods
|
|
- **Added** `PRIVATE_NETWORK_METHODS` constant (CLIQUE, IBFT, QBFT, PERM)
|
|
- **Made** private network methods configurable (default: enabled)
|
|
- **Improved** error messages for denied methods
|
|
|
|
**Before:**
|
|
```typescript
|
|
const DENIED_METHODS = [
|
|
'admin_',
|
|
'debug_',
|
|
'txpool_',
|
|
'miner_',
|
|
'clique_', // ❌ Denied
|
|
'ibft_', // ❌ Denied
|
|
'qbft_', // ❌ Denied
|
|
'perm_', // ❌ Denied
|
|
];
|
|
```
|
|
|
|
**After:**
|
|
```typescript
|
|
const DENIED_METHODS = [
|
|
'admin_',
|
|
'debug_',
|
|
'txpool_',
|
|
'miner_',
|
|
];
|
|
|
|
const PRIVATE_NETWORK_METHODS = [
|
|
'clique_', // ✅ Allowed (configurable)
|
|
'ibft_', // ✅ Allowed (configurable)
|
|
'qbft_', // ✅ Allowed (configurable)
|
|
'perm_', // ✅ Allowed (configurable)
|
|
];
|
|
```
|
|
|
|
### 2. Configuration Updates
|
|
|
|
**File**: `src/config.ts`
|
|
|
|
- **Added** `allowPrivateNetworkMethods` to Config interface
|
|
- **Default**: `true` (private network methods enabled)
|
|
- **Configurable** via `ALLOW_PRIVATE_NETWORK_METHODS` environment variable
|
|
|
|
**File**: `env.template`
|
|
|
|
- **Added** `ALLOW_PRIVATE_NETWORK_METHODS=true` configuration option
|
|
|
|
### 3. Main Application Updates
|
|
|
|
**File**: `src/main.ts`
|
|
|
|
- **Updated** RPC handler instantiation to pass `allowPrivateNetworkMethods` flag
|
|
|
|
### 4. Documentation Updates
|
|
|
|
**Created**: `API_METHODS_SUPPORT.md`
|
|
|
|
- Complete reference for all supported API methods
|
|
- Public network methods documentation
|
|
- Private network methods documentation (CLIQUE, IBFT, QBFT, PERM)
|
|
- Configuration options
|
|
- Examples and testing instructions
|
|
|
|
**Updated**: `README.md`
|
|
|
|
- Added information about private network method support
|
|
- Links to Besu API documentation
|
|
- Configuration instructions
|
|
|
|
---
|
|
|
|
## Supported Methods
|
|
|
|
### Public Network Methods ✅
|
|
|
|
All standard Ethereum JSON-RPC methods:
|
|
- `eth_*` - All standard Ethereum methods
|
|
- `net_*` - Network methods
|
|
- `web3_*` - Web3 utility methods
|
|
- `eth_subscribe` / `eth_unsubscribe` - WebSocket subscriptions
|
|
|
|
### Private Network Methods ✅ (Enabled by Default)
|
|
|
|
- **CLIQUE**: `clique_*` - Proof of Authority consensus
|
|
- **IBFT 2.0**: `ibft_*` - IBFT consensus
|
|
- **QBFT**: `qbft_*` - QBFT consensus
|
|
- **PERM**: `perm_*` - Permissioning (accounts/nodes allowlist)
|
|
|
|
### Intercepted Methods ✅
|
|
|
|
- `eth_sendTransaction` - Automatically signed and converted to `eth_sendRawTransaction`
|
|
|
|
### Denied Methods ❌ (Security)
|
|
|
|
- `admin_*` - Admin methods
|
|
- `debug_*` - Debug methods
|
|
- `txpool_*` - Transaction pool methods
|
|
- `miner_*` - Miner control methods
|
|
|
|
---
|
|
|
|
## Configuration
|
|
|
|
### Enable Private Network Methods (Default)
|
|
|
|
```bash
|
|
ALLOW_PRIVATE_NETWORK_METHODS=true
|
|
```
|
|
|
|
### Disable Private Network Methods
|
|
|
|
```bash
|
|
ALLOW_PRIVATE_NETWORK_METHODS=false
|
|
```
|
|
|
|
---
|
|
|
|
## Examples
|
|
|
|
### Public Network Method
|
|
|
|
```bash
|
|
curl -X POST http://192.168.11.240:9545 \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{
|
|
"jsonrpc": "2.0",
|
|
"method": "eth_chainId",
|
|
"params": [],
|
|
"id": 1
|
|
}'
|
|
```
|
|
|
|
### Private Network Method (CLIQUE)
|
|
|
|
```bash
|
|
curl -X POST http://192.168.11.240:9545 \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{
|
|
"jsonrpc": "2.0",
|
|
"method": "clique_getSigners",
|
|
"params": ["latest"],
|
|
"id": 1
|
|
}'
|
|
```
|
|
|
|
### Private Network Method (Permissioning)
|
|
|
|
```bash
|
|
curl -X POST http://192.168.11.240:9545 \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{
|
|
"jsonrpc": "2.0",
|
|
"method": "perm_getAccountsAllowlist",
|
|
"params": [],
|
|
"id": 1
|
|
}'
|
|
```
|
|
|
|
---
|
|
|
|
## Testing
|
|
|
|
### Test Private Network Method
|
|
|
|
```bash
|
|
# Test CLIQUE method
|
|
curl -X POST http://192.168.11.240:9545 \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"jsonrpc":"2.0","method":"clique_getSigners","params":["latest"],"id":1}'
|
|
|
|
# Test Permissioning method
|
|
curl -X POST http://192.168.11.240:9545 \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"jsonrpc":"2.0","method":"perm_getAccountsAllowlist","params":[],"id":1}'
|
|
```
|
|
|
|
---
|
|
|
|
## Deployment
|
|
|
|
The updated code has been:
|
|
- ✅ Built successfully
|
|
- ✅ Configuration updated in `env.template`
|
|
- ✅ Ready for deployment
|
|
|
|
To deploy the update:
|
|
|
|
```bash
|
|
cd /home/intlc/projects/proxmox/rpc-translator-138
|
|
./scripts/deploy-all-vmids.sh
|
|
```
|
|
|
|
Or manually:
|
|
1. Build: `pnpm run build`
|
|
2. Copy updated files to VMIDs
|
|
3. Restart services: `systemctl restart rpc-translator-138.service`
|
|
|
|
---
|
|
|
|
## References
|
|
|
|
- [Besu Public Networks API](https://besu.hyperledger.org/public-networks/reference/api)
|
|
- [Besu Private Networks API](https://besu.hyperledger.org/private-networks/reference/api)
|
|
- `API_METHODS_SUPPORT.md` - Complete method reference
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
✅ **Public Network Methods**: Fully supported
|
|
✅ **Private Network Methods**: Enabled by default
|
|
✅ **Configuration**: Configurable via environment variable
|
|
✅ **Documentation**: Complete API reference created
|
|
✅ **Backward Compatible**: Existing functionality preserved
|
|
|
|
The RPC Translator now fully supports both public and private network Besu API methods!
|