Looking for help! Sending a KEYSEND Payment via the REST API. HOW???? #6357
-
I've been driving myself crazy trying to send a Keysend payment via the REST API. I can do most else that I've tried to do via the REST API: check invoices, pay invoices, create new invoices... but sending a simple keysend payment has got me stumped! I'm working on Value 4 Value streaming payments in Podcasting and AMP is not an option. I know something like this will work from the command line...
But why can't I get my code to work? I'm using: I don't believe the KeysendCustomRecord is the issue as I get exactly the same failure with or without trying to send custom records. Headers and cert are working just fine. The failure always looks like and this is after I've gone to hell and back figuring out the correct (I think) hex and base64 encoding of the destination public key.
Code fragment:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 13 replies
-
Since you're not paying an invoice, the receiver doesn't know the preimage for the given payment's hash. You need to add the preimage to your custom records. The number is |
Beta Was this translation helpful? Give feedback.
-
Thank you!!! I'm making progress but I'm not there yet.... unless I've missed something this just isn't documented well anywhere!! I'll fix that if I can get this working. I've now added generating a pre_image I feel this should be much easier than it is especially considering how easy it is to do with lncli. I've tried to figure out what the Go is doing but I've never really looked a Go before. I'm now getting output like this:
|
Beta Was this translation helpful? Give feedback.
-
I feel like the head of a team of monkeys that just finished the last page typing out Shakespear's complete works! I got it to work..... :-) Now if you can point me to a good place in the docs I'll figure out how to explain this and make it easy becasue honestly this is the 3rd time I've attempted this over the last 6 months and I've given up every other time and just used LNPay's API which is buttery smooth and easy.
and I only had to re-use the pre-image in the docs once to make sure it was hashing the right way....
|
Beta Was this translation helpful? Give feedback.
-
Hi @brianoflondon @guggero I have been trying to do same with Javascript but I keep running into the same issue with the hash length
Here is my sample code
Any help will be appreciated, thanks |
Beta Was this translation helpful? Give feedback.
-
Thanks for the great work @brianoflondon! I was working on sending keysend payments with the LND gRPC interface. I ran into the same problem as you did above, and your solution worked for me too. |
Beta Was this translation helpful? Give feedback.
I feel like the head of a team of monkeys that just finished the last page typing out Shakespear's complete works!
I got it to work..... :-) Now if you can point me to a good place in the docs I'll figure out how to explain this and make it easy becasue honestly this is the 3rd time I've attempted this over the last 6 months and I've given up every other time and just used LNPay's API which is buttery smooth and easy.