Learn · stop 5 of 6 · interactive
Try to break a covenant
This is the real SimpleCovenant from the official tutorial — the same twelve
lines this site compiles in CI every day. Imagine coins locked by it, with the recipient
baked in at creation being you. Play the thief. Press the buttons.
This lesson runs in your browser against the contract's logic — no coins move. Every verdict shows the rule a real node would apply. Live testnet-10 broadcast: coming.
The contract — exactly as written
pragma silverscript ^0.1.0;
contract SimpleCovenant(pubkey recipient) {
entry spend() {
byte[36] recipientScriptPubKey = new ScriptPubKeyP2PK(recipient);
require(tx.outputs[0].scriptPubKey == byte[](recipientScriptPubKey));
}
} Build a spend and submit it
The transaction on the wire
vault UTXO
100 KAS · locked by SimpleCovenant
100 KAS · locked by SimpleCovenant
What entry spend() decides
What you just learned
- The chain enforces exactly what is written — nothing more, nothing less. A rejected spend isn't refused; it simply never becomes a transaction.
- This covenant never checks who signs. A thief can spend it — straight into your address. The rule is the lock, not the key.
- You may have found the hole: these twelve lines constrain only output 0's destination — not the amounts, not the other outputs. That's fine for a tutorial and fatal for a vault. Production covenants pin amounts, outputs and lineage — which is why every component page here has a "what it can't do" section, and why audits exist.
Want the rules-behind-the-rules? The build guide compiles this exact contract, and the KCC20 book shows what hardened covenants look like.