From 1554541db444a375c0453e3c7cc3510be31a32bb Mon Sep 17 00:00:00 2001
From: Luke Dashjr <luke-jr+git@utopios.org>
Date: Thu, 26 Jan 2017 21:48:59 +0000
Subject: bip-noreplay: Initial draft of an anti-replay BIP

---
 bip-noreplay.mediawiki | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 bip-noreplay.mediawiki

(limited to 'bip-noreplay.mediawiki')

diff --git a/bip-noreplay.mediawiki b/bip-noreplay.mediawiki
new file mode 100644
index 0000000..efd1a2c
--- /dev/null
+++ b/bip-noreplay.mediawiki
@@ -0,0 +1,61 @@
+<pre>
+  BIP: ?
+  Layer: Consensus (soft fork)
+  Title: Generic anti-replay protection using Script
+  Author: Luke Dashjr <luke+bip@dashjr.org>
+  Comments-Summary: No comments yet.
+  Comments-URI: FIXME
+  Status: Draft
+  Type: Standards Track
+  Created: 2017-01-26
+  License: BSD-2-Clause
+</pre>
+
+==Abstract==
+
+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.
+
+==Copyright==
+
+This BIP is licensed under the BSD 2-clause license.
+
+==Specification==
+
+OP_CHECKBLOCKATHEIGHT redefines the existing NOP5 opcode.
+
+When executed, if any of the following conditions are true, the script interpreter will terminate with an error:
+
+* the stack has fewer than 2 elements; or
+* the top item on the stack is not interpretable as a minimal-length CScriptNum; or
+* the top item on the stack, when interpreted as a block height (see below) is not within the range of allowed blocks; or
+* the second-to-top item on the stack, when interpreted as a block hash, has leading zeros; or
+* 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.
+
+Otherwise, script execution will continue as if a NOP had been executed.
+
+FIXME: some way to mask out parts of the block hash for gambling/deterministic-random applications?
+
+===Block height interpretation and limits===
+
+The specified block height may be either a negative number to specify a relative height, or a positive number for an absolute height.
+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).
+
+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).
+
+===Deployment===
+
+This BIP will be deployed by "version bits" BIP9 with the '''name''' TBD and using '''bit''' TBD.
+
+For Bitcoin '''mainnet''', the BIP9 '''starttime''' will be TBD (Epoch timestamp TBD) and BIP9 '''timeout''' will be TBD (Epoch timestamp TBD).
+
+For Bitcoin '''mainnet''', the BIP9 '''starttime''' will be TBD (Epoch timestamp TBD) and BIP9 '''timeout''' will be TBD (Epoch timestamp TBD).
+
+==Motivation==
+
+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.
+
+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.
+
+==Reference Implementation==
+
+TODO
-- 
cgit v1.2.3

