CLI tool for decoding Phantasma transactions (Carbon + VM) and hex-encoded event data.
- 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.
- Node.js with ESM support (Node 18+ recommended).
npm install
npm run buildphadec <txHex>
phadec tx --hex <txHex>
phadec tx --hash <txHash> --rpc <url>
phadec event --hex <eventHex> [--kind <eventKind>]--format <json|pretty>Output format (default:pretty).--rpc <url>RPC endpoint for--hash(use JSON-RPC, e.g.https://pharpc1.phantasma.info/rpc).--resolveFetch 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).--verboseEnable SDK logging.--kind <eventKind>Event kind hint for hex-encoded (classic) events (event mode only).--helpShow help.
Decode a tx hash from RPC:
phadec tx --hash 155422A6882C3342933521DDC1A335292BF6448DBD489ED0BE21CFC74AFBA52A \
--rpc https://pharpc1.phantasma.info/rpc \
--format json \
--vm-detail calls \
--carbon-detail callDecode a local tx hex (shorthand):
phadec 0xDEADBEEF...Decode hex-encoded event data (classic event):
phadec event --hex 0xAABBCC... --kind TokenMintJSON output is stable and machine-friendly:
{
"source": "tx-hash",
"input": "155422A6...",
"rpc": { "url": "https://...", "method": "getTransaction" },
"carbon": { "...": "..." },
"vm": { "...": "..." },
"event": { "...": "..." },
"warnings": [],
"errors": []
}Notes:
- Field
carbon.callis the human-readable call decode (module/method + args). - Field
carbon.msgis the raw payload decode (moduleId/methodId + args hex). - Use
--carbon-detailto show one or both. - Event hex decoding applies to classic events; newer structured events do not need hex decoding.
- If
--kindis omitted in event mode, the tool returns raw hex with a warning.
This repo ships a justfile:
justlist commandsjust bbuildjust r <args>rundist/cli/index.jsjust d <args>run in dev mode (tsx)
--resolvedepends ongetContractsRPC output. If the RPC returns an empty set, VM calls remain unresolved.- Unknown methods or argument types fall back to raw hex (no guessing).