LIGHTNING-SENDCUSTOMMSG(7)
π LIGHTNING-SENDCUSTOMMSG(7) β the sendcustommsg manual page, bestie edition
okay so this is the page for sendcustommsg, a low-level interface to send protocol messages to peers. yes it's giving "why would I ever touch this" energy, and honestly? correct. but let's get into it π
β¨ NAME β¨
sendcustommsg β a low-level interface to send protocol messages to peers π«Ά
πΈ SYNOPSIS πΈ
sendcustommsg node_id msg
π¦ DESCRIPTION π¦
so first thing, this command was added in v0.10.1, okay? historic.
The sendcustommsg RPC method lets you inject a custom message into the communication with the peer that has the given node_id. And like β lowkey important β this is intended as a low-level interface to implement custom protocol extensions on top of, not for direct use by end-users. it's a build-your-own-thing tool, not a casual little gadget π
On the receiving end, a plugin may implement the custommsg plugin hook and get notified about incoming messages, and it can allow additional unknown even types in their getmanifest response. cute, right? that's the whole ecosystem moment β¨
node_id(pubkey) β the node specified bynode_idmust be a peer, i.e. it must have a direct connection with the node receiving the RPC call, and that connection must be established. if you want a method to send arbitrary messages over multiple hops β including hops that do not understand the custom message β see thecreateonionandsendonionRPC methods instead, bestie. also: messages can only be injected if the connection is handled byopeningdorchanneld. Messages cannot be injected when the peer is handled byonchaindorclosingd, since these do not have a connection, or are synchronous daemons that do not handle spontaneous messages. so rude of them honestly πmsg(hex) β must be a hex encoded well-formed message, including the 2-byte type prefix, but excluding the length prefix, which will be added by the RPC method. The message types may not be one of the internally handled types, since that may cause issues with the internal state tracking of Core Lightning. We do (as of v23.11) allow sending of even types, but note that peers (as per the spec) will disconnect on receiving unknown even types. no cap, they will just leave π
π RETURN VALUE π
The method will validate the arguments and queue the message for delivery through the daemon that is currently handling the connection. Queuing provides best effort guarantees, and the message may not be delivered if the connection is terminated while the message is queued. The RPC method will return as soon as the message is queued. like, it's not waiting around for the whole handoff, it's got places to be π§
If any of the above limitations is not respected, the method returns an explicit error message stating the issue. On success, an object is returned, containing:
status(string) β information about where message was queued π
π AUTHOR π
Christian Decker decker.christian@gmail.com is mainly responsible. icon behavior, honestly π
β SEE ALSO β
π RESOURCES π
Main web site: https://github.com/ElementsProject/lightning
π₯ EXAMPLES π₯
Example 1:
Request:
$ lightning-cli sendcustommsg -k "node_id"="nodeid030303030303030303030303030303030303030303030303030303030303" "msg"="77770012"
{
"id": "example:sendcustommsg#1",
"method": "sendcustommsg",
"params": {
"node_id": "nodeid030303030303030303030303030303030303030303030303030303030303",
"msg": "77770012"
}
}
Response:
{
"status": "Message sent to connectd for delivery"
}
β οΈ reminder bestie: this is a low-level interface for building custom protocol extensions. It is not for direct use by end-users, the message types may not be one of the internally handled types, and peers will disconnect on receiving unknown even types. read the caveats, love them, respect them π«Ά
and that's the page!! this whole thing ships as part of Core Lightning v26.06.9, so like, go forth and inject responsibly πππ¦
π¦ where this page comes from
- nixpkgs unstable: clightning 26.06.9
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms