1

I'm trying to get the payees public key (destination node) from the payment request. You can see an example here.

In the source code for (https://lightningdecoder.com/) it seems like they get it from a tag or tag 19 (?) but I can't find this information in the decoded payment requests i get from LND:

https://github.com/andrerfneves/lightning-decoder/blob/0fd4bdcd9ec01e8bacd0a475543186ad2de3fe27/src/lib/bolt11.js#L386-L394

Does any one know how to get this? Preferably using Go and the invoice returned by LND

enter image description here

2
  • 1
    It's not quoite a duplicate question but I think the answer you seek for was given in the past to a similar question: bitcoin.stackexchange.com/a/96205 Jun 13 at 20:32
  • Thank you Rene, I think I can solve my question based on the answer you posted above. I’ll update this post once I have an example of the solution for future reference here. Jun 15 at 8:34

1 Answer 1

1

Here is the solution I ended up using:

// var invoice *lnrpc.Invoice

inva, err := zpay32.Decode(invoice.PaymentRequest, &chaincfg.MainNetParams)
if err != nil {
    return err
}

fmt.Sprintf("%x", inva.Destination.SerializeCompressed())

Alternatively, I think you can replace the fmt.Sprintf with hex.EncodeToString

hex.EncodeToString(inva.Destination.SerializeCompressed())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.