Skip to content

payjoin/nolooking

Repository files navigation

nolooking: Payjoin from LND

Send and receive BIP78 payjoin

Open All Your Channels in 1 Transaction

 

Funding channels the old way is a pain. First you'd fund your node on-chain, wait around, then open channels 1 by 1. Instead, nolooking funds and opens channels after you scan just 1 QR code.

A new node can get connected in one transaction that opens inbound and outbound channels using pay-to-endpoint. Privacy is just a bonus.

Nolooking leverages Pay-to-Endpoint (BIP78 payjoin) to negotiate a channel open for your lightning node from any BIP78 supporting wallet. Previously, custom PSBT channel funding could only be done by signing PSBTs manually. A node running nolooking can open many new lightning channel with every inbound transaction, provided the payer supports BIP78. E.g. by using Sparrow wallet, BTCPayServer, or Wasabi; following the normal QR scan and payjoin payment flow. Read the article about Lightning Powered Payjoin to hear how it can save your privacy, time, and money!

⚠️ WARNING: EXPERIMENTAL ALPHA

Use at your own risk. This crate has no professional independent Rust and Bitcoin security review yet.

Any unexpecected node version will likely cause permanent loss of funds.

Testing

Find a guide to automated integration tests and local testing with Polar regtest in the tests folder.

Usage

Requires:

  • Rust version 1.56 or higher to compile
  • LND v0.15.1 or higher

Install:

  1. Build and install the binary with
cargo install --path .
  1. Setup a reverse HTTP proxy with HTTPS forwarding to some port - e.g. 3000. You can do this in a few lines using local-ssl-proxy. Or use NGINX.
  2. Create a configuration file nolooking.conf containing:
bind_port=3000
endpoint="https://localhost:3010"
lnd_address="https://localhost:10009"
lnd_cert_path="/home/dan/.lnd/tls.cert"
lnd_macaroon_path="/home/dan/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"
  • payjoin uses a secured https or onion server endpoint to coordinate. The endpoint you specify should be addressable from whatever sender you use. Step 2 assumes your sender is local. The endpoint configuration parameter is printed in the bip21 uri.
  • Lines starting with lnd_ specify your connection to your bitcoin node.
  • You will be able to view the nolooking site on bind_port and the payjoin endpoint will be endpoint (e.g. can be a domain).
  1. Run with nolooking --conf nolooking.conf
  2. Visit Nolooking on 127.0.0.1 and queue some bitcoin channels.
  3. Generate the QR code, pay it or share it! Once a payjoin transaction has enough confirmations, your new lightning channels will be established and you can move your sats over the lightning nework!

Expected fee savings

In the traditional path for opening a lightning channel, you first must fund the LND wallet and then make a second transaction to fund the opening of the channel, a total of two transactions. Nolooking however does this all in a single transaction, saving 106 vB (68 vB input + 22 vB script pubkey + 8 vB output amount + 4 vB version + 4vB timelock).

If you wanted to fund a number of channels, say 10 channels, this would traditionally take 11 transactions. Nolooking can do this in a single transaction - saving 1060 vB.

You can also schedule channel opens, such that when someone goes to pay you lightning channel funding transactions piggyback along with their payment. Again not only saving fees and also saving you a shedload of time since you don't have to wait for confirmations in between each successive channel open. (There's --spend-unconfirmed, but that has its own drawbacks)

Expected privacy implications

If you open a lightning channel the usual way, common input heuristic makes a good assumption that the change from this funding transaction belongs to the funder. Using payjoin breaks that assumption, where this change could now be the payer's change instead.

Just as with any other payjoin, it becomes unclear whether all inputs of a transaction belong to a single funder or whether there are indeed multiple parties funding the transaction.

Because this tool breaks analytic assumptions regarding bitcoin transactions in general, using it will add transactions to the network which have a large set of possible interpretations and thus better privacy.

Future research

Payjoin works great for channel opening, but the underlying protocol needs to change in order to support closing a channel in a payjoin.

If lightning channels were truly private, then this tool could make chain analytics even more confusing since heurestics may incorrectly assume a transaction funds a single node instead of two or even several.

Once lightning channels are opened in taproot outputs, it will be impossible to distinguish a CoinJoin from a batch open of several same-sized private channels. Actually, CoinJoin and batch opening of several same-sized private channels could be one transaction. Good luck analyzing that!

UX implications

All of this is possible without nolooking by manually exchanging PSBTs. BIP78 turns that tedious back and forth into scanning/clicking one link, followed by confirmation in the wallet. In other words, your grandmother will be able to somewhat privately open a bunch of channels for you, using her BIP78-capable wallet on her iPad.

Limitations and future plans

  • Invalid request may kill the whole server

License

The license is MIT, with one restriction and one warning:

You are forbidden from preventing people from distributing, analyzing or modifying your source code or binaries they unless they specifically signed a contract with you in which they committed to not do so.

I will be maximally helpful towards your victims suing you if you ever market, vendor or distribute this software in exchange for payment or free of charge in a way that could make it look like a reliable or tested product unless you demonstrate serious work done reviewing and improving the code before doing so. Such must be done by people with good knowledge of Rust, cryptography, Bitcoin, network protocols and security.