Lightning Addresses for EVERYONE on Hive!

in Value 4 Value3 years ago (edited)

WORKING AGAIN!

I think it's all back to normal.... whatever normal actually is....

Earlier today 2022-05-20:

Coingeck's @coingecko 's API is still not working and I can't restart without it. Following this I will obviously work on adding another price service so I'm better prepared for this kind of thing.... living and learning!

Overnight Coingecko's API started going wrong and so I've got to clean up some stuff, all should be working again soon I hope.


You know that thing on Twitter where people (mostly) in the US can receive BTC Lightning tips direct through Twitter?

Well now literally EVERY ACCOUNT ON HIVE can receive Lightning tips!

untitled.gif

If you like my work on bridging Lightning and Hive, please vote for my continuation proposal:


Support Proposal 222 on PeakD
Support Proposal 222 with Hivesigner
Support Proposal 222 on Ecency


You heard it right. Your very own human memorable Lightning Address looks just like this (yes it does look just like an email address):

[email protected]

Just replace brianoflondon with your own Hive account name. Any BTC lightning sent to that address will end up as Hive in your Hive account.

You can also get yourself a QR code like the one I have at the bottom of the page.

This link will give you a QR code: just replace my hive account name with your own.

https://v4v.app/v1/lnurlp/qrcode/brianoflondon

You can save that image and put it anywhere.

