# Working with PNS

Before you can begin interacting with ENS, you will need to obtain a reference to the ENS registry. How you do this depends on the library you are using.

Example code for the Javascript-based APIs (ensjs, web3.js, ethjs-ens, and ethers.js) here expect that they are being run inside a DApp browser, such as Chrome with [metamask installed](https://metamask.github.io/metamask-docs/Main_Concepts/Getting_Started), which exposes the `ethereum` object.

{% tabs %}
{% tab title="pnsjs" %}

```javascript
import PNS, { getPnsAddress } from '@pnsdomains/pnsjs'

const pns = new PNS({ provider, pnsAddress: getPnsAddress('1028') })
```

{% endtab %}

{% tab title="ethers.js" %}

```javascript
var ethers = require('ethers');
var provider = new ethers.providers.Web3Provider({
  ensAddress: 'TBD'
});
// PNS functionality is provided directly on the core provider object.
```

{% endtab %}

{% tab title="go-pns" %}

```go
import (
  pns "github.com/pulsedomains/go-pns/v2"
  ethereum "github.com/ethereum/go-ethereum"
)

// Can dial up a connection through either IPC or HTTP/HTTPS
client, err := ethereum.Dial("/home/ethereum/.ethereum/geth.ipc")
registry, err := pns.Registry(client)
```

{% endtab %}
{% endtabs %}

Some web3 libraries - e.g., ethers.js, - have integrated support for name resolution. In these libraries, you can pass in an PNS name anywhere you can supply an address, meaning you do not need to interact directly with their PNS APIs unless you want to manually resolve names or do other PNS operations.

If no library is available for your platform, you can instantiate the PNS registry contract directly using the interface definition [here](https://github.com/pulsedomains/pns-contracts/blob/master/contracts/registry/ENS.sol). Addresses for the PNS registry on each supported network are available in the PNS Deployments page.


---

# 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.pulse.domains/dapp-developer-guide/getting-started/working-with-pns.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.
