Try it Live
Run Address examples in the interactive playground
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
- 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
- from - Universal constructor
- fromHex - Parse from hex string
- toBytes - Convert to Uint8Array
- fromAbiEncoded - Extract from 32-byte ABI encoding

