ethers.js/docs/v4/index.html

435 lines
22 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>What is ethers.js &mdash; ethers.js 4.0.0 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/ethers.css" type="text/css" />
<link rel="stylesheet" href="_static/css/ethers.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Getting Started" href="getting-started.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="#" class="icon icon-home"> ethers.js
</a>
<div class="version">
4.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Developer Documentation</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Application Programming Interface (API)</a></li>
<li class="toctree-l1"><a class="reference internal" href="api-advanced.html">Low-Level API</a></li>
<li class="toctree-l1"><a class="reference internal" href="cookbook.html">Cookbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="migration.html">Migration Guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="notes.html">Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="#">ethers.js</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="#">Docs</a> &raquo;</li>
<li>What is ethers.js</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="what-is-ethers-js">
<h1>What is ethers.js<a class="headerlink" href="#what-is-ethers-js" title="Permalink to this headline"></a></h1>
<p>The ethers.js library aims to be a complete and compact library for interacting
with the Ethereum Blockchain and its ecosystem. It was originally designed for
use with <a class="reference external" href="https://ethers.io">ethers.io</a> and has since expanded into a much more general-purpose
library.</p>
<hr class="docutils" />
<div class="section" id="features">
<h2>Features<a class="headerlink" href="#features" title="Permalink to this headline"></a></h2>
<blockquote>
<div><ul class="simple">
<li>Keep your private keys in your client, <strong>safe</strong> and sound</li>
<li>Import and export <strong>JSON wallets</strong> (Geth, Parity and crowdsale)</li>
<li>Import and export BIP 39 <strong>mnemonic phrases</strong> (12 word backup phrases) and HD Wallets (English, Italian, Japanese, Korean, Simplified Chinese, Traditional Chinese; more coming soon)</li>
<li>Meta-classes create JavaScript objects from any contract ABI, including <strong>ABIv2</strong> and <strong>Human-Readable</strong> ABI</li>
<li>Connect to Ethereum nodes over <a class="reference external" href="https://github.com/ethereum/wiki/wiki/JSON-RPC">JSON-RPC</a>, <a class="reference external" href="https://infura.io/">INFURA</a>, <a class="reference external" href="https://etherscan.io/">Etherscan</a>, or <a class="reference external" href="https://metamask.io/">MetaMask</a>.</li>
<li><strong>ENS names</strong> are first-class citizens; they can be used anywhere an Ethereum addresses can be used</li>
<li><strong>Tiny</strong> (~88kb compressed; 284kb uncompressed)</li>
<li><strong>Complete</strong> functionality for all your Ethereum needs</li>
<li>Extensive <a class="reference external" href="https://docs.ethers.io">documentation</a></li>
<li>Large collection of <strong>test cases</strong> which are maintained and added to</li>
<li>Fully <strong>TypeScript</strong> ready, with definition files and full TypeScript source</li>
<li><strong>MIT License</strong> (including ALL dependencies); completely open source to do with as you please</li>
</ul>
</div></blockquote>
<hr class="docutils" />
<div class="toctree-wrapper compound">
<p class="caption"><span class="caption-text">Developer Documentation</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting Started</a><ul>
<li class="toctree-l2"><a class="reference internal" href="getting-started.html#installing-in-node-js">Installing in Node.js</a><ul>
<li class="toctree-l3"><a class="reference internal" href="getting-started.html#importing">Importing</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="getting-started.html#including-in-web-applications">Including in Web Applications</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api.html">Application Programming Interface (API)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api-wallet.html">Wallets and Signers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-wallet.html#wallet">Wallet</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-wallet.html#signer-api">Signer API</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-providers.html">Providers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#connecting-to-ethereum">Connecting to Ethereum</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#properties">Properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#network">Network</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#account">Account</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#blockchain-status">Blockchain Status</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#ethereum-naming-service">Ethereum Naming Service</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#contract-execution">Contract Execution</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#contract-state">Contract State</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#events">Events</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#objects-and-types">Objects and Types</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-providers.html#provider-specific-extra-api-calls">Provider Specific Extra API Calls</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-contract.html">Contracts</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#deploying-a-contract">Deploying a Contract</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#connecting-to-existing-contracts">Connecting to Existing Contracts</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#meta-class-properties">Meta-Class Properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#overrides">Overrides</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#event-emitter">Event Emitter</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#providers-vs-signers">Providers vs Signers</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#types">Types</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#filtering-events">Filtering Events</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-contract.html#application-binary-interface-abi">Application Binary Interface (ABI)</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-utils.html">Utilities</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#addresses">Addresses</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#arrayish">Arrayish</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#big-numbers">Big Numbers</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#bytes32-strings">Bytes32 Strings</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#constants">Constants</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#cryptographic-functions">Cryptographic Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#ether-strings-and-wei">Ether Strings and Wei</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#hex-strings">Hex Strings</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#namehash">Namehash</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#signatures">Signatures</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#transactions">Transactions</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#utf-8-strings">UTF-8 Strings</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-utils.html#web">Web</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api-advanced.html">Low-Level API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api-advanced.html#abi-coder">ABI Coder</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#creating-instances">Creating Instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#static-properties">Static Properties</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#prototype">Prototype</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-advanced.html#hdnode">HDNode</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id1">Creating Instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id2">Prototype</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#deriving-child-and-neutered-nodes">Deriving Child and Neutered Nodes</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#static-methods">Static Methods</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-advanced.html#interface">Interface</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#creating-an-instance">Creating an Instance</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id3">Prototype</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#parsing-objects">Parsing Objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#object-test-functions">Object Test Functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#descriptions">Descriptions</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-advanced.html#provider-sub-classing">Provider (Sub-Classing)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id4">Static Methods</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id5">Prototype</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-advanced.html#recursive-length-prefixed-encoding-rlp">Recursive-Length Prefixed Encoding (RLP)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id6">Static Methods</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api-advanced.html#signing-key">Signing Key</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id7">Creating Instances</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#id8">Prototype</a></li>
<li class="toctree-l3"><a class="reference internal" href="api-advanced.html#cryptographic-operations">Cryptographic Operations</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cookbook.html">Cookbook</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cookbook-accounts.html">Accounts</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cookbook-accounts.html#dump-all-json-wallet-balances-in-current-directory">Dump All JSON Wallet Balances (in current directory)</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-accounts.html#sweep-an-account-into-another">Sweep an Account into Another</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-accounts.html#coalesce-jaxx-wallets">Coalesce Jaxx Wallets</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-accounts.html#access-funds-in-a-mnemonic-phrase-wallet">Access Funds in a Mnemonic Phrase Wallet</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-accounts.html#random-mnemonic">Random Mnemonic</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-accounts.html#get-transaction-history">Get Transaction History</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cookbook-contracts.html">Contracts</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cookbook-contracts.html#return-a-value-from-a-state-changing-method">Return a Value from a State-Changing Method</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-contracts.html#economic-incentives-and-economic-value">Economic Incentives and Economic Value</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cookbook-providers.html">Providers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cookbook-providers.html#metamask">MetaMask</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-providers.html#testrpc-ganache">TestRPC / Ganache</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-providers.html#custom-provider">Custom Provider</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cookbook-signing.html">Signing Messages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cookbook-signing.html#signing-a-string-message">Signing a String Message</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-signing.html#signing-a-digest-hash">Signing a Digest Hash</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cookbook-testing.html">Testing</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cookbook-testing.html#contract-events">Contract Events</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-testing.html#using-multiple-accounts">Using Multiple Accounts</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cookbook-react.html">React Native</a><ul>
<li class="toctree-l3"><a class="reference internal" href="cookbook-react.html#shims">Shims</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-react.html#wordlists">Wordlists</a></li>
<li class="toctree-l3"><a class="reference internal" href="cookbook-react.html#other-notes">Other Notes</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="migration.html">Migration Guides</a><ul>
<li class="toctree-l2"><a class="reference internal" href="migration.html#migrating-from-web3-to-ethers-v4">Migrating from Web3 to ethers v4</a></li>
<li class="toctree-l2"><a class="reference internal" href="migration.html#migrating-from-ethers-v3-to-ethers-v4">Migrating from ethers v3 to ethers v4</a><ul>
<li class="toctree-l3"><a class="reference internal" href="migration.html#constants">Constants</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#deploying-contracts">Deploying Contracts</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#encrypted-wallets">Encrypted Wallets</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#events">Events</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#fetching-json">Fetching JSON</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#interfaces">Interfaces</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#networks">Networks</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#parsing-transactions">Parsing Transactions</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#custom-signer">Custom Signer</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#default-provider">Default Provider</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#big-number">Big Number</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#jsonrpcprovider">JsonRpcProvider</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#verifying-messages">Verifying Messages</a></li>
<li class="toctree-l3"><a class="reference internal" href="migration.html#waiting-for-transactions">Waiting for Transactions</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="notes.html">Notes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="notes.html#why-can-t-i-just-use-numbers">Why cant I just use numbers?</a></li>
<li class="toctree-l2"><a class="reference internal" href="notes.html#promises">Promises</a></li>
<li class="toctree-l2"><a class="reference internal" href="notes.html#checksum-address">Checksum Address</a></li>
<li class="toctree-l2"><a class="reference internal" href="notes.html#icap-address">ICAP Address</a></li>
<li class="toctree-l2"><a class="reference internal" href="notes.html#supported-platforms">Supported Platforms</a></li>
<li class="toctree-l2"><a class="reference internal" href="notes.html#contributing">Contributing</a></li>
<li class="toctree-l2"><a class="reference internal" href="notes.html#security">Security</a><ul>
<li class="toctree-l3"><a class="reference internal" href="notes.html#the-github-and-npm-package">The GitHub and NPM Package</a></li>
<li class="toctree-l3"><a class="reference internal" href="notes.html#memory-hard-brute-force-encrpyting">Memory Hard Brute-Force Encrpyting</a></li>
<li class="toctree-l3"><a class="reference internal" href="notes.html#responsible-disclosure">Responsible Disclosure</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="testing.html">Testing</a></li>
</ul>
</div>
</div>
<hr class="docutils" />
<div class="section" id="legacy-documentation">
<h2>Legacy Documentation<a class="headerlink" href="#legacy-documentation" title="Permalink to this headline"></a></h2>
<p>For documentation of older versions, we will keep a list here.</p>
<blockquote>
<div><ul class="simple">
<li><a class="reference external" href="/v3/">version 3.0</a></li>
</ul>
</div></blockquote>
<hr class="docutils" />
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="getting-started.html" class="btn btn-neutral float-right" title="Getting Started" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2016, Richard Moore &lt;me@ricmoo.com&gt;
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>