<>
represents data or script{}
represents data that must prefixed by OP_PUSHDATA[]
represents multiple{}
PubKey (pay-to-pubkey / P2PK)
Address: N/A
scriptPubKey: {pubKey} OP_CHECKSIG
scriptSig: {signature}
PubKeyHash (pay-to-pubkeyhash / P2PKH)
Address: Base58(0x00 <hash160 pubKey> <checksum>)
scriptPubKey: OP_DUP OP_HASH160 {hash160(pubKey)} OP_EQUALVERIFY OP_CHECKSIG
scriptSig: {signature} {pubKey}
ScriptHash (pay-to-scripthash / P2SH)
Address: Base58(0x05 <hash160 script> <checksum>)
scriptPubKey: OP_HASH160 {hash160(scriptPubKey2)} OP_EQUAL
scriptSig: [scriptSig2 ...] {scriptPubKey2}
MultiSig (pay-to-multisig / P2MS)
Address: N/A
scriptPubKey: m [pubKeys ...] n OP_CHECKMULTISIG
scriptSig: OP_0 [signatures ...]
Witness PubKeyHash (pay-to-witness-pubkeyhash / P2WPKH)
Address: Bech32('bc' {hash160(pubKey)})
scriptPubKey: 0 {hash160(pubKey)}
scriptSig: (empty)
witness: {signature} {pubKey}
Witness ScriptHash (pay-to-witness-scripthash / P2WSH)
Address: Bech32('bc' {sha256(script)})
scriptPubKey: 0 {sha256(scriptPubKey2)}
scriptSig: (empty)
witness: [scriptSig2 ...] {scriptPubKey2}
OP_RETURN
Address: N/A
scriptPubKey: OP_RETURN {data}
scriptSig: N/A
Anyone-can-spend
Address: N/A
scriptPubKey: N/A
scriptSig: OP_TRUE
Transaction-puzzle
Address: N/A
scriptPubKey: OP_HASH256 {hash} OP_EQUAL
scriptSig: <data>
CheckLockTimeVerify
Requires that the spending transaction has an
nLockTime
greater or equal to that of the input transaction's output scriptexpiry
time (see example below).The
expiry
is a signed, positive, little-endian variable length integer encoded as data (seeCScriptNum
).OP_CHECKLOCKTIMEVERIFY
does not remove anything from the stack, this is so compatibility is kept withOP_NOP2
.Therefore
OP_DROP
is usually required after.The spending transaction's relevant input field must have an
nSequence != 0xffffffff
, or else the input is invalid.The type of
nLockTime
must be consistent (lock-by-blockheight
orlock-by-blocktime
).Example
{expiry} OP_CHECKLOCKTIMEVERIFY OP_DROP ...
In the above example, the spending transaction would require a
nLockTime >= expiry
,