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

pha-decode

v0.1.1

Published

Phantasma transaction and event decoder CLI

Readme

pha-decode

CLI tool for decoding Phantasma transactions (Carbon + VM) and hex-encoded event data.

Features

  • Decode Carbon transactions (Call, Call_Multi, mint/burn/transfer).
  • Decode VM transactions (script disassembly + method calls).
  • Decode hex-encoded event data for classic events.
  • JSON or pretty output.
  • Optional ABI resolution from files or RPC.

Requirements

  • Node.js with ESM support (Node 18+ recommended).

Installation

# install globally (recommended for CLI usage)
npm i -g pha-decode

# or run once via npx
npx pha-decode --help

# local dev install
npm install
npm run build

Usage

pha-decode <txHex>
pha-decode tx --hex <txHex>
pha-decode tx --hash <txHash> --rpc <url>
pha-decode event --hex <eventHex> [--kind <eventKind>]

Options

  • --format <json|pretty> Output format (default: pretty).
  • --rpc <url> RPC endpoint for --hash (use JSON-RPC, e.g. https://pharpc1.phantasma.info/rpc).
  • --resolve Fetch contracts from RPC and merge ABI for VM call decoding.
  • --abi <path> ABI JSON file or directory (merged with built-ins).
  • --vm-detail <all|calls|ops|none> Control VM output detail (default: all).
  • --carbon-detail <all|call|msg|none> Control Carbon output detail (default: call).
  • --protocol <number> Protocol version for interop ABI selection (default: latest known).
  • --verbose Enable SDK logging.
  • --kind <eventKind> Event kind hint for hex-encoded (classic) events (event mode only).
  • --help Show help.

Examples

Decode a tx hash from RPC:

pha-decode tx --hash 155422A6882C3342933521DDC1A335292BF6448DBD489ED0BE21CFC74AFBA52A \
  --rpc https://pharpc1.phantasma.info/rpc \
  --format json \
  --vm-detail calls \
  --carbon-detail call

Decode a local tx hex (shorthand):

pha-decode 0xDEADBEEF...

Decode hex-encoded event data (classic event):

pha-decode event --hex 0xAABBCC... --kind TokenMint

Output

JSON output is stable and machine-friendly:

{
  "source": "tx-hash",
  "input": "155422A6...",
  "rpc": { "url": "https://...", "method": "getTransaction" },
  "carbon": { "...": "..." },
  "vm": { "...": "..." },
  "event": { "...": "..." },
  "warnings": [],
  "errors": []
}

Notes:

  • Field carbon.call is the human-readable call decode (module/method + args).
  • Field carbon.msg is the raw payload decode (moduleId/methodId + args hex).
  • Use --carbon-detail to show one or both.
  • Event hex decoding applies to classic events; newer structured events do not need hex decoding.
  • If --kind is omitted in event mode, the tool returns raw hex with a warning.

Dev shortcuts

This repo ships a justfile:

  • just list commands
  • just b build
  • just r <args> run dist/cli/index.js
  • just d <args> run in dev mode (tsx)

Limitations

  • --resolve depends on getContracts RPC output. If the RPC returns an empty set, VM calls remain unresolved.
  • Unknown methods or argument types fall back to raw hex (no guessing).