ethereumjs-monorepo

@ethereumjs/util / Address

Class: Address

Handling and generating Ethereum addresses

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Address(bytes)

Parameters

Name Type
bytes Uint8Array

Defined in

packages/util/src/address.ts:17

Properties

bytes

Readonly bytes: Uint8Array

Defined in

packages/util/src/address.ts:15

Methods

equals

equals(address): boolean

Is address equal to another.

Parameters

Name Type
address Address

Returns

boolean

Defined in

packages/util/src/address.ts:97


isPrecompileOrSystemAddress

isPrecompileOrSystemAddress(): boolean

True if address is in the address range defined by EIP-1352

Returns

boolean

Defined in

packages/util/src/address.ts:112


isZero

isZero(): boolean

Is address zero.

Returns

boolean

Defined in

packages/util/src/address.ts:104


toBytes

toBytes(): Uint8Array

Returns a new Uint8Array representation of address.

Returns

Uint8Array

Defined in

packages/util/src/address.ts:129


toString

toString(): string

Returns hex encoding of address.

Returns

string

Defined in

packages/util/src/address.ts:122


fromPrivateKey

Static fromPrivateKey(privateKey): Address

Returns an address for a given private key.

Parameters

Name Type Description
privateKey Uint8Array A private key must be 256 bits wide

Returns

Address

Defined in

packages/util/src/address.ts:58


fromPublicKey

Static fromPublicKey(pubKey): Address

Returns an address for a given public key.

Parameters

Name Type Description
pubKey Uint8Array The two points of an uncompressed key

Returns

Address

Defined in

packages/util/src/address.ts:46


fromString

Static fromString(str): Address

Returns an Address object from a hex-encoded string.

Parameters

Name Type Description
str string Hex-encoded address

Returns

Address

Defined in

packages/util/src/address.ts:35


generate

Static generate(from, nonce): Address

Generates an address for a newly created contract.

Parameters

Name Type Description
from Address The address which is creating this new address
nonce bigint The nonce of the from account

Returns

Address

Defined in

packages/util/src/address.ts:71


generate2

Static generate2(from, salt, initCode): Address

Generates an address for a contract created using CREATE2.

Parameters

Name Type Description
from Address The address which is creating this new address
salt Uint8Array A salt
initCode Uint8Array The init code of the contract being created

Returns

Address

Defined in

packages/util/src/address.ts:84


zero

Static zero(): Address

Returns the zero address.

Returns

Address

Defined in

packages/util/src/address.ts:27