Skip to content

Commit 534af57

Browse files
committed
fixup! bolt-taproot-gossip
1 parent bbc609e commit 534af57

File tree

1 file changed

+75
-69
lines changed

1 file changed

+75
-69
lines changed

bolt-taproot-gossip.md

Lines changed: 75 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ The initial version of the Lightning Network gossip protocol as defined in
3636
channels, the `channel_announcement` message is used to advertise the channel to
3737
the rest of the network. Nodes in the network use the content of this message to
3838
prove that the channel is sufficiently bound to the Lightning Network context
39-
and that it is owned by the nodes advertising the channel. This proof and
40-
verification protocol is, however, not compatible with SegWit V1 (P2TR) outputs
41-
and so cannot be used to advertise the channels defined in the
42-
[Simple Taproot Channel][simple-taproot-chans] proposal. This document thus aims
43-
to define an updated gossip protocol that will allow nodes to both advertise and
44-
verify taproot channels. This part of the update affects the
39+
by being provided enough information to prove that the script is a 2-of-2
40+
multi-sig and that it is owned by the nodes advertising the channel. This
41+
ownership proof is done by including signatures in the `channel_announcement`
42+
from both the node ID keys along with the bitcoin keys used in the P2WSH script.
43+
This proof and verification protocol is, however, not compatible with SegWit V1
44+
(P2TR) outputs and so cannot be used to advertise the channels defined in the
45+
[Simple Taproot Channel][simple-taproot-chans] proposal. This document thus aims
46+
to define an updated gossip protocol that will allow nodes to both advertise and
47+
verify taproot channels. This part of the update affects the
4548
`announcement_signatures` and `channel_announcement` messages.
4649

4750
The opportunity is also taken to rework the `node_announcement` and
@@ -138,13 +141,13 @@ separate signatures in the `channel_announcement`. However, [BIP-340][bip-340]
138141
signatures and the MuSig2 protocol allow us to now aggregate these four
139142
signatures into a single one. Verifiers will then be able to aggregate the four
140143
keys (`bitcoin_key_1`, `bitcoin_key_2`, `node_ID_1` and `node_ID_2`) using
141-
MuSig2 key aggregation and then they can do a single signature verification
144+
MuSig2 key aggregation, and then they can do a single signature verification
142145
check instead of four individual checks.
143146

144-
## Timestamp fields
147+
## Block-height fields
145148

146-
In this document, the `timestamp` fields in messages are block heights instead
147-
of the UNIX timestamps used in the legacy gossip messages.
149+
In the messages defined in this document, block heights are used as timestamps
150+
instead of the UNIX timestamps used in the legacy set of gossip messages.
148151

149152
### Rate Limiting
150153

@@ -165,7 +168,7 @@ provides an incentive for nodes not to spam the network with too many updates.
165168
To also prevent nodes from building up too large of a burst-buffer with which
166169
they can spam the network and to give a limit to how low the block height on a
167170
`node_announcement_2` can be: nodes should not be allowed to use a block height
168-
smaller 1440 (~ a day worth of blocks) below the current block height.
171+
smaller 2016 (~ one week worth of blocks) below the current block height.
169172

170173
### Simplifies Channel Announcement Queries
171174

@@ -217,7 +220,7 @@ un-upgraded nodes will drop this message due to the fact that no legacy
217220
nodes will also not be able to use a legacy `node_announcement` to propagate
218221
their new `node_announcement_2` message.
219222

220-
### Consideration & Suggestions
223+
### Considerations & Suggestions
221224

222225
While the network is in the upgrade phase, the following suggestions apply:
223226

@@ -269,7 +272,8 @@ gossip messages.
269272

270273
A node can be assumed to understand the new gossip v2 messages if:
271274

272-
- They advertise `option_taproot_gossip` in a legacy `node_announcement` message
275+
- They advertise `option_taproot_gossip` in the `init` or
276+
legacy `node_announcement` messages
273277
OR
274278
- They have broadcast one of the new gossip messages defined in this document.
275279

@@ -306,7 +310,7 @@ These extensions only apply if the `option_taproot` channel type was set in the
306310
1. type: 0 (`announcement_node_pubnonce`)
307311
2. data:
308312
* [`66*byte`: `public_nonce`]
309-
3. type: 1 (`announcement_bitcoin_pubnonce`)
313+
3. type: 2 (`announcement_bitcoin_pubnonce`)
310314
4. data:
311315
* [`66*byte`: `public_nonce`]
312316

