I wanted to know how to get a Bech32 version of my LND Lightning Node's Public Key, for use in DNS SRV records outlined in the Bolt-12 proposal at https://github.com/tyzbit/lightning-rfc/blob/bolt12-node-dns-advertisement/12-node-dns-advertisement.md
There's an App for that!
This didn't seem easily done in LND command-line, however I found the following tool:
To install, clone to a directory as follows:
git clone https://github.com/nym-zone/bech32 cd bech32
However I get an error on the documented instructions.
make -f Makefile.linux && make -f Makefile.linux check && sudo make -f Makefile.linux install
make: Nothing to be done for 'all'. make: *** No rule to make target 'check'. Stop.
So instead I went with the following which worked out fine.
make -f Makefile.linux && sudo make -f Makefile.linux install
cc -O2 -std=c99 -c -o bech32.o bech32.c cc -O2 -std=c99 -c -o segwit_addr.o segwit_addr.c cc -o bech32 bech32.o segwit_addr.o [sudo] password for bretton: install bech32 /usr/local/bin install bech32.1 /usr/local/man/man1
Then to encode my LN node's public key to a Bech32 string I'll use:
bech32 -e -h <human readable part> <my-node-pubkey>
For the human readable part we're going to use
ln for Lighting Network. As follows:
bech32 -e -h ln 02262bbc21c171bc91a1d6bbf89571c95873849b9a60d3ea9671b777d852d39ecd
I can now do this for all my lightning nodes and update DNS accordingly.
Find your node at https://www.robtex.com/lightning/node/ and there is output to check what is expected from DNS, along with validation once it's setup.
There is also a python library here: https://github.com/sipa/bech32/tree/master/ref/python