Skip to content

Add eth_subscribe and eth_unsubscribe support to IPC service #9503

@MqllR

Description

@MqllR

Description

Currently, the IPC service only supports regular JSON-RPC methods but does not support subscription methods (eth_subscribe and eth_unsubscribe), which are only available through the WebSocket service. This prevents applications connecting via IPC sockets from subscribing to events like new block headers, logs, pending transactions, and syncing status.

Problem

When attempting to call eth_subscribe via IPC:

echo '{"jsonrpc":"2.0","method":"eth_subscribe","params":["newHeads"],"id":1}' | nc -U /path/to/besu.ipc

The service returns:

{"jsonrpc":"2.0","id":1,"error":{"code":-32604,"message":"Method not enabled"}}

Benefits

  • Applications using IPC can subscribe to blockchain events without switching to WebSocket
  • Maintains consistency between IPC and WebSocket APIs
  • No breaking changes to existing functionality
  • Backward compatible

Implementation Notes

  • Subscription methods should only work for single requests, not batch requests
  • Connection cleanup is essential to prevent memory leaks
  • The implementation reuses existing subscription infrastructure from WebSocket service

Related

This enables use cases where applications prefer Unix domain sockets (IPC) for security and performance reasons but still need event subscription capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions