Skip to content

Commit d7abc41

Browse files
committed
bip-noreplay: Remove relative height and redo depth limit
1 parent c624f9b commit d7abc41

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

bip-noreplay.mediawiki

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ When this opcode is executed:
2727

2828
* If the stack has fewer than 2 elements, the script fails.
2929
* If the top item on the stack cannot be interpreted as a minimal-length 32-bit CScriptNum, the script fails.
30-
* The top item on the stack is interpreted as a block height (ParamHeight, see below).
30+
* The top item on the stack is interpreted as a block height (ParamHeight).
3131
* If the blockchain (in the context of the execution) does not have ParamHeight blocks, the script fails (this failure must not be cached across blocks; it is equivalent to non-final status).
32-
* If ParamHeight is not within the range of allowed blocks, the script fails.
32+
* If ParamHeight specifies a block deeper than 52596 blocks in the chain (including negative values), the opcode completes successfully and script continues as normal.
3333
* The second-to-top item on the stack is interpreted as a block hash (ParamBlockHash).
3434
* If ParamBlockHash is longer than 28 bytes or has leading zeros, the script fails.
3535
* If ParamBlockHash does not match the block hash of the block specified by ParamHeight, the script fails.
@@ -38,13 +38,6 @@ Otherwise, script execution will continue as if a NOP had been executed.
3838

3939
FIXME: some way to mask out parts of the block hash for gambling/deterministic-random applications?
4040

41-
===Block height interpretation and limits===
42-
43-
The specified block height may be either a negative number to specify a relative height, or a positive number for an absolute height.
44-
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).
45-
46-
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).
47-
4841
===Deployment===
4942

5043
This BIP will be deployed by "version bits" [[bip-0009.mediawiki|BIP9]] with the '''name''' "cbah" and using '''bit''' TBD.
@@ -73,6 +66,17 @@ This can be guaranteed by choosing a block which exists only on either side of t
7366

7467
==Rationale==
7568

69+
Why are block heights required to be absolute, rather than relative?
70+
71+
* A relative block height would allow for creation of transactions which are valid at block N, but not N+1. This is carefully avoided by Bitcoin to ensure that if any given block is reorganised out, non-malicious transactions can be simply re-confirmed in a later block.
72+
73+
Why are blocks older than 52596 deep in the chain not verified?
74+
75+
* This is to avoid creating an infinite storage requirement from all full nodes which would be necessary to maintain all the block headers indefinitely. 52596 block headers requires a fixed size of approximately 4 MB.
76+
* In any case where you might want to specify a deeper block, you can also just as well specify a more recent one that decends from it.
77+
* It is assumed that 1 year is sufficient time to double-spend any common UTXOs on all blockchains of interest.
78+
* If a deeper check is needed, it can be softforked in. Making the check more shallow, on the other hand, is a hardfork.
79+
7680
TODO
7781

7882
==Backwards Compatibility==

0 commit comments

Comments
 (0)