# Connect to CORE ID using ethers.js

Core id is compatible with ens, you can use ethers.js to connect to CORE ID

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

const network = {
  name: "CORE",
  chainId: 1116,
  ensAddress: "0x00000000003dB7663112d1e121c6D2bb8220F671"
};  

//const provider = new ethers.providers.JsonRpcProvider("https://rpc.coredao.org/", network)
const provider = new ethers.providers.Web3Provider(window.ethereum, network)  

await provider.getBalance("coreid.core");
// { BigNumber: "26959293642897667667" }

await provider.resolveName("coreid.core");
// '0x9826a59Aa17C36e88AA2F6dC367772381f034401'  

await provider.lookupAddress("0x9826a59Aa17C36e88AA2F6dC367772381f034401");
// 'coreid.core'
// Requires primary name to be set
```

For more information on how to use it, you can check out the [ethers.js docs](https://docs.ethers.io/v5/api/providers/provider/#Provider--ens-methods)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coreid.org/connect-to-core-id-using-ethers.js.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
