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

@qevm/purc

v0.1.0

Published

Purity compiler JavaScript bindings

Readme

purc-js

JavaScript bindings for the Purity compiler.

Purity is a fork of Solidity with 32-byte native addressing and other modifications targeting next-generation EVM-compatible virtual machines.

purc-js is derived from solc-js and provides the same API surface, with naming and defaults updated for Purity.

Node.js Usage

npm install purc

Command-Line Usage

If this package is installed globally (npm install -g purc), a command-line tool called purcjs will be available.

purcjs --help

To compile a contract that imports other contracts via relative paths:

purcjs --bin --include-path node_modules/ --base-path . MainContract.sol

Use --base-path to specify the root of your source tree and --include-path for external code directories (e.g. libraries installed with a package manager).

Usage in Projects

There are two ways to use purc:

  1. Through a high-level API giving a uniform interface to all compiler versions
  2. Through a low-level API giving access to all the compiler interfaces

High-level API

The high-level API consists of a single method, compile, which expects the Compiler Standard Input and Output JSON.

It also accepts an optional set of callback functions, including import and smtSolver callbacks.

Example usage without the import callback

var purc = require('purc');

var input = {
  language: 'Purity',
  sources: {
    'test.sol': {
      content: 'pragma purity >=0.1.0; contract C { function f() public pure returns (uint) { return 42; } }'
    }
  },
  settings: {
    outputSelection: {
      '*': {
        '*': ['*']
      }
    }
  }
};

var output = JSON.parse(purc.compile(JSON.stringify(input)));

for (var contractName in output.contracts['test.sol']) {
  console.log(
    contractName +
      ': ' +
      output.contracts['test.sol'][contractName].evm.bytecode.object
  );
}

Note: "Solidity" is also accepted as the language value for backward compatibility.

Example usage with import callback

var purc = require('purc');

var input = {
  language: 'Purity',
  sources: {
    'test.sol': {
      content: 'import "lib.sol"; contract C { function f() public { L.f(); } }'
    }
  },
  settings: {
    outputSelection: {
      '*': {
        '*': ['*']
      }
    }
  }
};

function findImports(path) {
  if (path === 'lib.sol')
    return {
      contents:
        'library L { function f() internal returns (uint) { return 7; } }'
    };
  else return { error: 'File not found' };
}

var output = JSON.parse(
  purc.compile(JSON.stringify(input), { import: findImports })
);

for (var contractName in output.contracts['test.sol']) {
  console.log(
    contractName +
      ': ' +
      output.contracts['test.sol'][contractName].evm.bytecode.object
  );
}

Low-level API

The low-level API is available for compatibility with older compiler binaries:

  • purc.lowlevel.compileSingle
  • purc.lowlevel.compileMulti
  • purc.lowlevel.compileCallback
  • purc.lowlevel.compileStandard

Note: These low-level functions remain for compatibility reasons but have been superseded by compile().

Loading a Custom Compiler Binary

You can load the compiler binary manually and use setupMethods to create the wrapper:

var purc = require('purc');
var compiler = purc.setupMethods(require('/path/to/purjson.js'));

Linking Bytecode

The linker module (require('purc/linker')) offers helpers for linking library addresses into bytecode:

var linker = require('purc/linker');

bytecode = linker.linkBytecode(bytecode, { 'lib.sol:MyLibrary': '0x1234...' });

You can also find link references in unlinked bytecode:

var linkReferences = linker.findLinkReferences(bytecode);

Updating the ABI

The abi module (require('purc/abi')) can translate ABI output from older compiler versions to the latest standard:

var abi = require('purc/abi');
var outputABI = abi.update('0.3.6', inputABI);

Formatting Assembly Output

var translate = require('purc/translate');
var output = translate.prettyPrintLegacyAssemblyJSON(assemblyJSON, sourceCode);

Key Differences from solc-js

  • Default language in Standard JSON is "Purity" (though "Solidity" is accepted for backward compatibility)
  • Package name is purc instead of solc
  • CLI binary is purcjs instead of solcjs
  • Version numbering starts at 0.1.0

Migration from solc-js

  1. Replace require('solc') with require('purc')
  2. Update language: 'Solidity' to language: 'Purity' in Standard JSON inputs (optional — both are accepted)
  3. Replace solcjs CLI commands with purcjs
  4. Update pragma solidity to pragma purity in .sol source files (optional — both are accepted)

Browser Usage

The only supported way to use purc in a web browser is through a web worker:

import wrapper from 'purc/wrapper';

self.addEventListener('message', () => {
  const compiler = wrapper(self.Module);
  self.postMessage({
    version: compiler.version()
  });
}, false);

License

MIT — see LICENSE.

This project is derived from solc-js, originally created by the Ethereum community.