Digitization Transformation concept with background of people in an office

Introducing scryptTS: Write Bitcoin smart contracts in Typescript

This post was first published on Medium.

After months of intense development, we are super thrilled to introduce scryptTS: a Typescript framework to write smart contracts on Bitcoin.

scryptTS a Typescript framework to write smart contracts on Bitcoin

scryptTS is a Typescript-based domain specific language (DSL) for coding smart contracts on Bitcoin, based on our experience of developing and fostering the sCrypt ecosystem in the past three years. Developers can directly code smart contracts in Typescript, one of the most popular programming languages in the world and used by millions of developers every day.

Barrier to Bitcoin smart contract developer adoption

The current smart contract development on Bitcoin is based on sCrypt, a high-level programming language to write smart contracts. Its IDE has drawn over 4,000 downloads since launch. Despite its drastic improvement over developing in Bitcoin Script, an assembly-like low-level set of instructions for Bitcoin, Bitcoin companies and projects still have difficulty finding qualified smart contract developers, hindering wide Bitcoin adoption. This is mainly because sCrypt is still a relatively niche language, given its nascency.

Based on our years of developing sCrypt contracts ourselves and talking with hundreds of developers in and beyond Bitcoin, we summarize the major pain points of 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 daily development workflow poses a significant barrier to entry and degrades developer experience. Consequently, the number of Bitcoin developers today is small compared to that of other blockchains.

The ultimate solution: scryptTS

To fix these pain points, we have designed scryptTS from the ground up. Its design principle is to reuse existing programming languages and tools that many developers are already familiar with.

Credit electric Capital
Credit: Electric Capital

The number of Web3/blockchain developers is merely ~0.07% of all developers, and the number of sCrypt developers is actually even smaller than that.

Javascript is the most popular programming languages. Typescript basically adds types into it. For smart contracts that control users’ funds, type safety is paramount. That is why we choose Typescript.

1. Familiar and simple syntax

scryptTS is simply Typescript. Creating a loop is just writing “for” and conditional “if.” There is NO new syntax to learn.

Below is an example of writing an Ackermann function.

Here is another example of implementing 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 using Mocha, which is among the most popular Typescript/Javascript testing frameworks.

3. Package management

scryptTS does not need its own package manager. It just uses npm, Typescript/Javascript’s package manager. One can publish his own scryptTS contract using npm. Anyone else can just import and reuse it as a dependency via npm.

4. IDE and Debugging

One can use his 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!

example of using Visual Studio Code to debug a scryptTS contract
See the full animation here

We need you

The scryptTS framework has just gotten off the ground. We want to hear feedback from you. Try it today at https://scrypt.io/scrypt-ts. Your can find examples at https://github.com/sCrypt-Inc/scryptTS-examples. We have also launched a free course on Youtube. Join us on Discord (channel #scrypt) or Slack to talk directly to the team and other enthusiasts.

Watch: The BSV Global Blockchain Convention presentation, Smart Contracts and Computation on BSV

YouTube video

New to blockchain? Check out CoinGeek’s Blockchain for Beginners section, the ultimate resource guide to learn more about blockchain technology.