Skip to main content
An observer node connects to the Ubu-Block network to monitor and synchronize blockchain data without participating in block submission or verification. Observer nodes are ideal for read-only access to the network.

Overview

Observer nodes:
  • Connect to existing peers to receive blockchain updates
  • Synchronize blocks from the network
  • Provide read-only access to blockchain data
  • Do not submit or verify blocks
  • Require minimal resources compared to submission nodes

Prerequisites

  • Rust toolchain installed (1.70+)
  • Network access to at least one peer node
  • SQLite database support

Setup Instructions

1
Clone the Repository
2
git clone https://github.com/your-org/ubu-block.git
cd ubu-block
3
Build the Observer Node
4
cd nodes/observer
cargo build --release
5
Configure Database Connection
6
The observer node uses in-memory SQLite databases by default, but you can modify the source to use persistent storage.
7
Default configuration in nodes/observer/src/main.rs:80-81:
8
let chain_db = SqlitePool::connect_lazy("sqlite::memory:").unwrap();
let private_db = SqlitePool::connect_lazy("sqlite::memory:").unwrap();
9
Start the Observer Node
10
RUST_LOG=info cargo run --release
11
The node will automatically attempt to connect to the default peer at 127.0.0.1:9090.

Environment Variables

VariableDescriptionDefault
RUST_LOGLogging level (trace, debug, info, warn, error)info

Peer Configuration

By default, the observer node connects to a peer at 127.0.0.1:9090 as defined in nodes/observer/src/main.rs:78:
let peer_addr = "127.0.0.1:9090".parse().unwrap();
To connect to a different peer, modify the peer_addr value before building.

P2P Configuration

The observer node uses the default P2P configuration defined in crates/types/src/p2p.rs:102-112:
P2PConfig {
    max_peers: 50,
    ping_interval: Duration::from_secs(30),
    connection_timeout: Duration::from_secs(10),
    sync_batch_size: 100,
    max_message_size: 10 * 1024 * 1024, // 10MB
}

Initial Data

The observer node initializes with sample electoral data including:
  • Positions (MCA, Women Rep, MP, Senator, Governor, President)
  • Political parties (ODM, PNU)
  • Counties (Kiambu, Kisii)
  • Constituencies (Juja, Bonchari)
  • Wards (Kalimoni, Bomariba)
  • Polling stations
  • Candidates
This data is automatically inserted on startup as defined in nodes/observer/src/main.rs:8-75.

Monitoring

To monitor your observer node:
# View logs
RUST_LOG=debug cargo run --release

# Check database tables
sqlite3 blockchain.db ".tables"

Troubleshooting

Connection Failed

If the node cannot connect to peers:
  • Verify the peer address is correct and accessible
  • Check firewall settings
  • Ensure the peer node is running

Database Errors

For persistent storage, ensure:
  • SQLite is properly installed
  • The data directory has write permissions
  • Database file paths are absolute or relative to the correct directory

Next Steps

Submission Node

Learn how to run a submission node

Configuration

Explore advanced configuration options

Build docs developers (and LLMs) love