Skip to main content
TON Decompiler is an utility for converting BoC of the contract into a Fift-like pseudocode. Decompiled code cannot match match the original source. At the very least, variable names and high-level structure is removed during compilation. Variables and methods will get some generated names, for example, ?fun_ref_12345678. The resulting pseudocode might not compile back to the same BoC either.

CLI usage

Install Tact language tool suite.
npm install -g @tact-lang/compiler
Then run it on a BoC file:
unboc example.boc

API usage

Add it to the project
npm install @tact-lang/ton-decompiler
Then call a disassembler to decompile it, and a writer to put the result back into Fift-like pseudocode.
import { Cell } from "@ton/core";
import { disassembleRoot } from "./decompiler/disasm";
import { AssemblyWriter } from "./printer/assembly-writer";

const cell: Cell = ...; // your TVM contract bytecode
const program = disassembleRoot(cell);
const writer = new AssemblyWriter();
const code = writer.write(program);
console.log(code);
I