lightning-commando

lightning-commando -- Command to Send a Command to a Remote Peer

SYNOPSIS

commando peer_id method [params] [rune] [filter]

DESCRIPTION

The commando RPC command is a homage to bad 80s movies. It also sends a directly-connected peer_id a custom message, containing a request to run method (with an optional dictionary of params); generally the peer will only allow you to run a command if it has provided you with a rune which allows it.

  • peer_id (pubkey): Peer to command.
  • method (string): Method to invoke on peer.
  • params (one of, optional):
    • (array): Array of positional parameters.
    • (object): Parameters for method.:
  • rune (string, optional): Rune to authorize the command.
  • filter (object, optional): Filter to peer to apply to any successful result.:

RETURN VALUE

On success, the return depends on the method invoked.

ERRORS

On failure, one of the following error codes may be returned:

  • -32600: Usually means peer is not connected
  • 19535: the local commando plugin discovered an error.
  • 19536: the remote commando plugin discovered an error.
  • 19537: the remote commando plugin said we weren't authorized.

It can also fail if the peer does not respond, in which case it will simply hang awaiting a response.

AUTHOR

Rusty Russell <[email protected]> wrote the original Python commando.py plugin, the in-tree commando plugin, and this manual page.

Christian Decker came up with the name "commando", which almost excuses his previous adoption of the name "Eltoo".

SEE ALSO

lightning-commando-rune(7)

RESOURCES

Main web site: https://github.com/ElementsProject/lightning

EXAMPLES

Example 1:

Request:

lightning-cli commando -k "peer_id"="nodeid020202020202020202020202020202020202020202020202020202020202" "rune"="zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA==" "method"="newaddr" "params"='{"addresstype": "p2tr"}'
{
  "id": "example:commando#1",
  "method": "commando",
  "params": {
    "peer_id": "nodeid020202020202020202020202020202020202020202020202020202020202",
    "rune": "zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA==",
    "method": "newaddr",
    "params": {
      "addresstype": "p2tr"
    }
  }
}

Response:

{
  "p2tr": "bcrt1p338x07070707070707070707070707070707070707070707070707070707"
}

Example 2:

Request:

lightning-cli commando -k "peer_id"="nodeid020202020202020202020202020202020202020202020202020202020202" "rune"="RXgu0DD_i0wSPEZkIDyZIWL0bSAGdhvJ_GHOQdTg04A9MSZpZF4wMjY2ZTQ1OThkMWQzYzQxNWY1NyZtZXRob2Q9bGlzdHBlZXJz" "method"="listpeers" "params"='["nodeid030303030303030303030303030303030303030303030303030303030303"]'
{
  "id": "example:commando#2",
  "method": "commando",
  "params": {
    "peer_id": "nodeid020202020202020202020202020202020202020202020202020202020202",
    "rune": "RXgu0DD_i0wSPEZkIDyZIWL0bSAGdhvJ_GHOQdTg04A9MSZpZF4wMjY2ZTQ1OThkMWQzYzQxNWY1NyZtZXRob2Q9bGlzdHBlZXJz",
    "method": "listpeers",
    "params": [
      "nodeid030303030303030303030303030303030303030303030303030303030303"
    ]
  }
}

Response:

{
  "peers": [
    {
      "id": "nodeid030303030303030303030303030303030303030303030303030303030303",
      "connected": true,
      "num_channels": 2,
      "netaddr": [
        "127.0.0.1:19736"
      ],
      "features": "08a0882a8a59a1"
    }
  ]
}

Example 3:

Request:

lightning-cli commando -k "peer_id"="nodeid020202020202020202020202020202020202020202020202020202020202" "rune"="QUJEYMLGgiaJvMDv_MhR2hiMKIBTbq-PrL-KxcIlirQ9MiZtZXRob2Q9cGF5JnBuYW1lYW1vdW50bXNhdDwxMDAwMA==" "method"="pay" "params"='{"bolt11": "lnbcrt100n1pnt2bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000", "amount_msat": 9900}'
{
  "id": "example:commando#3",
  "method": "commando",
  "params": {
    "peer_id": "nodeid020202020202020202020202020202020202020202020202020202020202",
    "rune": "QUJEYMLGgiaJvMDv_MhR2hiMKIBTbq-PrL-KxcIlirQ9MiZtZXRob2Q9cGF5JnBuYW1lYW1vdW50bXNhdDwxMDAwMA==",
    "method": "pay",
    "params": {
      "bolt11": "lnbcrt100n1pnt2bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000bolt11invl020300000000",
      "amount_msat": 9900
    }
  }
}

Response:

{
  "destination": "nodeid020202020202020202020202020202020202020202020202020202020202",
  "payment_hash": "paymenthashcmdpycp10cp10cp10cp10cp10cp10cp10cp10cp10cp10cp10cp10",
  "created_at": 1738000000,
  "parts": 1,
  "amount_msat": 9900,
  "amount_sent_msat": 9900,
  "payment_preimage": "paymentpreimagec010101010101010101010101010101010101010101010101",
  "status": "complete"
}

Core Lightning (previously c-lightning) is a lightweight, highly customizable and standard compliant implementation of the Lightning Network protocol.

© 2023 Core Lightning
All rights reserved.

Discussion Forum

The official Core Lightning forum is hosted at discuss.corelightning.org

BuildonL2 Community

The official BuildOnL2 community lives at community.corelightning.org. Join us and build the future of bitcoin on lightning.

Mailing List

For general discussions about CLN implementation, use [email protected]. For the Lightning Network, use [email protected]

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/w27fMFESMN to join.

Internet Relay Chat

Don't hesitate to reach out to us on IRC at #lightning-dev @ libera.chat, #c-lightning @ libera.chat.