学习 · 第 5/6 站 · 互动
试着攻破一份契约
这就是官方教程里真实的 SimpleCovenant — 本站每天在 CI 中编译的正是这十二行代码。想象有币被它锁住,而创建时写死的收款人是你。来扮演小偷,按下按钮试试。
本课程在你的浏览器中针对合约逻辑运行 — 不会移动任何币。每个判定都会展示真实节点会套用的规则。测试网-10 实时广播:即将推出。
合约 — 原文照录
pragma silverscript ^0.1.0;
contract SimpleCovenant(pubkey recipient) {
entry spend() {
byte[36] recipientScriptPubKey = new ScriptPubKeyP2PK(recipient);
require(tx.outputs[0].scriptPubKey == byte[](recipientScriptPubKey));
}
} 构造一笔花费并提交
vault UTXO
100 KAS · SimpleCovenant
100 KAS · SimpleCovenant
entry spend() 的判定