This guide explains how to send a custom message in the P2P network using Othentic Stack.
Custom Messaging
To enable the custom P2P messaging feature, Update the Aggregator or Attester node with the following option:
otnode run aggregator \ --json-rpc \ --json-rpc.custom-message-enabled
otnode run attester \ /ip4/127.0.0.1/tcp/9876/p2p/<BOOTSTRAP_NODE_ID> \ --json-rpc \ --json-rpc.custom-message-enabled
Submit the data to the p2p network using the sendCustomMessage RPC call. This is the format for the RPC call:
data
sendCustomMessage
{ "jsonrpc": "2.0", "method": "sendCustomMessage", "params": [<data>] // Raw data in bytes "id": 1 }
Accepts raw data in bytes format.
bytes
Define an endpoint (/p2p/message) that allows Operator nodes to trigger the custom logic. This endpoint should accept data as parameters.
/p2p/message
POST /p2p/message
POST
Headers
Content-Type
application/json
Body
string
Represents the data being sent
Last updated 7 months ago