# @blockcore/dns

> DNS Provider package to query and resolve dynamic and decentralized DNS entries

Latest version **0.0.13** (published 2024-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @blockcore/dns
pnpm add @blockcore/dns
yarn add @blockcore/dns
bun add @blockcore/dns
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.13 |
| Published | 2024-04-22 |
| First published | 2022-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18.* |
| Dependencies | 0 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Blockcore |
| Maintainers | sondreb |

## Links

- npm: https://www.npmjs.com/package/@blockcore/dns
- Repository: https://github.com/block-core/blockcore-dns-js
- Homepage: https://github.com/block-core/blockcore-dns-js#readme
- Issues: https://github.com/block-core/blockcore-dns-js/issues
- npm.io page: https://npm.io/package/@blockcore/dns

## Recent versions

- 0.0.13 (latest) — 2024-04-22
- 0.0.12 — 2023-09-29
- 0.0.11 — 2022-11-24
- 0.0.10 — 2022-11-24
- 0.0.9 — 2022-09-18
- 0.0.8 — 2022-07-23
- 0.0.7 — 2022-07-23
- 0.0.6 — 2022-07-23
- 0.0.5 — 2022-07-22
- 0.0.4 — 2022-07-20
- 0.0.3 — 2022-07-20
- 0.0.2 — 2022-07-20
- 0.0.1 — 2022-07-20

## README

<p align="center">
  <p align="center">
    <img src="https://avatars3.githubusercontent.com/u/53176002?s=200&v=4" height="100" alt="Blockcore" />
  </p>
  <h3 align="center">
    Blockcore DNS Provider
  </h3>
  <p align="center">
    DNS Provider package to query and resolve dynamic and decentralized DNS entries
  </p>
  <p align="center">
      <a href="https://github.com/block-core/blockcore-dns-js/actions/workflows/build.yml"><img src="https://github.com/block-core/blockcore-dns-js/actions/workflows/build.yml/badge.svg" /></a>   <a href="https://github.com/block-core/blockcore-dns-js/actions/workflows/release.yml"><img src="https://github.com/block-core/blockcore-dns-js/actions/workflows/release.yml/badge.svg" /></a>
  </p>
  <p align="center"><em>Work-in-Progress - use with caution!</em></p>
</p>

# Blockcore DNS Provider

## Install

```sh
npm install @blockcore/dns
```

**Warning:** This package is native [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and does not provide a CommonJS export. If your project uses CommonJS, you'll have to [convert to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) or use the [dynamic `import()`](https://v8.dev/features/dynamic-import) function.


## Usage

```ts
import { BlockcoreDns } from '@blockcore/dns';

let dns = new BlockcoreDns();

// This relies on a central nameserver registry:
await dns.load();
let indexers = await dns.getServicesByType('Indexer');
```

Get servers from known nameservers:

```ts
import { BlockcoreDns } from '@blockcore/dns';

let dns = new BlockcoreDns();

// This relies on fixed set of nameservers:
await dns.load({ url: 'https://ns.blockcore.net', contact: 'post@blockcore.net' });
let indexers = await dns.getServicesByType('Indexer');
```

You can create an load the nameservers using this static function:

```ts
let dnsServers = await BlockcoreDns.getDnsServers();
dns.setActiveServer(dnsServers[0].url);

await dns.api.getServicesByType('Indexer');
await dns.api.getServicesByNetwork('CITY');
await dns.api.getServicesByTypeAndNetwork('Indexer', 'CITY');
await dns.api.getExternalIP();
```

---
_Source: https://npm.io/package/@blockcore/dns · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