And a special shout out to all Hive Devs: you can add "tip with Lightning" buttons to any Hive UI. You just need to call the api to generate the QR code (you can even cache this, it doesn't change!).

Demo

Hive Lightning Address demo

I've sped up the typing part but the rest of this is real speed. The wallet I'm using here is Breez which is a non-custodial wallet (meaning I really do hold the keys). There are custodial wallets which might shave a few seconds off the Lightning sending time.

How it works

Behind the scenes there is quite a lot going on to make this happen.

As I've written extensively before, Lightning is not a blockchain based crypto system. Lightning can only be received by a Lightning Node which is online and working 24/7 and which has "channels" open to the rest of the Lightning Network.

So in order for you to "receive" Lightning on a static address, just as you can receive Hive on your username or BTC on an address you can generate, things get interesting.

LNURL

What Lightning needed was a way to have a pointer to something on the web which could then generate a Lightning Invoice as a way to receive funds. I kind of built this from scratch myself in order for my v4v.app system to receive Hive and send Lightning: behind the scenes I don't really just receive Lightning, I generate an invoice which a mobile wallet can pay.

DIY was the way I learned

Having built this all from scratch myself, I then realised I had built most of the components I would need to implement something which has been growing in adoption on the Lightning Side: Lightning Addresses. There's a fancy website to tell you all about this and it gives you dozens of ways to grab a Lightning Address but almost all are custodial.

There is a way to set this up with your own node but it's seriously tedious work (here's a 20 min video for you to plough through.

The Flow

Part 1 flow

The background for what is going on here is in this Github repo: LNURL RFC. I'm specifically making use of LUD-01, LUD-06 and LUD-12

  • LUD-01: Base LNURL encoding and decoding
  • LUD-06: payRequest base spec
  • LUD-12: Comments in payRequest.

Zeus Wallet Lightning Address Payment screen

When a compatible Lightning wallet scans the QR Code I produce or a user types an address like [email protected] into a compatible wallet they are presented with a screen like this screen from Zeus. There's a visual reminder of the destination (my avatar), space to enter an amount between 1,000 and 100,000 Sats and space for an optional comment.

Part 1 technical

The Lightning Address is encoded in the QR Code as a BECH32 string and actually looks like this:

lightning:LNURL1DP68GURN8GHJ7A35WCHXZURS9UH8WETVDSKKKMN0WAHZ7MRWW4EXCUP0VFEXJCTWDANXCMMWV3HKU64WYHS

The lightning: prefix is mostly to help Mobile apps route these strings. On my iPhone, the Breez app grabs these strings automatically if the camera sees a QR code with this encoding. On Android the same thing happens but I believe you have the option to chose which app takes over.

The Lightning app then sends a GET request to the URL encoded in that string which is actually this:

https://v4v.app/.well-known/lnurlp/brianoflondon (you can click on it, you'll get some JSON).

If you manually type [email protected] into a Lightning wallet as an address it just reorganizes that to make the same call.

That GET request returns a JSON which looks like something like this:

{
  "tag": "payRequest",
  "callback": "https://v4v.app/v1/lnurlp/callback/brianoflondon?no_image=true",
  "minSendable": 1000000,
  "maxSendable": 100000000,
  "metadata": "[[\"text/plain\", \"v4v.app Lightning to Hive @brianoflondon\"], [\"text/identifier\", \"[email protected]\"], [\"text/long-desc\", \"Sending Lightning to Hive account: @brianoflondon\"]]",
  "commentAllowed": 1000
}

However I've actually excluded a big chunk of data from the "metadata" field because an encoded version of the Hive avatar is sent in there as well.

Part 2 flow

The user can now be shown a range for the amount to send and an image to help identify where the payment is going: that's where I use the Hive avatar. The user can then add a comment and hit send, there will be one more confirmation and then the sats will be sent.

Part 2 technical

The wallet app can now call the "callback" address with the parameters set by the user. When that happens my API generates a unique invoice specifically for this payment in the form of another BECH32 encoded string. This is the "regular" Lightning way of making exchanges of value.

Once the Wallet receives that invoice, it pays it.

Part 3 Hive

From here on in the rest of my @v4vapp apparatus takes over. It watches incoming payments to my Lightning node and acts on them based on various metadata in the comment field and embedded in the Invoice itself (which my software generated in part 2 above). I receive the sats and immediately make a conversion to Hive and send the Hive out. That bit is generally quicker than the Lightning side.

And the final result....

You Got Hive!


Support Proposal 222 on PeakD
Support Proposal 222 with Hivesigner
Support Proposal 222 on Ecency


Send Lightning to Me!

Sort:  
There are 2 pages
Pages


~~~ embed:1527257061859409920 twitter metadata:RW9pbkNhcnJvbGw1MHx8aHR0cHM6Ly90d2l0dGVyLmNvbS9Fb2luQ2Fycm9sbDUwL3N0YXR1cy8xNTI3MjU3MDYxODU5NDA5OTIwfA== ~~~

~~~ embed:1527284221353504768 twitter metadata:dGhlZWJvYm18fGh0dHBzOi8vdHdpdHRlci5jb20vdGhlZWJvYm0vc3RhdHVzLzE1MjcyODQyMjEzNTM1MDQ3Njh8 ~~~

~~~ embed:1527297604018577412 twitter metadata:ZHVkZW9udGhld2VifHxodHRwczovL3R3aXR0ZXIuY29tL2R1ZGVvbnRoZXdlYi9zdGF0dXMvMTUyNzI5NzYwNDAxODU3NzQxMnw= ~~~

~~~ embed:1527323586834608130 twitter metadata:dGFza21hc3RlcjQ0NTB8fGh0dHBzOi8vdHdpdHRlci5jb20vdGFza21hc3RlcjQ0NTAvc3RhdHVzLzE1MjczMjM1ODY4MzQ2MDgxMzB8 ~~~

~~~ embed:1527338094176788494 twitter metadata:aGl2ZV9ibG9ja2NoYWlufHxodHRwczovL3R3aXR0ZXIuY29tL2hpdmVfYmxvY2tjaGFpbi9zdGF0dXMvMTUyNzMzODA5NDE3Njc4ODQ5NHw= ~~~

~~~ embed:1527432570828472336 twitter metadata:R2lzZXRTYW18fGh0dHBzOi8vdHdpdHRlci5jb20vR2lzZXRTYW0vc3RhdHVzLzE1Mjc0MzI1NzA4Mjg0NzIzMzZ8 ~~~

~~~ embed:1527553016274239490 twitter metadata:RG9jdW1lbnRpbmdIaXZlfHxodHRwczovL3R3aXR0ZXIuY29tL0RvY3VtZW50aW5nSGl2ZS9zdGF0dXMvMTUyNzU1MzAxNjI3NDIzOTQ5MHw= ~~~

~~~ embed:1527579722309328900 twitter metadata:c3RlZXZjfHxodHRwczovL3R3aXR0ZXIuY29tL3N0ZWV2Yy9zdGF0dXMvMTUyNzU3OTcyMjMwOTMyODkwMHw= ~~~

~~~ embed:1528028201246769156 twitter metadata:UmFpY2VseXNfR29tZXp8fGh0dHBzOi8vdHdpdHRlci5jb20vUmFpY2VseXNfR29tZXovc3RhdHVzLzE1MjgwMjgyMDEyNDY3NjkxNTZ8 ~~~

The rewards earned on this comment will go directly to the people( @steemadi ) sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.

Greetings friend @brianoflondon pleased to say hello. I have been testing the lightning bridge, trying to send some satoshis to my wallet Tippin.me but there has been no way for the application to take the invoice. In the image you can see the message it gives me every time I try.

Saludos amigo @brianoflondon complacido de saludar. He estado probando el puente Lightning, tratando de enviar algunos satoshis a mi billetera Tippin.me pero no ha habido manera de que la aplicacion me tome el invoice. En la imagen puedes ver el mensaje que me entrega cada vez que lo intento.

image

Now, I sent satoshis to my Hive account and this transaction was carried out without problems and very quickly. My question: what could be happening? Are there any restrictions with this wallet or something like that? Or am I doing it wrong? I know how to thank you very much for your support and help. Greetings.

Ahora bien realice un envió de satoshis a mi cuenta de Hive y esta transacción se realizo sin problemas y muy rápido. Mi consulta: ¿Que puede estar sucediendo? ¿Existe alguna restricción con esta billetera o algo por el estilo? ¿O sera que lo estoy haciendo mal? Mucho sabre agradecer tu soporte y ayuda. Saludos.

You’re right my code has a problem with Tippin. I’ll look at this today and hopefully get it working. Thanks for finding this!

Fixed it and it should be working with Tippin now. I sent you 2000 sats :-)

