Pathfinding

Intelligent Pathfinding

Improve payment reliability by using Intelligent Pathfinding.

📖

See the full documentation here.

API

You can get a route though the API.

This is a GraphQL API so you can fetch as much or as little information as desired from the different queries and mutations.

Queries

find_enhanced_route

Note: The API also has a similar endpoint publicly available: getPublic > find_simple_path. It uses the same input/output structure but does not use machine learning.

query GetEnhancedPath($input: PathfindingInput!) {
  getPaths {
    find_enhanced_path(input: $input) {
      lnd {
        fee
        hops {
          channel
          channel_capacity
          fee
          fee_mtokens
          forward
          forward_mtokens
          public_key
          timeout
        }
        timeout
        tokens
      }
      lnd_v2 {
        payment_hash {
          base64
          hex
        }
        route {
          hops {
            amt_to_forward
            amt_to_forward_msat
            chan_capacity
            chan_id
            expiry
            fee
            fee_msat
            mpp_record {
              payment_addr
              total_amt_msat
            }
            pub_key
          }
          total_amt
          total_amt_msat
          total_fees
          total_fees_msat
          total_time_lock
        }
      }
    }
  }
}
Variables

Note: Either an invoice or destination/amount is needed to get a route. Invoice is recommended since this holds the payment hash and route hints (optional).

VariableDescriptionMandatory
input/originPubkey of source
input/invoice/payment_requestUse a bolt 11 invoice for destination and amount
input/payment/destinationPubkey of destination.
input/payment/amountAmount in sats to send.
🧑‍🍳

See an example written in Python here (opens in a new tab).

Mutations

save_result

Note: This API mutation is public.

mutation SaveResult($input: PathfindingResultInput!) {
  public {
    pathfinding {
      save_result(input: $input)
    }
  }
}
Variables
VariableDescriptionMandatory
input/capacitySize of payment, in sats
input/destination_pubkeyPubkey of destination.
input/source_pubkeyPubkey of source.
input/payloadJSON object which should include success and path

Payload example:

{
  "path": {
    "hops": [
      {
        "amt_to_forward": "21000",
        "amt_to_forward_msat": "21000000",
        "chan_capacity": "1000000",
        "chan_id": "902603389126311936",
        "expiry": 866760,
        "fee": "0",
        "fee_msat": "0",
        "mpp_record": {
          "payment_addr": "CxDye+vTClU3jSY5O+O4BWYf6WfSgnSh8uTBptz1HFU=",
          "total_amt_msat": "21000000"
        },
        "pub_key": "02356bca6f6bf2da33eb01e4b754a9fc575552e87cfd765893b79f83983fead301"
      }
    ],
    "total_amt": "21000",
    "total_amt_msat": "21000000",
    "total_fees": "0",
    "total_fees_msat": "0",
    "total_time_lock": 866760
  },
  "success": true
}