Skip to main content

Module memo_hash

Module memo_hash 

Source
Expand description

TAIP-20 on-chain transfer correlation via memo hash.

TAIP-20 defines a chain-agnostic correlation primitive that ties a TAP transfer to its on-chain settlement. The primitive is tap_hash = SHA-256(UTF8(transfer_id)). The hash is then carried on-chain in either:

  • Profile A (text): the canonical form tap:1:<64-lowercase-hex> placed in a UTF-8 memo / reference / comment field.
  • Profile B (binary): the raw 32-byte hash placed in a fixed-length binary memo field.

See prds/taips/TAIPs/taip-20.md for the full spec.

Functionsยง

encode_binary_memo
Encode a transfer ID as a Profile B (binary) memo: the raw 32-byte hash.
encode_text_memo
Encode a transfer ID as a Profile A (text) memo: tap:1:<64-lowercase-hex>.
tap_memo_hash
Compute the canonical TAP correlation hash for a transfer ID: SHA-256(UTF8(transfer_id)).
verify_binary_memo
Verify that a Profile B binary memo (raw bytes) correlates to the given transfer ID. Memos that are not exactly 32 bytes long are rejected.
verify_text_memo
Verify that a Profile A text memo correlates to the given transfer ID.