Package: lnproxy
LnproxyProxy connections from a patched C-Lightning.Proxy removes onion (1300B) before HTLC transmission and receiver dynamically re-generates them upon receipt.RequirementsPython >= 3.7C-Lightning compiled withnoencrypt_final.patchandgossip_disabled_and_300s_HTLC_timeout.patchapplied.jqfor your system (for the helper scripts)libsecp256k1 installationFirst install libsecp256k1 from source as per theproject installation instructionsOn Debian? See thiscommenton issue 24.C Lightning installationClone the C-Lightning branch below. This branch includes two plugins by default:Lnproxy (this plugin)Sauron(fetches blocks from blockstream.info, no need for bitcoind on testnet)gitclonehttps://github.com/willcl-ark/lightning.gitcdlightning
gitcheckoutlnproxy# Setup and activate a virtualenv for the lightning branch (with e.g. pyenv) and install lnproxy and C-lightning requirementspipinstall--upgradepip
pipinstalllnproxy
pipinstall-rrequirements.txt
pipinstall-rplugins/sauron/requirements.txtFollow the remaining compilation instructions for your OS as found atinstall C-Lightningmaking sure to follow the./configurestep using--enable-developerflag. We need this flag to disable gossip, minimising bandwidth used. If you've already compiled C-Lightning before on your system, this will likely be enough:./configure--enabledeveloper&&makeQuick run, testnet, single local node:# Let's start by sourcing the helper scriptssourcecontrib/startup_testnet1.sh# Start up C-Lightningstart_ln# You can tail the logs in a second terminal window withtail-f-n50/tmp/l1-testnet/log|cut-c26-# Fund the wallet as usual, e.g.:l1-clinewaddr# Send tBTC to the addressNext we are going to add a node to the lnproxy routing table. We can set some variables to help us:LISTEN_PORT: the portyouwill listen for incoming connections from the remote node. Open this port in any firewall you have.REMOTE_PUBKEY: the remote node's pubkeyexportLISTEN_PORT="<local_open_port>"# Let's also export their pubkey for convenienceexportREMOTE_PUBKEY="<their_node_pubkey>"Now we can add the node to the Lnproxy router and make the connection:# Add a remote node to lnproxy plugin routerl1-cliadd-node<remote_pubkey>@<remote_host>:<remote_port>$LISTEN_PORT# Make a connection to the remote nodel1-cliproxy-connect$REMOTE_PUBKEYAfter successful connection, we can fund a channel in the usual way:# Open a private outbound channel with remote nodel1-clifundchannelid=$REMOTE_PUBKEYamount=100000feerate=10000announce=false# You can check the status of the channel withl1-clilistfundsAfter the channel reaches statusCHANNELD_NORMAL, we can begin to make a payment, two different payment types shown below:# Pay a regular invoice without transmitting onion# First obtain a bolt11 invoice out-of-bandl1-clipay<bolt11_invoice># Send a "message"/spontaneous payment/sphinx-send to remote nodel1-cliwaitsendpay$(l1-climessage$REMOTE_PUBKEY"<your_message_goes_here>"100000|jq-r'.payment_hash')Quick run, testnet, two local nodes:Using the helper functions in the~/src/lightning/contrib/startup_testnet2.shlet you get set up faster. Run in approximately this sequence as necessary:# Start 2x C-Lightningstart_ln# Add each node to the other node's routeradd_nodesTheadd_nodescommand will echo the listening port that the remote node (or radio device e.g. fldigi-proxy) should connect in to to make an inbound connectionTo make an outbound connection from node 1, use theproxy-connectcommand with the port your transport connection is listening on, e.g.:# Now begin outbound connection from l1 to l2. If you are using alternative transport (e.g. fldigi), use the fldigi listening tcp_portl1-cliproxy-connect$(l2-cligetinfo|jq-r.id)The connection should occur automatically from here, you will need to fund the wallet and open a channel as normal.After these commands have completed, you can move right onto thepaymentsorspontaneous sendssections below to start making payments.Manual modeSeemanual_operation.mdfor a more manual approach.Invoice paymentNow we have seen thechannel_updatemessages for the channel, if you have, you can try a simple single hop pay:# First get a BOLT11 invoice from the remote node...lclipay<bolt11_invoice>Spontaneous sendsTo attempt a "spontaneous send" payment with encrypted message, use the "message" command added to C-Lightning by the lnproxy plugin:# First lets generate a 12 digit random hex message which we'll use as the message to sendexportMESSAGE="$(opensslrand-hex12)"# Using waitsendpay will wait synchronously until payment succeeds or failslcliwaitsendpay$(lclimessage<remote_pubkey>$MESSAGE100000|jq-r.payment_hash)The "message" RPC implements a keysend-like functionality: we know about the (final) recipient in our plugin routing table, even though C-Lightning doesn't know about them (no gossip exchanged via l2). This means we can send them a message encrypted with their pubkey (using ECIES wherenonce=payment_hash[0:16]) and where only recipient can decrypt the preimage(sha256(decrypted_message).digest()).Seeencryption.mdfor more information on this.TroubleshootingThere are some currently known issues with running on Debian via Qubes OS, so currently this OS config is not supported.TODO:Can be foundhere