On this page

latest contributor to this doc

Last Edit:

@gcharang

Lightning Network Payments

Lightning methods are currently only available using the native Komodo DeFi Framework. WASM support should be available in late 2023.

API-v2lightning::payments::generate_invoice

The lightning::payments::generate_invoice method generates an invoice to be paid by another node.

ParameterTypeDescription
coinstringTicker of coin to generate invoice for.
descriptionstringA note to indicate the purpose of the invoice.
amount_in_msatintegerAmount to be paid, in millisatoshis (A thousandth of a satoshi; the same as 0.00000000001 bitcoin.)
expiryintegerOptional, defaults to 3600. Seconds until the invoice expires.

Generate invoice

POST
lightning::payments::generate_invoice
{
  "method": "lightning::payments::generate_invoice",
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "params": {
    "coin": "tBTC-lightning",
    "description": "For the burger on Tuesday",
    "amount_in_msat": 10000,
    "expiry": 600
  },
  "id": 1
}
API-v2lightning::payments::send_payment

The lightning::payments::send_payment method sends a payment to another node.

Used to pay an invoice or send a payment via pubkey/address.

ParameterTypeDescription
typestringTicker of the coin to query.
paymentobjectA standard LightningPayment object.

Send Payment

POST
lightning::payments::send_payment
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::payments::send_payment",
  "params": {
    "coin": "tBTC-lightning",
    "payment": {
      "type": "invoice",
      "invoice": "lntb20u1p32wwxapp5p8gjy2e79jku5tshhq2nkdauv0malqqhzefnqmx9pjwa8h83cmwqdp8xys9xcmpd3sjqsmgd9czq3njv9c8qatrvd5kumcxqrrsscqp79qy9qsqsp5m473qknpecv6ajmwwtjw7keggrwxerymehx6723avhdrlnxmuvhs54zmyrumkasvjp0fvvk2np30cx5xpjs329alvm60rwy3payrnkmsd3n8ahnky3kuxaraa3u4k453yf3age7cszdxhjxjkennpt75erqpsfmy4y"
    }
  },
  "id": 6
}

Send Payment

POST
lightning::payments::send_payment
{
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "method": "lightning::payments::send_payment",
  "params": {
    "coin": "tBTC-lightning",
    "payment": {
      "type": "keysend",
      "destination": "038863cf8ab91046230f561cd5b386cbff8309fa02e3f0c3ed161a3aeb64a643b9",
      "amount_in_msat": 1000,
      "expiry": 24
    }
  },
  "id": 6
}
API-v2lightning::payments::get_payment_details

The lightning::payments::get_payment_details method returns details about a lightning payment from a given payment_hash.

ParameterTypeDescription
coinstringTicker of the coin to query.
payment_hashstringThe hexidecimal string which identifies a invoice. The payment_hash is returned from a lightning::payments::send_payment request if the payment was sent by us, or from a lightning::payments::generate_invoice request if the payment is received (or will be received) by us.

Get Payment Details

POST
lightning::payments::get_payment_details
{
  "method": "lightning::payments::get_payment_details",
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "params": {
    "coin": "tBTC-lightning",
    "payment_hash": "414f9b3524fc4e48c99f2723952732d8bc2eba1b35ce3bf2a70f5144b40f599e"
  },
  "id": 1
}
API-v2lightning::payments::list_payments_by_filter

The lightning::payments::list_payments_by_filter method returns a list of payments (sent and/or received) for a coin which match the given filter.

ParameterTypeDescription
coinstringTicker of the coin to query.
filterobjectOptional. A standard LightningPaymentFilter object.
paging_optionsobjectOptional. A standard Pagination object.
limitintegerOptional, defaults to 10. Maximum number of results to return.

List Payments by Filter

POST
lightning::payments::list_payments_by_filter
{
  "method": "lightning::payments::list_payments_by_filter",
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "params": {
    "coin": "tBTC-lightning"
  },
  "id": 1
}

List Payments by Filter

POST
lightning::payments::list_payments_by_filter
{
  "method": "lightning::payments::list_payments_by_filter",
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "payment_type": {
        "type": "Inbound Payment"
      }
    },
    "limit": 2,
    "paging_options": {
      "PageNumber": 2
    }
  },
  "id": 1
}

List Payments by Filter

POST
lightning::payments::list_payments_by_filter
{
  "method": "lightning::payments::list_payments_by_filter",
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "status": "pending",
      "from_amount_msat": 10000,
      "to_amount_msat": 40000
    }
  },
  "id": 1
}

List Payments by Filter

POST
lightning::payments::list_payments_by_filter
{
  "method": "lightning::payments::list_payments_by_filter",
  "userpass": "RPC_UserP@SSW0RD",
  "mmrpc": "2.0",
  "params": {
    "coin": "tBTC-lightning",
    "filter": {
      "status": "succeeded",
      "from_timestamp": 1681948800,
      "to_timestamp": 1682035199
    }
  },
  "id": 1
}