<divclass="link title"><ahref="/v5/">Documentation</a></div><divclass="base show link depth-1"><ahref="/v5/getting-started/">Getting Started</a></div><divclass="base show link depth-1"><ahref="/v5/concepts/">Ethereum Basics</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/events/">Events</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/gas/">Gas</a></div><divclass="hide link depth-2"><ahref="/v5/concepts/security/">Security</a></div><divclass="base ancestor show link depth-1"><ahref="/v5/api/">Application Programming Interface</a></div><divclass="show link depth-2"><ahref="/v5/api/contract/">Contract Interaction</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/contract/">Contract</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/contract-factory/">ContractFactory</a></div><divclass="hide link depth-3"><ahref="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><divclass="show link depth-2"><ahref="/v5/api/signer/">Signers</a></div><divclass="show link depth-2"><ahref="/v5/api/providers/">Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/provider/">Provider</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/api-providers/">API Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/other/">Other Providers</a></div><divclass="hide link depth-3"><ahref="/v5/api/providers/types/">Types</a></div><divclass="ancestor show link depth-2"><ahref="/v5/api/utils/">Utilities</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/abi/">Application Binary Interface</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/interface/">Interface</a></div><divclass="hide link depth-4"><ahref="/v5/api/utils/abi/fragments/">Fragments</a></div><divclass="myself ancestor ancestor show link depth-3"><ahref="/v5/api/utils/address/">Addresses</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/bignumber/">BigNumber</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/bytes/">Byte Manipulation</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/constants/">Constants</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/display-logic/">Display Logic and Input</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/encoding/">Encoding Utilities</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/fixednumber/">FixedNumber</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/hashing/">Hashing Algorithms</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/hdnode/">HD Wallet</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/logger/">Logging</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/properties/">Property Utilities</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/signing-key/">Signing Key</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/strings/">Strings</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/transactions/">Transactions</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/web/">Web Utilities</a></div><divclass="show link depth-3"><ahref="/v5/api/utils/wordlists/">Wordlists</a></div><divclass="show link depth-2"><ahref="/v5/api/other/">Other Libraries</a></div><divclass="hide link depth-3"><ahref="/v5/api/other/assembly/">Assembly</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/api/">Utilities</a></div><divclass="hide link depth-4"><ahref="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><divclass="hide link depth-3"><ahref="/v5/api/other/hardware/">Hardware Wallets</a></div><divclass="show link depth-2"><ahref="/v5/api/experimental/">Experimental</a></div><divclass="base show link depth-1"><ahref="/v5/cli/">Command Line Interfaces</a></div><divclass="hid
<aname="addresses"></a><aname="addresses"></a><h1class="show-anchors"><div>Addresses<divclass="anchors"><aclass="self"href="/v5/api/utils/address/#addresses"></a></div></div></h1><p>Explain addresses,formats and checksumming here.</p>
<aname="address"></a><aname="addresses--address-formats--address"></a><h3class="show-anchors"><div>Address<divclass="anchors"><aclass="self"href="/v5/api/utils/address/#address"></a></div></div></h3><p>An <b>Address</b> is a <ahref="/v5/api/utils/bytes/#DataHexString">DataHexString</a> of 20 bytes (40 nibbles), with optional mixed case.</p>
<p>If the case is mixed, it is a <b>Checksum Address</b>, which uses a specific pattern of uppercase and lowercase letters within a given address to reduce the risk of errors introduced from typing an address or cut and paste issues.</p>
<p>All functions that return an Address will return a Checksum Address.</p>
<aname="address-icap"></a><aname="addresses--address-formats--address-icap"></a><h3class="show-anchors"><div>ICAP Address<divclass="anchors"><aclass="self"href="/v5/api/utils/address/#address-icap"></a></div></div></h3><p>The <b>ICAP Address Format</b> was an early attempt to introduce a checksum into Ethereum addresses using the popular banking industry's <ahref="https://en.wikipedia.org/wiki/International_Bank_Account_Number">IBAN</a> format with the country code specified as <b>XE</b>.</p>
<p>Due to the way IBAN encodes address, only addresses that fit into 30 base-36 characters are actually compatible, so the format was adapted to support 31 base-36 characters which is large enough for a full Ethereum address, however the preferred method was to select a private key whose address has a <codeclass="inline">0</code> as the first byte, which allows the address to be formatted as a fully compatibly standard IBAN address with 30 base-36 characters.</p>
<p>In general this format is no longer widely supported anymore, however any function that accepts an address can receive an ICAP address, and it will be converted internally.</p>
<p>To convert an address into the ICAP format, see <ahref="/v5/api/utils/address/#utils-getIcapAddress">getIcapAddress</a>.</p>
<aname="utils--address"></a><aname="addresses--utils--address"></a><h2class="show-anchors"><div>Converting and Verifying<divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils--address"></a></div></div></h2>
<aname="utils-getAddress"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">getAddress</span><spanclass="symbol">(</span><spanclass="param">address</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">string<<ahref="/v5/api/utils/address/#address">Address</a>></span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-getAddress"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/address/src.ts/index.ts#L80">source</a></div></div><divclass="body"><p>Returns <i>address</i> as a Checksum Address.</p>
<p>If <i>address</i> is an invalid 40-nibble <ahref="/v5/api/utils/bytes/#HexString">HexString</a> or if it contains mixed case and the checksum is invalid, an InvalidArgument Error is throw.</p>
<p>The value of <i>address</i> may be any supported address format.</p>
</div></div><aname="utils-getIcapAddress"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">getIcapAddress</span><spanclass="symbol">(</span><spanclass="param">address</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">string<<ahref="/v5/api/utils/address/#address-icap">IcapAddress</a>></span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-getIcapAddress"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/address/src.ts/index.ts#L126">source</a></div></div><divclass="body"><p>Returns <i>address</i> as an <ahref="https://github.com/ethereum/wiki/wiki/Inter-exchange-Client-Address-Protocol-%28ICAP%29">ICAP address</a>. Supports the same restrictions as <ahref="/v5/api/utils/address/#utils-getAddress">utils.getAddress</a>.</p>
</div></div><aname="utils-isAddress"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">isAddress</span><spanclass="symbol">(</span><spanclass="param">address</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">boolean</span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-isAddress"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/address/src.ts/index.ts#L118">source</a></div></div><divclass="body"><p>Returns true if <i>address</i> is valid (in any supported format).</p>
<aname="utils-computeAddress"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">computeAddress</span><spanclass="symbol">(</span><spanclass="param">publicOrPrivateKey</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">string<<ahref="/v5/api/utils/address/#address">Address</a>></span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-computeAddress"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/transactions/src.ts/index.ts#L75">source</a></div></div><divclass="body"><p>Returns the address for <i>publicOrPrivateKey</i>. A public key may be compressed or uncompressed, and a private key will be converted automatically to a public key for the derivation.</p>
</div></div><aname="utils-recoverAddress"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">recoverAddress</span><spanclass="symbol">(</span><spanclass="param">digest</span><spanclass="symbol">,</span><spanclass="param">signature</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">string<<ahref="/v5/api/utils/address/#address">Address</a>></span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-recoverAddress"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/transactions/src.ts/index.ts#L80">source</a></div></div><divclass="body"><p>Use <ahref="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Public_key_recovery">ECDSA Public Key Recovery</a> to determine the address that signed <i>digest</i> to which generated <i>signature</i>.</p>
<aname="utils-getContractAddress"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">getContractAddress</span><spanclass="symbol">(</span><spanclass="param">transaction</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">string<<ahref="/v5/api/utils/address/#address">Address</a>></span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-getContractAddress"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/address/src.ts/index.ts#L133">source</a></div></div><divclass="body"><p>Returns the contract address that would result if <i>transaction</i> was used to deploy a contract.</p>
</div></div><aname="utils-getCreate2Address"></a><divclass="property show-anchors"><divclass="signature"><spanclass="path">ethers</span><spanclass="symbol">.</span><spanclass="path">utils</span><spanclass="symbol">.</span><spanclass="method">getCreate2Address</span><spanclass="symbol">(</span><spanclass="param">from</span><spanclass="symbol">,</span><spanclass="param">salt</span><spanclass="symbol">,</span><spanclass="param">initCodeHash</span><spanclass="symbol">)</span><spanclass="arrow">⇒</span><spanclass="returns">string<<ahref="/v5/api/utils/address/#address">Address</a>></span><divclass="anchors"><aclass="self"href="/v5/api/utils/address/#utils-getCreate2Address"></a><aclass="source"href="https://github.com/ethers-io/ethers.js/blob/ethers-v5-beta/packages/address/src.ts/index.ts#L146">source</a></div></div><divclass="body"><p>Returns the contract address that would result from the given <ahref="https://eips.ethereum.org/EIPS/eip-1014">CREATE2</a> call.</p>
<divclass="copyright">The content of this site is licensed under the <ahref="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on June 10, 2020, 12:47am.</div>