@@ -356,10 +360,10 @@ allow the announcement of the channel to the rest of the network.
356360
1. type: 0 (`channel_id`)
357361
2. data:
358362
* [`channel_id`:`channel_id`]
359-
3. type: 1 (`short_channel_id`)
363+
3. type: 2 (`short_channel_id`)
360364
4. data:
361365
* [`short_channel_id`:`short_channel_id`]
362-
5. type: 2 (`partial_signature`)
366+
5. type: 4 (`partial_signature`)
363367
6. data:
364368
* [`partial_signature`:`partial_signature`]
365369

@@ -372,14 +376,12 @@ The requirements are similar to the ones defined for the legacy
372376
A node:
373377
- if the `open_channel` message has the `announce_channel` bit set AND a
374378
`shutdown` message has not been sent:
375-
- MUST send the `announcement_signatures_2` message.
376-
- MUST NOT send `announcement_signatures_2` messages until `channel_ready`
379+
- MUST send the `announcement_signatures_2` message once `channel_ready`
377380
has been sent and received AND the funding transaction has at least six
378381
confirmations.
379-
- MUST set the `partial_signature` field to the 32-byte `s` value of the
380-
partial signature calculated as described
381-
in [Partial Signature Calculation](#partial-signature-calculation). The
382-
message to be signed is
382+
- MUST set the `partial_signature` field to the 32-byte `partial_sig` value of
383+
the partial signature calculated as described in [Partial Signature
384+
Calculation](#partial-signature-calculation). The message to be signed is
383385
`MsgHash("channel_announcement", "announcement_sig", m)` where `m` is the
384386
serialisation of the `channel_announcement_2` message excluding the
385387
`announcement_sig` field (see the
@@ -433,38 +435,39 @@ channel.
433435
1. type: 0 (`announcement_sig`)
434436
2. data:
435437
* [`bip340_sig`:`bip340_sig`]
436-
3. type: 1 (`features`)
438+
3. type: 1 (`chain_hash`)
437439
4. data:
438-
* [`...*byte`: `features`]
439-
5. type: 2 (`chain_hash`)
440+
* [`chain_hash`:`chain_hash`]
441+
5. type: 2 (`features`)
440442
6. data:
441-
* [`chain_hash`:`chain_hash`]
442-
7. type: 3 (`short_channel_id`)
443+
* [`...*byte`: `features`]
444+
7. type: 4 (`short_channel_id`)
443445
8. data:
444446
* [`short_channel_id`:`short_channel_id`]
445-
9. type: 4 (`node_id_1`)
447+
9. type: 6 (`node_id_1`)
446448
10. data:
447449
* [`point`:`point`]
448-
11. type: 5 (`node_id_2`)
450+
11. type: 8 (`node_id_2`)
449451
12. data:
450452
* [`point`:`point`]
451-
13. type: 6 (`bitcoin_key_1`)
453+
13. type: 3 (`bitcoin_key_1`)
452454
14. data:
453455
* [`point`:`point`]
454-
15. type: 7 (`bitcoin_key_2`)
456+
15. type: 5 (`bitcoin_key_2`)
455457
16. data:
456458
* [`point`:`point`]
459+
17. type: 7 (`tap_tweak`)
460+
18. data:
461+
* [`point`:`point`]
457462

458463
### Requirements
459464

460465
The origin node:
461466

462-
- MUST include types 0-7.
463-
- MUST set `chain_hash` to the 32-byte hash that uniquely identifies the chain
464-
that the channel was opened within:
465-
- for the _Bitcoin blockchain_:
466-
- MUST set `chain_hash` value (encoded in hex) equal
467-
to `6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000`.
467+
- If the chain being referred to is not the Bitcoin blockchain:
468+
- MUST set `chain_hash` to the 32-byte hash that uniquely identifies the chain
469+
that the channel was opened within:
470+
- otherwise, MUST not set `chain_has` as the _Bitcoin blockchain_ is assumed.
468471
- MUST set `short_channel_id` to refer to the confirmed funding transaction, as
469472
specified in [BOLT #2](02-peer-protocol.md#the-channel_ready-message).
470473
- Note: the corresponding output MUST be a P2TR, as described
@@ -483,15 +486,15 @@ The origin node:
483486

484487
The receiving node:
485488

486-
- If types 0-7 are not present:
489+
- If any even typed messages are not present:
487490
- SHOULD send a `warning`.
488491
- MAY close the connection.
489492
- MUST ignore the message.
490493
- MUST verify the integrity AND authenticity of the message by verifying the
491494
`announcement_sig` as per [BIP 340][bip-340-verify].
492495
- if there is an unknown even bit in the `features` field:
493496
- MUST NOT attempt to route messages through the channel.
494-
- if the `short_channel_id`'s output does NOT correspond to a P2WSH (using
497+
- if the `short_channel_id`'s output does NOT correspond to a P2TR (using
495498
`bitcoin_key_1` and `bitcoin_key_2`, as specified in
496499
[BOLT #3](03-transactions.md#funding-transaction-output)) OR the output is
497500
spent:
@@ -569,31 +572,31 @@ is now a block height and that the message is purely TLV based.
569572
1. type: 0 (`announcement_sig`)
570573
2. data:
571574
* [`bip340_sig`:`bip340_sig`]
572-
3. type: 1 (`features`)
575+
3. type: 2 (`features`)
573576
4. data:
574577
* [`...*byte`: `features`]
575-
5. type: 2 (`timestamp`)
578+
5. type: 4 (`block_height`)
576579
6. data:
577580
* [`u32`: `block_height`]
578-
7. type: 3 (`node_ID`)
581+
7. type: 6 (`node_ID`)
579582
8. data:
580583
* [`point`:`node_id`]
581-
9. type: 4 (`color`)
584+
9. type: 1 (`color`)
582585
10. data:
583586
* [`rgb_color`:`rgb_color`]
584-
11. type: 5 (`alias`)
587+
11. type: 3 (`alias`)
585588
12. data:
586589
* [`...*utf8`:`alias`]
587-
13. type: 6 (`ipv4_addrs`)
590+
13. type: 5 (`ipv4_addrs`)
588591
14. data:
589592
* [`...*ipv4_addr`: `ipv4_addresses`]
590593
15. type: 7 (`ipv6_addrs`)
591594
16. data:
592595
* [`...*ipv6_addr`: `ipv6_addresses`]
593-
17. type: 8 (`tor_v3_addrs`)
596+
17. type: 9 (`tor_v3_addrs`)
594597
18. data:
595598
* [`...*tor_v3_addr`: `tor_v3_addresses`]
596-
19. type: 9 (`dns_hostname`)
599+
19. type: 11 (`dns_hostname`)
597600
20. data:
598601
* [`dns_hostname`: `dns_hostname`]
599602

@@ -638,7 +641,6 @@ exceed 255 bytes.
638641

639642
The sender:
640643

641-
- MUST set types 0-3 (inclusive)
642644
- MUST set `announcement_sig` to a valid [BIP340][bip-340] signature for the
643645
`node_id` key. The message to be signed is
644646
`MsgHash("node_announcement_2", "announcement_sig", m)` where `m` is the
@@ -648,7 +650,7 @@ The sender:
648650
- MAY set `color` and `alias` to customise appearance in maps and graphs.
649651
- If the node sets the `alias`:
650652
- MUST use 32 utf8 characters or less.
651-
- MUST set `timestamp` to be greater than that of any previous
653+
- MUST set `block_height` to be greater than that of any previous
652654
`node_announcement_2` it has previously created.
653655
- MUST set it to a block height less than the latest block's height but no
654656
more than 1440 lower.
@@ -668,7 +670,7 @@ The sender:
668670

669671
The receiving node:
670672

671-
- If any type between 0-3 (inclusive) are missing:
673+
- If any type between even-typed values are missing:
672674
- SHOULD send a `warning`.
673675
- MAY close the connection.
674676
- MUST ignore the message.
@@ -693,11 +695,11 @@ The receiving node:
693695
- if `port` is equal to 0 for any `ipv6_addr` OR `ipv4_addr` OR `hostname`:
694696
- SHOULD ignore that address.
695697
- if `node_id` is NOT previously known from a `channel_announcement` OR
696-
`channel_announcement_2` message, OR if `timestamp` is NOT greater than the
698+
`channel_announcement_2` message, OR if `blockheight` is NOT greater than the
697699
last-received `node_announcement_2` from this `node_id`:
698700
- SHOULD ignore the message.
699701
- otherwise:
700-
- if `timestamp` is greater than the last-received `node_announcement_2`
702+
- if `block_height` is greater than the last-received `node_announcement_2`
701703
from this `node_id`:
702704
- SHOULD queue the message for rebroadcasting.
703705
- MAY use `rgb_color` AND `alias` to reference nodes in interfaces.
@@ -746,28 +748,28 @@ the last HTLC in the route, are provided in the payment request
746748
1. type: 0 (`update_sig`)
747749
2. data:
748750
* [`bip340_sig`:`bip340_sig`]
749-
3. type: 2 (`chain_hash`)
751+
3. type: 1 (`chain_hash`)
750752
4. data:
751753
* [`chain_hash`:`chain_hash`]
752-
5. type: 2 (`timestamp`)
754+
5. type: 2 (`block_height`)
753755
6. data:
754756
* [`u32`: `block_height`]
755-
7. type: 5 (`channel_flags`)
757+
7. type: 4 (`channel_flags`)
756758
8. data:
757759
* [`...*byte`, `channel_flags`]
758760
9. type: 6 (`cltv_expiry_delta`)
759761
10. data:
760762
* [`tu32`, `cltv_expiry_delta`]
761-
11. type: 7 (`htlc_min_msat`)
763+
11. type: 8 (`htlc_min_msat`)
762764
12. data:
763765
* [`tu64`, `htlc_min_msat`]
764766
13. type: 10 (`htlc_max_msat`)
765767
14. data:
766768
* [`tu64`, `htlc_max_msat`]
767-
15. type: 8 (`fee_base_msat`)
769+
15. type: 12 (`fee_base_msat`)
768770
16. data:
769771
* [`tu32`, `fee_base_msat`]
770-
17. type: 9 (`fee_prop_millionths`)
772+
17. type: 14 (`fee_prop_millionths`)
771773
18. data:
772774
* [`tu32`, `fee_prop_millionths`]
773775

@@ -788,6 +790,10 @@ The `node_id` for the signature verification is taken from the corresponding
788790
### Requirements
789791

790792
The origin node:
793+
- If the chain being referred to is not the Bitcoin blockchain:
794+
- MUST set `chain_hash` to the 32-byte hash that uniquely identifies the
795+
chain that the channel was opened within:
796+
- otherwise, MUST not set `chain_hash` as the _Bitcoin blockchain_ is assumed.
791797
- MUST NOT send `channel_update_2` before `channel_ready` has been received.
792798
- MUST NOT send `channel_update_2` for legacy (non-taproot) channels.
793799
- MAY create a `channel_update_2` to communicate the channel parameters to the
@@ -823,10 +829,10 @@ The origin node:
823829
settlement).
824830
- MAY send a subsequent `channel_update_2` with the `disable` bit set to 0
825831
to re-enable the channel.
826-
- MUST set `timestamp` greater or equal to the block height that the channel's
827-
funding transaction was mined in AND to greater than any previously-sent
828-
`channel_update_2` for this `short_channel_id` AND no less than 1440 blocks
829-
below the current best block height .
832+
- MUST set `block_height` greater or equal to the block height that the
833+
channel's funding transaction was mined in AND to greater than any
834+
previously-sent `channel_update_2` for this `short_channel_id` AND no less
835+
than 1440 blocks below the current best block height .
830836
- MUST set `cltv_expiry_delta` to the number of blocks it will subtract from
831837
an incoming HTLC's `cltv_expiry`.
832838
- MUST set `htlc_minimum_msat` to the minimum HTLC value (in millisatoshi)
@@ -855,21 +861,21 @@ The receiving node:
855861
- if the specified `chain_hash` value is unknown (meaning it isn't active on
856862
the specified chain):
857863
- MUST ignore the channel update.
858-
- if the `timestamp` is equal to the last-received `channel_update_2` for this
859-
`short_channel_id` AND `node_id`:
860-
- if the fields below `timestamp` differ:
864+
- if the `block_height` is equal to the last-received `channel_update_2` for
865+
this `short_channel_id` AND `node_id`:
866+
- if the fields below `block_height` differ:
861867
- MAY blacklist this `node_id`.
862868
- MAY forget all channels associated with it.
863-
- if the fields below `timestamp` are equal:
869+
- if the fields below `block_height` are equal:
864870
- SHOULD ignore this message
865-
- if `timestamp` is lower than that of the last-received
871+
- if `block_height` is lower than that of the last-received
866872
`channel_update_2` for this `short_channel_id` AND for `node_id`:
867873
- SHOULD ignore the message.
868874
- otherwise:
869-
- if the `timestamp` is a block height greater than the current best block
875+
- if the `block_height` is a block height greater than the current best block
870876
height:
871877
- MAY discard the `channel_update_2`.
872-
- if the `timestamp` block height is more than 1440 blocks less than the
878+
- if the `block_height` block height is more than 1440 blocks less than the
873879
current best block height:
874880
- MAY discard the `channel_update_2`.
875881
- otherwise:

0 commit comments

Comments
 (0)