sCrypt IDE v0.5.5 allows a user to deploy a stateful contract and repeatedly call its methods in a GUI, extending our previous feature. We use an example contract AdvancedCounter to illustrate the workflow.


AdvancedCounter contains a counter, which is increased by one every time increment() is called. We initialize it to be 0 and locks 10000 satoshis into the contract. After hitting Deploy, it should be deployed.

Image for post
Image for post

Multiple Calls

In the Call panel, there is an additional section Outputs (Optional) and Transaction Settings, besides section Public Function Arguments introduced last time. It allows customizing outputs, which is necessary in many stateful contracts. …

We implement a smart contract to outsource solving Sudoku puzzles on Bitcoin, utilizing the paradigm we published earlier. The general problem of solving Sudoku puzzles is computationally intensive as grid size increases. In fact, it is known to be NP-complete, same as the Travelling Salesman Problem we introduced previously. The advantage of solving it on Bitcoin is that we only have to verify if the proposed solution is valid, which can be done efficiently. The intense computation of solving the puzzle is done off chain.

Image for post
Image for post
A Typical Sudoku Puzzle
Sudoku Contract

Cambrian Explosion of Bitcoin Smart Contracts post Genesis

We have made great strides in igniting the smart contract revolution on Bitcoin, despite many unforeseeable challenges of 2020.

We started from virtually nothing when the year started and have witnessed the explosive growth of smart contracts in Bitcoin using sCrypt, after the Genesis upgrade. To our greatest pleasure, our users have independently created the most innovative and sophisticated contracts, even we at sCrypt could not have imagined. Recently, we have seen companies start hiring sCrypt engineers, such as Volt and TokenSwap. …

sCrypt IDE v0.5.0 allows users to deploy a contract to testnet and interact with it without writing a single line of code.


We need a private key of testnet to fund the deployment and calling transactions. To do so, open sCrypt settings in VSCode and input your private key.

Image for post
Image for post
sCrypt Settings


  1. Before we deploy a contract, we need to compile it. Right click on it and select Compile to Bitcoin Script.
  2. Now click the sCrypt logo in the Activity Bar on the left, you should see your contract listed. …

How Santa uses Bitcoin to optimize his Christmas Eve trip

We present a novel paradigm to outsource intensive computation using Bitcoin smart contracts. It is amenable to solving a large set of computationally intensive problems. We apply it to the Travelling Salesman Problem as an example.

Travelling Santa/Salesman Problem

On Christmas Eve, Santa Claus needs to traverse every family to deliver presents to the children. He wants to find the shortest route to make the round-trip of all chimneys before preparing his sledge. Impressed by Bitcoin’s superior smart contracting capability, he decides to leverage it to tackle this challenge, which is computationally intensive since the number of chimneys is large¹.

Image for post
Image for post
TSP through US cities

He deploys the following contract and locks up an entire bitcoin in the UTXO containing it. Anyone that finds a path no longer than a given threshold can unlock and redeem the bounty². It is noteworthy that the contract does not recompute the path, but merely verify if its length meets requirement. …

Launch Debugger Directly From Failed Tests

sCrypt IDE v0.4.13 lets you launch a debugger that stops right at where sCrypt test fails. This will help developers to locate contract bugs tremendously.

Previously, when a test fails using the sCrypt testing framework, error message only shows where it fails in JavaScript/TypeScript code. If a user has to find out where it fails inside the sCrypt code, he has to print out debug arguments, copy and paste them into launch.json, which is a laborious and error-prone process.

Image for post
Image for post
Launch Debugger Right From a Failed sCrypt Test

In the latest IDE, when a test fails, there are two additional lines in the error message.

  • Go to Source: it shows which line fails inside sCrypt code and also the last opcode executed. Right clicking on the link will take you directly to the offending line. …

Previously, we introduced the source-level debugger in our IDE, which enables debugging at sCrypt code level. Today, we are thrilled to introduce its advanced version, which allows debugging at Script level. This would be immensely helpful for users who desire to cope directly with raw Script, e.g., for customized optimization.

Image for post
Image for post
Script Debugger

More specifically, the Script-level debugger enables you to:

  • Map between sCrypt and its Script output in realtime
  • Set breakpoint and step in Script
  • View the main and alternative stack

This is a premium feature and requires a license. To purchase a license, just send us a baemail at For more information, please visit our IDE homepage.

Conway’s Game of Life is a fascinating zero-player game on a grid, whose evolution is determined by its initial state. Each generation is a pure function of the preceding one.

Image for post
Image for post
Game Of Life

We implement the game on Bitcoin SV. Each generation evolves to a new generation when triggered by a bitcoin transaction. The game lives completely on chain. As long as there are transactions interacting with it, it lives on chain forever.


  1. Any live cell with fewer than two live neighbours dies, as if by needs caused by underpopulation.
  2. Any live cell with more than three live neighbours dies, as if by overcrowding. …

Recently, an attacker exploited a nuanced flaw in ElectrumSV’s newly debuted Accumulator MultiSig feature and stole large amount of bitcoins. We analyze the attack and make a few suggestions on how to mitigate such attacks in the future.


Accumulator MultiSig is introduced by nChain in 2019, as an alternative of multisig based on P2SH, which has been removed from Bitcoin since Genesis. It achieves the same security and privacy features of multisig without P2SH.

In ElectrumSV’s implementation of Accumulator MultiSig, the last opcode OP_GREATERTHANOREQUAL was used where OP_LESSTHANOREQUAL should be, probably due to negligence about the ordering of operands on the stack. This means instead of demanding at least m out of n signatures to unlock an output, at most m signatures are required. …

We show the complete workflow of the design, development, testing, deployment, and invocation process of smart contracts in sCrypt.


The first step in building any smart contract is a high-level design. Here we choose to implement a common transaction type Pay To Public Key Hash (P2PKH) in the Bitcoin network. There are two main reasons to use this type of transaction as an example:

  • P2PKH is the most popular type of transactions in the bitcoin network used to sending bitcoins from one to another, which is necessary for beginners to understand
  • By implementing this classic transaction type, one can more intuitively understand the capabilities and usage of…



sCrypt Inc is a company with mission to providing integrated on-chain smart contracting solutions on Bitcoin SV.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store