{"id":29861019,"url":"https://github.com/ton-blockchain/tasm","last_synced_at":"2026-04-22T05:31:22.241Z","repository":{"id":306250293,"uuid":"1025511783","full_name":"ton-blockchain/tasm","owner":"ton-blockchain","description":"Assembler and disassembler implementation for TVM bitcode in pure TypeScript","archived":false,"fork":false,"pushed_at":"2025-12-03T10:33:04.000Z","size":528,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-06T13:34:41.790Z","etag":null,"topics":["assembler","bitcode","bytecode","disassembler","fift","ton"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ton-blockchain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-24T11:14:43.000Z","updated_at":"2025-12-03T10:33:08.000Z","dependencies_parsed_at":"2025-07-24T16:14:47.812Z","dependency_job_id":"4457520d-f70c-498c-9978-dde3e12c7882","html_url":"https://github.com/ton-blockchain/tasm","commit_stats":null,"previous_names":["ton-blockchain/tasm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ton-blockchain/tasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-blockchain%2Ftasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-blockchain%2Ftasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-blockchain%2Ftasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-blockchain%2Ftasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ton-blockchain","download_url":"https://codeload.github.com/ton-blockchain/tasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ton-blockchain%2Ftasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32122685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembler","bitcode","bytecode","disassembler","fift","ton"],"created_at":"2025-07-30T04:10:08.394Z","updated_at":"2026-04-22T05:31:22.236Z","avatar_url":"https://github.com/ton-blockchain.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TON Assembly\n\nThis repository contains an assembler and disassembler implementation for TVM bitcode.\n\nThis implementation provides a complete cycle\n`Text -\u003e Internal representation -\u003e Cells -\u003e BoC -\u003e Cells -\u003e Internal representation -\u003e Text`, this means that the same\ntext assembly can be obtained from a text assembly, going through all the compilation and decompilation steps.\n\nThe assembler correctly handles cases where the code does not fit into a single cell and automatically\ncreates a separate reference for the remaining code.\nCurrent implementation optimizes cases where the reference can be folded into more efficient instructions\n(e.g. `IF` into `IFREF`), thereby optimizing gas consumption.\n\nDuring compilation, the assembler collects additional mappings that can be used to convert the TVM log into a full trace\nthat will refer to specific instructions in the decompiled version of the contract.\n\nThis mapping looks like this:\n\n```\ncell-hash + offset -\u003e instruction\n```\n\nThis implementation is able to generate a coverage report for the contract by BoC and logs\nfrom [Sandbox](https://github.com/ton-org/sandbox).\nThe proof of concept can be found in the [`./src/coverage`](./src/coverage) folder.\n\n`instructionNameForOpcode()` function can be used to get the name of the instruction for a given opcode, which is useful\nfor runtime debugging with TVM since TVM itself provides only integer opcodes.\n\n## CLI Tools\n\nThis package includes three command-line utilities for working with TON and Fift assembly:\n\n### Assembler\n\nCompile TVM Assembly files to BOC format:\n\n```bash\n# Install globally\nnpm install -g ton-assembly\n\n# Use the assembler\ntasm contract.tasm -o contract.boc\n\n# Or via yarn scripts\nyarn assembler contract.tasm -o contract.boc\n```\n\n### Disassembler\n\nDisassemble BOC files back to TVM Assembly:\n\n```bash\n# Use the disassembler\ntdisasm contract.boc -o contract.tasm\n\n# Or via yarn scripts\nyarn disassembler contract.boc -o contract.tasm\n```\n\n### Fift Assembly Compiler\n\nCompile Fift assembly smart contract source files (from FunC or Tolk) to BoC format:\n\n```bash\n# Use the Fift assembly compiler\ntfift contract.fif -o contract.boc\n\n# Or via yarn scripts\nyarn fift-compiler contract.fif -o contract.boc\n```\n\nNote: Currently, tfift does not support Fift constructions like `\u003cb b\u003e s\u003e`. In the future, we will add support for most common used constructions to be able to compile more FunC and Tolk code.\n\nAll three tools support multiple output formats (binary, hex, base64) and provide verbose output options.\nAll three tools support input from a string.\n\n#### Example Usage\n\n```bash\n# Compile assembly to BOC\ntasm contract.tasm -o contract.boc --verbose\n\n# Disassemble BOC back to assembly\ntdisasm contract.boc -o decompiled.tasm --verbose\n\n# Compile Fift assembly to BOC\ntfift contract.fif -o contract.boc --verbose\n\n# Full round-trip test\ntasm decompiled.tasm -o recompiled.boc\n# contract.boc and recompiled.boc should be identical!\n\n# Work with different formats\ntasm contract.tasm -f hex \u003e contract.hex\ntdisasm contract.hex -f hex -o contract.tasm\n\n# Assemble from string directly\ntasm -s \"PUSHINT_4 1\" -f hex\n\n# Disassemble from hex/base64 strings directly\ntdisasm -s \"b5ee9c72410102010027000114ff008e83f4a413ed43d901002fa64ce73b5134348034c7f487f4fffd0115501b05485b1460ec17065c\" -f hex -o contract.tasm\ntdisasm -s \"te6cckEBAgEAJwABFP8AjoP0pBPtQ9kBAC+mTOc7UTQ0gDTH9If0//0BFVAbBUhbFGDsFwZc\" -f base64\n```\n\nSee [CLI documentation](./src/cli/README.md) for detailed usage instructions.\n\n## Library Usage\n\nIn addition to the CLI tools, this package can be used as a library for programmatic compilation, decompilation, and log\ntracing.\n\nFor detailed information, see the [**API Documentation**](API.md).\n\n## Validity\n\nThe assembler was tested on 106k contracts from the blockchain\nwhere it successfully decompiled and compiled all contracts into equivalent **Cells**.\n\n## License\n\nThis project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.\n\nMIT © [TON Studio](https://tonstudio.io).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fton-blockchain%2Ftasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fton-blockchain%2Ftasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fton-blockchain%2Ftasm/lists"}