> For the complete documentation index, see [llms.txt](https://basename.gitbook.io/bns-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://basename.gitbook.io/bns-docs/developer-guide/ethers.md).

# Ethers

## Installation <a href="#installation" id="installation"></a>

```
npm i ethers
```

## Setup provider with BNS registry <a href="#provider-with-bns-registry" id="provider-with-bns-registry"></a>

```javascript
import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider("https://mainnet.base.org", {
  name: "Base Mainnet",
  chainId: 8453,
  ensAddress: "0xeCBaE6E54bAA669005b93342E5650d5886D54fc7",
});
```

{% hint style="info" %}
**0xeCBaE6E54bAA669005b93342E5650d5886D54fc7** is BNS Registry contract on Base mainnet.
{% endhint %}

## Resolve .base name to address <a href="#domain-resolution" id="domain-resolution"></a>

```javascript
provider.resolveName("hello.base");
```

## Resolve address to .base name <a href="#reverse-resolution" id="reverse-resolution"></a>

```javascript
provider.lookupAddress("0x4fb3f133951bF1B2d52fF6CEab2c703fbB6E98cC");
```
