npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bitsocial/bso-resolver

v0.2.0

Published

Resolve `.bso` names to their `bitsocial` TXT records from the [BSIP-13](https://bsips.bitsocial.net/bsip-13#resolving-bso-names) registry.

Readme

@bitsocial/bso-resolver

Resolve .bso names to their bitsocial TXT records from the BSIP-13 registry.

The registry is 0x85085e9074542F7608D6B54F1151448f0f54b011 on Ethereum mainnet, deployed at block 26527619. The address is fixed in the package and cannot be configured, so provider must be an Ethereum mainnet RPC.

Install

npm install @bitsocial/bso-resolver

With pkc-js, use @pkcprotocol/pkc-js 0.0.165 or newer (it passes the log that resolve() and destroy() require). Without pkc-js, also install the logger:

npm install @pkcprotocol/pkc-logger

With pkc-js

If you're wiring this into pkc-js, create resolver instances per provider:

import Pkc from "@pkcprotocol/pkc-js";
import { BsoResolver } from "@bitsocial/bso-resolver";

const chainProviderUrls = [
  "https://eth.drpc.org", // see "Recommended chain providers" below
  "https://mainnet.infura.io/v3/YOUR_KEY",
  "wss://mainnet.infura.io/ws/v3/YOUR_KEY",
];

const resolvers = chainProviderUrls.map((url) => new BsoResolver({
  key: `bso-${new URL(url).origin}`,
  provider: url,
}));

const pkc = await Pkc({ nameResolvers: resolvers });

// Access a resolver instance later, it should not be needed in general:
const resolver = pkc.clients.nameResolvers["bso-https://eth.drpc.org"].resolver;

// Later, when shutting down:
await pkc.destroy(); // should cascade to resolver.destroy() for each resolver

Usage

resolve() and destroy() require a log. pkc-js passes its own; standalone, create one with @pkcprotocol/pkc-logger:

import { BsoResolver } from "@bitsocial/bso-resolver";
import Logger from "@pkcprotocol/pkc-logger";

const log = Logger({ namespace: "my-app:bso" });

// Create a resolver instance
const resolver = new BsoResolver({ key: "bso-viem", provider: "viem" });

// Check if a name can be resolved
resolver.canResolve({ name: "example.bso" }); // true
resolver.canResolve({ name: "example.com" }); // false

// Resolve a name
const record = await resolver.resolve({ name: "example.bso", log });
// BsoResolveResult | undefined

// Resolve using a custom RPC URL
const resolver2 = new BsoResolver({
  key: "bso-infura",
  provider: "https://mainnet.infura.io/v3/YOUR_KEY",
});

// Optional cancellation with AbortController
const controller = new AbortController();
const record2 = await resolver.resolve({
  name: "example.bso",
  abortSignal: controller.signal,
  log,
});

// Optional: pin resolution to a historical block for deterministic reads
// (must be at or after 26527619, the block the registry was deployed at, and the
// provider must keep state for that block: see "Recommended chain providers")
const record3 = await resolver.resolve({
  name: "example.bso",
  blockNumber: 26527641n,
  log,
});

// Clean up when done
await resolver.destroy({ log });
await resolver2.destroy({ log });

Recommended chain providers

The following free public mainnet RPCs are the recommended defaults. Each was checked against the registry on 2026-11-30 with the live suite (BSO_LIVE_PROVIDER=<url> npm run test:live):

| Provider | Resolve at head | Burst in one eth_call | Resolve with blockNumber | | --- | --- | --- | --- | | https://eth.drpc.org | yes | yes | yes | | https://rpc.mevblocker.io | yes | yes | yes | | https://eth-pokt.nodies.app | yes | yes | yes | | https://ethereum.publicnode.com | yes | yes | no | | https://ethereum-rpc.publicnode.com | yes | yes | no | | https://1rpc.io/eth | yes | yes | unreliable |

A resolve with blockNumber needs a provider that keeps the chain state at that block. The two publicnode endpoints keep only the most recent blocks: a read about 300 blocks (one hour) behind head was refused, and the resolve threw. https://1rpc.io/eth answered some of those reads and refused others. Use one of the first three providers for blockNumber resolves.

provider: "viem" uses the default RPC of the installed viem version, https://ethereum.reth.rs/rpc in viem 2.58.8. It passed the same check, including the blockNumber resolves.

API

new BsoResolver({ key, provider, batch? })

Creates a resolver instance with a viem client. The client is lazily initialized on the first resolve() call.

  • key - Unique identifier for this resolver instance (e.g. `bso-${new URL(chainProviderUrl).origin}` — origin keeps the scheme so https://… and wss://… to the same host don't collide)
  • provider - Either "viem" for the default public transport, or an HTTP(S) RPC URL or a Websocket RPC URL
  • batch (optional) - Multicall batching of concurrent resolves. Defaults to { wait: 200, batchSize: 100_000 }. Pass false to disable, or an object to tune (see Batching)
const resolver = new BsoResolver({
  key: "bso-viem",
  provider: "viem",
});

Caching is not handled here. This module is a thin network wrapper. Callers (such as pkc-js) are responsible for caching resolution results. Every call to resolve() makes a fresh RPC request.

resolver.resolve({ name, log, blockNumber?, abortSignal? }): Promise<BsoResolveResult | undefined>

Resolves a .bso name by reading its bitsocial TXT record from the BSIP-13 registry: the name is normalized, hashed with the .bso suffix kept (node = namehash(name)), and looked up with the registry's text(node, "bitsocial"). A name without a TLD is treated as .bso; any other TLD throws.

  • name - The domain name to resolve (e.g. "example.bso")
  • log - A Logger from @pkcprotocol/pkc-logger. pkc-js passes one tagged with the name being resolved. A failed resolve is logged at trace level. Logs and error.details.provider show only the provider's host, never the full URL (which often carries an API key). Throws TypeError if missing.
  • blockNumber (optional) - bigint block number to pin the text-record read to a canonical historical block. When omitted, resolves at head ('latest'). Useful when independent verifiers must read the same registry state deterministically. Must be >= 26527619, the block the registry was deployed at. An older block reads a chain state where the registry does not exist, so the resolve throws instead of returning undefined. The provider must also keep state for that block: some free RPCs only serve recent blocks and reject the request, which also throws (see Recommended chain providers).
  • abortSignal (optional) - Abort signal used to cancel an in-flight resolve

Returns a BsoResolveResult, or undefined if not found.

undefined specifically means the lookup completed successfully but no bitsocial TXT record exists for name — the name is unregistered, expired or in its grace period, or it is registered but has no bitsocial text record set. Network/RPC failures and malformed TXT records throw rather than return undefined, so callers that need to distinguish "not found" from "lookup failed" should both try/catch and check for result === undefined.

TXT value format: <ipnsPublicKey>[;key=value;other=value] -> { publicKey, key, other }

Return type: BsoResolveResult
interface BsoResolveResult {
  /** Required. The IPNS public key from the first segment of the
   *  `bitsocial` TXT record. */
  publicKey: string;
  /** Custom metadata from key=value segments in the TXT record.
   *  Reserved key: publicKey. */
  [key: string]: string;
}

Note: Each bitsocial TXT record value points to a single identity — either a community or an author. A future revision of the format may allow both in the same record.

resolver.canResolve({ name }): boolean

Returns true if the name ends with .bso (case-insensitive).

resolver.destroy({ log }): Promise<void>

Aborts in-flight resolves, closes the WebSocket connection (if any), and releases the viem client. Idempotent — safe to call multiple times.

  • log - A Logger from @pkcprotocol/pkc-logger (pkc-js passes one). A failure to close the WebSocket is logged at error level. Throws TypeError if missing.

After destroy(), calling resolve() will throw.

Batching

Concurrent resolve() calls on the same resolver instance are batched into a single Multicall3.aggregate3 eth_call (via viem's client-level multicall batching). Public RPC endpoints rate-limit exactly the burst pattern that name resolution produces (many small eth_calls in a short window), so batching reduces the possibility of RPC throttling — on a production cold start it cut 63 RPC requests down to 6 with identical results.

The default is { wait: 200, batchSize: 100_000 }:

  • wait - Milliseconds to wait for more concurrent resolves before flushing the batch. Each resolve pays up to this much extra latency, which is acceptable because name resolution is a background path whose results are cached by the caller. Same semantics as viem's batch.multicall.wait.
  • batchSize - Maximum calldata size in bytes before a batch is split. Each resolve is ~500-600 bytes, so viem's default of 1024 would split after ~2 calls; the large default effectively means "never split". Same semantics as viem's batch.multicall.batchSize.
// Default: batch concurrent resolves within a 200ms window
new BsoResolver({ key, provider });

// Only coalesce resolves issued in the same tick (no added latency)
new BsoResolver({ key, provider, batch: { wait: 0 } });

// Disable batching: every resolve is an individual eth_call immediately
new BsoResolver({ key, provider, batch: false });

Notes:

  • Resolves pinned to a blockNumber only batch with other resolves at the same block; resolves at different blocks are never merged.
  • Each call in the batch is independent (allowFailure: true) — one failing name does not poison the batch.
  • If the batched RPC call itself fails, all names in that batch fail together; callers like pkc-js fall back to the next provider per name, where they re-batch.

Caching

This module does not cache. Every call to resolve() makes a fresh RPC request to the configured provider. Caching is the consumer's responsibility — pkc-js (the primary consumer) maintains a persistent name-resolution cache with per-call freshness control and is the right layer for that policy.

Testing

Run the full test suite with:

npm test

Install the Playwright browser binaries used by the browser suite with:

npm run test:browser:install

Run the live suite, which reads the deployed registry through public RPC endpoints, with:

npm run test:live

It is separate from npm test because it depends on the network; CI runs it as its own job.

Run the browser suite on Playwright's Chromium and Firefox engines with:

npm run test:browser

On Linux CI or fresh machines, Playwright may also require:

npx playwright install --with-deps chromium firefox

Entry Points

The package publishes separate Node and browser entry points.

  • Browser-aware bundlers should resolve the root package import to the browser build automatically.
  • Explicit subpaths are also available:
    • @bitsocial/bso-resolver/browser
    • @bitsocial/bso-resolver/node

Publishing to npm

Publishing is automated via .github/workflows/publish.yml. When release-it creates a GitHub release (triggered by CI on main), the publish workflow builds and publishes to npm with --provenance.

First-time setup

  1. Create the @bitsocial organization on npmjs.com
  2. Do an initial manual publish: npm login && npm run build && npm publish --access public
  3. On npmjs.com, go to the package settings → Publishing access → Configure trusted publishing
  4. Add: owner=bitsocialnet, repo=bso-resolver, workflow=publish.yml

License

GPL-2.0-only