Skip to content

Commit 1554541

Browse files
committed
bip-noreplay: Initial draft of an anti-replay BIP
1 parent 77cde96 commit 1554541

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

bip-noreplay.mediawiki

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<pre>
2+
BIP: ?
3+
Layer: Consensus (soft fork)
4+
Title: Generic anti-replay protection using Script
5+
Author: Luke Dashjr <[email protected]>
6+
Comments-Summary: No comments yet.
7+
Comments-URI: FIXME
8+
Status: Draft
9+
Type: Standards Track
10+
Created: 2017-01-26
11+
License: BSD-2-Clause
12+
</pre>
13+
14+
==Abstract==
15+
16+
This BIP describes a new opcode (OP_CHECKBLOCKATHEIGHT) for the Bitcoin scripting system that allows construction of transactions which are valid only on specific blockchains.
17+
18+
==Copyright==
19+
20+
This BIP is licensed under the BSD 2-clause license.
21+
22+
==Specification==
23+
24+
OP_CHECKBLOCKATHEIGHT redefines the existing NOP5 opcode.
25+
26+
When executed, if any of the following conditions are true, the script interpreter will terminate with an error:
27+
28+
* the stack has fewer than 2 elements; or
29+
* the top item on the stack is not interpretable as a minimal-length CScriptNum; or
30+
* the top item on the stack, when interpreted as a block height (see below) is not within the range of allowed blocks; or
31+
* the second-to-top item on the stack, when interpreted as a block hash, has leading zeros; or
32+
* the second-to-top item on the stack does not match the block hash of the block specified by the top item on the stack interpreted as a height.
33+
34+
Otherwise, script execution will continue as if a NOP had been executed.
35+
36+
FIXME: some way to mask out parts of the block hash for gambling/deterministic-random applications?
37+
38+
===Block height interpretation and limits===
39+
40+
The specified block height may be either a negative number to specify a relative height, or a positive number for an absolute height.
41+
A value of -1 refers to the block immediately preceding the block the transaction is mined it (but this is not a valid value, note).
42+
43+
The specified height must not be more recent than the previous 100 blocks (that is, the largest negative value allowed is -101), nor older than 262144 blocks prior (ie, the smallest negative value is -262144).
44+
45+
===Deployment===
46+
47+
This BIP will be deployed by "version bits" BIP9 with the '''name''' TBD and using '''bit''' TBD.
48+
49+
For Bitcoin '''mainnet''', the BIP9 '''starttime''' will be TBD (Epoch timestamp TBD) and BIP9 '''timeout''' will be TBD (Epoch timestamp TBD).
50+
51+
For Bitcoin '''mainnet''', the BIP9 '''starttime''' will be TBD (Epoch timestamp TBD) and BIP9 '''timeout''' will be TBD (Epoch timestamp TBD).
52+
53+
==Motivation==
54+
55+
In the event of a permanent blockchain split, some mechanism is desired by which the UTXOs valid in either chain may be spent without the transaction being validly replayable on the other chain.
56+
57+
Additionally, there are some cases in normal Bitcoin operation wherein a wallet may need to respend a payment, but must guarantee its respend cannot be mined in the same block as a previous payment which has been recently conflicted by a double-spend.
58+
59+
==Reference Implementation==
60+
61+
TODO

0 commit comments

Comments
 (0)