Skip to main content

Try it Live

Run Bytecode examples in the interactive playground

    BytecodeLike Type

    BytecodeLike is a union type accepting any input that can be coerced to bytecode:

    Accepted Types

    Uint8Array - Raw byte arrays:
    BrandedBytecode - Branded bytecode (passed through):
    Hex String - With or without 0x prefix:
    Strings without 0x prefix may be treated as UTF-8 text, not hex. Always use 0x prefix for hex strings.

    Usage in Function Signatures

    Use BytecodeLike for flexible function parameters:

    Performance

    No conversion overhead for Uint8Array, BrandedBytecode, and Bytecode (zero-copy). Conversion required for strings (parses hex and allocates new Uint8Array). For performance-critical code, prefer passing Uint8Array or BrandedBytecode directly.

    See Also