Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interactive-tx: Add dual-funding flow, using the interactive tx protocol (feature 28/29) #851

Merged
merged 21 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
998b789
spelling: fix spelling mistakes + add new words to ignore spelling
niftynei Nov 2, 2023
7f57338
interactive-tx: Add dual-funding flow, using the interactive tx protocol
niftynei Mar 3, 2021
6ce7491
v2 opens: add a `tx_abort` message
niftynei Jan 31, 2022
11b8451
Clarify RBF funding requirements
t-bast Oct 26, 2022
a810c67
Use signed amounts in RBF messages
t-bast Apr 11, 2023
0749591
peer-protocol: send first+second commit point in openchanv2 + accept
niftynei Dec 16, 2022
4caa100
v2 opens: proposal to get rid of the minimum estimated fee
niftynei Dec 16, 2022
c2ac8a7
Add `require_confirmed_inputs` TLV
t-bast Oct 24, 2022
c5f3c75
Add section about liquidity griefing
t-bast Feb 10, 2023
36c04c8
Store state when sending `commitment_signed`
t-bast Mar 28, 2023
c33cdc8
Use bitcoin wire encoding for witnesses
dunxen Mar 29, 2023
9f85945
interactive-tx: highlight MUST of serial_id sorting
niftynei Nov 10, 2023
d705522
Bolt 2: Make interactive-tx explicitly use SIGHASH_ALL
ddustin Apr 7, 2023
e5b2677
tx-abort: port over meaning of the `data` field from `warning`
niftynei Nov 10, 2023
5edaaa6
tx-complete: clarify that the total input/total output incl funding
niftynei Nov 10, 2023
820852e
nit: verbiage + wording
niftynei Nov 10, 2023
e73ce64
tx-signatures: address comments regarding underpyament of fees
niftynei Nov 10, 2023
5185bd0
dual-fund, nit: change wording on common input heuristic
niftynei Nov 12, 2023
afc4c72
dual-fund, wording: move sighash_all into existing verbiage
niftynei Nov 12, 2023
024df99
dual-fund, verbiage: clarify situation for closing a underfunded channel
niftynei Nov 12, 2023
27ffef4
dual-fund: add `require_confirmed_inputs` to RBF messages
niftynei Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions .aspell.en.pws
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nhops
retransmitted
dev
tradeoff
kiloweight
mixHeader
uint
hopsData
Expand Down Expand Up @@ -115,6 +116,17 @@ delayedsig
hopDataSize
I'th
segwit
RBF
accepter
accepter's
subtype
redeemScript
scriptSig
utxo
scriptPubKey
scriptPubKeys
scriptlen
sats
htlc
htlcs
ChaCha
Expand Down Expand Up @@ -286,6 +298,13 @@ pico
mainnet
testnet
icecream
extractable
de
anonymize
Punycode
rck
sck
zeroconf
swiss
lollypop
UTC
Expand Down Expand Up @@ -394,3 +413,15 @@ pkh
kB
unblind
unblinded
workflow
PUSHDATA
prev
vout
rbf
standardness
perkw
prevtx
ints
replaceability
disincentivize
UTXOs
124 changes: 121 additions & 3 deletions 01-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This protocol assumes an underlying authenticated and ordered transport mechanis

The default TCP port depends on the network used. The most common networks are:

- Bitcoin mainet with port number 9735 or the corresponding hexadecimal `0x2607`;
- Bitcoin mainnet with port number 9735 or the corresponding hexadecimal `0x2607`;
- Bitcoin testnet with port number 19735 (`0x4D17`);
- Bitcoin signet with port number 39735 (`0xF87`).

