Merge pull request #11357 from Roasbeef/zpay32-bolt11-vectors
What changed, and why it matters
This change tightens how LND reads BOLT 11 Lightning invoices. It now rejects invoices that violate the spec: fixed-length fields with wrong lengths, duplicate payment-address fields, and high-S signatures when the invoice explicitly names the payee. Previously these malformed invoices were accepted or silently skipped. The patch is defensive and brings LND into line with the BOLT 11 specification and its official test vectors.
Treat as a hardening/spec-compliance patch. Review whether any production or partner systems previously relied on LND accepting the now-rejected malformed invoices, and update integration tests that may have depended on the old lenient behavior. No emergency response is indicated by the commit materials alone.
Security signals we found
Rejects malformed BOLT 11 invoices that were previously accepted
Adds low-S signature enforcement for invoices with explicit destination pubkey
Adds duplicate payment-address (s) field rejection
Adds fixed-length field validation for p/h/s/n
Adds BOLT 11 official test vectors to the test suite
Release note describes change as spec compliance, not a security fix
Evidence from the diff
The commit updates zpay32 to enforce three BOLT 11 reader rules: (1) fixed-length tagged fields p/h/s/n must have exact lengths, returning ErrInvalidFixedFieldLength instead of skipping; (2) only one payment-address (s) field is allowed, returning ErrDuplicatePaymentAddr; (3) when an explicit destination (n) field is present, the signature must be low-S, returning ErrHighSSignature. It also imports the BOLT 11 invoice-test.json vectors and adds a test harness that runs Decode against them. The release note frames this as spec compliance rather than a vulnerability fix.
Changed components
zpay32/decode.gozpay32/invoice.gozpay32/bolt11_vectors_test.gozpay32/test-vectors/invoice-test.jsonInspect captured patch +389 / −49
### docs/release-notes/unreleased/11357.md
@@ -0,0 +1,10 @@
+# Technical and Architectural Updates
+
+## BOLT Spec Updates
+
+* The BOLT 11 invoice decoder now [rejects invoices that the spec marks
+ invalid](https://github.com/lightningnetwork/lnd/pull/11357) but were
+ previously accepted: fixed-length fields (`p`, `h`, `s`, `n`) with the wrong
+ length, more than one payment address (`s`) field, and a high-S signature on
+ an invoice with an explicit destination (`n`) field. The spec's invoice test
+ vectors are now part of the test suite.
### zpay32/bolt11_vectors_test.go
@@ -0,0 +1,108 @@
+package zpay32
+
+import (
+ "encoding/json"
+ "os"
+ "strings"
+ "testing"
+
+ "github.com/btcsuite/btcd/chaincfg/v2"
+ "github.com/stretchr/testify/require"
+)
+
+// bolt11VectorFile holds the invoice test vectors published alongside BOLT 11
+// in the spec repository (bolt11/invoice-test.json).
+const bolt11VectorFile = "test-vectors/invoice-test.json"
+
+// bolt11Vector is a single entry of the BOLT 11 invoice test vectors.
+type bolt11Vector struct {
+ Description string `json:"description"`
+ Valid bool `json:"valid"`
+ Invoice string `json:"invoice"`
+}
+
+// paymentLayerVectors lists the invalid vectors that Decode accepts on
+// purpose, as lnd enforces the rule they exercise when the invoice is paid
+// rather than when it's decoded. Each value is the reason.
+var paymentLayerVectors = map[string]string{
+ // The `s` field is optional at the decoding layer, since lnd creates
+ // invoices with blinded paths and no payment address, and older
+ // stored invoices may predate payment addresses. The router rejects
+ // a payment request with neither a payment address nor blinded paths.
+ "Missing required `s` field": "payment address checked by the router",
+}
+
+// expectedVectorErrors maps invalid vectors to the error Decode must return
+// for them, so a vector rejected for the wrong reason fails the test.
+var expectedVectorErrors = map[string]error{
+ "Same, but with an `n` field of invalid length": ErrInvalidFixedFieldLength, //nolint:ll
+ "Two distinct p fields in an otherwise valid invoice": ErrDuplicatePaymentHash, //nolint:ll
+ "The same p field twice in an otherwise valid invoice": ErrDuplicatePaymentHash, //nolint:ll
+ "Two distinct s fields in an otherwise valid invoice": ErrDuplicatePaymentAddr, //nolint:ll
+ "Non canonical signature (high-S) with 'n' field defined": ErrHighSSignature, //nolint:ll
+}
+
+// TestBOLT11Vectors runs every invoice test vector from the spec through
+// Decode. Unknown required feature bits are rejected through the
+// WithErrorOnUnknownFeatureBit option, as by default they're left for
+// pathfinding to reject so that the invoice can still be inspected.
+func TestBOLT11Vectors(t *testing.T) {
+ t.Parallel()
+
+ jsonData, err := os.ReadFile(bolt11VectorFile)
+ require.NoError(t, err)
+
+ var vectors []bolt11Vector
+ require.NoError(t, json.Unmarshal(jsonData, &vectors))
+ require.NotEmpty(t, vectors)
+
+ // Every key in the two maps must name a vector, so a reworded
+ // description in a later resync fails here instead of silently
+ // dropping its stricter check.
+ descriptions := make(map[string]struct{}, len(vectors))
+ for _, v := range vectors {
+ descriptions[v.Description] = struct{}{}
+ }
+ for desc := range paymentLayerVectors {
+ require.Contains(t, descriptions, desc)
+ }
+ for desc := range expectedVectorErrors {
+ require.Contains(t, descriptions, desc)
+ }
+
+ for _, v := range vectors {
+ t.Run(v.Description, func(t *testing.T) {
+ t.Parallel()
+
+ net := &chaincfg.MainNetParams
+ hrp := strings.ToLower(v.Invoice)
+ if strings.HasPrefix(hrp, "lntb") {
+ net = &chaincfg.TestNet3Params
+ }
+
+ invoice, err := Decode(
+ v.Invoice, net, WithErrorOnUnknownFeatureBit(),
+ )
+
+ if _, ok := paymentLayerVectors[v.Description]; ok {
+ require.False(t, v.Valid)
+ require.NoError(t, err)
+ require.True(t, invoice.PaymentAddr.IsNone())
+
+ return
+ }
+
+ if v.Valid {
+ require.NoError(t, err)
+
+ return
+ }
+
+ require.Error(t, err)
+ wantErr, ok := expectedVectorErrors[v.Description]
+ if ok {
+ require.ErrorIs(t, err, wantErr)
+ }
+ })
+ }
+}
### zpay32/decode.go
@@ -189,6 +189,15 @@ func Decode(invoice string, net *chaincfg.Params, opts ...DecodeOption) (
if !signature.Verify(hash, decodedInvoice.Destination) {
return nil, fmt.Errorf("invalid invoice signature")
}
+
+ // BOLT 11 only lets a reader accept a high-S signature when it
+ // recovers the public key from it. With an explicit `n` field
+ // the signature must be in low-S form.
+ var sigS btcec.ModNScalar
+ sigS.SetByteSlice(sig.RawBytes()[32:64])
+ if sigS.IsOverHalfOrder() {
+ return nil, ErrHighSSignature
+ }
} else {
headerByte := recoveryID + 27 + 4
compactSign := append([]byte{headerByte}, sig.RawBytes()...)
@@ -268,6 +277,7 @@ func parseTaggedFields(invoice *Invoice, fields []byte, net *chaincfg.Params) er
var (
index int
paymentHashSeen bool
+ paymentAddrSeen bool
)
for len(fields)-index > 0 {
@@ -306,19 +316,16 @@ func parseTaggedFields(invoice *Invoice, fields []byte, net *chaincfg.Params) er
invoice.PaymentHash, err = parse32Bytes(base32Data)
case fieldTypeS:
- if invoice.PaymentAddr.IsSome() {
- // We skip the field if we have already seen a
- // supported one.
- continue
+ if paymentAddrSeen {
+ return ErrDuplicatePaymentAddr
}
+ paymentAddrSeen = true
addr, err := parse32Bytes(base32Data)
if err != nil {
return err
}
- if addr != nil {
- invoice.PaymentAddr = fn.Some(*addr)
- }
+ invoice.PaymentAddr = fn.Some(*addr)
case fieldTypeD:
if invoice.Description != nil {
@@ -340,17 +347,19 @@ func parseTaggedFields(invoice *Invoice, fields []byte, net *chaincfg.Params) er
case fieldTypeN:
if invoice.Destination != nil {
- // We skip the field if we have already seen a
- // supported one.
+ // BOLT 11 only requires exactly one `p` and
+ // one `s` field, so for a repeated field we
+ // keep the first one we saw.
continue
}
invoice.Destination, err = parseDestination(base32Data)
case fieldTypeH:
if invoice.DescriptionHash != nil {
- // We skip the field if we have already seen a
- // supported one.
+ // BOLT 11 only requires exactly one `p` and
+ // one `s` field, so for a repeated field we
+ // keep the first one we saw.
continue
}
@@ -449,16 +458,11 @@ func parseFieldDataLength(data []byte) (uint16, error) {
func parse32Bytes(data []byte) (*[32]byte, error) {
var paymentHash [32]byte
- // A field with an unexpected length is reported as absent rather
- // than as an error, leaving it to the caller to decide whether a
- // missing field is fatal. Note that BOLT 11 is stricter, and
- // requires a reader to fail on a fixed-length field (p, h, s, n)
- // with the wrong length. For the payment hash the end result is the
- // same: a lone wrong-length field leaves PaymentHash nil and
- // validateInvoice rejects the invoice, and a wrong-length field
- // paired with a valid one is rejected as a duplicate.
+ // BOLT 11 requires a reader to fail on a fixed length field (p, h, s,
+ // n) with the wrong length, rather than skip it.
if len(data) != hashBase32Len {
- return nil, nil
+ return nil, fmt.Errorf("%w: got %d groups, expected %d",
+ ErrInvalidFixedFieldLength, len(data), hashBase32Len)
}
hash, err := bech32.ConvertBits(data, 5, 8, false)
@@ -497,10 +501,11 @@ func parseMetadata(data []byte) ([]byte, error) {
// parseDestination converts the data (encoded in base32) into a 33-byte public
// key of the payee node.
func parseDestination(data []byte) (*btcec.PublicKey, error) {
- // As BOLT-11 states, a reader must skip over the destination field
- // if it does not have a length of 53, so avoid returning an error.
+ // BOLT 11 requires a reader to fail on a destination field that
+ // doesn't have a length of 53, rather than skip it.
if len(data) != pubKeyBase32Len {
- return nil, nil
+ return nil, fmt.Errorf("%w: got %d groups, expected %d",
+ ErrInvalidFixedFieldLength, len(data), pubKeyBase32Len)
}
base256Data, err := bech32.ConvertBits(data, 5, 8, false)
### zpay32/invoice.go
@@ -109,6 +109,25 @@ var (
ErrDuplicatePaymentHash = errors.New(
"invoice contains multiple payment hashes",
)
+
+ // ErrDuplicatePaymentAddr is returned when an invoice contains more
+ // than one payment address (`s`) field.
+ ErrDuplicatePaymentAddr = errors.New(
+ "invoice contains multiple payment addresses",
+ )
+
+ // ErrInvalidFixedFieldLength is returned when one of the fixed length
+ // tagged fields (p, h, s, n) has a data length other than the one
+ // BOLT 11 specifies for it.
+ ErrInvalidFixedFieldLength = errors.New(
+ "invalid data length for fixed length field",
+ )
+
+ // ErrHighSSignature is returned when an invoice carrying an explicit
+ // destination (`n` field) has a signature that isn't in low-S form.
+ ErrHighSSignature = errors.New(
+ "invoice signature is not in low-S form",
+ )
)
// MessageSigner is passed to the Encode method to provide a signature
### zpay32/invoice_internal_test.go
@@ -3,6 +3,7 @@ package zpay32
import (
"bytes"
"encoding/binary"
+ "errors"
"math"
"reflect"
"testing"
@@ -316,9 +317,8 @@ func TestParseFieldDataLength(t *testing.T) {
}
}
-// TestParse32Bytes checks that the payment hash is properly parsed.
-// If the data does not have a length of 52 bytes, we skip over parsing the
-// field and do not return an error.
+// TestParse32Bytes checks that the payment hash is properly parsed, and that
+// data without a length of 52 groups is rejected.
func TestParse32Bytes(t *testing.T) {
t.Parallel()
@@ -330,24 +330,21 @@ func TestParse32Bytes(t *testing.T) {
result *[32]byte
}{
{
- data: []byte{},
- valid: true,
- result: nil, // skip unknown length, not 52 bytes
+ data: []byte{},
+ valid: false, // not 52 groups
},
{
- data: []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- valid: true,
- result: nil, // skip unknown length, not 52 bytes
+ data: []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
+ valid: false, // not 52 groups
},
{
data: testPaymentHashData,
valid: true,
result: &testPaymentHash,
},
{
- data: append(testPaymentHashData, 0x0),
- valid: true,
- result: nil, // skip unknown length, not 52 bytes
+ data: append(testPaymentHashData, 0x0),
+ valid: false, // not 52 groups
},
}
@@ -422,9 +419,8 @@ func TestParseDescription(t *testing.T) {
}
}
-// TestParseDestination checks that the destination is properly parsed.
-// If the data does not have a length of 53 bytes, we skip over parsing the
-// field and do not return an error.
+// TestParseDestination checks that the destination is properly parsed, and
+// that data without a length of 53 groups is rejected.
func TestParseDestination(t *testing.T) {
t.Parallel()
@@ -436,24 +432,21 @@ func TestParseDestination(t *testing.T) {
result *btcec.PublicKey
}{
{
- data: []byte{},
- valid: true,
- result: nil, // skip unknown length, not 53 bytes
+ data: []byte{},
+ valid: false, // not 53 groups
},
{
- data: []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
- valid: true,
- result: nil, // skip unknown length, not 53 bytes
+ data: []byte{0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
+ valid: false, // not 53 groups
},
{
data: testPubKeyData,
valid: true,
result: testPubKey,
},
{
- data: append(testPubKeyData, 0x0),
- valid: true,
- result: nil, // skip unknown length, not 53 bytes
+ data: append(testPubKeyData, 0x0),
+ valid: false, // not 53 groups
},
}
@@ -808,6 +801,14 @@ func TestParseTaggedFields(t *testing.T) {
&distinctPaymentHashes, fieldTypeP, secondPaymentHash,
))
+ var distinctPaymentAddrs bytes.Buffer
+ require.NoError(t, writeBytes32(
+ &distinctPaymentAddrs, fieldTypeS, testPaymentHash,
+ ))
+ require.NoError(t, writeBytes32(
+ &distinctPaymentAddrs, fieldTypeS, secondPaymentHash,
+ ))
+
tests := []struct {
name string
data []byte
@@ -837,7 +838,7 @@ func TestParseTaggedFields(t *testing.T) {
{
name: "malformed then valid payment hash",
data: malformedThenValid.Bytes(),
- wantErr: ErrDuplicatePaymentHash,
+ wantErr: ErrInvalidFixedFieldLength,
},
{
name: "identical payment hashes",
@@ -849,6 +850,11 @@ func TestParseTaggedFields(t *testing.T) {
data: distinctPaymentHashes.Bytes(),
wantErr: ErrDuplicatePaymentHash,
},
+ {
+ name: "distinct payment addresses",
+ data: distinctPaymentAddrs.Bytes(),
+ wantErr: ErrDuplicatePaymentAddr,
+ },
{
name: "only type specified",
data: []byte{0x0d},
@@ -879,7 +885,7 @@ func TestParseTaggedFields(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
var invoice Invoice
gotErr := parseTaggedFields(&invoice, tc.data, netParams)
- if tc.wantErr != gotErr {
+ if !errors.Is(gotErr, tc.wantErr) {
t.Fatalf("Unexpected error. want=%v got=%v",
tc.wantErr, gotErr)
}
### zpay32/invoice_test.go
@@ -1027,6 +1027,41 @@ func TestDecodeDuplicatePaymentHashes(t *testing.T) {
}
}
+// TestDecodeHighSWithDestination checks that Decode rejects a high-S
+// signature when the invoice carries an explicit `n` field, and accepts the
+// low-S form of the same signature. The two invoices differ only in the
+// signature, so the rejection can only come from the low-S check.
+func TestDecodeHighSWithDestination(t *testing.T) {
+ t.Parallel()
+
+ highS := "lnbc25m1p70xwfzpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyq" +
+ "cyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6t" +
+ "wvus8g6rfwvs8qun0dfjkxaqnp4q0n326hr8v9zprg8gsvezcch06gfa" +
+ "qqhde2aj730yg0durunfhv66sp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3z" +
+ "yg3zyg3zyg3zyg3zyg3zygs9qrsgq4dnj26gykrcyg6rw2pyk7sshrg8" +
+ "890l9q0vxvvnq7c6q7n7fhn4uhw89rghjljt2a4q0he7ka3cefq84r79" +
+ "w4n2cthhrhtyzqtc99qcpl325ac"
+ lowS := "lnbc25m1p70xwfzpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyq" +
+ "cyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6t" +
+ "wvus8g6rfwvs8qun0dfjkxaqnp4q0n326hr8v9zprg8gsvezcch06gfa" +
+ "qqhde2aj730yg0durunfhv66sp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3z" +
+ "yg3zyg3zyg3zyg3zyg3zygs9qrsgq4dnj26gykrcyg6rw2pyk7sshrg8" +
+ "890l9q0vxvvnq7c6q7n7fhn4ng3c6uhgdqd54z2lsgxpfzw8x5wdeh4d" +
+ "ug768mhgedvs2e4z7a0sq6zvx67"
+
+ _, err := Decode(highS, &chaincfg.MainNetParams)
+ require.ErrorIs(t, err, ErrHighSSignature)
+
+ invoice, err := Decode(lowS, &chaincfg.MainNetParams)
+ require.NoError(t, err)
+ require.True(t, invoice.PaymentAddr.IsSome())
+ require.Equal(
+ t, "03e7156ae33b0a208d0744199163177e909e80176e55d97a2f22"+
+ "1ede0f934dd9ad",
+ hex.EncodeToString(invoice.Destination.SerializeCompressed()),
+ )
+}
+
// TestNewInvoice tests that providing the optional arguments to the NewInvoice
// method creates an Invoice that encodes to the expected string.
func TestNewInvoice(t *testing.T) {
### zpay32/test-vectors/invoice-test.json
@@ -0,0 +1,157 @@
+[
+ {
+ "description": "Please make a donation of any amount using payment_hash 0001020304050607080900010203040506070809000102030405060708090102 to me @03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad",
+ "valid": true,
+ "invoice": "lnbc1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq9qrsgq357wnc5r2ueh7ck6q93dj32dlqnls087fxdwk8qakdyafkq3yap9us6v52vjjsrvywa6rt52cm9r9zqt8r2t7mlcwspyetp5h2tztugp9lfyql"
+ },
+ {
+ "description": "Please send $3 for a cup of coffee to the same peer, within one minute",
+ "valid": true,
+ "invoice": "lnbc2500u1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpu9qrsgquk0rl77nj30yxdy8j9vdx85fkpmdla2087ne0xh8nhedh8w27kyke0lp53ut353s06fv3qfegext0eh0ymjpf39tuven09sam30g4vgpfna3rh"
+ },
+ {
+ "description": "Please send 0.0025 BTC for a cup of nonsense (ナンセンス 1杯) to the same peer, within one minute",
+ "valid": true,
+ "invoice": "lnbc2500u1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpu9qrsgqhtjpauu9ur7fw2thcl4y9vfvh4m9wlfyz2gem29g5ghe2aak2pm3ps8fdhtceqsaagty2vph7utlgj48u0ged6a337aewvraedendscp573dxr"
+ },
+ {
+ "description": "Now send $24 for an entire list of things (hashed)",
+ "valid": true,
+ "invoice": "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs9qrsgq7ea976txfraylvgzuxs8kgcw23ezlrszfnh8r6qtfpr6cxga50aj6txm9rxrydzd06dfeawfk6swupvz4erwnyutnjq7x39ymw6j38gp7ynn44"
+ },
+ {
+ "description": "The same, on testnet, with a fallback address mk2QpYatsKicvFVuTAQLBryyccRXMUaGHP",
+ "valid": true,
+ "invoice": "lntb20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfpp3x9et2e20v6pu37c5d9vax37wxq72un989qrsgqdj545axuxtnfemtpwkc45hx9d2ft7x04mt8q7y6t0k2dge9e7h8kpy9p34ytyslj3yu569aalz2xdk8xkd7ltxqld94u8h2esmsmacgpghe9k8"
+ },
+ {
+ "description": "On mainnet, with fallback address 1RustyRX2oai4EYYDpQGWvEL62BBGqN9T with extra routing info to go via nodes 029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255 then 039e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c77255",
+ "valid": true,
+ "invoice": "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqsfpp3qjmp7lwpagxun9pygexvgpjdc4jdj85fr9yq20q82gphp2nflc7jtzrcazrra7wwgzxqc8u7754cdlpfrmccae92qgzqvzq2ps8pqqqqqqpqqqqq9qqqvpeuqafqxu92d8lr6fvg0r5gv0heeeqgcrqlnm6jhphu9y00rrhy4grqszsvpcgpy9qqqqqqgqqqqq7qqzq9qrsgqdfjcdk6w3ak5pca9hwfwfh63zrrz06wwfya0ydlzpgzxkn5xagsqz7x9j4jwe7yj7vaf2k9lqsdk45kts2fd0fkr28am0u4w95tt2nsq76cqw0"
+ },
+ {
+ "description": "On mainnet, with fallback (P2SH) address 3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX",
+ "valid": true,
+ "invoice": "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfppj3a24vwu6r8ejrss3axul8rxldph2q7z99qrsgqz6qsgww34xlatfj6e3sngrwfy3ytkt29d2qttr8qz2mnedfqysuqypgqex4haa2h8fx3wnypranf3pdwyluftwe680jjcfp438u82xqphf75ym"
+ },
+ {
+ "description": "On mainnet, with fallback (P2WPKH) address bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
+ "valid": true,
+ "invoice": "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfppqw508d6qejxtdg4y5r3zarvary0c5xw7k9qrsgqt29a0wturnys2hhxpner2e3plp6jyj8qx7548zr2z7ptgjjc7hljm98xhjym0dg52sdrvqamxdezkmqg4gdrvwwnf0kv2jdfnl4xatsqmrnsse"
+ },
+ {
+ "description": "On mainnet, with fallback (P2WSH) address bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3",
+ "valid": true,
+ "invoice": "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfp4qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q9qrsgq9vlvyj8cqvq6ggvpwd53jncp9nwc47xlrsnenq2zp70fq83qlgesn4u3uyf4tesfkkwwfg3qs54qe426hp3tz7z6sweqdjg05axsrjqp9yrrwc"
+ },
+ {
+ "description": "On mainnet, with fallback (P2TR) address bc1pptdvg0d2nj99568qn6ssdy4cygnwuxgw2ukmnwgwz7jpqjz2kszse2s3lm",
+ "valid": true,
+ "invoice": "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqsfp4pptdvg0d2nj99568qn6ssdy4cygnwuxgw2ukmnwgwz7jpqjz2kszs9qrsgqy606dznq28exnydt2r4c29y56xjtn3sk4mhgjtl4pg2y4ar3249rq4ajlmj9jy8zvlzw7cr8mggqzm842xfr0v72rswzq9xvr4hknfsqwmn6xd"
+ },
+ {
+ "description": "Please send 0.00967878534 BTC for a list of items within one week, amount in pico-BTC",
+ "valid": true,
+ "invoice": "lnbc9678785340p1pwmna7lpp5gc3xfm08u9qy06djf8dfflhugl6p7lgza6dsjxq454gxhj9t7a0sd8dgfkx7cmtwd68yetpd5s9xar0wfjn5gpc8qhrsdfq24f5ggrxdaezqsnvda3kkum5wfjkzmfqf3jkgem9wgsyuctwdus9xgrcyqcjcgpzgfskx6eqf9hzqnteypzxz7fzypfhg6trddjhygrcyqezcgpzfysywmm5ypxxjemgw3hxjmn8yptk7untd9hxwg3q2d6xjcmtv4ezq7pqxgsxzmnyyqcjqmt0wfjjq6t5v4khxsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygsxqyjw5qcqp2rzjq0gxwkzc8w6323m55m4jyxcjwmy7stt9hwkwe2qxmy8zpsgg7jcuwz87fcqqeuqqqyqqqqlgqqqqn3qq9q9qrsgqrvgkpnmps664wgkp43l22qsgdw4ve24aca4nymnxddlnp8vh9v2sdxlu5ywdxefsfvm0fq3sesf08uf6q9a2ke0hc9j6z6wlxg5z5kqpu2v9wz"
+ },
+ {
+ "description": "Please send $30 for coffee beans to the same peer, which supports features 8, 14 and 99, using secret 0x1111111111111111111111111111111111111111111111111111111111111111",
+ "valid": true,
+ "invoice": "lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgq2a25dxl5hrntdtn6zvydt7d66hyzsyhqs4wdynavys42xgl6sgx9c4g7me86a27t07mdtfry458rtjr0v92cnmswpsjscgt2vcse3sgpz3uapa"
+ },
+ {
+ "description": "Same, but all upper case",
+ "valid": true,
+ "invoice": "LNBC25M1PVJLUEZPP5QQQSYQCYQ5RQWZQFQQQSYQCYQ5RQWZQFQQQSYQCYQ5RQWZQFQYPQDQ5VDHKVEN9V5SXYETPDEESSP5ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYGS9Q5SQQQQQQQQQQQQQQQQSGQ2A25DXL5HRNTDTN6ZVYDT7D66HYZSYHQS4WDYNAVYS42XGL6SGX9C4G7ME86A27T07MDTFRY458RTJR0V92CNMSWPSJSCGT2VCSE3SGPZ3UAPA"
+ },
+ {
+ "description": "Same, but including fields which must be ignored",
+ "valid": true,
+ "invoice": "lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgq2qrqqqfppnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqcsenjd934c02h7v9deyju0t43ye2y38nd2h2wr0ykzlqs7v873jkvvg36kfwwmp9lftrn8a3gp4ax52zpvyc7quffgjjj7avx7we9zcp3dce9d"
+ },
+ {
+ "description": "Please send 0.01 BTC with payment metadata 0x01fafaf0",
+ "valid": true,
+ "invoice": "lnbc10m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp9wpshjmt9de6zqmt9w3skgct5vysxjmnnd9jx2mq8q8a04uqsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q2gqqqqqqsgq7hf8he7ecf7n4ffphs6awl9t6676rrclv9ckg3d3ncn7fct63p6s365duk5wrk202cfy3aj5xnnp5gs3vrdvruverwwq7yzhkf5a3xqpd05wjc"
+ },
+ {
+ "description": "Public-key recovery with high-S signature",
+ "valid": true,
+ "invoice": "lnbc1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq9qrsgq357wnc5r2ueh7ck6q93dj32dlqnls087fxdwk8qakdyafkq3yap2r09nt4ndd0unm3z9u5t48y6ucv4r5sg7lk98c77ctvjczkspk5qprc90gx"
+ },
+ {
+ "description": "Same, but adding invalid unknown feature 100",
+ "valid": false,
+ "invoice": "lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q4psqqqqqqqqqqqqqqqqsgqtqyx5vggfcsll4wu246hz02kp85x4katwsk9639we5n5yngc3yhqkm35jnjw4len8vrnqnf5ejh0mzj9n3vz2px97evektfm2l6wqccp3y7372"
+ },
+ {
+ "description": "Same, but with an `n` field of invalid length",
+ "valid": false,
+ "invoice": "lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgqnp5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqf9dt6rzhc3ynq3u7axf4xc3zaw3fy2kyqal6n86nh5j3lhgcutdjzhvswudd5l8ay9acgrrpd2e6vw9sdqxq6dzq983sgt7dpxk5wacqacdc2y"
+ },
+ {
+ "description": "Missing required `p` field",
+ "valid": false,
+ "invoice": "lnbc25m1pvjluezdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgqjy08jd52dtj25pefkh0enc54lxtjtr8wnum2msrq2d8uztp9vhhpccq93ljpff0kkjgzkzcp2czlyenjphf6upazjlc8uxw7za0ynusqrfhg8u"
+ },
+ {
+ "description": "Two distinct p fields in an otherwise valid invoice",
+ "valid": false,
+ "invoice": "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqpp5lllllllllllllllllllllllllllllllllllllllllllllllllllsdpyv36hqmrfvdshgefqwpshjmt9de6zq6rpwd5qsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9g3f93cqturay6zk2fyfcmeflphlzew9wfq0n5nf9hqnlwxthtzqcljcuurljyd2vngkya5hndakf33ghly97qm5nc3umj7jep22nfsq3nr0w8"
+ },
+ {
+ "description": "The same p field twice in an otherwise valid invoice",
+ "valid": false,
+ "invoice": "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpyv36hqmrfvdshgefqwpshjmt9de6zq6rpwd5qsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs29wywgsx0wpv9t045f683nj97nnjk55wt0exe3eassl6smx60nk9hlaae8vhe0hwv25s6fthcwqkxsw2hpjeptxz7xujtexa3l8jrkcqyn037r"
+ },
+ {
+ "description": "Two distinct s fields in an otherwise valid invoice",
+ "valid": false,
+ "invoice": "lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygssp5yg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3q9q5sqqqqqqqqqqqqqqqqsgqy23f0q2mhf0mnhfesz2lt3j9n8negrgr2a7wd554fppeqnvwz9749j2zmp2jd2sfvn3lzlajhalyxlv2h6ccs6p3yg7wg43y22cazccp5vkkte"
+ },
+ {
+ "description": "Bech32 checksum is invalid",
+ "valid": false,
+ "invoice": "lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpuyk0sg5g70me25alkluzd2x62aysf2pyy8edtjeevuv4p2d5p76r4zkmneet7uvyakky2zr4cusd45tftc9c5fh0nnqpnl2jfll544esqchsrnt"
+ },
+ {
+ "description": "Malformed bech32 string (no 1)",
+ "valid": false,
+ "invoice": "pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpuyk0sg5g70me25alkluzd2x62aysf2pyy8edtjeevuv4p2d5p76r4zkmneet7uvyakky2zr4cusd45tftc9c5fh0nnqpnl2jfll544esqchsrny"
+ },
+ {
+ "description": "Malformed bech32 string (mixed case)",
+ "valid": false,
+ "invoice": "LNBC2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpuyk0sg5g70me25alkluzd2x62aysf2pyy8edtjeevuv4p2d5p76r4zkmneet7uvyakky2zr4cusd45tftc9c5fh0nnqpnl2jfll544esqchsrny"
+ },
+ {
+ "description": "Signature is not recoverable",
+ "valid": false,
+ "invoice": "lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqwgt7mcn5yqw3yx0w94pswkpq6j9uh6xfqqqtsk4tnarugeektd4hg5975x9am52rz4qskukxdmjemg92vvqz8nvmsye63r5ykel43pgz7zq0g2"
+ },
+ {
+ "description": "String is too short",
+ "valid": false,
+ "invoice": "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6na6hlh"
+ },
+ {
+ "description": "Invalid multiplier",
+ "valid": false,
+ "invoice": "lnbc2500x1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqrrzc4cvfue4zp3hggxp47ag7xnrlr8vgcmkjxk3j5jqethnumgkpqp23z9jclu3v0a7e0aruz366e9wqdykw6dxhdzcjjhldxq0w6wgqcnu43j"
+ },
+ {
+ "description": "Invalid sub-millisatoshi precision",
+ "valid": false,
+ "invoice": "lnbc2500000001p1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgq0lzc236j96a95uv0m3umg28gclm5lqxtqqwk32uuk4k6673k6n5kfvx3d2h8s295fad45fdhmusm8sjudfhlf6dcsxmfvkeywmjdkxcp99202x"
+ },
+ {
+ "description": "Missing required `s` field",
+ "valid": false,
+ "invoice": "lnbc20m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs9qrsgq7ea976txfraylvgzuxs8kgcw23ezlrszfnh8r6qtfpr6cxga50aj6txm9rxrydzd06dfeawfk6swupvz4erwnyutnjq7x39ymw6j38gp49qdkj"
+ },
+ {
+ "description": "Non canonical signature (high-S) with 'n' field defined",
+ "valid": false,
+ "invoice": "lnbc25m1p70xwfzpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaqnp4q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhv66sp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgq4dnj26gykrcyg6rw2pyk7sshrg8890l9q0vxvvnq7c6q7n7fhn4uhw89rghjljt2a4q0he7ka3cefq84r79w4n2cthhrhtyzqtc99qcpl325ac"
+ }
+]Why this scored 48/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.