Skip to content

Commit 274fa40

Browse files
authored
Merge pull request bitcoin#1278 from JeremyRubin/patch-6
[BIP-119] Clarify that policy is not validity + what a covenant is.
2 parents 34d211a + 5901e70 commit 274fa40

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

bip-0119.mediawiki

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ The recommended standardness rules additionally:
3939
4040
==Motivation==
4141

42-
Covenants are restrictions on how a coin may be spent beyond key ownership. Covenants can be useful
43-
to construct smart contracts. As covenants are complex to implement and risk of introducing
44-
fungibility discriminants they have not been seriously considered for inclusion in Bitcoin.
42+
Covenants are restrictions on how a coin may be spent beyond key ownership. This is a general
43+
definition based on the legal definition which even simple scripts using CSV would satisfy.
44+
Covenants in Bitcoin transactions usually refer to restrictions on where coins can be transferred.
45+
Covenants can be useful to construct smart contracts. As covenants are complex to implement
46+
and risk of introducing fungibility discriminants they have not been seriously considered for
47+
inclusion in Bitcoin.
4548

4649
This BIP introduces a simple covenant called a *template* which enables a limited set of highly
4750
valuable use cases without significant risk.
@@ -271,14 +274,14 @@ For the avoidance of unclarity, the parameters to be determined are:
271274
consensus.vDeployments[Consensus::DEPLOYMENT_CHECKTEMPLATEVERIFY].min_activation_height = 0;
272275
273276
Until BIP-119 reaches ACTIVE state and the
274-
SCRIPT_VERIFY_DEFAULT_CHECK_TEMPLATE_VERIFY_HASH flag is set, the network should
275-
execute a NOP4 as SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS for policy and a NOP for
276-
consensus.
277+
SCRIPT_VERIFY_DEFAULT_CHECK_TEMPLATE_VERIFY_HASH flag is enforced, node implementations should (are recommended to)
278+
execute a NOP4 as SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS (to deny entry to the mempool) for policy and must evaluate as
279+
a NOP for consensus (during block validation).
277280

278281
In order to facilitate using CHECKTEMPLATEVERIFY, the common case of a
279282
PayToBareDefaultCheckTemplateVerifyHash
280-
with no scriptSig data shall be made standard to permit relaying. Future template types may be
281-
standardized later as policy changes.
283+
with no scriptSig data may (is recommended to) be made standard to permit relaying. Future template types may be
284+
standardized later as policy changes at the preference of the implementor.
282285

283286
==Reference Implementation==
284287

@@ -589,12 +592,13 @@ reuse-unsafe.
589592
Because CHECKTEMPLATEVERIFY commits to the input index currently being spent, reused-keys are
590593
guaranteed to execute in separate transactions which reduces the risk of "half-spend" type issues.
591594

592-
====NOP-Default and Standardness Rules====
595+
====NOP-Default and Recommended Standardness Rules====
593596

594-
If the argument length is not exactly 32, CHECKTEMPLATEVERIFY treats it as a NOP.
595-
Many OP_NOP upgrades prefer to fail in such circumstances. In particular, for
596-
CHECKTEMPLATEVERIFY, making an invalid argument a NOP permits future soft-forks to upgrade the
597-
semantics or loosed restrictions around the value being previously pushed only.
597+
If the argument length is not exactly 32, CHECKTEMPLATEVERIFY treats it as a NOP during
598+
consensus validation. Implementations are recommended to fail in such circumstances during non-consensus
599+
relaying and mempool validation. In particular, making an invalid-length argument a failure aids future
600+
soft-forks upgrades to be able to rely on the tighter standard restrictions to safely loosen
601+
the restrictions for standardness while tightening them for consensus with the upgrade's rules.
598602

599603
The standardness rules may lead an unscrupulous script developer to accidentally rely on the
600604
stricter standardness rules to be enforced during consensus. Should that developer submit a
@@ -710,8 +714,9 @@ for an OP_NOP are a soft fork, so existing software will be fully functional wit
710714
for mining and block validation. Similar soft forks for OP_CHECKSEQUENCEVERIFY and OP_CHECKLOCKTIMEVERIFY
711715
(see BIP-0065 and BIP-0112) have similarly changed OP_NOP semantics without introducing compatibility issues.
712716

713-
In contrast to previous forks, OP_CHECKTEMPLATEVERIFY will not make scripts
714-
valid for policy until the new rule is active.
717+
In contrast to previous forks, OP_CHECKTEMPLATEVERIFY's reference implementation does not allow transactions with spending
718+
scripts using it to be accepted to the mempool or relayed under standard policy until the new rule is active. Other implementations
719+
are recommended to follow this rule as well, but not required.
715720

716721
Older wallet software will be able to accept spends from OP_CHECKTEMPLATEVERIFY outputs, but will
717722
require an upgrade in order to treat PayToBareDefaultCheckTemplateVerifyHash chains with a confirmed ancestor as

0 commit comments

Comments
 (0)