1
0
mirror of https://github.com/bitcoin/bips.git synced 2024-11-19 01:40:05 +01:00

bip-noreplay: Initial draft of an anti-replay BIP

This commit is contained in:
Luke Dashjr 2017-01-26 21:48:59 +00:00
parent 77cde96da1
commit 1554541db4

61
bip-noreplay.mediawiki Normal file
View File

@ -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