rpc_command

rpc_command -- Hook for intercepting and modifying RPC commands

DESCRIPTION

The rpc_command hook allows a plugin to take over any RPC command.

You can optionally specify a filters array, containing the command names you want to intercept: without this, all commands will be sent to this hook. (added in v25.12)

The plugin receives the full JSON-RPC request and may choose to continue, replace the request, or return a custom result or error.

This is a chained hook: only the first plugin that modifies the request or response will take effect. Other plugins will then be ignored and a warning will be logged.

HOOK PAYLOAD

  • rpc_command (object): The original JSON-RPC request object.:
    • id (one of): The JSON-RPC request id.:
      • (string)
      • (number)
      • (null)
    • method (string): The RPC method name.
    • params (one of): The parameters passed to the RPC method.:
      • (object):
      • (array)
        • (any type)

HOOK RETURN

  • result (string, optional) (always "continue"): Indicates that lightningd should continue processing the RPC command normally.
  • replace (object, optional): Replaces the original JSON-RPC request with a new one.:
    • jsonrpc (string) (always "2.0"): The JSON-RPC version.
    • id (one of): The JSON-RPC request id.:
      • (string)
      • (number)
      • (null)
    • method (string): The RPC method name.
    • params (one of): The parameters passed to the RPC method.:
      • (object):
      • (array)
        • (any type)
  • return (object, optional): Returns a custom JSON-RPC response to the caller.:
    • result (object, optional): Custom result object to return to the caller.:
    • error (object, optional): Custom error object to return to the caller.:
      • code (integer): JSON-RPC error code.
      • message (string): Human-readable error message.

Core Lightning is Blockstream's open-source implementation of the Lightning Network optimised for performance. It is highly customizable through modular expandability.

© 2026 Core Lightning, a Blockstream project.
All rights reserved.

X Twitter Logo Streamline Icon: https://streamlinehq.com

X

The official Core Lightning X(Twitter) handle to follow project updates and announcements.

Github Logo 2 Streamline Icon: https://streamlinehq.com

Github

Github repository for source code, issues, and contributions. Visit our project here to explore or contibute.

Telegram

Community-driven telegram group where most of the node operators hang out. Go to https://t.me/lightningd to join.

Discord

Community-driven discord server where the devs flock together. Go to https://discord.gg/V6ay9yNhBQ to join.