You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bip-0032.mediawiki
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -259,7 +259,7 @@ PyCoin (https://github.com/richardkiss/pycoin) is a suite of utilities for deali
259
259
260
260
A Java implementation is available at https://github.com/bitsofproof/supernode/blob/1.1/api/src/main/java/com/bitsofproof/supernode/api/ExtendedKey.java
261
261
262
-
A C++ implementation is available at https://github.com/CodeShark/CoinClasses/tree/master/tests/hdwallets
262
+
A C++ implementation is available at https://github.com/ciphrex/mSIGNA/blob/master/deps/CoinCore/src/hdkeys.h
263
263
264
264
An Objective-C implementation is available at https://github.com/oleganza/CoreBitcoin/blob/master/CoreBitcoin/BTCKeychain.h
265
265
@@ -281,4 +281,5 @@ A Haskell implementation is available at https://github.com/haskoin/haskoin toge
281
281
282
282
* Gregory Maxwell for the original idea of type-2 deterministic wallets, and many discussions about it.
283
283
* Alan Reiner for the implementation of this scheme in Armory, and the suggestions that followed from that.
284
+
* Eric Lombrozo for reviewing and revising this BIP.
284
285
* Mike Caldwell for the version bytes to obtain human-recognizable Base58 strings.
@@ -49,139 +49,160 @@ The block produced time is equal to the median-time-past of its previous block.
49
49
50
50
When the relative lock-time is block-based, it is interpreted as a minimum block-height constraint over the input's age. A relative block-based lock-time of zero indicates an input which can be included in any block. More generally, a relative block lock-time n can be included n blocks after the mining date of the output it is spending, or any block thereafter.
51
51
52
-
This is proposed to be accomplished by replacing IsFinalTx() and CheckFinalTx(), existing consensus and non-consensus code functions that return true if a transaction's lock-time constraints are satisfied and false otherwise, with LockTime() and CheckLockTime(), new functions that return a non-zero value if a transaction's lock-time or sequence number constraints are not satisfied and zero otherwise:
52
+
==Implementation==
53
+
54
+
A reference implementation is provided by the following pull request
55
+
56
+
https://github.com/bitcoin/bitcoin/pull/7184
53
57
54
58
<pre>
55
-
enum {
56
-
/* Interpret sequence numbers as relative lock-time constraints. */
57
-
LOCKTIME_VERIFY_SEQUENCE = (1 << 0),
58
-
};
59
-
60
-
/* Setting nSequence to this value for every input in a transaction
Code conditional on the return value of IsFinalTx() / CheckLockTime() has to be updated as well, since the semantics of the return value has been inverted.
169
-
170
-
==Example: Bidirectional payment channel==
171
132
172
-
A bidirectional payment channel can be established by two parties funding a single output in the following way: Alice funds a 1 BTC output which is the 2-of-2 multisig of Alice AND Bob, or Alice's key only after a sufficiently long timeout, e.g. 30 days or 4320 blocks. The channel-generating transaction is signed by Alice and broadcast to the network.
173
-
174
-
Alice desires to send Bob a payment of 0.1 BTC. She does so by constructing a transaction spending the 1 BTC output and sending 0.1 BTC to Bob and 0.9 BTC back to herself. She provides her signature for the 2-of-2 multisig constraint, and sets a relative lock-time using the sequence number field such that the transaction will become valid 24-hours or 144 blocks before the refund timeout. Two more times Alice sends Bob a payment of 0.1 BTC, each time generating and signing her half of a transaction spending the 1btc output and sending 0.2 BTC, then 0.3 BTC to Bob with a relative lock-time of 29 days from creation of the channel.
175
-
176
-
Bob now desires to send Alice a refund of 0.25 BTC. He does so by constructing a transaction spending the 1btc output and sending 0.95 BTC (= 0.7 BTC + 0.25 BTC) to Alice and 0.05 BTC to himself. Since Bob will still have in his logs the transaction giving him 0.7 BTC 29 days after the creation of the channel, Alice demands that this new transaction have a relative lock-time of 28 days so she has a full day to broadcast it before the next transaction matures.
177
-
178
-
Alice and Bob continue to make payments to each other, decrementing the relative lock-time by one day each time the channel switches direction, until the present time is reached or either party desires to close out the channel. A close-out is performed by finalizing the input (nSequence = MAX_INT) and both parties signing.
179
-
180
-
==Implementation==
181
-
182
-
A reference implementation is provided by the following pull request
133
+
int nCoinHeight = (*prevHeights)[txinIndex];
134
+
135
+
if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) {
0 commit comments