Overview
Submission nodes:- Accept block submissions via HTTP API
- Validate and add blocks to the blockchain
- Announce new blocks to connected peers
- Synchronize with other nodes in the network
- Serve blockchain data through REST endpoints
Prerequisites
- Rust toolchain installed (1.70+)
- SQLite database support
- Network ports available for P2P and HTTP traffic
Setup Instructions
main_db = "sqlite://../../data/blockchain.db"
private_db = "sqlite://../../data/private.db"
http_addr = "127.0.0.1:9091"
node_addr = "127.0.0.1:9090"
[peers]
default = "127.0.0.1:9090"
See the Configuration page for detailed options.
Command Line Options
| Option | Description | Required |
|---|---|---|
--config <FILE> | Path to configuration file | Yes |
HTTP API Endpoints
The submission node exposes the following REST API endpoints at/api/v1:
Submit Block
Query Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/v1/block/{height} | GET | Get block by height |
/api/v1/positions | GET | List all positions |
/api/v1/parties | GET | List all political parties |
/api/v1/counties | GET | List all counties |
/api/v1/counties/{county}/constituencies | GET | List constituencies by county |
/api/v1/constituencies/{constituency}/wards | GET | List wards by constituency |
/api/v1/wards/{ward}/stations | GET | List polling stations by ward |
/api/v1/candidates/{position_type}/{area_id} | GET | List candidates by position and area |
apps/api/src/lib.rs:110-131
Environment Variables
| Variable | Description | Default |
|---|---|---|
RUST_LOG | Logging level (trace, debug, info, warn, error) | info |
Network Architecture
The submission node operates on two network interfaces:P2P Interface
- Handles blockchain protocol messages
- Connects to peer nodes for synchronization
- Announces new blocks to the network
- Default port: 9090
HTTP Interface
- Serves REST API for client applications
- Accepts block submissions
- Provides query endpoints for blockchain data
- Default port: 9091
Peer Management
Submission nodes automatically connect to configured peers on startup. Each peer connection is established asynchronously. Fromnodes/submission/src/main.rs:44-54:
Running Multiple Nodes
To run multiple submission nodes on the same machine, create separate configuration files: config1.toml:Monitoring
Monitor your submission node:Troubleshooting
Port Already in Use
If you see “Address already in use” errors:- Change the
http_addrandnode_addrin your config file - Ensure no other processes are using those ports
- Check with:
lsof -i :9090orlsof -i :9091
Database Connection Failed
- Verify database paths in config file are correct
- Ensure the data directory exists and has write permissions
- Create the directory:
mkdir -p data
Peer Connection Failed
- Verify peer addresses are reachable
- Check firewall settings
- Ensure peer nodes are running before starting your node
Next Steps
Observer Node
Learn about observer nodes
Configuration
Advanced configuration options