The HRF Bounty On Human-Readable Offers
At least two people have contacted me concerning the 2 BTC bounty:
2 BTC for a human-readable bolt 12 offer generator feature integrated into a popular iOS or android bitcoin wallet. “Human-readable” means something that can be used on feature phone without QR or copy/paste ability. For example, something that looks like LN address.
This, of course, is asking to solve Zooko’s Triangle, so one of decentralizationm, human readability, or security needs to compromise! Fortunately, the reference to LN address gives a hint on how we might proceed.
The scenario, presumably, is Bob wants to pay Alice, where Alice shows Bob a “Human Readable Offer” and Bob types it into his phone. Each one runs Phoenix, Greenlight, or (if their phone is too low-end) uses some hosted service, but any new third party trust should be minimized.
There are three parts we need here:
- Bob finds Alice’s node.
- Bob requests Alice’s node for invoice.
- If she wants, Alice can easily check Bob’s going to pay the right thing.
The Imagined Scenario
Consider the normal offer case: the offer encodes Alice’s nodeid and description (and maybe other info) about what’s on offer. Bob turns this into an invoice_request, sends an onion message to Alice’s node, which returns the (signed) invoice, which Bob pays. We need to encode that nodeid and extra information as compactly as we can.
Part 1: Finding Alice’s Node from a Human Readable Offer
The issue of “finding Alice’s node” has been drafted already for BOLT12, at https://github.com/rustyrussell/bolt12address (but it needs updating!). This means that if you say “rusty@blockstream.com” you can get a valid generic offer, either by contacting the webserver at “blockstream.com” or having someone else do it for you (important for privacy!), or even downloading a public list of common receivers.
Note that it’s easier to type *
than @
on feature phones, so I suggest allowing both rusty@blockstream.com
and RUSTY*BLOCKSTREAM.COM
.
What’s Needed On The Server
- The BOLT 12 Address Format needs to be updated.
- It needs to be implemented for some Web server.
- Ideally, integrate it into BTC Payserver or the like.
Part 2: Getting the Invoice
Now, presumably, we want a specific invoice: it might be some default “donate to Alice”, but it could be a specific thing “$2 hot dog”. So you really want some (short!) short-code to indicate which invoice you want. I suggest a hash, followed by some randomly chosen alphanumeric string here (case-insensitive!): an implementation may choose to restrict themselves to numbers however, as that’s faster to enter on a feature phone.
What’s Needed On The Server
- We can put the short-code in the
invreq_payer_note
field in BOLT 12 or add a new odd field. - We need to implement (presumably in Core Lightning):
- A way to specify/assign a short-code for each offer.
- A way of serving a particular invoice based on this short-code match.
Part 3: Checking the Invoice
So, did you even get the right node id? That’s the insecure part; you’re trusting blockstream.com! Checking the nodeid is hard: someone can grind out a nodeid with the same first 16 digits in a few weeks. But I think you can provide some assurance, by creating a 4-color “flag” using the node id and the latest bitcoin blocks: this will change every new block, and is comparable between Alice and Bob at a glance:
This was made using this hacky code which turns my node id 024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605 into an RGB color (by hashing the nodeid+blockhash).
For a moment, when a new block comes in, one image might be displaced, hence the number, but it’ll only be out by one.
Putting it All Together
What’s Needed On Alice’s Client
- Alice needs to configure her BOLT12 Address with some provider when she sets up the phone: it should check that it works!
- She should be able to choose an existing offer (may be a “donation” by default), or create a new one on the fly (with a new short code).
- Display the BOLT12-ADDRESS
#
SHORT-CODE, and the current nodeid flag.
What’s Needed On Bob’s Client
- It needs to be able to convert BOLT12-ADDRESS into a bolt12 address request:
- Either via some service (to be implemented!), or by directly query (ideally over Tor).
- It needs to be able to produce an offer from the returns bolt12 address response, by putting the SHORT-CODE into the invreq_payer_note.
- It needs to be able to fetch an invoice for this offer.
- It needs to be able to display the current nodeid flag for the invoice’s node id.
- Allow Bob to confirm to send payment.
Is There Anything Else?
There are probably other ways of doing this, but this method has the advantage of driving maturity in several different areas which we want to see in Bitcoin:
- bolt12 address to support vendor field validation for offers.
- Simple name support for bootstrapping.
- Driving Bitcoin to be more accessible to everyone!
Feel free to contact me with questions!