Opcode 是指令字节,不是私钥或独立交易。成功花费需要完整有效的脚本与交易上下文,而不只是某个操作名称。
Script 被解码为指令和数据项。OP_PUSHDATA 指定压入字节;压入数据内部的字节不会再被解释为其他 opcode。 [Bitcoin Core v29.0 — Script interpreter] [Bitcoin Core v29.0 — Opcode definitions]
OP_DUP 复制栈顶,OP_DROP 移除栈顶。缺少参数可能导致失败;元素顺序与编码也是条件的一部分。 [Bitcoin Core v29.0 — Script interpreter] [Bitcoin Developer Guide — Transactions]
OP_EQUAL 比较两个元素并压入结果。OP_EQUALVERIFY 在不相等时失败,相等时移除结果;两者本身均不验证密钥控制权。 [Bitcoin Core v29.0 — Script interpreter] [Bitcoin Core v29.0 — Opcode definitions]
OP_CHECKSIG 对照公钥及交易导出的消息验证签名。Legacy 和 SegWit v0 使用 ECDSA,Tapscript 中普通的 32 字节密钥使用 Schnorr。sighash 也决定承诺范围。 [Bitcoin Core v29.0 — Script interpreter] [BIP 342 — Validation of Taproot Scripts]
OP_IF 和 OP_ELSE 根据栈选择分支。Script 没有通用循环;未执行分支的规则仍取决于 opcode 类型和脚本版本。 [Bitcoin Core v29.0 — Script interpreter] [BIP 342 — Validation of Taproot Scripts]
OP_CHECKLOCKTIMEVERIFY 检查绝对锁,OP_CHECKSEQUENCEVERIFY 检查相应输入的相对条件。它们不会等待、发送付款或替代签名条件。 [Bitcoin Core v29.0 — Script interpreter] [Bitcoin Developer Guide — Transactions]
Tapscript 更改签名规则,加入 OP_CHECKSIGADD,并在执行 OP_CHECKMULTISIG 时拒绝。未注明版本的指令列表不是完整的验证指南。 [BIP 342 — Validation of Taproot Scripts]
BIP 342 为未来扩展保留 OP_SUCCESSx:解码 Tapscript 时遇到它们,可依这些规则成功。这不代表某项新操作提案已经激活或能够安全强制预期条件。 [BIP 342 — Validation of Taproot Scripts] [Bitcoin Core — Segregated Witness benefits]
网络策略可能拒绝转发共识允许纳入区块的交易。例如 Bitcoin Core v29.0 默认阻止使用 OP_SUCCESSx 的标准转发;节点策略不是新的共识规则。 [BIP 342 — Validation of Taproot Scripts] [Bitcoin Core v29.0 — Standard script flags]
阅读脚本时应确定版本、初始栈、签名消息和所有失败路径。有效语法或好听的 opcode 名称不能保证正确保管资金;完整用法才是关键。 [Bitcoin Core v29.0 — Script interpreter] [Bitcoin Developer Guide — Transactions]
要获得更完整的理解,请将本词条与以下词条结合阅读: Bitcoin Script, CHECKLOCKTIMEVERIFY, CHECKSEQUENCEVERIFY, Taproot.