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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@babbage/tokenator

v1.0.2

Published

The ultimate tool for creating and transferring tokens

Readme

Tokenator

Tokenator is a flexible and lightweight TypeScript library for creating, updating, redeeming, and querying simple text-based tokens on the Bitcoin SV (BSV) blockchain.

Tokens are embedded using PushDrop scripts, can optionally be encrypted using the BSV SDK's BRC-2 encryption system, and support either local or overlay tracking modes.


Features

  • Optional encryption and decryption of token data
  • Local token tracking via wallet baskets
  • Overlay tracking via broadcast and lookup services
  • Simple API for creating, updating, redeeming, and listing tokens
  • Built on @bsv/sdk

Installation

npm install @bsv/sdk

Then copy Tokenator.ts into your project.


Usage

Initialization

import { WalletClient } from '@bsv/sdk'
import { Tokenator } from './Tokenator'

const wallet = new WalletClient()

const tokenator = new Tokenator({
  protocol: [2, 'MyApp'],
  keyID: '1',
  tracking: 'local',          // or 'overlay'
  basket: 'my-basket',        // required for local mode
  encryptByDefault: true      // optional
}, wallet)

Create Token

await tokenator.createToken('My secure message')

This creates and broadcasts a token using the configured tracking mode (local basket or overlay topic). If encryptByDefault is set, the message will be encrypted automatically.


List Tokens

const tokens = await tokenator.listTokens()
// tokens: Array<{ message, token: { txid, outputIndex, lockingScript, satoshis, beef? } }>

By default:

  • Includes beef, which is required to redeem or update tokens
  • Decrypts messages if in local mode and encryption was used

Update Token

await tokenator.updateToken(tokens[0].token, 'Updated message')

Updates the given token output with a new message. Encryption is applied based on constructor settings (or can be overridden per call).


Redeem Token

await tokenator.redeemToken(tokens[0].token)

Spends (removes) the token by creating and signing a transaction that consumes it.


Tracking Modes

| Mode | Description | |----------|-----------------------------------------------------------------------------| | local | Tokens are stored in a wallet basket. No overlay broadcast is performed. | | overlay| Tokens are broadcast to a topic and queryable via a lookup overlay service.|


API Reference

Constructor

new Tokenator(options: TokenatorOptions, wallet?: WalletInterface)

TokenatorOptions

| Name | Type | Description | |-------------------|----------------------|--------------------------------------------| | protocol | [number, string] | Protocol ID and name | | keyId | string | Identifier for key derivation | | tracking | 'local' | 'overlay' | Token tracking mode | | basket | string? | Required if using local mode | | overlayTopic | string? | Topic name for overlay broadcast | | overlayService | string? | Lookup service name for overlay query | | encryptByDefault| boolean? | Automatically encrypt all messages |


Example: Public Notes with Overlay

const notes = new Tokenator({
  protocol: [99, 'Notes'],
  keyId: '1',
  tracking: 'overlay',
  overlayTopic: 'public_notes',
  overlayService: 'ls_notes'
}, wallet)

await notes.createToken('Hello, world!')
const results = await notes.listTokens({ limit: 5 })
console.log(results.map(n => n.message))

License

This library is licensed under the Open BSV License.