Observability, Tools, and Research for Nostr Protocol
Nostr is a decentralized protocol for censorship-resistant communication — no central servers, no gatekeepers, no single point of failure. We believe this openness is critical infrastructure for free speech and privacy, and it's worth protecting.
But decentralization creates new challenges. With thousands of independent relays and no central authority, fundamental questions emerge: How healthy is the network? Which relays can be trusted? How does information actually propagate? What are the real privacy guarantees?
BigBrotr exists to answer these questions — openly, for everyone.
Bring visibility to the invisible. The Nostr network has no central directory. We monitor thousands of relays continuously, making network dynamics transparent and understandable.
Empower individuals. Users shouldn't need to blindly trust relays. We provide data and tools so anyone can make informed decisions about where their content goes and who can see it.
Lower barriers for developers. Building on Nostr should be accessible. We create libraries and infrastructure that handle protocol complexity, so developers can focus on their applications.
Enable rigorous analysis. Decentralized networks need empirical study, not just theory. We provide datasets, methodologies, and reproducible tools for research.
Stay open. All our work is MIT-licensed. Anyone can deploy their own infrastructure, replicate our analyses, or build on top of our tools. No gatekeepers, no proprietary data, no vendor lock-in.
Use nostr-tools to build anything from simple bots to full-featured clients:
- Generate keypairs and manage identities
- Create, sign, and verify events
- Connect to relays with automatic reconnection
- Test relay capabilities (NIP-11, NIP-66) before trusting them
- Support both clearnet and Tor relays seamlessly
pip install nostr-toolsDeploy bigbrotr to monitor the network independently:
- Discover relays automatically from APIs and seed lists
- Track relay health with NIP-11/NIP-66 compliance testing
- Measure round-trip times and availability
- Synchronize events across multiple relays
- Archive the data you care about
You don't need to trust our data — you can generate your own.
Use relay-shadow-dvm to get personalized relay recommendations:
- Define your threat model (casual user to high-risk journalist)
- Get scored recommendations based on privacy, reliability, and censorship resistance
- Understand geographic diversity and jurisdiction implications
- Analyze your current relay setup for weaknesses
Explore our analysis notebooks to understand how Nostr actually works:
- Event distribution across relay types
- Relay health and uptime patterns
- Author activity and publishing behavior
- Event propagation and redundancy
Use our methodologies as a starting point for your own analysis.
Network Monitoring & Archiving Infrastructure · Documentation
A modular system for relay discovery, health monitoring, and event synchronization. Built with Python 3.9+ and PostgreSQL, designed for both analysis and production use.
Architecture
The system follows a three-layer architecture that separates concerns:
- Core Layer — Reusable components: async PostgreSQL connection pooling, database interface with stored procedures, structured logging, abstract service base classes
- Service Layer — Business logic: Initializer (database bootstrap), Finder (relay discovery), Monitor (health checking), Synchronizer (event collection)
- Implementation Layer — Deployment configurations with YAML configs, SQL schemas, Docker Compose orchestration
Key Features
- Relay discovery from multiple sources (APIs, seed lists, event scanning)
- NIP-11 and NIP-66 compliance testing with RTT measurements
- Multicore event synchronization using
aiomultiprocess - Full Tor support for .onion relay monitoring
- Incremental sync with per-relay timestamp tracking
- Content-addressed deduplication for efficient storage
Two Deployment Options
- BigBrotr — Full archival with complete event data (id, pubkey, created_at, kind, tags, content, sig)
- LilBrotr — Lightweight indexing without tags/content (~60% disk savings, same metadata)
Python asyncpg PostgreSQL 16+ PGBouncer Docker Compose Tor
Python Library for Nostr · API Documentation · PyPI
A comprehensive, production-ready library for building Nostr applications in Python.
pip install nostr-toolsCore Protocol
- Complete NIP-01 implementation
- Event creation, validation, signing, and verification
- Support for all event kinds (0-65535)
- Tag management with helper methods
Networking
- Async WebSocket client with automatic reconnection
- Real-time event streaming
- Multi-relay support with fallback strategies
- Built-in SOCKS5 proxy support for Tor
Relay Testing
- NIP-11 relay information document fetching
- NIP-66 capability testing (openable, readable, writable)
- RTT measurements for performance comparison
- Comprehensive relay metadata collection
Cryptography
- Secure key generation using
os.urandom() - Key format conversion (hex ↔ bech32)
- Schnorr signature creation and verification
- Proof-of-work event generation
Example
import asyncio
from nostr_tools import Client, Relay, generate_keypair, generate_event, Event
async def main():
private_key, public_key = generate_keypair()
event_data = generate_event(
private_key=private_key,
public_key=public_key,
kind=1,
content="Hello from nostr-tools!"
)
relay = Relay("wss://relay.damus.io")
async with Client(relay) as client:
success = await client.publish(Event.from_dict(event_data))
print(f"Published: {success}")
asyncio.run(main())Python 3.9+ aiohttp aiohttp-socks secp256k1 bech32
Privacy-Focused Relay Recommendations
A Data Vending Machine (NIP-90) that provides intelligent relay recommendations based on real network data from BigBrotr's monitoring infrastructure.
Built for Bitcoin++ Privacy Edition Hackathon 2025
The Problem
Nostr users face a paradox: the protocol is designed for censorship resistance, but choosing the wrong relays can undermine privacy and reliability. With thousands of relays available, users lack the information to make good choices.
The Solution
Relay Shadow analyzes comprehensive relay data to provide personalized recommendations:
- Threat Model Analysis — Recommendations scaled from casual privacy to nation-state adversary protection
- Privacy Scoring — No-log policies, Tor support, jurisdiction analysis
- Censorship Resistance — Geographic diversity, network independence, uptime history
- Social Graph Integration — Find relays used by people you follow
- Current Setup Analysis — Identify weaknesses in your existing relay configuration
How It Works
- User submits a request via Nostr DVM protocol (kind 5600)
- DVM queries BigBrotr's relay analytics database
- Scoring algorithms evaluate relays against user's criteria
- Personalized recommendations returned as Nostr events
Node.js PostgreSQL NIP-90
Network Analysis Notebooks
Jupyter notebooks and Python scripts for analyzing Nostr network data collected by BigBrotr.
Available Analyses
| Notebook | Description |
|---|---|
database_overview |
Database statistics, table sizes, storage metrics |
events_overview |
Event kind distribution, temporal patterns, content analysis |
relays_overview |
Relay health trends, uptime statistics, capability distribution |
pubkeys_analysis |
Author activity patterns, publishing behavior, relay preferences |
events_relays_overview |
Event propagation, relay coverage, redundancy analysis |
Use Cases
- Understand how events propagate across the network
- Identify reliable vs. unreliable relays over time
- Study user behavior and relay selection patterns
- Generate visualizations for papers and presentations
- Validate assumptions about decentralized networks
Jupyter pandas matplotlib seaborn
Documentation Site
Source code for bigbrotr.com, the official documentation for all BigBrotr projects.
Contents
- Architecture overview and design patterns
- Service configuration guides
- Database schema reference (tables, views, stored procedures)
- Deployment instructions (Docker, manual)
- API documentation
- Contributing guidelines
Astro Starlight MDX Vercel
git clone https://github.com/bigbrotr/bigbrotr.git
cd bigbrotr/implementations/bigbrotr
cp .env.example .env
# Edit .env to set DB_PASSWORD
docker-compose up -dpip install nostr-toolsfrom nostr_tools import Client, Relay, generate_keypair
async with Client(Relay("wss://relay.damus.io")) as client:
print(f"Connected: {client.is_connected}")- Infrastructure: bigbrotr.com
- Python Library: bigbrotr.github.io/nostr-tools
BigBrotr provides infrastructure specifically designed for empirical analysis of decentralized networks.
Available Data
- Event archives with temporal relay provenance (which relay, when seen)
- Relay health metrics over time (uptime, RTT, capabilities)
- NIP-11/NIP-66 metadata snapshots
- Network topology data
Applications
- Censorship resistance analysis
- Information propagation studies
- Relay reliability and performance benchmarking
- Social network analysis on decentralized protocols
- Privacy and metadata leakage research
Open Datasets
We're working on publishing anonymized datasets. Follow our repositories for updates.
Citing BigBrotr
@misc{imperati2025bigbrotr,
author = {Imperati, Vincenzo},
title = {BigBrotr: Open Infrastructure for the Nostr Decentralized Network},
year = {2025},
url = {https://github.com/bigbrotr}
}All BigBrotr projects are MIT-licensed and welcome contributions.
- Report bugs and suggest features via GitHub Issues
- Submit pull requests for code improvements
- Improve documentation
- Share analysis conducted with our tools
- Deploy independent monitoring nodes
See each repository's CONTRIBUTING.md for specific guidelines.