Workflow Documentation
This document details the step-by-step workflows for various operations in the P2P network.
Node Initialization Flow
Message Exchange Flow
Peer Discovery Flow
Status Broadcasting Flow
Method Call Sequence
Node Startup
start()- Entry pointinitNode()- Initialize node configurationP2PNetwork.constructor()- Create network instanceP2PNetwork.start()- Start network servicessetupPubSub()- Initialize messagingregisterWithContract()- Register with blockchainstartDiscovery()- Begin peer discoverystartDHTMaintenance()- Start maintenance tasks
Message Handling
sendMessage()- Send a messagelookupPeerIdByAddress()- Find recipientsignMessage()- Sign the messagehandleAgentMessage()- Process incoming messageverifyMessage()- Verify signatureemit("message")- Notify application
Network Maintenance
broadcastStatus()- Share node statusupdateDHTRecords()- Update peer recordsannouncePresence()- Broadcast availabilityhandleStatusUpdate()- Process peer updatesstorePeerMapping()- Update peer mappings