Opcodes · crypto · enabled

OP_HASH160 (0xa9)

Replaces the top item with its SHA-256 then RIPEMD-160 hash (20 bytes). Used in P2PKH and P2SH20 addresses.

Verified
Stack in → out
x → hash(x)
Since
Original Bitcoin script
Cost
Base instruction cost 100 plus result length, plus 192 per hash digest iteration under relay policy (64 under consensus); digest iterations also count toward the per-input hashing limit (2025 VM limits). The two-round hash adds one extra digest iteration.
Bitcoin status
Same in Bitcoin (BTC)

Example

OP_DUP OP_HASH160 <pkh> OP_EQUALVERIFY OP_CHECKSIG

Step through it opcode by opcode in Bitauth IDE, the in-browser BCH VM debugger.

Sources

  1. Libauth BCH_2023_05 opcodes (bch-2023-opcodes.ts)
  2. CHIP-2021-05 VM Limits: Targeted Virtual Machine Limits
  3. BCHN VM limits (vm_limits.h)