Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

A better encoding for lightning invoices

2 messages, Apr 1, 2020. Started by Bastien TEINTURIER.

Bastien TEINTURIER, ZmnSCPxj

Permalink First message in the Wayback Machine

Bastien TEINTURIER permalink original

Good morning list,

In Bolt 11 we decided to use bech32 to encode lightning invoices. While bech32 has some nice properties, it isn't well suited for invoices. The main drawback of Bolt 11 invoices is their size: when you start adding routing hints or rendezvous onions, invoices become huge and hard to share.

Empirical evidence shows that most lightning transactions are done over Twitter (73,41% of all lightning payments in 2019 were made via tweets). Since Twitter only allows up to 280 characters per tweet, this has severely impacted the development of new features for lightning. Anything that made an invoice bigger ended up being unused as users were left without any option to share those invoices.

After several months of research and experimentation at Acinq Research, we have come up with a highly efficient invoice encoding, optimized primarily for Twitter. This has caused further delays in the development of our iOS wallet, but we felt this was a much higher priority.

Our encoding uses an AI-optimized mapping from 11-bit words to Twitter emojis. Early results show that emoji invoices are more than 2 times smaller than legacy invoices.

Reckless users are already using this in production:

https://twitter.com/realtbast/status/1245258812279398400?s=20 https://twitter.com/acinq_co/status/1245258815597096960

There is a spec PR available at [1], along with reference eclair code [2]. We plan to release this feature in the next update of our Phoenix wallet [3].

We'd like feedback from this list on how to improve this further. We believe the same encoding could be used to compress the bitcoin blockchain. With more training data, we believe our AI-optimized mapping could allow bitcoin blocks to fit in a single tweet; we would then be able to use Twitter feeds to store the whole blockchain.

Cheers, Bastien

[1] https://github.com/lightningnetwork/lightning-rfc/pull/762
[2] https://github.com/ACINQ/eclair/tree/emoji-encoding
[3] https://phoenix.acinq.co/
ZmnSCPxj in reply to Bastien TEINTURIER permalink original

Good morning Bastien,

Quoted text (4 lines)
> We believe the
> same encoding could be used to compress the bitcoin blockchain. With more training
> data, we believe our AI-optimized mapping could allow bitcoin blocks to fit in a
> single tweet; we would then be able to use Twitter feeds to store the whole blockchain.

An utter derailment of this thread, but this claim seems to me a massive departure from my understanding of information theory. I am put to mind of the fable of the 1-bit image compressor, which can compress any image to just 1 bit; its decompression algorithm checked if the input bit is a 1 and if so, emitted the Lenna test image, and if the input bit was 0, would fail with a decompression error. Since the only requirement for publication in a journal is to be able to correctly compress and decompress the Lenna test image, the image compressor achieves 1-bit compression of any image, as shown by the successful compression and decompression of the Lenna test image.

I wonder if the blockchain data is stored in the tweet, or in the AI that decides how to store it in the tweet.

Regards, ZmnSCPxj