Bitcoin概念理解

  1. 锁定脚本与解锁脚本
    两者用于确定UTXO的所有权,其中,锁定脚本(sciptPubKey)存在于transaction的output,解锁脚本(scriptSig)存在于transaction的input。
  • 具体规则如下:
  • 交易验证过程:

以上摘自比特币的交易过程-知乎

  • 解锁脚本里签名的内容为:

We define an electronic coin as a chain of digital signatures. Each owner transfers the coin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership. 摘自Bitcoin Whitepaper

总的来说,校验过程先校验解锁脚本里公钥PubKey和锁定脚本里是吻合的,然后校验解锁脚本里的签名。使用对应的私钥,对来源(产生消费的该UTXO的transaction)和去处(转账接受者的pubkey)进行签名。校验过程只需要校验(签名,该UTXO的公钥,签名内容)这三者是吻合的。