Othentic
  • Introduction
    • Introducing Othentic Stack
    • Use Cases
  • AVS Framework
    • Abstract
    • Quick Start
    • Othentic CLI
      • Key Management
      • Contracts Deployment
      • Operator Registration
      • AVS Logic Implementation
      • Operator Deposit
      • Node Operators
      • Rewards Distribution
      • P2P Config
        • Custom P2P Messaging
        • P2P Auth Layer
        • Metrics and Monitoring
        • Logging
        • Persistent storage
        • Latency
      • CLI Command Reference
    • Smart Contracts
      • AVS Governance
      • Attestation Center
      • Hooks
        • Task Logic
        • Operator Management
        • Rewards Fee Calculator
      • OBLS
      • Othentic Registry
      • Message Handlers
    • Othentic Consensus
      • Abstract
      • Task & Task Definitions
      • Leader Election
      • Proof of Task
      • Execution Service
      • Validation Service
      • Voting Power
      • Rewards and Penalties
      • Internal Tasks
    • FAQ
    • Supported Networks
    • Explainers
      • Networking
      • Multichain
      • Production Guidelines
      • Operator Allowlisting
      • Governance Multisig
  • External
    • AVS Examples
  • GitHub
  • Othentic Hub
Powered by GitBook
On this page
  • Overview
  • Usage
  • Implementation Details
  • Node Configuration
  • Validation Service Integration
  • Use cases
  • Leader Election in External Task Triggers
  • Node Management
  • Concerns and Mitigation Strategies
  • Potential for Spam and DDoS Attacks
  • Unvalidated Raw Bytes
  1. AVS Framework
  2. Othentic CLI
  3. P2P Config

Custom P2P Messaging

Empower your AVSs with flexible P2P messaging capabilities.

PreviousP2P ConfigNextP2P Auth Layer

Last updated 1 day ago

Overview

This enhancement introduces the ability to send custom P2P messages over the AVS network. It enables operators to publish arbitrary data as P2P messages and ensures seamless handling across all nodes in the network.


Usage

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

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


Implementation Details

Topic: othentic.p2p.custom_message

  • The new P2P topic othentic.p2p.custom_message is introduced to handle custom messages.

  • All nodes subscribe to this topic by default.

JSON-RPC Method: sendCustomMessage

Note: If the operator starts without the --json-rpc option, the custom messaging feature will not be available as the JSON-RPC Service will not be enabled.

  • Handler: Implemented in the JSON-RPC server.

  • Functionality:

    • Accepts raw data in bytes format.

    • Publishes the provided data to the othentic.p2p.custom_message topic.

Node Configuration

  • New Startup Option:

    • --json-rpc.custom-message-enabled

    • When enabled, it activates the sendCustomMessage RPC method.

Validation Service Integration

  • Endpoint: /p2p/message

  • Purpose: Receives and processes custom messages from the P2P network.

  • Behavior: Operator sends an HTTP POST request to this endpoint whenever a message is received on the othentic.p2p.custom_message topic.


Use cases

Leader Election in External Task Triggers

Node Management

Custom Messaging can be used to maintain a dynamic list of active nodes in the AVS network.

  • Whenever a node joins the network, it sends a Custom message announcing its presence.

  • Other nodes receive this message and update their internal databases with the new node's details.

  • This ensures that each operator maintains a real-time, up-to-date list of all other nodes in the network.


Concerns and Mitigation Strategies

Potential for Spam and DDoS Attacks

Since this feature allows sending arbitrary custom messages, malicious actors could exploit it to spam the P2P network with excessive messages, potentially leading to a Distributed Denial-of-Service (DDoS) scenario.

Recommendations:

  • Rate Limiting: Introduce rate limits for the sendCustomMessage method to reduce the risk of abuse.

  • Monitoring and Alerts: Implement monitoring to detect unusual activity patterns and respond to potential threats.

Unvalidated Raw Bytes

The custom messages are published as raw bytes without any validation or schema enforcement. This lack of validation poses a risk if the messages contain malformed or malicious content.

Recommendations:

  • Validation Responsibility: The AVS developers must implement robust validation and sanitization logic in the Validation Service to handle incoming messages from the /p2p/message endpoint.

  • Error Handling: Ensure that the Validation Service handles invalid or unexpected message content gracefully without affecting its stability.


For more details, refer to the .

Custom Messaging can be used to implement leadeLeader Election when an external API is triggered. Upon an external event, a node broadcasts a message request to the P2P network. All the nodes in the network receive this message and run the election algorithm. For implementation details, refer to the .

Leader election
Custom Messaging Implementation guide
Custom Messaging