
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@ton/retracer-core
Advanced tools
retracer-core is a core library for deep analysis, emulation, and tracing transactions on the TON blockchain. The library allows you to reproduce transaction execution in a local sandbox, obtain detailed reports on computation, actions, and money flow, and collect low-level information about blocks, accounts, and messages.
yarn add @ton/retracer-core
# or
npm install @ton/retracer-core
import {RETRACE_MAINNET_NETWORK, retrace} from "@ton/retracer-core"
// Example: trace a transaction by its hash
const result = await retrace(RETRACE_MAINNET_NETWORK, "YOUR_TX_HASH")
console.log(result)
import {
RETRACE_MAINNET_NETWORK,
RETRACE_TESTNET_NETWORK,
findBaseTxByHash,
retrace,
retraceBaseTx,
} from "@ton/retracer-core"
import type {RetraceNetworkConfig} from "@ton/retracer-core"
/**
* @param network - Toncenter-compatible network configuration
* @param txHash - hex transaction hash
* @returns Detailed execution report (TraceResult)
*/
const result1 = await retrace(RETRACE_MAINNET_NETWORK, txHash)
const result2 = await retrace(RETRACE_TESTNET_NETWORK, txHash)
const customNetwork: RetraceNetworkConfig = {
testnet: true,
v2BaseUrl: "https://example.com/api/v2",
v3BaseUrl: "https://example.com/api/v3",
toncenterApiKey: "optional-api-key",
}
const result3 = await retrace(customNetwork, txHash)
/**
* Retrace a transaction described by base transaction information.
* Base transaction info should be resolved through the same network first,
* because it carries the Toncenter v3 shard block reference.
*/
const baseTx = await findBaseTxByHash(RETRACE_MAINNET_NETWORK, txHash)
if (baseTx === undefined) {
throw new Error("Transaction not found")
}
const result4 = await retraceBaseTx(RETRACE_MAINNET_NETWORK, baseTx)
Use retraceTrace when a single transaction is not enough and you need the result of every
transaction in its complete message trace. The input may be the hash of any transaction in the
trace; rootTxHash identifies the actual trace root and can therefore differ from the input.
import {RETRACE_MAINNET_NETWORK, retraceTrace} from "@ton/retracer-core"
const replay = await retraceTrace(RETRACE_MAINNET_NETWORK, txHash)
if (!replay.stateUpdateHashOk) {
throw new Error("At least one transaction diverged from the on-chain state update")
}
const rootTransaction = replay.transactions[replay.rootTxHash]
console.log("root", rootTransaction)
for (const [hash, transaction] of Object.entries(replay.transactions)) {
console.log(hash, transaction.inMsg, transaction.money, transaction.emulatedTx)
}
retraceTrace returns a TraceReplayResult:
rootTxHash — normalized lowercase hex hash of the trace root, without a 0x prefix.transactions — TraceResult values keyed by normalized transaction hash. Entries are
populated in Toncenter's transactions_order when it is available, with logical-time and trace
tree fallbacks for compatible endpoints that omit it.stateUpdateHashOk — true only when every replayed transaction produced the same state update
as the on-chain transaction. Do not use replayed state changes as authoritative when this value
is false.emulatorVersion — TON Sandbox executor version used for the replay.Replay is sequential because each transaction may provide the account state required by a later
transaction. Missing public libraries are loaded automatically and the trace is restarted with the
expanded library set. options.additionalLibs can be used to provide libraries that are not
available from the configured endpoint.
The method rejects incomplete traces rather than returning partial state changes. It also rejects when the trace is missing, empty, references unavailable transactions, cannot load required block context or libraries, or when transaction emulation fails. Network and Toncenter errors are passed through to the caller.
All methods are exported from retracer-core and can be used independently:
All main types (transactions, blocks, messages, tracing results) are exported from retracer-core and are fully typed (see src/types.ts).
MIT © TON Core, TON Studio
FAQs
Core TxTracer library for collecting transaction information
The npm package @ton/retracer-core receives a total of 44 weekly downloads. As such, @ton/retracer-core popularity was classified as not popular.
We found that @ton/retracer-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.