1

I need to get fee, before send payment.

BOLT11:

root@855e20daeae9:/# lightning-cli --testnet decodepay lntb1u1p07t3tdpp5ax3hk4jzf08sn8a8dupayswf6ja497mj25lmcdqn7m0ce22ch0qqdq8vankwecxqrrss9qy9qsqsp5f5s9kqwnp7uh3pg93wr970420xy7vueelqhratwlrt9jzvn2lv7srzjqwfn3p9278ttzzpe0e00uhyxhned3j5d9acqak5emwfpflp8z2cng8xmauqqq0gqqqqqqqlgqqqqqeqqjqatpu8h3tcatdvvxl0t93zkltwlpzaqlu75sgrh3vv92utfqaq6gpgmyaks48v5tptmc30yaach48pr3l3dfnhm5ytr5my8z87xjmnpcqmjh036
{
   "currency": "tb",
   "created_at": 1608893805,
   "expiry": 3600,
   "payee": "03aba9dfe8612755f6edc363b90e3f1f4a684517cd0558452fb9620ffaebab683e",
   "msatoshi": 100000,
   "amount_msat": "100000msat",
   "description": "gggg",
   "min_final_cltv_expiry": 18,
   "payment_secret": "4d205b01d30fb97885058b865f3eaa7989e67339f82e3eaddf1acb21326afb3d",
   "features": "028200",
   "routes": [
      [
         {
            "pubkey": "03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134",
            "short_channel_id": "1891311x61x0",
            "fee_base_msat": 1000,
            "fee_proportional_millionths": 100,
            "cltv_expiry_delta": 144
         }
      ]
   ],
   "payment_hash": "e9a37b56424bcf099fa76f03d241c9d4bb52fb72553fbc3413f6df8ca958bbc0",
   "signature": "3045022100eac3c3de2bc756d630df7acb115beb77c22e83fcf52081de2c6155c5a41d06900220146c9db42a7651615ef11793bdc5ea708e3f8b533bee8458e9b21c47f1a5b987"
}

Then I need to get the route:

getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops]

Final node ID:

root@855e20daeae9:/# lightning-cli --testnet getroute 030f1784fafe1b5b143e4e4545e6c2f612943c60e6a5b770b35e324c60b6ae9516 10000000 10
{
   "route": [
      {
         "id": "03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134",
         "channel": "1900118x8x0",
         "direction": 1,
         "msatoshi": 10002000,
         "amount_msat": "10002000msat",
         "delay": 178,
         "style": "tlv"
      },
      {
         "id": "03d5e17a3c213fe490e1b0c389f8cfcfcea08a29717d50a9f453735e0ab2a7c003",
         "channel": "1834823x53x0",
         "direction": 0,
         "msatoshi": 10000000,
         "amount_msat": "10000000msat",
         "delay": 34,
         "style": "tlv"
      },
      {
         "id": "030f1784fafe1b5b143e4e4545e6c2f612943c60e6a5b770b35e324c60b6ae9516",
         "channel": "1722566x108x0",
         "direction": 1,
         "msatoshi": 10000000,
         "amount_msat": "10000000msat",
         "delay": 9,
         "style": "tlv"
      }
   ]
}

Which ID should I use to get the route for private BOLT11?

How to pay private BOLT11 in manual mode?

Murch
  • 71,155
  • 33
  • 180
  • 600

1 Answers1

1

There is the routes field in the invoice as a routing hint

   "routes": [
      [
         {
            "pubkey": "03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134",
            "short_channel_id": "1891311x61x0",
            "fee_base_msat": 1000,
            "fee_proportional_millionths": 100,
            "cltv_expiry_delta": 144
         }
      ]

This tells you the node ID which getroute can find:

03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134

There are plugins that allow you to create custom routes along a given path. So I suggest to call getroute to the node from the routing hint extend that route with the private hope and use the following plugin to create a custom onion:

https://github.com/lightningd/plugins/pull/85

Rene Pickhardt
  • 11,670
  • 8
  • 35
  • to create custom hope, i need target node ID. but this BOLT11 dont contains final node ID. – Petr Stukalov Dec 25 '20 at 12:05
  • 2
    The node ID is being recovered from the signature, and `devtools/bolt11-cli decode [invoice]` will give you the recovered ID. – cdecker Dec 25 '20 at 14:48