快速上手 · 5 分钟
从下载到第一段 BVM 字节码。
本页所有命令均参考官方安装与教程页编写;如平台或路径与你本地不一致,请优先按 docs.installation 的版本执行。
本页是「5 分钟尝鲜版」,覆盖 下载 → 编译 → 调试 闭环。完整安装与平台细节以官方为准。 docs.installation.
Step 01
下载发布包。
utxo_compiler-v1.0.0-linux/ ├── utxo_compiler # executable ├── doc/ # documentation ├── install.sh # install script └── VERSION # version info
utxo_compiler-v1.0.0-windows-64/ ├── utxo_compiler.exe # Windows executable ├── libstdc++-6.dll # C++ standard library ├── libgcc_s_seh-1.dll # GCC runtime ├── libwinpthread-1.dll # threading runtime ├── doc/ # documentation ├── install.bat # Windows install script ├── DEPENDENCIES.txt # dependency notes └── VERSION # version info
macOS 计划支持,未上线。
Step 02
验证安装。
# Linux
./builds/linux/bin/utxo_compiler --version# Windows (PowerShell)
.\builds\windows-64\bin\utxo_compiler.exe --versionStep 03
写一个 P2PKH 合约。
新建 p2pkh.ct:
Contract P2PKH:
def verify(sig: hex, pubKey: hex):
pubKey_copy = pubKey.Clone()
pubKeyHash = Hash160(pubKey_copy)
EqualVerify(pubKeyHash, self.pubKeyHash)
result = CheckSig(sig, pubKey)- Hash160 消耗其输入;后续 CheckSig(sig, pubKey) 还要用 pubKey —— 所以先 pubKey.Clone()。
- EqualVerify 失败立即终止,符合「必须满足」的约束语义。
Step 04
编译。
./utxo_compiler p2pkh.ct成功后,会输出 JSON 格式字节码,包含合约名 P2PKH、公开函数 verify(sig: hex, pubKey: hex) 与对应字节码 / 调试信息(取决于编译参数)。
Step 05
调试。
./utxo_compiler p2pkh.ct --debug进入交互式调试器后输入参数:
Enter parameters for verify: sig [hex]: 0x3045022100... pubKey [hex]: 0x03ab12...
- 通过路径:使用与 pubKeyHash 匹配的公钥与对应签名 → EqualVerify 通过、CheckSig 返回 1、合约最终返回真。
- 失败路径:故意输错公钥或签名 → 在对应步骤被立即拒绝。