From 9b3d77904b529ec805cefb1998fc632349ef3d5d Mon Sep 17 00:00:00 2001 From: MPins Date: Sat, 21 Jun 2025 22:27:21 -0300 Subject: [PATCH 1/2] lnaddr.py: add support for signet and regtest --- lnaddr.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lnaddr.py b/lnaddr.py index 2d88a87..ed892ab 100755 --- a/lnaddr.py +++ b/lnaddr.py @@ -77,7 +77,7 @@ def bitarray_to_u5(barr): def encode_fallback(fallback, currency): """ Encode all supported fallback addresses. """ - if currency == 'bc' or currency == 'tb': + if currency == 'bc' or currency == 'tb' or currency == 'tbs' or currency == 'bcrt': fbhrp, witness = bech32_decode(fallback) if fbhrp: if fbhrp != currency: @@ -100,7 +100,7 @@ def encode_fallback(fallback, currency): raise NotImplementedError("Support for currency {} not implemented".format(currency)) def parse_fallback(fallback, currency): - if currency == 'bc' or currency == 'tb': + if currency == 'bc' or currency == 'tb' or currency == 'tbs' or currency == 'bcrt': wver = fallback[0:5].uint if wver == 17: addr=base58.b58encode_check(bytes([base58_prefix_map[currency][0]]) @@ -119,8 +119,10 @@ def parse_fallback(fallback, currency): # Map of classical and witness address prefixes base58_prefix_map = { - 'bc' : (0, 5), - 'tb' : (111, 196) + 'bc' : (0, 5), + 'tb' : (111, 196), + 'tbs' : (111, 196), + 'bcrt': (111, 196), } def is_p2pkh(currency, prefix): From 516750048ec136713c897492e8339946ec3494fb Mon Sep 17 00:00:00 2001 From: MPins Date: Sat, 21 Jun 2025 22:38:08 -0300 Subject: [PATCH 2/2] examples.sh: added signet and regtest examples --- examples.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples.sh b/examples.sh index dd7368d..dce8657 100755 --- a/examples.sh +++ b/examples.sh @@ -32,6 +32,14 @@ echo '### The same, on testnet, with a fallback address mk2QpYatsKicvFVuTAQLBryy ./lightning-address.py encode $TIMESTAMP --currency=tb --fallback=mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP --description-hashed="$LONG_DESCRIPTION" $(to_btc 24) $RHASH $PRIVKEY echo +echo '### The same, on signet, with a fallback address mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP' +./lightning-address.py encode $TIMESTAMP --currency=tbs --fallback=mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP --description-hashed="$LONG_DESCRIPTION" $(to_btc 24) $RHASH $PRIVKEY +echo + +echo '### The same, on regtest, with a fallback address mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP' +./lightning-address.py encode $TIMESTAMP --currency=bcrt --fallback=mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP --description-hashed="$LONG_DESCRIPTION" $(to_btc 24) $RHASH $PRIVKEY +echo + echo '### On mainnet, with fallback address 1RustyRX2oai4EYYDpQGWvEL62BBGqN9T with extra routing info to go via nodes 029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255 then 039e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255' ./lightning-address.py encode $TIMESTAMP --route=029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255/0102030405060708/1/20/3/039e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255/030405060708090a/2/30/4 --fallback=1RustyRX2oai4EYYDpQGWvEL62BBGqN9T --description-hashed="$LONG_DESCRIPTION" $(to_btc 24) $RHASH $PRIVKEY echo