feat: Add eth_subscribe and eth_unsubscribe support to IPC service#9504
Merged
macfarla merged 4 commits intobesu-eth:mainfrom Dec 2, 2025
Merged
feat: Add eth_subscribe and eth_unsubscribe support to IPC service#9504macfarla merged 4 commits intobesu-eth:mainfrom
macfarla merged 4 commits intobesu-eth:mainfrom
Conversation
macfarla
reviewed
Dec 1, 2025
| besuController.getProtocolManager().ethContext().getScheduler()); | ||
|
|
||
| final WebSocketMethodsFactory ipcMethodsFactory = | ||
| new WebSocketMethodsFactory(subscriptionManager, ipcMethods); |
Contributor
Author
There was a problem hiding this comment.
Tried without, but it turns out that this is what:
- enables the 2 methods for the service https://github.com/hyperledger/besu/blob/main/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/methods/WebSocketMethodsFactory.java#L36
- bind the subscription manager with the methods.
So unless we want to manage it in another way, I'd answer yes, it's necessary !
Contributor
There was a problem hiding this comment.
tagging this as #techdebt for later investigation, you've found a code smell: reactive methods are bound to a transport type, which is excessive coupling.
Signed-off-by: Mael Regnery <mael@mqli.fr>
56846d5 to
2cb9523
Compare
Signed-off-by: Mael Regnery <mael@mqli.fr>
3ee2f96 to
bf58fa7
Compare
macfarla
approved these changes
Dec 2, 2025
AliZDev-v0
pushed a commit
to AliZDev-v0/besu
that referenced
this pull request
Dec 10, 2025
…esu-eth#9504) * feat: Add eth_subscribe and eth_unsubscribe support to IPC service Signed-off-by: Mael Regnery <mael@mqli.fr> * add changelog note for subscription over IPC Signed-off-by: Mael Regnery <mael@mqli.fr> --------- Signed-off-by: Mael Regnery <mael@mqli.fr> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com> Signed-off-by: Ali Zhagparov <alijakparov.kz@gmail.com>
pinges
pushed a commit
to pinges/besu
that referenced
this pull request
Dec 15, 2025
…esu-eth#9504) * feat: Add eth_subscribe and eth_unsubscribe support to IPC service Signed-off-by: Mael Regnery <mael@mqli.fr> * add changelog note for subscription over IPC Signed-off-by: Mael Regnery <mael@mqli.fr> --------- Signed-off-by: Mael Regnery <mael@mqli.fr> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com> Signed-off-by: stefan.pingel@consensys.net <stefan.pingel@consensys.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add eth_subscribe and eth_unsubscribe support to IPC service
Description
This PR adds subscription support (
eth_subscribeandeth_unsubscribe) to the IPC service, enabling applications to subscribe to blockchain events over Unix domain sockets without requiring WebSocket connections.Motivation
Currently, subscription methods are only available through the WebSocket service. Applications using IPC sockets cannot subscribe to events like new block headers, logs, pending transactions, or syncing status. This limitation forces applications to maintain both IPC and WebSocket connections when they prefer IPC for security and performance reasons.
Changes
Core Implementation
JsonRpcIpcService.java:SubscriptionManagerparameter (backward compatible)JsonRpcRequesttoWebSocketRpcRequestwith connection ID for single requestsRunnerBuilder.java:eth_subscribe,eth_unsubscribe) to IPC usingWebSocketMethodsFactorySubscriptionManagerto IPC service when enabledjsonRpcIpcConfigurationTesting
JsonRpcIpcServiceTest.java:eth_subscriberequestseth_unsubscriberequestsUsage Example
Benefits
Testing
Related Issues
Closes #9503