Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Bitcoin/Lightning meta tag (value4value meta tag) #1

Open
bumi opened this issue Feb 16, 2022 · 7 comments
Open

Bitcoin/Lightning meta tag (value4value meta tag) #1

bumi opened this issue Feb 16, 2022 · 7 comments

Comments

@bumi
Copy link
Collaborator

bumi commented Feb 16, 2022

Bitcoin Lightning Meta Tag

The Bitcoin Lightning meta tag gives websites a way to receive direct payments from their visitors.
It allows websites to describe how and where they would like to receive payments.
Utilizing the open Lightning Network protocol payments can be sent in real-time from the visitor to the creator without the need for a third-party.

The goals is to bring the #value4value ideas to the web and make value4value transactions possible on any website.

What is value4value?

The value for value system is a way for content creators to receive direct payments from consumers. Consumers can reward creators by sending payments based on their perceived value of the content. The concept originated from the podcasting world but can be applied to any digital content.

Thanks to the open nature of the Lightning Network protocol value can be transferred directly from the consumer to the creator without the need to rely on a third-party.

Specification

Websites can specify one or more Lightning meta tags.

Lightning Meta tag format

The metadata name attribute must be set to lightning.

The metadata content attribute contains data as key-value pairs separated by a semi-colon and, optionally, a space for legibility. The value may or may not be wrapped in double- or single-inverted commas, which should be removed from the value if found at the beginning and end of the value.

Possible attributes

  • lnurlp: LNURL-pay URL or internet identifier.
  • keysend: The destination's node pubkey
  • bolt11: A bolt11 invoice
  • bolt12: A bolt12 offer
  • suggested: The suggested amount in Satoshi

Extensibility

As the standard evolves more attributes might be added in the future.

Examples

Receive payments through an LNURL-pay specified lightning address with a suggested amount of 100 Satoshi.

<meta name="lightning" content="lnurlp:your@lightning.address; suggested:100;">

Receive payments through keysend payments with a suggested amount of 100 Satoshi.

<meta name="lightning" content="keysend:0235s1df8b244dc91adclo8d1b1a3cp7fue31cee4r7e819e15bef9174d31d07154; suggested:100;">

Receive payments through a bolt11 invoice

<meta name="lightning" content="bolt11:lnbc100n13qjf26pp5k2zpzvnahqesv9xnk5sgfuxc7v9r0y4hvh86vx8lnqmupz74e6sqhp">

Payment notifications

JavaScript events can be triggered for successful payment notifications. This allows website to subscribe to payment events and process payment details in JavaScript.

Events are triggered as CustomEvent and can contain lightning payment details in the detail event property:

{
  preimage: string
}

Example

document.addEventListener('lightning:transaction', function (event) {
  console.log(event.type);
  console.log(event.detail);
  console.log(event.detail.preimage);
});

References

@bumi bumi changed the title Bitcoin/Lightning Meta Tag (value4value meta tag) Bitcoin/Lightning meta tag (value4value meta tag) Feb 16, 2022
@dergigi
Copy link

dergigi commented Feb 17, 2022

Love it!

suggested: The suggested amount in Satoshi

I'm a huge fan of making sats the standard, but what are your thoughts around adding support for other denominators as well? Would it be a terrible idea to support something like suggested:2usd or suggested:5eur?

The reason why I'm asking is that this will probably a "set it and forget it" kind of thing for content creators. For example, I did a paywall experiment not too long ago and set it to 2¢ in sats. Cents are down by 6x in terms of sats since then, and bitcoin is not done appreciating in purchasing power as far as I'm concerned.

In any case: I love everything about this, open standards and interoperability are definitely the way! 🧡:rocket:

@bumi
Copy link
Collaborator Author

bumi commented Feb 21, 2022

thanks for the feedback! That's a very good point. The idea should be "set and forget" (e.g. for static HTML pages).

Maybe we should add a currency attribute which defaults to BTC (in Satoshi). The denomination of the suggested attribute is then always in the smallest denomination of currency
This could make it easier for clients to parse.

@bumi
Copy link
Collaborator Author

bumi commented Feb 25, 2022

Should this maybe written as a bLIP? like Podcasting 2.0

@schneimi
Copy link

Hi, thx for directing me to this discussion. Here are my thoughts from reading the podcast:value spec and playing around with the meta tag.

  • There should be multiple recipients and a percentage split option.
  • I would keep this within one tag for simplicity, it's easy to parse and handle. Maybe similar to viewport.
  • For sufficient flexibility, I would keep the semi-colon as separator but for equal sign key-value pairs and go along with comma separated values resp. sub key-value pairs separated by colon.

Here are some examples with existing proposals:

# multiple recipients and `split` attribute with comma separated percentages
<meta name="lightning" content="recipient=keysend:[PUBKEY]; recipient=lnurlp:[ADDRESS]; suggested=1000; currency=sats; split=60,40;" />

# it would be also possible to use a `shares` or `percentage` sub key-value pair instead of `split`
<meta name="lightning" content="recipient=bolt11:[INVOICE],shares:60; recipient=bolt12:[OFFER],shares:40; suggested=1000; currency=sats;" />

I could also imagine this as part of a value4value meta tag:

<meta name="value4value" content="type=lightning; ..." />

Not sure if I am on the right track with this, but I wanted to share.

@bumi
Copy link
Collaborator Author

bumi commented Feb 28, 2022

thanks a lot for your input!

Regarding arrays I thought about doing it similar to the Open Graph protocol. They also say to " put multiple versions of the same tag on your page". Using any type of selectors should be able to get those arrays (e.g. document.querySelectorAll('head > meta[name="lightning"]'))
Somehow I actually thought it is easier to parse because it means less information in the string. The content string then always only has key-value pairs that should be easy to split. Why do you think it is easier to parse from within one string? instead of an array?

@schneimi
Copy link

schneimi commented Mar 2, 2022

You're welcome, I like the idea and enjoyed thinking about it.

Thanks for explaining the intention. Didn't think of this, meant easy in terms of just splitting.

I also see good reasons for Open Graph like RDFa notation but wanted to scout the possibilities here. I find it appealing to only have to put one meta tag in the head. The very most standard cases would still be pretty lean and legible.

Found a nice list of all meta tags: https://gist.github.com/lancejpollard/1978404

@danielcharrua
Copy link

Is there a list of services that currently support this meta tag? I know about getAlby but not others...

This is a great idea if becomes a standard 💪

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants