# `BSV.Tokens.Script.Templates`
[🔗](https://github.com/Bittoku/bsv_sdk_elixir/blob/main/lib/bsv/tokens/script/templates.ex#L1)

Byte-pattern constants for classifying STAS script versions, plus
builders for fixed locking-script bodies (such as the STAS 3.0 v0.1
§10.2 P2MPKH locking script).

# `empty_hash160`

EMPTY_HASH160 sentinel = HASH160(""). Means "skip auth" in owner / arbitrator slots.

# `p2mpkh_locking_script`

```elixir
@spec p2mpkh_locking_script(&lt;&lt;_::160&gt;&gt;) :: binary()
```

Build the fixed 70-byte STAS 3.0 v0.1 §10.2 P2MPKH locking-script body.

This locking script is used at issuance and redemption boundaries of a
STAS token — i.e. on UTXOs that are not themselves STAS in-life UTXOs
but bracket a STAS token's lifecycle. In-life STAS UTXOs do NOT carry
this script; the engine inlines equivalent logic.

## Input
- `mpkh` — 20-byte MPKH (`HASH160` of the redeem buffer; see
  `BSV.Transaction.P2MPKH.mpkh/1`).

## Output
70-byte binary equal to:

    <<0x76, 0xA9, 0x14, mpkh::binary-size(20),
      0x88, 0x82, 0x01, 0x21, 0x87, 0x63, 0xAC, 0x67,
      0x51, 0x7F, (0x51, 0x7F, 0x73, 0x63, 0x7C, 0x7F, 0x68) x 5,
      0xAE, 0x68>>

Decoded as Bitcoin Script: `OP_DUP OP_HASH160 <MPKH> OP_EQUALVERIFY
OP_SIZE 0x21 OP_EQUAL OP_IF OP_CHECKSIG OP_ELSE OP_1 OP_SPLIT
(OP_1 OP_SPLIT OP_IFDUP OP_IF OP_SWAP OP_SPLIT OP_ENDIF) x 5
OP_CHECKMULTISIG OP_ENDIF`.

# `p2mpkh_locking_script_len`

STAS 3.0 v0.1 §10.2 P2MPKH locking-script body length (70 bytes).

# `p2pkh_len`

Standard P2PKH script length in bytes.

# `p2pkh_prefix`

P2PKH script prefix: `OP_DUP OP_HASH160 OP_DATA_20`.

# `p2pkh_suffix`

P2PKH script suffix: `OP_EQUALVERIFY OP_CHECKSIG`.

# `pkh_len`

Length of a public key hash in bytes.

# `stas3_base_prefix`

STAS 3.0 base template prefix bytes.

# `stas3_base_template_len`

Length of the STAS 3.0 canonical engine base template in bytes.

Sourced from `github.com/stassso/STAS-3-script-templates` (v0.2.3).
The previous 2812-byte engine used a length-prefixed piece consumer
and is deprecated.

# `stas_v2_marker`

STAS v2 marker bytes after the 20-byte owner PKH.

# `stas_v2_marker_offset`

Byte offset of the STAS v2 marker within the script.

# `stas_v2_min_len`

Minimum length of a STAS v2 script (template + flags).

# `stas_v2_op_return_offset`

Byte offset of the OP_RETURN within a STAS v2 template.

# `stas_v2_owner_offset`

Byte offset of the owner PKH within a STAS v2 script.

# `stas_v2_prefix`

STAS v2 prefix bytes: `OP_DUP OP_HASH160 OP_DATA_20`.

# `stas_v2_redemption_offset`

Byte offset of the redemption PKH within a STAS v2 template.

# `stas_v2_template_len`

Length of the STAS v2 template body in bytes.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
