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

@pulsartronic/entropy

v1.0.10

Published

Commit-reveal entropy definitions and interfaces for Solidity

Readme

ABC Entropy

Verifiable, tamper-proof randomness for your smart contracts.

ABC Entropy is a lightweight commit-reveal randomness oracle designed to deliver verifiable, on-chain random numbers to your dApp with minimal friction.


Table of contents

How ABC entropy works

This is a commit-reveal scheme built on three components, each contributing part of the final random number:

| | Component | Role | |---|---|---| | A | Your dapp users | Your frontend provides the user's entropy contribution. | | B | Generator (us) | We lock our entropy contribution behind a hash beforehand, allowing post-reveal verification. | | C | Sequencer (the network) | It introduces additional entropy so that no party, including us, can manipulate the outcome. |

As long as we aren't running the sequencer, the system remains tamper-proof, even against us. Read Security model.

Getting started: consuming entropy from a contract

Below is an example consumer contract implementing IEntropyConsumer (see ABCEntropyExample.sol for the full source code and detailed inline comments):

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@pulsartronic/entropy/Definitions.sol";

struct UserState {
    EntropyRequest entropy_request;
    HashRecord hash_record;
}

contract ABCEntropyExample is IEntropyConsumer {
    IABCEntropy public abc_entropy;
    mapping(address => UserState) public user_state_map;
    event RandomEvent(address user, bytes32 random_number);

    constructor() {
        // Arbitrum Sepolia example address.
        abc_entropy = IABCEntropy(0x29A269640D240B4d08e74b2564832aEcA00484FC);
    }

    function get_entropy(bytes32 user_entropy) external payable {
        bytes memory a_seed = abi.encodePacked(user_entropy, msg.sender);
        bytes32 entropy_a = keccak256(a_seed);
        UserState storage user_state = user_state_map[msg.sender];
        bytes32 callback_id = bytes32(uint256(uint160(msg.sender)));
        uint256 callback_gas_limit = 50000;
        uint256 fee = abc_entropy.get_fee(callback_gas_limit);

        // Request a randoom number.
        user_state.entropy_request = abc_entropy.get{value: fee}(
            callback_id,
            callback_gas_limit,
            user_state.hash_record.id,
            entropy_a
        );
    }

    function entropy_callback(
        bytes32 callback_id, EntropyResponse calldata entropy_response
    ) external payable {
        require(msg.sender == address(abc_entropy), "INVALID_PROVIDER");
        address user = address(uint160(uint256(callback_id)));
        UserState storage user_state = user_state_map[user];

        // Get the requested random number.
        Verified memory verified = abc_entropy.verify(
            user_state.hash_record.hash,
            user_state.entropy_request,
            entropy_response
        );

        // Emit an event with the generated random number.
        user_state.hash_record = verified.next_hash_record;
        emit RandomEvent(user, verified.random_number);
    }
}

Quick Test Guide in Remix

  1. Open the Contract: Click Open in Remix.
  2. Compile: Go to the Solidity Compiler tab on the left, select version 0.8.20 (or higher), and click Compile ABCEntropyExample.sol.
  3. Deploy & Test on Arbitrum Sepolia:
    • Switch your Web3 wallet (MetaMask) to Arbitrum Sepolia.
    • Go to the Deploy & Run Transactions tab.
    • Set Environment to Injected Provider - MetaMask.
    • The contract is pre-configured with the testnet oracle address (0x29A269640D240B4d08e74b2564832aEcA00484FC).
    • Call get_entropy passing some test bytes32 data (e.g., 0x1234...) and attach the required ETH fee (check get_fee first if needed)!

Features

  • Verifiable: every number ships with a proof that anyone can check on-chain.
  • Fast: results arrive in your callback within a few seconds on supported chains.
  • Predictable cost: the fee for a request is readable from the contract with get_fee(callback_gas_limit).
  • Simple to integrate: one request function, one callback. No off-chain infrastructure to run.

Supported networks

Mainnets

| Network | Contract | |---|---| | Arbitrum | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | | Base | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | | Optimism | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | | Binance | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | | Monad | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 |

Testnets

| Network | Contract | |---|---| | Arbitrum | 0x29A269640D240B4d08e74b2564832aEcA00484FC | | Base | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | | Optimism | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 | | Binance | 0x15f31ab7371C02E2a505f569Eea9057AA75CaBAB | | Monad | 0x16C208E0e2B8Df76f11A7085B3e306A27455F9F9 |

Security model

ABC Entropy relies on a cryptographically secure commit-reveal architecture designed to prevent any single party from predicting, altering, or rigging the final outcome. The resulting random number is derived by combining three independent entropy sources:

random_number = keccak256(A, B, C)

Entropy A is the user contribution (a seed generated by your front-end dApp).
Entropy B is our contribution, which we first publish as "hash(B)"
Entropy C is the block hash in which your dApp sends A requesting B (It places A before C).

why

Mitigating external threats is "easy". The core challenge in building a verifiable random number oracle is preventing ourselves from acting as a privileged user within your dApp.

This threat is neutralized through Entropy C:

  • Even though we could know Entropies A and B in advance (by acting as a user), we couldn't know C before we commit to A and B, which prevents any pre-calculation.
  • Something similar would happen to the Sequencer where it could know Entropies A and C in advance, but not B.

Trust Assumptions

This security model remains fully tamper-proof as long as the service provider (us) does not control the entity generating Entropy C (the sequencer).

We mitigate this risk by letting you choose your preferred sequencer from a (growing) list, making it unlikely that we control all available options.

License

MIT © 2026 pulsartronic