Expand All @@ -29,6 +29,7 @@ All data fields are unsigned big-endian unless otherwise specified.
* [Appendix A: BigSize Test Vectors](#appendix-a-bigsize-test-vectors)
* [Appendix B: Type-Length-Value Test Vectors](#appendix-b-type-length-value-test-vectors)
* [Appendix C: Message Extension](#appendix-c-message-extension)
* [Appendix D: Signed Integers Test Vectors](#appendix-d-signed-integers-test-vectors)
* [Acknowledgments](#acknowledgments)
* [References](#references)
* [Authors](#authors)
Expand Down Expand Up @@ -220,9 +221,16 @@ receiver to parse individual elements from `value`.
Various fundamental types are referred to in the message specifications:

* `byte`: an 8-bit byte
* `s8`: an 8-bit signed integer
* `u16`: a 2 byte unsigned integer
* `s16`: a 2 byte signed integer
* `u32`: a 4 byte unsigned integer
* `s32`: a 4 byte signed integer
* `u64`: an 8 byte unsigned integer
* `s64`: an 8 byte signed integer

Signed integers use standard big-endian two's complement representation
(see test vectors [below](#appendix-d-signed-integers-test-vectors)).

For the final value in TLV records, truncated integers may be used. Leading zeros in
truncated integers MUST be omitted:
Expand Down Expand Up @@ -344,14 +352,22 @@ For simplicity of diagnosis, it's often useful to tell a peer that something is

The channel is referred to by `channel_id`, unless `channel_id` is 0 (i.e. all bytes are 0), in which case it refers to all channels.

The funding node:
The funding node using channel establishment v1 (`open_channel`):
- for all error messages sent before (and including) the `funding_created` message:
- MUST use `temporary_channel_id` in lieu of `channel_id`.

The fundee node:
The fundee node using channel establishment v1 (`accept_channel`):
- for all error messages sent before (and not including) the `funding_signed` message:
- MUST use `temporary_channel_id` in lieu of `channel_id`.

The opener node using channel establishment v2 (`open_channel2`):
- for all error messages sent before the `accept_channel2` message is received:
- MUST use `temporary_channel_id` in lieu of `channel_id`.
t-bast marked this conversation as resolved.
Show resolved Hide resolved

The accepter node using channel establishment v2 (`open_channel2`):
- for all error messages sent before (and including) the `accept_channel2` message:
- MUST use `temporary_channel_id` in lieu of `channel_id`.

A sending node:
- SHOULD send `error` for protocol violations or internal errors that make channels unusable or that make further communication unusable.
- SHOULD send `error` with the unknown `channel_id` in reply to messages of type `32`-`255` related to unknown channels.
Expand Down Expand Up @@ -959,6 +975,108 @@ Note that when messages are signed, the _extension_ is part of the signed bytes.
Nodes should store the _extension_ bytes even if they don't understand them to
be able to correctly verify signatures.

## Appendix D: Signed Integers Test Vectors

The following test vector show how signed integers (`s8`, `s16`, `s32`
and `s64`) are encoded using big-endian two's complement.

```json
[
{
"value": 0,
"bytes": "00"
},
{
"value": 42,
"bytes": "2a"
},
{
"value": -42,
"bytes": "d6"
},
{
"value": 127,
"bytes": "7f"
},
{
"value": -128,
"bytes": "80"
},
{
"value": 128,
"bytes": "0080"
},
{
"value": -129,
"bytes": "ff7f"
},
{
"value": 15000,
"bytes": "3a98"
},
{
"value": -15000,
"bytes": "c568"
},
{
"value": 32767,
"bytes": "7fff"
},
{
"value": -32768,
"bytes": "8000"
},
{
"value": 32768,
"bytes": "00008000"
},
{
"value": -32769,
"bytes": "ffff7fff"
},
{
"value": 21000000,
"bytes": "01406f40"
},
{
"value": -21000000,
"bytes": "febf90c0"
},
{
"value": 2147483647,
"bytes": "7fffffff"
},
{
"value": -2147483648,
"bytes": "80000000"
},
{
"value": 2147483648,
"bytes": "0000000080000000"
},
{
"value": -2147483649,
"bytes": "ffffffff7fffffff"
},
{
"value": 500000000000,
"bytes": "000000746a528800"
},
{
"value": -500000000000,
"bytes": "ffffff8b95ad7800"
},
{
"value": 9223372036854775807,
"bytes": "7fffffffffffffff"
},
{
"value": -9223372036854775808,
"bytes": "8000000000000000"
}
]
```

## Acknowledgments

[ TODO: (roasbeef); fin ]
Expand Down