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

evm-selector-extractor

v0.1.0

Published

Lightweight Ethereum Virtual Machine (EVM) bytecode selector extractor (Node + Browser, zero dependencies)

Readme

evm-selector-extractor

npm version npm downloads GitHub

Lightweight Ethereum Virtual Machine (EVM) bytecode selector extractor.

  • Zero dependencies
  • Works in Node.js and Browser
  • ESM + CommonJS compatible
  • Extracts PUSH4 function selectors directly from raw bytecode

Installation

npm install evm-selector-extractor

Usage (Node.js + ethers v6)

This example:

  • Creates a provider
  • Fetches bytecode of PEPE (ERC-20)
  • Extracts function selectors
  • Prints them to console
import { JsonRpcProvider } from "ethers";
import { EVM } from "evm-selector-extractor";

const provider = new JsonRpcProvider("https://ethereum-rpc.publicnode.com");

const address = "0x6982508145454ce325ddbe47a25d4ec3d2311933"; // PEPE ERC-20

async function main() {
    const bytecode = await provider.getCode(address);

    const evm = new EVM(bytecode);
    const selectors = evm.getSelectors();

    console.log("Extracted selectors:");
    console.log(selectors);
}

main();

Usage (CommonJS)

const { JsonRpcProvider } = require("ethers");
const { EVM } = require("evm-selector-extractor");

const provider = new JsonRpcProvider("https://ethereum-rpc.publicnode.com");

async function main() {
    const bytecode = await provider.getCode(
        "0x6982508145454ce325ddbe47a25d4ec3d2311933"
    );

    const evm = new EVM(bytecode);
    console.log(evm.getSelectors());
}

main();

Browser Example

import { EVM } from "evm-selector-extractor";

const bytecode = "0x63a9059cbb...";
const evm = new EVM(bytecode);

console.log(evm.getSelectors());

No Node.js APIs are used internally. The library relies only on Uint8Array.


API

new EVM(bytecode: string)

Creates an EVM bytecode parser instance.

  • Accepts hex string with or without 0x
  • Throws if invalid hex

getOpcodes(): EvmOpcode[]

Returns parsed opcode list.

interface EvmOpcode {
    name: string;
    opcode: number;
    pc: number;
    pushData?: Uint8Array;
}

getSelectors(): string[]

Extracts unique PUSH4 selectors.

Returns:

string[] // e.g. ["0xa9059cbb", "0x095ea7b3"]

Hidden internal selectors are automatically filtered.


Why not use ethereum.js / ethers ABI parsing?

This library:

  • Does not require ABI
  • Does not depend on heavy EVM stacks
  • Works directly on raw bytecode
  • Designed for lightweight analysis tools and browser environments

Build

npm run build

Repository

https://github.com/snipe-dev/evm-selector-extractor