summaryrefslogtreecommitdiff
path: root/e3/796c9ef2d3b9fe11a4cef714dcb2035d410b2b
blob: 780b2a72644cfc4a03c8d5c298e380c6120a7db1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Return-Path: <alex.bosworth@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id 14F07AA6
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Tue,  4 Sep 2018 03:24:23 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com
	[209.85.219.175])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B1B035E2
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Tue,  4 Sep 2018 03:24:22 +0000 (UTC)
Received: by mail-yb1-f175.google.com with SMTP id t71-v6so779393ybi.7
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Mon, 03 Sep 2018 20:24:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=m0dueVg0KYxhDunIelNLbTFG2mTY8rnqXFgZR/3/yLQ=;
	b=YipwZN3okOCx6J+iB2iIy0HTFNobNw+wXvkP/bsSU0yz57VpnxiQmxDivkYTvtj87T
	VfqVVsTzGQj14V2+fsAfbQci+nw1GP9vLUdDA4PtORzttaVvVOm3lAAzpf2JhGHB4QqT
	5GHXi3qIx9uUArhpMxLjxT3fwoHVyVRZ7oHU2QiPG60446FYaG4uoqt0uMv+hrbOJ1Ee
	nQpHa+Wb979rbCK/5hBhfmz1VDc4Ia+2Kof7uHZSYmMfakU5myUL0sHV7tXWM/fnugqR
	++IzbqPywurN0LSJ5RYXMTWx8ZU/QCNf+PhVC31no3BlfiSfF4Iejtjs8+R42t66x4A5
	OWtg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=m0dueVg0KYxhDunIelNLbTFG2mTY8rnqXFgZR/3/yLQ=;
	b=PeLDtInlvRNpsYgiU6d7SUYQJu3OckoSsImdcR5blkdgBRKDNWSh0lWUU67S+p40s1
	cUSQsv/4lEZHg67zKTnrxt5dn31p69pkt/t92bBACtIXO/DrhHu9rUE6ZXZxDUiZ9HsF
	UF0GhgUwCDnuM1ZCrFJV4i09xEi/2Ao63472NKG0BrIVIuIPQgG76PqWN67IQE0du2+c
	ROsrw/YaKZhCfJnEteBvTB9gR9Ku1oVaAamA1os1F9z5Nx05bilE3h8VfHOdOS+2QlHQ
	nNTGhPBRVYrnR26HCEinspZNo3+fRbheZkWplwCfgEGYog0Ai4GP0OulIFo8Zcg+w+iw
	nbFQ==
X-Gm-Message-State: APzg51DjIzQrjUPVam7hS/ZEF8abZ/OVxDqePr83wIAsOxmr/6xms5Rw
	QwSnUha9pkESFYKF0jMK312q1AuSJvZ8IWOV/IH+XeY0
X-Google-Smtp-Source: ANB0VdYfekBHriGFeoYJ2bnEhIEqnZCz25LyB3GBv2tf1x1nGuC62tPXGzEcBeqACGm7x+GeWuXNwWQQMmdTTSLBD90=
X-Received: by 2002:a25:e709:: with SMTP id
	e9-v6mr17748575ybh.358.1536031461860; 
	Mon, 03 Sep 2018 20:24:21 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a81:84c5:0:0:0:0:0 with HTTP;
	Mon, 3 Sep 2018 20:24:01 -0700 (PDT)
From: Alex Bosworth <alex.bosworth@gmail.com>
Date: Mon, 3 Sep 2018 20:24:01 -0700
Message-ID: <CAFLuHNFD8vTyYfF+64e2Xs_HympQs4ufzSAxQ96jkLZg=pdm7A@mail.gmail.com>
To: bitcoin-dev@lists.linuxfoundation.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM,
	RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
X-Mailman-Approved-At: Tue, 04 Sep 2018 11:32:01 +0000
Subject: [bitcoin-dev] Extending BIP174 for HTLCs
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
	<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Sep 2018 03:24:23 -0000

I've been experimenting with a format tag for BIP 174 to help support
HTLC scripts I've been working with.

Not sure on the best format for this, but what I have been thinking
about is a new input type that defines elements that should be
inserted in the final p2sh/p2wsh stack such as a preimage or a refund
path flag.

Type: Additional Stack Element ADDITIONAL_STACK_ELEMENT = 0xXX

Key: The index in the stack to insert a value (uint32 LE)

{0xXX}|{Stack index}

Value: The value to push into the stack for a redeem script or witness
script at the specified index.

{value}

So my flow is:

1. Create blank PSBT (attaching locktime, anticipating final weight to
adjust outputs for fees)
2. Update with redeem scripts and/or witness scripts
3. Update with sighashes
4. Sign: generate partial signature
5. Attach additional stack elements for the required non-signature elements
6. Finalize to create the final scriptsig and/or witness
7. Extract the signed transaction for broadcast

This may be overkill or overly generic, has anyone else thought of how
to use PSBTs in an HTLC context?

-- 
Sent from my iPhone