Hello Brian, there seems to be a bug in your code. I received multiple HIVE payments for a single lightning transmission.

image.png

Yes! Coingeko's API has broken and this has caused my code to malfunction. I've turned everything off right now and will try to work out what's going on. and fix.

I send you the Hive I received later

Thank you, i'm still trying to figure out what happened. Did you also send me (separately) a payment direct to me as lightning?

Yes, i sent you two Times 1000 sats.

Don't send me anything back yet, there was a huge problem at my end caused by @coingecko 's API not working (and me not anticipating that failure properly).

I'll work through all the problems and let you know. I think you probably got around $5 worth of Hive more than you should but it will take me a while to untangle this and Coingecko's price feed is still not working anyway.

holy crap this is so cool!

You know that thing on Twitter where people (mostly) in the US can receive BTC Lightning tips direct through Twitter?

Well now literally EVERY ACCOUNT ON HIVE can receive Lightning tips

This is the only part of this post that makes sense to me.. the rest is nerdery and jibberish.. but that's good.. we need more nerds building shit here.. great job. Proposal supported.

!PIMP

Think you can invent a !NERD token next? 🤣😂

You can receive Satoshis which get converted to HIVE which you can convert to HBD..

...which can be used to buy weed.

Skip the jibberish and get to the use cases.

Posted Using LeoFinance Beta

Lol! Yes you can buy some Weed products with HBD, lol. Now we can take your lightning too, lol.

[email protected]

Lol. Best explanation ever

This! I love how you summed it up for a cub to understand :)

Posted Using LeoFinance Beta

We don't need to know how all tjses things work thanks God.
We just need to know that there are great Devs on hive that can make it happen for us.

Thanks Brian. This looks amazing.

👍👍👍

!BEER


Hey @niallon11, here is a little bit of BEER from @davedickeyyall for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.


You must be killin' it out here!
@davedickeyyall just slapped you with 1.000 PIMP, @brianoflondon.
You earned 1.000 PIMP for the strong hand.
They're getting a workout and slapped 1/2 possible people today.

pimp_logo


Read about some PIMP Shit or Look for the PIMP District

So by using the Lightning address you can buy Hive with bitcoin without using an exchange, and it goes straight to your Hive account?

Does it work in reverse? Say you send Hive to the Lightning node and receive satoshis?

This is so cool! Thank you for helping to grow our ecosystem

Thank you for this Brain.

Any BTC lightning sent to that address will end up as Hive in your Hive account

It worked perfectly for me :)

Screenshot 20220519 at 13.23.49.png

Posted Using LeoFinance Beta

You need to try it once more Nathan. Let's see if it works again.

image.png

This is exactly why I put the avatar in the middle of these :-) Very important part of the plan!

So there's only one time we can generate this unique QR??

Posted Using LeoFinance Beta

You can generate it as much as you like but it shouldn't change. Behind the scenes it's just a complicated way to encode this address:

https://v4v.app/.well-known/lnurlp/finguru?no_image=false

So unless I change something, that doesn't really need to change so the QR code remains static.

Got it. Just to confirm one last time, my QR code will not change even if I change my DP?

Posted Using LeoFinance Beta

i was wondering this too... if DP means profile pic that is...

1777 Sats sent 🤜

Go Nate
Go Nate

Go Nate

This is really amazing! Congratz! 💜

Preety cool ah!! Congragulations!!

Posted Using LeoFinance Beta

I appreciate every work you put to this which is really nice and awesome and also I have voted on your proposal as well to appreciate your good work.

I shall definitely use this. I have a qr code, then I let people scan the code to pay me. Its so useful, I will try it out when I send this comment !

How did it go?

Posted Using LeoFinance Beta

This some awesome stuff!

Wow, that’s great! Will have to test it if it really works. 👏🏻 Excellent work.

Really awesome

I did wonder if one could tip accounts with btc here like we do hive.

But doesn't it defeat the purpose? 🤔

nice

Screenshot_20220519-132552_Zeus.jpg

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment !STOP below


