Crate ethaddr

Source
Expand description

Implementation of Ethereum public addresses for Rust.

This crate provides an Address type for representing Ethereum public addresses.

§Checksums

Addresses are by default formatted with ERC-55 mixed-case checksum encoding. Addresses checksums may optionally be verified when parsing with Address::from_str_checksum().

§address! Macro

This crate exports an address! macro that can be used for creating compile-time address constants. Under the hood, it is implemented with const fn and does not use procedural macros.

§Features

  • default std: Additional integration with Rust standard library types. Notably, this includes std::error::Error implementation on the ParseAddressError type and conversions from Vec<u8>.
  • serde: Serialization traits for the serde crate. Note that the implementation is very much geared towards JSON serialization with serde_json.
  • sha3: Use the Rust Crypto Keccak-256 implementation (provided by the sha3 crate) instead of the built-in one. Note that the address! macro will always use the built-in Keccak-256 implementation for checksum verification, as sha3 does not expose a const fn API.

Macros§

address
Macro to create Ethereum public address values from string literals that get verified at compile time. A compiler error will be generated if an invalid address is specified.

Structs§

Address
An Ethereum public address.

Enums§

ParseAddressError
Represents an error parsing an address from a string.