{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "added": "v23.08",
  "rpc": "showrunes",
  "title": "Command to list previously generated runes",
  "description": [
    "The **showrunes** RPC command either lists runes that we stored as we generate them (see lightning-createrune(7)) or decodes the rune given on the command line."
  ],
  "request": {
    "required": [],
    "additionalProperties": false,
    "properties": {
      "rune": {
        "type": "string",
        "description": [
          "If specified, only details of that rune will be returned."
        ]
      }
    }
  },
  "response": {
    "required": [
      "runes"
    ],
    "additionalProperties": false,
    "properties": {
      "runes": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "rune",
            "unique_id",
            "restrictions",
            "restrictions_as_english"
          ],
          "properties": {
            "rune": {
              "type": "string",
              "description": [
                "Base64 encoded rune."
              ]
            },
            "unique_id": {
              "type": "string",
              "description": [
                "Unique id assigned when the rune was generated; this is always a u64 for commando runes."
              ]
            },
            "restrictions": {
              "type": "array",
              "description": [
                "The restrictions on what commands this rune can authorize."
              ],
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "alternatives",
                  "english"
                ],
                "properties": {
                  "alternatives": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "fieldname",
                        "value",
                        "condition",
                        "english"
                      ],
                      "properties": {
                        "fieldname": {
                          "type": "string",
                          "description": [
                            "The field this restriction applies to; see commando-rune(7)."
                          ]
                        },
                        "value": {
                          "type": "string",
                          "description": [
                            "The value accepted for this field."
                          ]
                        },
                        "condition": {
                          "type": "string",
                          "description": [
                            "The way to compare fieldname and value."
                          ]
                        },
                        "english": {
                          "type": "string",
                          "description": [
                            "English readable description of this alternative."
                          ]
                        }
                      }
                    }
                  },
                  "english": {
                    "type": "string",
                    "description": [
                      "English readable summary of alternatives above."
                    ]
                  }
                }
              }
            },
            "restrictions_as_english": {
              "type": "string",
              "description": [
                "English readable description of the restrictions array above."
              ]
            },
            "stored": {
              "type": "boolean",
              "enum": [
                false
              ],
              "description": [
                "This is false if the rune does not appear in our datastore (only possible when `rune` is specified)."
              ]
            },
            "blacklisted": {
              "type": "boolean",
              "enum": [
                true
              ],
              "description": [
                "The rune has been blacklisted; see commando-blacklist(7)."
              ]
            },
            "last_used": {
              "type": "number",
              "description": [
                "The last time this rune was successfully used."
              ],
              "added": "v23.11"
            },
            "our_rune": {
              "type": "boolean",
              "enum": [
                false
              ],
              "description": [
                "This is not a rune for this node (only possible when `rune` is specified)."
              ]
            }
          }
        }
      }
    }
  },
  "author": [
    "Shahana Farooqui [sfarooqui@blockstream.com](mailto:sfarooqui@blockstream.com) is mainly responsible."
  ],
  "see_also": [
    "lightning-commando-showrunes(7)",
    "lightning-blacklistrune(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:showrunes#1",
        "method": "showrunes",
        "params": {
          "rune": "zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA=="
        }
      },
      "response": {
        "runes": [
          {
            "rune": "zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA==",
            "last_used": 1738000000,
            "unique_id": "0",
            "restrictions": [],
            "restrictions_as_english": ""
          }
        ]
      }
    },
    {
      "request": {
        "id": "example:showrunes#2",
        "method": "showrunes",
        "params": {}
      },
      "response": {
        "runes": [
          {
            "rune": "zFMd1fjhrAYxUeFA54TjloZqOt8JrA_i_nYwIgXkag49MA==",
            "last_used": 1738000000,
            "unique_id": "0",
            "restrictions": [],
            "restrictions_as_english": ""
          },
          {
            "rune": "RXgu0DD_i0wSPEZkIDyZIWL0bSAGdhvJ_GHOQdTg04A9MSZpZF4wMjY2ZTQ1OThkMWQzYzQxNWY1NyZtZXRob2Q9bGlzdHBlZXJz",
            "last_used": 1738000000,
            "unique_id": "1",
            "restrictions": [
              {
                "alternatives": [
                  {
                    "fieldname": "id",
                    "value": "0266e4598d1d3c415f57",
                    "condition": "^",
                    "english": "id starts with 0266e4598d1d3c415f57"
                  }
                ],
                "english": "id starts with 0266e4598d1d3c415f57"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "listpeers",
                    "condition": "=",
                    "english": "method equal to listpeers"
                  }
                ],
                "english": "method equal to listpeers"
              }
            ],
            "restrictions_as_english": "id starts with 0266e4598d1d3c415f57 AND method equal to listpeers"
          },
          {
            "rune": "QUJEYMLGgiaJvMDv_MhR2hiMKIBTbq-PrL-KxcIlirQ9MiZtZXRob2Q9cGF5JnBuYW1lYW1vdW50bXNhdDwxMDAwMA==",
            "last_used": 1738000000,
            "unique_id": "2",
            "restrictions": [
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "pay",
                    "condition": "=",
                    "english": "method equal to pay"
                  }
                ],
                "english": "method equal to pay"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "pnameamountmsat",
                    "value": "10000",
                    "condition": "<",
                    "english": "pnameamountmsat < 10000"
                  }
                ],
                "english": "pnameamountmsat < 10000"
              }
            ],
            "restrictions_as_english": "method equal to pay AND pnameamountmsat < 10000"
          },
          {
            "rune": "jEx3l0c7NMZPSDYT7xnXXvNA83z5PDNBHRQTIk1BwNw9MyZpZD0wMjY2ZTQ1OThkMWQzYzQxNWY1NzJhODQ4ODgzMGI2MGY3ZTc0NGVkOTIzNWViMGIxYmE5MzI4M2IzMTVjMDM1MTgmbWV0aG9kPWxpc3RwZWVycyZwbnVtPTEmcG5hbWVpZD0wMjY2ZTQ1OThkMWQzYzQxNWY1NzJhODQ4ODgzMGI2MGY3ZTc0NGVkOTIzNWViMGIxYmE5MzI4M2IzMTVjMDM1MTh8cGFycjA9MDI2NmU0NTk4ZDFkM2M0MTVmNTcyYTg0ODg4MzBiNjBmN2U3NDRlZDkyMzVlYjBiMWJhOTMyODNiMzE1YzAzNTE4",
            "unique_id": "3",
            "restrictions": [
              {
                "alternatives": [
                  {
                    "fieldname": "id",
                    "value": "nodeid010101010101010101010101010101010101010101010101010101010101",
                    "condition": "=",
                    "english": "id equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
                  }
                ],
                "english": "id equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "listpeers",
                    "condition": "=",
                    "english": "method equal to listpeers"
                  }
                ],
                "english": "method equal to listpeers"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "pnum",
                    "value": "1",
                    "condition": "=",
                    "english": "pnum equal to 1"
                  }
                ],
                "english": "pnum equal to 1"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "pnameid",
                    "value": "nodeid010101010101010101010101010101010101010101010101010101010101",
                    "condition": "=",
                    "english": "pnameid equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
                  },
                  {
                    "fieldname": "parr0",
                    "value": "nodeid010101010101010101010101010101010101010101010101010101010101",
                    "condition": "=",
                    "english": "parr0 equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
                  }
                ],
                "english": "pnameid equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 OR parr0 equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
              }
            ],
            "restrictions_as_english": "id equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 AND method equal to listpeers AND pnum equal to 1 AND pnameid equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 OR parr0 equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
          },
          {
            "rune": "8_CRIJ4arWAz72A4ILOZ46MESSJtQQQ9iQZjU28qulA9NCZpZD0wMjY2ZTQ1OThkMWQzYzQxNWY1NzJhODQ4ODgzMGI2MGY3ZTc0NGVkOTIzNWViMGIxYmE5MzI4M2IzMTVjMDM1MTgmbWV0aG9kPWxpc3RwZWVycyZwbnVtPTEmcG5hbWVpZF4wMjY2ZTQ1OThkMWQzYzQxNWY1N3xwYXJyMF4wMjY2ZTQ1OThkMWQzYzQxNWY1Nw==",
            "unique_id": "4",
            "restrictions": [
              {
                "alternatives": [
                  {
                    "fieldname": "id",
                    "value": "nodeid010101010101010101010101010101010101010101010101010101010101",
                    "condition": "=",
                    "english": "id equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
                  }
                ],
                "english": "id equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "listpeers",
                    "condition": "=",
                    "english": "method equal to listpeers"
                  }
                ],
                "english": "method equal to listpeers"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "pnum",
                    "value": "1",
                    "condition": "=",
                    "english": "pnum equal to 1"
                  }
                ],
                "english": "pnum equal to 1"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "pnameid",
                    "value": "0266e4598d1d3c415f57",
                    "condition": "^",
                    "english": "pnameid starts with 0266e4598d1d3c415f57"
                  },
                  {
                    "fieldname": "parr0",
                    "value": "0266e4598d1d3c415f57",
                    "condition": "^",
                    "english": "parr0 starts with 0266e4598d1d3c415f57"
                  }
                ],
                "english": "pnameid starts with 0266e4598d1d3c415f57 OR parr0 starts with 0266e4598d1d3c415f57"
              }
            ],
            "restrictions_as_english": "id equal to 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 AND method equal to listpeers AND pnum equal to 1 AND pnameid starts with 0266e4598d1d3c415f57 OR parr0 starts with 0266e4598d1d3c415f57"
          },
          {
            "rune": "iP1FQEsFmPsu-XW7w8uXIJaJb7jU9PqOfkmXlOyWMuA9NSZtZXRob2RebGlzdHxtZXRob2ReZ2V0fG1ldGhvZD1zdW1tYXJ5fG1ldGhvZD1wYXl8bWV0aG9kPXhwYXkmbWV0aG9kL2xpc3RkYXRhc3RvcmUmbWV0aG9kL3BheXxwZXI9MWRheSZtZXRob2QvcGF5fHBuYW1lYW1vdW50X21zYXQ8MTAwMDAwMDAxJm1ldGhvZC94cGF5fHBlcj0xZGF5Jm1ldGhvZC94cGF5fHBuYW1lYW1vdW50X21zYXQ8MTAwMDAwMDAx",
            "unique_id": "5",
            "restrictions": [
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "list",
                    "condition": "^",
                    "english": "method starts with list"
                  },
                  {
                    "fieldname": "method",
                    "value": "get",
                    "condition": "^",
                    "english": "method starts with get"
                  },
                  {
                    "fieldname": "method",
                    "value": "summary",
                    "condition": "=",
                    "english": "method equal to summary"
                  },
                  {
                    "fieldname": "method",
                    "value": "pay",
                    "condition": "=",
                    "english": "method equal to pay"
                  },
                  {
                    "fieldname": "method",
                    "value": "xpay",
                    "condition": "=",
                    "english": "method equal to xpay"
                  }
                ],
                "english": "method starts with list OR method starts with get OR method equal to summary OR method equal to pay OR method equal to xpay"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "listdatastore",
                    "condition": "/",
                    "english": "method unequal to listdatastore"
                  }
                ],
                "english": "method unequal to listdatastore"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "pay",
                    "condition": "/",
                    "english": "method unequal to pay"
                  },
                  {
                    "fieldname": "per",
                    "value": "1day",
                    "condition": "=",
                    "english": "per equal to 1day"
                  }
                ],
                "english": "method unequal to pay OR per equal to 1day"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "pay",
                    "condition": "/",
                    "english": "method unequal to pay"
                  },
                  {
                    "fieldname": "pnameamount_msat",
                    "value": "100000001",
                    "condition": "<",
                    "english": "pnameamount_msat < 100000001"
                  }
                ],
                "english": "method unequal to pay OR pnameamount_msat < 100000001"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "xpay",
                    "condition": "/",
                    "english": "method unequal to xpay"
                  },
                  {
                    "fieldname": "per",
                    "value": "1day",
                    "condition": "=",
                    "english": "per equal to 1day"
                  }
                ],
                "english": "method unequal to xpay OR per equal to 1day"
              },
              {
                "alternatives": [
                  {
                    "fieldname": "method",
                    "value": "xpay",
                    "condition": "/",
                    "english": "method unequal to xpay"
                  },
                  {
                    "fieldname": "pnameamount_msat",
                    "value": "100000001",
                    "condition": "<",
                    "english": "pnameamount_msat < 100000001"
                  }
                ],
                "english": "method unequal to xpay OR pnameamount_msat < 100000001"
              }
            ],
            "restrictions_as_english": "method starts with list OR method starts with get OR method equal to summary OR method equal to pay OR method equal to xpay AND method unequal to listdatastore AND method unequal to pay OR per equal to 1day AND method unequal to pay OR pnameamount_msat < 100000001 AND method unequal to xpay OR per equal to 1day AND method unequal to xpay OR pnameamount_msat < 100000001"
          }
        ]
      }
    }
  ]
}
