Skip to content

Instantly share code, notes, and snippets.

@Roasbeef
Last active December 18, 2023 02:30
Show Gist options
  • Save Roasbeef/624c02cd5a90a44ab06ea90e30a6f5f0 to your computer and use it in GitHub Desktop.
Save Roasbeef/624c02cd5a90a44ab06ea90e30a6f5f0 to your computer and use it in GitHub Desktop.
lnd REST example
▶ curl localhost:8080/v1/channels | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   259  100   259    0     0  34634      0 --:--:-- --:--:-- --:--:-- 37000
{
  "channels": [
    {
      "remote_pubkey": "0213f6ea36672398c2da4643c6d41cfd5a05be1406ce9e8b4609c500ba5e0591b4",
      "channel_point": "0dd3a9320b4f280e4a9cbd77567a01c2572b05ade1fdbd631db4e108b9af6f70:0",
      "chan_id": "3786718046126080",
      "capacity": "30000",
      "remote_balance": "25000"
    }
  ]
}
 curl localhost:8080/v1/getinfo | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   188  100   188    0     0  23470      0 --:--:-- --:--:-- --:--:-- 26857
{
  "identity_pubkey": "0350fef35c8e0b4251fa340c3fdf75fe775da16bcd8965ecc112dd19b46f172fcb",
  "block_height": 3455,
  "block_hash": "549d709992fc7e13921ddd825995d60b7b684064c9b5b3bf2d45dc9407e716a7"
}

▶ curl localhost:8080/v1/graph/node/0350fef35c8e0b4251fa340c3fdf75fe775da16bcd8965ecc112dd19b46f172fcb | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   210  100   210    0     0  28206      0 --:--:-- --:--:-- --:--:-- 30000
{
  "node": {
    "last_update": 1490129732,
    "pub_key": "0350fef35c8e0b4251fa340c3fdf75fe775da16bcd8965ecc112dd19b46f172fcb",
    "address": "[::]:10011",
    "alias": "0350fef35c8e0b4251fa"
  },
  "num_channels": 1,
  "total_capacity": "25000"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment