{"id":26370,"library":"scrypt-ts-transpiler","title":"sCrypt TypeScript Transpiler","description":"Transpiler that compiles TypeScript smart contracts for Bitcoin SV into sCrypt bytecode. Current stable version is 1.2.29, updated periodically. Key differentiator: enables writing Bitcoin smart contracts entirely in TypeScript, leveraging its tooling and type safety, while outputting efficient on-chain bytecode. Requires TypeScript ~5.3.0 as a peer dependency and Node.js >=16.","status":"active","version":"1.2.29","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript","sCrypt"],"install":[{"cmd":"npm install scrypt-ts-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add scrypt-ts-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add scrypt-ts-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency to transpile TypeScript source files","package":"typescript","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require will fail.","wrong":"const transpile = require('scrypt-ts-transpiler').transpile","symbol":"transpile","correct":"import { transpile } from 'scrypt-ts-transpiler'"},{"note":"Type included for handling compilation errors.","wrong":"","symbol":"CompileError","correct":"import { CompileError } from 'scrypt-ts-transpiler'"},{"note":"Use type import for compile-time type safety, avoid runtime import.","wrong":"import { TranspileOptions } from 'scrypt-ts-transpiler'","symbol":"TranspileOptions","correct":"import type { TranspileOptions } from 'scrypt-ts-transpiler'"}],"quickstart":{"code":"import { transpile } from 'scrypt-ts-transpiler';\nimport { writeFileSync } from 'fs';\n\nconst source = `\nexport class Counter extends SmartContract {\n    @prop()\n    readonly count: bigint;\n\n    constructor(count: bigint) {\n        super(...arguments);\n        this.count = count;\n    }\n\n    @method()\n    public increment() {\n        this.count++;\n    }\n}`;\n\nconst result = transpile(source, {\n    artifactPath: './artifacts',\n    sourceMap: true\n});\n\nwriteFileSync('artifacts/counter.scrypt', result.bytecode);\nconsole.log('Bytecode compiled successfully');","lang":"typescript","description":"Compile a simple sCrypt TypeScript smart contract into bytecode and save the artifact."},"warnings":[{"fix":"Pass an options object as the second argument to transpile().","message":"Version 1.0.0 changed the transpile function signature; options object is required.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Install TypeScript ~5.3.0: npm install typescript@~5.3.0","message":"TypeScript peer dependency must be exactly ~5.3.x; other versions may cause compilation errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to >=16.","message":"Node.js <16 is not supported; transpile will fail on older runtimes.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: npm install scrypt-ts-transpiler","cause":"Package is not installed or not in node_modules.","error":"Error: Cannot find module 'scrypt-ts-transpiler'"},{"fix":"Use import statement: import { transpile } from 'scrypt-ts-transpiler'","cause":"Using CommonJS require instead of ESM import.","error":"SyntaxError: The requested module 'scrypt-ts-transpiler' does not provide an export named 'transpile'"},{"fix":"Ensure TypeScript ~5.3.0 is installed and tsconfig.json includes 'moduleResolution': 'node' or 'node16'.","cause":"TypeScript cannot resolve the package's types; likely missing or misconfigured.","error":"error TS2688: Cannot find type definition file for 'scrypt-ts-transpiler'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}