
Security News
GitHub Actions Adds cache-mode to Limit Cache Poisoning Risk
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.
@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.
Use emulateRawMessage to execute a serialized inbound message from a chosen masterchain state.
The message may be passed as a Cell, a hex BoC, or a base64 BoC. Internal messages emitted by a
transaction are executed in order against an in-memory account-state cache. ignoreChksig applies
only to the root transaction; signature checks remain enabled for the rest of the cascade.
import {emulateRawMessage, RETRACE_TESTNET_NETWORK} from "@ton/retracer-core"
const emulation = await emulateRawMessage(RETRACE_TESTNET_NETWORK, rawMessageBoc, {
mcSeqno: 42_000_000,
ignoreChksig: true,
maxTransactions: 64,
accountStateOverrides: {
[contractAddress.toString()]: {
balance: 10_000_000_000n,
state: {
type: "active",
codeBoc: compiledCode.toBoc().toString("base64"),
dataBoc: initialData.toBoc().toString("base64"),
},
},
},
})
console.log(emulation.rootTxHash)
console.log(emulation.trace.trace)
console.log(emulation.transactions[emulation.rootTxHash])
When mcSeqno is omitted, the latest masterchain block is used. now and lt can override the
execution timestamp and initial logical time. Account overrides can start from a complete
shardAccountBoc and then replace its balance, state, or last-transaction metadata.
The returned EmulateRawMessageResult contains detailed TraceResult values and a synthetic
Toncenter-shaped EmulatedTrace. Its stateUpdateHashOk value is always true for compatibility;
raw-message emulation has no on-chain state update to compare against, so it must not be interpreted
as an on-chain verification result. maxTransactions bounds the cascade and defaults to 128.
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 74 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
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.

Company News
Allow myself to introduce... myself.

Research
/Security News
A Twitch browser extension on Chrome and Firefox forwards users’ live OAuth session tokens through proxies controlled by a Russian bot service.