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

@crosstown/sdk

v0.1.4

Published

Crosstown SDK for building ILP-gated Nostr services

Readme

@crosstown/sdk

The building blocks for creating services that participate in the Crosstown network.

What It Does

The SDK provides a framework for processing ILP-paid Nostr events. You register handlers for specific event kinds, and the SDK handles everything else: identity derivation, Schnorr signature verification, payment validation, and handler dispatch.

Incoming ILP packet
  → Size check (1MB max)
    → TOON parse (extract metadata)
      → Signature verification (Schnorr)
        → Payment validation (per-byte pricing)
          → Your handler (business logic)

Install

npm install @crosstown/sdk

Quick Example

import { createNode, fromMnemonic } from '@crosstown/sdk';
import { ConnectorNode } from '@crosstown/connector';

// 1. Create an identity
const identity = fromMnemonic('your twelve word mnemonic phrase here');

// 2. Create an embedded ILP connector
const connector = new ConnectorNode({
  nodeId: 'my-node',
  btpServerPort: 3000,
  environment: 'development',
  deploymentMode: 'embedded',
  peers: [],
  routes: [],
});

// 3. Create a node with the connector
const node = createNode({
  secretKey: identity.secretKey,
  connector,
  basePricePerByte: 10n,
});

// 4. Register handlers for specific event kinds
node.on(1, async (ctx) => {
  const event = ctx.decode();
  console.log(`Received kind:${ctx.kind} from ${ctx.pubkey}`);
  console.log(`Paid: ${ctx.amount} units`);
  return ctx.accept({ eventId: event.id });
});

// 5. Start the node
const result = await node.start();
console.log(`Connected to ${result.peerCount} peers`);

Easier path: If you just want to run a relay, use @crosstown/town — it manages the connector externally so you don't need to embed one. The SDK is for building custom services where you control the full pipeline.

Where It Sits

┌─────────────────────────┐
│  Your Application       │  ← You write this
├─────────────────────────┤
│  @crosstown/sdk         │  ← Identity, verification, pricing, handlers
├─────────────────────────┤
│  @crosstown/core        │  ← Bootstrap, discovery, peering
├─────────────────────────┤
│  ILP Connector          │  ← Payment routing
└─────────────────────────┘

The SDK is the framework layer. You bring handlers; it handles the protocol.

API Overview

| Export | Purpose | |--------|---------| | createNode(config) | Compose a full service node | | fromMnemonic(phrase) | Derive identity from BIP-39 mnemonic | | fromSecretKey(key) | Derive identity from raw secret key | | generateMnemonic() | Generate a new 12-word mnemonic | | HandlerRegistry | Kind-based handler routing | | createHandlerContext() | Build handler context objects | | createVerificationPipeline() | Schnorr signature verifier | | createPricingValidator() | Payment amount validator |

Key Concepts

| Concept | Description | |---------|-------------| | Unified identity | One secp256k1 key produces both a Nostr pubkey and an EVM address | | Handler pattern | ctx.accept() / ctx.reject() — handlers respond, not return | | Self-write bypass | Events from your own pubkey skip pricing | | Dev mode | Skip verification and pricing for testing | | TOON encoding | Events encoded in compact text format, not JSON |

Full Documentation

See the SDK Guide for the complete API reference, handler patterns, verification pipeline details, publishing events, and error handling.

Requirements

  • Node.js >= 20
  • @crosstown/connector >= 1.6.0 (peer dependency, optional)

License

MIT