lightning-listdatastore

lightning-listdatastore -- Command for listing (plugin) data

SYNOPSIS

listdatastore [key]

DESCRIPTION

The listdatastore RPC command allows plugins to fetch data which was stored in the Core Lightning database.

  • key (one of, optional):
    • (array of strings): All immediate children of the key (or root children) are returned.
      Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended.
      An array of values to form a hierarchy (though a single value is treated as a one-element array).
      • (string, optional)
    • (string)

RETURN VALUE

On success, an object containing datastore is returned. It is an array of objects, where each object contains:

  • key (array of strings):
    • (string, optional): Part of the key added to the datastore.
  • generation (u64, optional): The number of times this has been updated.
  • hex (hex, optional): The hex data from the datastore.
  • string (string, optional): The data as a string, if it's valid utf-8.

ERRORS

The following error codes may occur:

  • -32602: invalid parameters.

AUTHOR

Rusty Russell <[email protected]> is mainly responsible.

SEE ALSO

lightning-datastore(7), lightning-deldatastore(7), lightning-datastoreusage(7)

RESOURCES

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

EXAMPLES

Example 1:

Request:

lightning-cli listdatastore -k "key"='["test"]'
{
  "id": "example:listdatastore#1",
  "method": "listdatastore",
  "params": {
    "key": [
      "test"
    ]
  }
}

Response:

{
  "datastore": [
    {
      "key": [
        "test",
        "name"
      ],
      "generation": 0,
      "hex": "736176696e67206461746120746f207468652073746f7265",
      "string": "saving data to the store"
    }
  ]
}

Example 2:

Request:

lightning-cli listdatastore -k "key"="otherkey"
{
  "id": "example:listdatastore#2",
  "method": "listdatastore",
  "params": {
    "key": "otherkey"
  }
}

Response:

{
  "datastore": [
    {
      "key": [
        "otherkey"
      ],
      "generation": 1,
      "hex": "666f6f626172",
      "string": "foobar"
    }
  ]
}

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.