Custom Messaging

This guide explains how to send a custom message in the P2P network using Othentic Stack.

Read More

1

Enable Custom Messaging

To enable the custom P2P messaging feature, Update the Aggregator or Attester node with the following option:

othentic-cli node aggregator \
    --json-rpc \
    --json-rpc.custom-message-enabled
othentic-cli node attester \
    /ip4/127.0.0.1/tcp/9876/p2p/<BOOTSTRAP_NODE_ID> \
    --json-rpc \
    --json-rpc.custom-message-enabled
2

Trigger custom message

Submit the data to the p2p network using the sendCustomMessage RPC call. This is the format for the RPC call:

{
  "jsonrpc": "2.0",
  "method": "sendCustomMessage",
  "params": [<data>] // Raw data in bytes
  "id": 1
}

Accepts raw data in bytes format.

3

Expose an API endpoint

Define an endpoint (/p2p/message) that allows Operator nodes to trigger the custom logic. This endpoint should accept data as parameters.

POST /p2p/message

Headers

Name
Value

Content-Type

application/json

Body

Parameter
Type
Description

data

string

Represents the data being sent

Last updated