API Reference
Core Python APIs exposed by the Nawal platform. Everything below is importable from the blockchain and nawal packages.
MeshNetworkClient
Decentralized P2P communication for validators and federated participants.
from blockchain import MeshNetworkClient
client = MeshNetworkClient(
peer_id="validator-01", # unique peer identifier
listen_port=9090, # inbound connection port
blockchain_rpc="ws://localhost:9944",
private_key=None, # Ed25519; auto-generated if omitted
)
Methods
start()
Starts the client and begins listening for peers.
await client.start()
stop()
Gracefully shuts the client down.
await client.stop()
discover_peers()
Returns peers discovered from the on-chain validator registry.
peers = await client.discover_peers() # → List[PeerInfo]
announce_fl_round(...)
Announces a new federated learning round to the mesh.
await client.announce_fl_round(
round_id="round-42",
dataset_name="credit-model-v3",
target_participants=5,
deadline=3600, # seconds
min_stake=1000, # DALLA
reward_pool=50000, # DALLA
)
IdentityVerifier
Verifies a chain account's identity and reputation before it joins a round.
from blockchain import IdentityVerifier
verifier = IdentityVerifier(blockchain_rpc="ws://localhost:9944")
result = await verifier.verify_identity(account_id="r1...")
Returns verification status, display name, nationality, verification level, and a reputation score (0–100).
PayrollConnector
Builds privacy-preserving payroll submissions (see Payroll ZK).
from blockchain.payroll_connector import PayrollConnector
connector = PayrollConnector(node_url="ws://localhost:9944")
REST API
The Nawal service exposes an HTTP API (FastAPI). On the Ceiba testnet it is reachable through the shared reverse proxy at /api/nawal/:
curl https://testnet.belizechain.org/api/nawal/health
See the Testnet page for current endpoint availability.