What limits apply to reading transaction payload data in a Kaspa script?

The OpTxPayloadSubstr opcode lets a Kaspa script read a slice of the transaction's payload, but it enforces strict bounds. The opcode takes a start index and an end index; if those values are out of range, or if the slice length exceeds the protocol constant MAX_SCRIPT_ELEMENT_SIZE, the script returns an error. In Kaspa's scripting model, the payload is an arbitrary data field attached to a transaction, and introspection opcodes like this one let scripts inspect that data during validation. For a beginner, the practical point is that scripts cannot read unlimited amounts of payload data in one step — the protocol caps how much can be examined at once, which prevents scripts from becoming a vector for processing abuse.

Learn more ›