Introducing scryptTS: Write Bitcoin smart contracts in Typescript
This post was first published on Medium.
After months of intense development, we are super excited to introduce scryptTS: a Typescript framework for writing smart contracts on Bitcoin.
scryptTS is a Typescript-based domain-specific language (DSL) for coding smart contracts on Bitcoin, based on our experience developing and promoting the sCrypt ecosystem over the past three years. Developers can directly code smart contracts Typographyone of the most popular programming languages in the world and is used by millions of developers every day.
Barrier to use of Bitcoin smart contract developer
The current development of smart contracts on Bitcoin is based on sCrypt, a high-level programming language for writing smart contracts. Its IDE has drawn over 4,000 downloads since its launch. Despite the drastic improvement over developments in Bitcoin Script, a compilation-like set of low-level instructions for Bitcoin, Bitcoin companies and projects still have trouble finding qualified smart contract developers, hindering widespread Bitcoin adoption. This is mainly because sCrypt is still a relatively niche language, given its nuance.
Based on our years of developing sCrypt contracts ourselves and talking to hundreds of developers inside and outside of Bitcoin, we summarize the biggest pain points for new developers as follows:
- they have to learn a new programming language
- they have to learn new tools.
The requirement to learn something new and different from their day-to-day development workflow creates a significant barrier to entry and detracts from the developer experience. Consequently, the number of Bitcoin developers today is small compared to other blockchains.
The ultimate solution: scryptTS
To fix these pain points, we have designed scryptTS from the ground up. The design principle is to reuse existing programming languages and tools that many developers are already familiar with.
The number of Web3/blockchain developers is only ~0.07% of all developers, and the number of sCrypt developers is actually even less than that.
Javascript is the most popular programming language. Typescript basically adds types to it. For smart contracts that control users’ funds, type safety is paramount. That’s why we choose Typescript.
1. Familiar and simple syntax
scryptTS is simply Typescript. Creating a loop is just writing “for” and the conditional “if.” It is NO new syntax to learn.
Below is an example of writing an Ackermann function.
Here is another example implementation of the most popular smart contract in use today: Pay-to-PubKey-Hash (P2PKH).
2. Huge ecosystem
All existing Typescript/Javascript libraries can be seamlessly integrated with scryptTS. Below is an example to test scryptTS smart contracts with Mocha, which is among the most popular Typescript/Javascript testing frameworks.
3. Package handling
scryptTS does not need its own package processing. It just uses npm, Typescript/Javascript’s package manager. You can publish your own scryptTS contract with npm. Everyone else can just import and reuse it as a dependency via npm.
4. IDE and debugging
One can use their favorite Typescript IDE to code and debug scryptTS smart contracts, including Visual Studio Code, WebStorm, Vim, and Atom. Below is an example of using Visual Studio Code to debug a scryptTS contract, no extension needed!
We need you
The scryptTS the framework has just started. We want to hear your feedback. Try it today at You will find examples of We have also launched a free course on Youtube. Join us on Discord (channel #scrypt) or Slack to talk directly with the team and other enthusiasts.
See: The presentation of the BSV Global Blockchain Convention, Smart Contracts and Computation on BSV
width=”560″ height=”315″ frameborder=”0″ allowfullscreen=”allowfullscreen”>
New to Bitcoin? Check out CoinGeeks Bitcoin for beginners section, the ultimate resource guide for learning more about Bitcoin – as originally envisioned by Satoshi Nakamoto – and blockchain.