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

passnode-chain

v0.1.2

Published

PassNode Chain: Core NPM package for PassNode's blockchain-specific functionalities, including on-chain validation for ERC20/NFT-based access and token payment tracking. Extends PassNode with advanced Web3 features. #Web3 #Blockchain #ERC20 #NFT #PassNode

Readme

PassNode Chain — On-Chain Settlement for PassNode

npm package: passnode-onchain

PassNode Chain keeps the familiar PassNode middleware experience while recording purchases and settlements on-chain. Use it when multiple partners need a verifiable ledger or when you want a protocol-supported revenue share.

  • 🔗 Drop-in upgrade – reuse your passnode.rules.json and middleware wiring.
  • 🧾 Immutable settlements – record credits, passes, and pay-per-use receipts on-chain.
  • 💸 Protocol fee support – share a small percentage of every settlement with the PassNode ecosystem.
  • 🛠 Hardhat project included – deploy the ledger contract with the scripts in this repo.

Prerequisites

  • Node.js 18+
  • Hardhat (bundled)
  • RPC provider (Infura, Alchemy, etc.)
  • Service signer key capable of posting transactions

Installation

npm install passnode passnode-onchain

You always install the base passnode package as well—the chain adapter augments it.

Deploy the Ledger Contract

  1. Copy .env.example to .env in passnode-chain/ and fill in:

    • SEPOLIA_RPC_URL (or your preferred network)
    • PRIVATE_KEY (deployment signer)
    • PLATFORM_WALLET, PLATFORM_FEE_BPS, MIN_PLATFORM_FEE_WEI
  2. Install dependencies and compile:

    npm install
    npx hardhat compile
    npm run build:abi
  3. Deploy:

    npx hardhat run scripts/deploy.js --network sepolia

    The script prints the contract address—store it in your service config (e.g. .env).

  4. Register plans via Hardhat console or a script:

    await ledger.registerUsagePlan(ethers.id('usage-basic'), ethers.parseEther('0.05'), 100);
    await ledger.registerPassPlan(ethers.id('weekly-pass'), ethers.parseEther('0.12'), 7);

Wire the Adapter into Your Service

const { createPassNode } = require('passnode');
const { createPassNodeChain } = require('passnode-onchain');

const chain = createPassNodeChain({
  rpcUrl: process.env.RPC_URL,
  signerKey: process.env.SERVICE_SIGNER_KEY,
  network: 'sepolia',
  contracts: {
    ledger: process.env.LEDGER_ADDRESS
  }
});

const gate = createPassNode({
  rulesPath: './passnode.rules.json',
  planType: 'usage',
  chain
});

The adapter exposes middleware parity—req.passnode is still populated with wallet, plan, and balance information. Behind the scenes, purchases are settled against your ledger contract.

Adapter Options

| Option | Required | Description | | --- | --- | --- | | rpcUrl | ✓ | HTTPS endpoint for the target network. | | signerKey | ✓ | Service key used to submit transactions. | | contracts.ledger | ✓ | Address of the deployed PassNodeLedger contract. | | network | ✕ | Named network (e.g. mainnet, sepolia) for presets. | | protocolFeeBps | ✕ | Override default fee in basis points (if negotiated). | | gasMultiplier | ✕ | Multiply estimated gas (default 1.2). | | onSettlement* hooks | ✕ | Handlers for monitoring success/error events. |

Platform Fees

Each settlement sends the greater of price * protocolFeeBps / 10_000 and minPlatformFeeWei to the platform wallet. Configure these constants in the contract during deployment or through owner transactions.

Events & Monitoring

The ledger contract emits events for every purchase and credit consumption. Subscribe via your indexer or use the adapter’s event emitters:

chain.on('settlement:success', (receipt) => {
  console.log('Settled usage on-chain', receipt.transactionHash);
});

chain.on('settlement:error', (error, context) => {
  console.error('Settlement failed', context.txHash, error);
});

Project Structure

passnode-chain/
├── contracts/
│   └── PassNodeLedger.sol
├── scripts/
│   ├── deploy.js
│   └── export-abi.js
├── src/
│   ├── index.js        # Adapter + helpers
│   └── index.d.ts
├── hardhat.config.js
└── README.md

Run npm run build:abi after compiling to copy the ABI into src/abi/ for the adapter.

Roadmap

  • [ ] CLI for registering plans and inspecting balances
  • [ ] ERC-20 currency support
  • [ ] Batch settlement + retries
  • [ ] Security audit and gas optimisations before production release

Further Reading

For questions or feedback, open an issue or reach out via the main PassNode repository. Donations collected through the /coffee page help us ship new features faster.