{"id":28520264,"url":"https://github.com/tact-lang/tasm","last_synced_at":"2025-07-01T18:06:10.862Z","repository":{"id":297497556,"uuid":"995947957","full_name":"tact-lang/tasm","owner":"tact-lang","description":"Assembler and disassembler implementation for TVM bitcode in pure TypeScript","archived":false,"fork":false,"pushed_at":"2025-06-23T11:10:00.000Z","size":685,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T12:24:15.737Z","etag":null,"topics":["assembler","bitcode","bytecode","disassembler","ton","tvm"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@tact-lang/ton-assembly","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/tact-lang.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}},"created_at":"2025-06-04T08:32:53.000Z","updated_at":"2025-06-11T10:16:35.000Z","dependencies_parsed_at":"2025-06-05T20:35:21.224Z","dependency_job_id":null,"html_url":"https://github.com/tact-lang/tasm","commit_stats":null,"previous_names":["tact-lang/tasm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tact-lang/tasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tact-lang%2Ftasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tact-lang%2Ftasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tact-lang%2Ftasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tact-lang%2Ftasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tact-lang","download_url":"https://codeload.github.com/tact-lang/tasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tact-lang%2Ftasm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263013712,"owners_count":23399813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","ton","tvm"],"created_at":"2025-06-09T07:01:22.154Z","updated_at":"2025-07-01T18:06:10.852Z","avatar_url":"https://github.com/tact-lang.png","language":"TypeScript","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 two command-line utilities for working with TON 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\nBoth tools support multiple output formats (binary, hex, base64) and provide verbose output options.\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# 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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftact-lang%2Ftasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftact-lang%2Ftasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftact-lang%2Ftasm/lists"}