Files
Jędrzej Stuczyński a21a01cf1a node families (#6715)
* start node families topic branch

* start node families topic branch

* initialise node families contract

* define contract storage

* registering new family in storage

* accepting family invitation

* add_pending_invitation

* revoke_pending_invitation

* remove_family_member

* reject_pending_invitation

* disband_family

* added unit tests for the storage methods

* added restriction on uniquness of family names

* update rustc version for node families contract common

* clippy

* basic queries by id

* query_families_paged

* change family membership storage and expose query for all members of a family

* queries for pending invitations

* queries for past invitations

* queries for past data per node

* queries for past family members

* query_past_members_for_node_paged

* queries for family by name and by owner

* fixup family name normalisation

* fixed incorrect lower bound for queries for past data

* implement contract and storage initialisation

* stubbing tx messages that are to be exposed by the contract

* handler for updating config

* removed partial fee return

* wip: create family

* move mixnet contract interaction traits to shared location

* store original family name alongside the normalised variant

* prevent family creation if owner has a node in another family

* try_disband_family

* try_invite_to_family + shared helpers

* try_revoke_family_invitation

* accept_family_invitation

* stub method for node unbonding

* try_reject_family_invitation

* unit tests for family name normalisation

* try_leave_family

* try_kick_from_family

* fix outdated comments and add paid fee event attribute

* feat: NMv3: leave family upon node unbonding

* NF contract handling of unbonding

* lints

* init node families contract when creating performance contract tester

* clippy

* avoid self-dep in the contract dev deps

* introduced client traits for interacting with the node families contract

* add node families contract to cache refresher

* added query for all node family members (globally) and started scaffolding nym-api caches

* docs and cache -> api conversion

* calculating average node age based on individual timestamps

* wire up node families cache

* http stubs

* filled in the implementation

* route tests + extracting shared code

* review fixes

* feat: expose family information for all dvpn gateway endpoints within NS API

* expose family information for explorer v3 route

* clippy

* review comments and optimise db family update

* feat: Node Families: expose stake information inside DVpnGateway

* chore: update lock files after rebase

* chore: sort workspace members

* explicitly require providing node families contract address for mixnet contract migration

* fix missing node families contract address env export

* dont swallow cache overwrite failures in fixture

* pin network-defaults rustc version due to contracts dep

* further version pinning

* chore: update mixnet contract schema
2026-05-19 10:36:20 +01:00
..
2026-05-19 10:36:20 +01:00
2025-02-11 12:07:15 +01:00
2025-07-22 15:25:43 +02:00

Nym Node Status API

The Node Status API serves information about individual nym-nodes in the Mixnet, such as which role they are operating in, statistics about them, services such as Network Requesters, as well as summaries of the state of the Mixnet.

We recommend that developers building applications such as explorers or analytics interfaces about the Mixnet run their own instance of the API, in order to promote a robust network of downstream services, and spread the load of API calls amongst as many endpoints as possible.

You can find build and operation instructions in the docs.

Database Support

The Node Status API supports both SQLite and PostgreSQL databases through Cargo feature flags:

  • SQLite (default): Lightweight, file-based database suitable for development and small deployments
  • PostgreSQL: Full-featured database recommended for production deployments

Building with Different Database Backends

# Build with SQLite (default)
cargo build --features sqlite --no-default-features

# Build with PostgreSQL
cargo build --features pg --no-default-features

Running Tests

# Test with SQLite
cargo test --features sqlite --no-default-features

# Test with PostgreSQL
make test-db  # This sets up a test PostgreSQL instance

Development Commands

The project includes a Makefile with helpful commands for both database backends:

# Check code compilation
make check-sqlite     # Check with SQLite
make check-pg        # Check with PostgreSQL

# Run clippy linter
make clippy-sqlite   # Lint with SQLite
make clippy-pg      # Lint with PostgreSQL
make clippy         # Run both

# PostgreSQL development
make dev-db         # Start a PostgreSQL instance for development
make prepare-pg     # Prepare SQLx offline cache for PostgreSQL

Implementation Details

The database abstraction is implemented using a query wrapper that automatically converts SQLite-style ? placeholders to PostgreSQL-style $1, $2, ... placeholders at runtime. This allows writing queries once using SQLite syntax while maintaining compatibility with both databases.

Key differences handled:

  • Placeholder syntax (? vs $1, $2, ...)
  • Type conversions (SQLite uses i64, PostgreSQL uses i32 for many fields)
  • SQL dialect differences (e.g., INSERT OR IGNORE vs ON CONFLICT DO NOTHING)
  • RETURNING clause behavior

For more details on PostgreSQL setup, see README_PG.md.