summaryrefslogtreecommitdiff
path: root/62/94d7ab00881041ce5e8f91425f86b05ab41562
blob: 498832ba22257ca058be43614ed9c3787690ee9b (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
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <bitcoin-list@bluematt.me>) id 1UsBbs-0003on-7i
	for bitcoin-development@lists.sourceforge.net;
	Thu, 27 Jun 2013 12:47:36 +0000
Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of bluematt.me
	designates 173.246.101.161 as permitted sender)
	client-ip=173.246.101.161;
	envelope-from=bitcoin-list@bluematt.me; helo=mail.bluematt.me; 
Received: from vps.bluematt.me ([173.246.101.161] helo=mail.bluematt.me)
	by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76)
	id 1UsBbn-0002yK-SD for bitcoin-development@lists.sourceforge.net;
	Thu, 27 Jun 2013 12:47:36 +0000
Received: from [192.168.153.125] (unknown [74.125.61.18])
	by mail.bluematt.me (Postfix) with ESMTPSA id AF43B639C;
	Thu, 27 Jun 2013 12:29:32 +0000 (UTC)
User-Agent: K-9 Mail for Android
MIME-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
From: bitcoin-list@bluematt.me
Date: Thu, 27 Jun 2013 14:29:30 +0200
To: bitcoinj@googlegroups.com,bitcoin-development@lists.sourceforge.net
Message-ID: <44f8fd60-be4a-436d-a132-422b939d6de1@email.android.com>
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.8 (--)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	-0.0 SPF_PASS               SPF: sender matches SPF record
	-1.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay
	domain
X-Headers-End: 1UsBbn-0002yK-SD
Subject: [Bitcoin-development] [ANN] Micropayment Channel Implementation
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Thu, 27 Jun 2013 12:47:36 -0000

As of today, a full implementation of micropayment channels has been merg=
ed
onto bitcoinj's master branch (to be released in the next version). It is=
=0Ddesigned to make it easy for users to create payment channel servers a=
nd=0Dclients based on the design at=0Dhttps://en.bitcoin.it/wiki/Contract=
s#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_par=
ty,=0Dby creating a simple TCP socket and exchanging protobufs to initial=
ize and=0Dmake payments.

It supports various levels of abstractions, allowing users to drive the=0D=
state machines which do basic channel init/verification themselves, allow=
=0Dbitcoinj to handle all the complexity of channel management/expiry/etc=
 and=0Dsimply exchange protobufs over whatever whatever connection they w=
ish to=0Dmake with the server, or let bitcoinj handle opening a TCP socke=
t and do=0Dall the work. See=0Dhttps://code.google.com/p/bitcoinj/wiki/Wo=
rkingWithMicropayments for=0Ddetails on how to use the implementation in =
bitcoinj.

A more full protocol description will be written up in the form of a BIP =
as=0Dthe code matures a bit more (with the hope that other implementation=
s can=0Dappear), but, generally:

1. Client and server exchange version handshake, and client may=0Doptiona=
lly request that an existing channel be reopened (the channels last=0Dfor=
 24 hours by default, so if the connection gets killed, reopening an=0Dex=
isting channel is useful).
2. The protocol described on the wiki is followed, exchanging=0D(canonica=
l!) signatures and transactions until a multisignature contract is=0Desta=
blished and broadcast which locks money into the channel, and a refund=0D=
transaction is created and signed which allows the client to spend the=0D=
entire multisignature transaction to wherever they want=0D(SIGHASH_NONE|S=
IGHASH_ANYONECANPAY) after some lock time (by default, 24=0Dhours). Both =
client and server store a copy of the channel in their wallet=0Dso that i=
f the app itself crashes the refund transaction can still be=0Dbroadcast/=
the channel can still be resumed. At this point either the whole wallet s=
hould be backed up or the total value in payment channels at any=0Dgiven =
time should be kept reasonably low (because payment channels are=0Ddesign=
ed to combine micropayments into confirmable payments, this shouldn't be =
an issue)
3. The client increments payments by sending the server new signatures=0D=
spending the multisig contract partially back to themselves and allowing=0D=
the server to do what they want with the rest=0D(SIGHASH_SINGLE|SIGHASH_A=
NYONECANPAY).
4. When the client sends a CLOSE message or the channel approaches the=0D=
refund transaction unlock time, the server adds any necessary fees to the=
=0Dlatest payment transaction and broadcasts it, closing the channel, dis=
connecting the client if the connection is still open and removing the st=
ored channel state from its wallet.

See https://code.google.com/p/bitcoinj/source/browse/core/src/paymentchan=
nel.proto for the protobuf/protocol description.