Hey @condeas, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

This is a great work, thank you for making it happens real good 🤗

Lightning is not a blockchain based crypto system.

I thought all crypto was based on the blockchain. Mehn, I got a lot to learn with this crypto thing.

stick around, you'll learn and understand more and more every day.

Posted Using LeoFinance Beta

I'm sure gonna stick around

Posted Using LeoFinance Beta

This is really awesome! Thanks for working int his :D

This looks incredible, although reading all that confuses me, there are still many things I don't understand about Hive and the crypto world, I don't know much.

But what you show here looks awesome. I have to read it again in greater detail. Understanding how the funds can get to my Hive account, but from the side of the person giving the advice I don't quite understand that part of what to do. Maybe I read it too fast or got confused by so many things I don't understand. But it looks super fabulous, thank you very much @brianoflondon 😎

DO you understand how wiring money online works?

Not really❤️

You are the real MVP BOL. :')

You deserve to be voted as witness, which I just did. Thank you for sharing this with us dear.

Big step forwards for Hive today! Thanks a lot!

Posted Using LeoFinance Beta

I couldn't get [email protected] to work with Strike. However, invoicing through v4v does work with Strike. I'll have to play with another Lightning wallet.

This is the bridge to HIVE I have been waiting for. I look forward to seeing the platform scale. Although, this alone is huge.

amazing, thanks!

@tipu curate

Absolutely brilliant!

Now we just have to wait until the BTC Lightning network becomes useful :)

That's great. Will vote for your proposal when I get back on my laptop.

Posted using LeoFinance Mobile

What if I change my Profile Picture?

You can regenerate a new QR and it'll put your new image in it.

Wow, this is great news and it makes the process simple for everyone here on Hive. I think this is a great addition to the entire blockchain.

Posted Using LeoFinance Beta

The amount of work you did by yourself is impressive, especially as you started from scratch. That's super cool! Too bad I won't be able to connect to the CTT show tonight.

Cheers!

This is freaking EPIC!!! We need got all use these addresses on Twitter for our usernames! Changing mine now actually!

untitled.gif

Question… How would we approve the invoice on our end… For instance I attempted to send from Cash app and they require an invoice approval.

I am going to try again from my Blue wallet which is non custodial to see how it reacts there.

Just something I ran into…

Can this (or anything similar) be used by exchanges as a transfer method, when people buy/sell Hive and/or Hive Dollars (HBD)?

Well my friend!!! lets try this out!!!

image.png

Proposal voted!

Esta es una valiosa información, muchas gracias por compartir

Great work Brian. A very elegant solution.

Posted Using LeoFinance Beta

Good work! It would be interesting to see this integrated clearly into onboarding processes to make initial power ups of new accounts more efficient.

Supported for sure.

Thank you so much for this! This is the kind of work that makes HIVE to excel! I already support your proposal!!! Much success in your endeavors!!! I can't give much in gratitude but just a few tokens !PIZZA !PGM !LOLZ !CTP !HBIT


cpol.png

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.01 MOTA - 0.05 DEC - 15 SBT tokens to @brianoflondon

remaining commands 1

BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!

The tokens that the command sends are: 0.1 PGM-0.1 LVL-2.5 BUDS-0.01 MOTA-0.05 DEC-15 SBT-1 STARBITS-0.00000001 BTC (SWWAP.BTC)

image.png
Discord image.png

Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP

Get potential votes from @ pgm-curator by paying in PGM, here is a guide

I'm a bot, if you want a hand ask @ zottone444


PIZZA!

PIZZA Holders sent $PIZZA tips in this post's comments:
@cpol(3/5) tipped @brianoflondon (x1)

You can now send $PIZZA tips in Discord via tip.cc!

That is amazing! Thank you for what you are doing and just voted for your proposal.

Posted Using LeoFinance Beta

Man....This is just awesome on so many levels!

Thank you for all the hard work you put into this community. Appreciate you sir!

Just voted for your proposal!

Posted Using LeoFinance Beta

Congratulations @brianoflondon! Your post has been a top performer on the Hive blockchain and you have been rewarded with the following badge:

Post with the highest payout of the day.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Month - Feedback from May - Day 15

$WINE


Congratulations, @theguruasia You Successfully Shared 0.300 WINEX With @brianoflondon.
You Earned 0.300 WINEX As Curation Reward.
You Utilized 3/3 Successful Calls.

wine_logo


Contact Us : WINEX Token Discord Channel
WINEX Current Market Price : 0.152


Swap Your Hive <=> Swap.Hive With Industry Lowest Fee (0.1%) : Click This Link
Read Latest Updates Or Contact Us

Wow, that's cool 😎

!BEER

There are 2 pages
Pages