Skip to main content

Try it Live

Run Address examples in the interactive playground
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
View the complete executable example at playground/src/examples/primitives/address/from-bytes.ts.

    Length Validation

    The input must be exactly 20 bytes. Any other length throws an error:

    Memory Behavior

    TypeScript/JavaScript:
    • Creates a new Uint8Array (copies input)
    • Safe to modify original bytes after creation
    • No aliasing between input and result
    Zig:
    • Copies to fixed-size array
    • Stack-allocated by default
    • No heap allocation required

    Common Use Cases

    Extracting from ABI Encoded Data

    Reading from Buffer

    Converting from Hash

    Performance

    Zero allocation overhead - directly wraps the bytes into branded type. For repeated conversions, fromBytes() is the fastest constructor:
    • No hex parsing required
    • No numeric conversion
    • Direct memory operation

    See Also