plugins icon indicating copy to clipboard operation
plugins copied to clipboard

Send onions along a fixed path

Open renepickhardt opened this issue 5 years ago • 3 comments
trafficstars

which might be extended if payment channels are missing.

It would be nice if you could double check that I did not mess up the check of global features and the direction flag of channels (comments in the code with references to c-lightning and BOLTs)

This plugin helps you to construct a route object (to be used with sendpay) which goes over a sequence of node ids. if all these nodeids are on a path of payment channels an onion following this path will be constructed. In the case of missing channels lightning-cli geroute is invoked to find partial routs.

This plugin can be used to create circular onions or to send payments along specific paths if that is necessary (as long as the paths provide enough liquidity).

I guess this plugin could also be used to simulate the behaviour of trampoline payments.

And of course I imagine you the reader of this message will find even more creative ways of using it.

examples

First we have an example where a path of payment channel between all nodes exists. The output should be exactly the same as calling lightning-cli getroute 0383494542d2e21cafc46d80ae9d2a0bd6b55db4b50721ac3703315c59b9ec27b3 1000 1 9 032060a40a94dc7b848d02314e4ccebe20f451dc87f28c1ed685caa58bfcc3989a sufficiently often (until lightningd decides to return this particular route)

$ lightning-cli getfixedroute 1000 '["032060a40a94dc7b848d02314e4ccebe20f451dc87f28c1ed685caa58bfcc3989a","022c260f9ad58196af280c80a96ec9eabf6404df59ff1a7553b0f381c875a29ba0","02bb24da3d0fb0793f4918c7599f973cc402f0912ec3fb530470f1fc08bdd6ecb5","0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266","0383494542d2e21cafc46d80ae9d2a0bd6b55db4b50721ac3703315c59b9ec27b3"]'
{
   "route": [
      {
         "id": "022c260f9ad58196af280c80a96ec9eabf6404df59ff1a7553b0f381c875a29ba0",
         "channel": "554745x2295x1",
         "direction": 1,
         "msatoshi": 2004,
         "amount_msat": "2004msat",
         "dealy": 187,
         "style": "tlv"
      },
      {
         "id": "02bb24da3d0fb0793f4918c7599f973cc402f0912ec3fb530470f1fc08bdd6ecb5",
         "channel": "574084x2058x1",
         "direction": 0,
         "msatoshi": 2004,
         "amount_msat": "2004msat",
         "dealy": 183,
         "style": "tlv"
      },
      {
         "id": "0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266",
         "channel": "567407x202x1",
         "direction": 1,
         "msatoshi": 2000,
         "amount_msat": "2000msat",
         "dealy": 153,
         "style": "tlv"
      },
      {
         "id": "0383494542d2e21cafc46d80ae9d2a0bd6b55db4b50721ac3703315c59b9ec27b3",
         "channel": "554391x1396x1",
         "direction": 0,
         "msatoshi": 1000,
         "amount_msat": "1000msat",
         "dealy": 9,
         "style": "tlv"
      }
   ]
}

same example as above but I artificially injected my own node (03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df) at the 3rd hop so now the result contains more channels because my node was not connected to the nodes in this path.

 $ lightning-cli getfixedroute 1000 '["032060a40a94dc7b848d02314e4ccebe20f451dc87f28c1ed685caa58bfcc3989a","022c260f9ad58196af280c80a96ec9eabf6404df59ff1a7553b0f381c875a29ba0","02bb24da3d0fb0793f4918c7599f973cc402f0912ec3fb530470f1fc08bdd6ecb5","03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df","0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266","0383494542d2e21cafc46d80ae9d2a0bd6b55db4b50721ac3703315c59b9ec27b3"]'
{
   "route": [
      {
         "id": "022c260f9ad58196af280c80a96ec9eabf6404df59ff1a7553b0f381c875a29ba0",
         "channel": "554745x2295x1",
         "direction": 1,
         "msatoshi": 2431,
         "amount_msat": "2431msat",
         "dealy": 239,
         "style": "tlv"
      },
      {
         "id": "02bb24da3d0fb0793f4918c7599f973cc402f0912ec3fb530470f1fc08bdd6ecb5",
         "channel": "574084x2058x1",
         "direction": 0,
         "msatoshi": 2431,
         "amount_msat": "2431msat",
         "dealy": 235,
         "style": "tlv"
      },
      {
         "id": "0390b5d4492dc2f5318e5233ab2cebf6d48914881a33ef6a9c6bcdbb433ad986d0",
         "channel": "567217x1362x0",
         "direction": 0,
         "msatoshi": 2435,
         "amount_msat": "2435msat",
         "delay": 231,
         "style": "tlv"
      },
      {
         "id": "03efccf2c383d7bf340da9a3f02e2c23104a0e4fe8ac1a880c8e2dc92fbdacd9df",
         "channel": "550103x2322x0",
         "direction": 0,
         "msatoshi": 2431,
         "amount_msat": "2431msat",
         "delay": 201,
         "style": "legacy"
      },
      {
         "id": "032679fec1213e5b0a23e066c019d7b991b95c6e4d28806b9ebd1362f9e32775cf",
         "channel": "558577x633x1",
         "direction": 1,
         "msatoshi": 2004,
         "amount_msat": "2004msat",
         "delay": 187,
         "style": "tlv"
      },
      {
         "id": "030995c0c0217d763c2274aa6ed69a0bb85fa2f7d118f93631550f3b6219a577f5",
         "channel": "574084x2092x1",
         "direction": 1,
         "msatoshi": 2004,
         "amount_msat": "2004msat",
         "delay": 183,
         "style": "tlv"
      },
      {
         "id": "0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266",
         "channel": "573935x1387x1",
         "direction": 1,
         "msatoshi": 2000,
         "amount_msat": "2000msat",
         "delay": 153,
         "style": "tlv"
      },
      {
         "id": "0383494542d2e21cafc46d80ae9d2a0bd6b55db4b50721ac3703315c59b9ec27b3",
         "channel": "554391x1396x1",
         "direction": 0,
         "msatoshi": 1000,
         "amount_msat": "1000msat",
         "dealy": 9,
         "style": "tlv"
      }
   ]
}

renepickhardt avatar Jan 24 '20 14:01 renepickhardt

Clean rebase on top of master

cdecker avatar Sep 06 '20 12:09 cdecker

Fixed up and cleaned up.

cdecker avatar Sep 06 '20 14:09 cdecker

Needs rebase

chrisguida avatar Feb 07 '24 16:02 chrisguida