sCrypt does not support floating point natively, mainly due to the high overhead of implementing it (such as IEEE Floating Point Standard) using integral arithmetic in Bitcoin Script. However, there are many use cases where fractional numbers are indispensable. We provide two libraries to support such cases.

Fixed Point Arithmetic

One simple way to represent a fractional number is storing a fixed number of digits of their fractional part, by scaling it with a fixed factor. For example, when you divide integer 1 by integer 2 in sCrypt, normally you get zero:

1 / 2 = 0

By scaling them both by 10…


We introduce a novel approach to call one smart contract from another. It is built upon a technique called OP_PUSH_TX. We illustrate the approach by letting one contract call another to solve a quadratic equation. It has been generalized and extensively used in projects such as Sensible Contract.

Background

Sighash Preimage Format

From the specification of sighash preimage, we can see each input in a transaction has a different sighash preimage. We also see their preimages overlap. Most notably, they share the same outputs (colored). The preimage of input0 and input1 both include output0 and output1 as highlighted below in an example transaction¹. …


We have implemented Rule 110 on Bitcoin. Similar to two-dimensional cellular automata (CA) Conway’s Game of Life, Rule 110, a one-dimensional CA, is also Turing-complete. By deduction, we have shown Bitcoin is Turing Complete, once again.

Rule 110

250 iterations of rule 110

The Rule 110 cellular automaton is a 1-dimensional elementary CA, where a linear pattern of 0s and 1s evolves according to a simple set of rules. Whether a point in the pattern will be 0 or 1 in the new generation depends on its current value and on those of its two neighbors. The Rule 110 has the following set of rules:


After introducing zero knowledge proof (ZKP) through an example, we demonstrate how it can be used as a powerful tool to increase privacy and further develop many applications building atop. We have implemented a ZKP-based escrow for purchasing physical goods using bitcoin.

Zero Knowledge Proof

A zero knowledge proof lets one party (i.e., a prover), who claims to know a secret, convince another party (i.e., a verifier) that the claim is valid, whilst not revealing the secret.

Finding Waldo is a game where you have to find Waldo among a sea of people that look like him.

Finding Waldo

Peggy (the prover) tells Victor (the…


Today we are extremely thrilled to publish sCrypt IDE v1.0, after over 40 iterations since our first release in early 2020. It offers multiple new critical features and significantly improves a wide range of existing features, which we selectively highlight below.

Optimization

The IDE can automatically optimize and reduce the resulting Script by up to 50%. This directly translates to enormous savings of running smart contracts.

Release Build

Documentation

Full IDE documentation can be found in both English and Chinese.

Formatting

Code can be automatically formatted to look consistent. This is especially useful when multiple developers are collaborating on the same codebase.


Why Ethereum is never needed

The entire reason for Ethereum’s existence is to overcome Bitcoin scripting language’s “limitations”. There are four limitations listed in the Ethereum whitepaper. We analyze each of them and show all claims of the supposed limitations are false, calling its existence into question.

Lack of Turing-completeness

while there is a large subset of computation that the Bitcoin scripting language supports, it does not nearly support everything. The main category that is missing is loops.

Contrary to popular belief, Bitcoin is Turing complete. Not only are there peer-reviewed theoretical¹ proofs², but it is also empirically verified on the Bitcoin blockchain³.

One common misconception lies in…


Smartphone vs pocket calculator

We compare two smart contract blockchains, Bitcoin and Ethereum, side by side. We find Bitcoin offers superior performance, security, and cost-effectiveness, due to its skillfully constructed fundamental design. This articles focuses on their technical differences. Economic, philosophical, legal, and environmental differences are beyond the scope of the article.

Scalability

Ethereum: account model and vertical scaling

EVM

In Ethereum, each smart contracts resides in an account. It has its own storage that persists across contract execution. To see how, let us examine the core smart-contract engine of Ethereum: the Ethereum Virtual Machine (EVM). It is stack based and stores data in three places: stack, memory, and storage. The former…


Part I: manual optimization

sCrypt programming is different from traditional programming done in Javascript or Python, as the compiled code size directly determines their running cost when the transaction encapsulating it is submitted to the Bitcoin network. It is thus imperative that the resulting Script is as small as possible to save transaction fees¹. We list some tips for developers to manually optimize their sCrypt contracts’ Script outputs.

1. Batch same function calls

All function calls are implemented by inlining. The function body is copied to where it is called. If there are multiple callers of the same function, code size can be saved by merging them. In the…


Outsource the training to others

Previously, we have implemented a single-layer perceptron, which can be continuously trained on Bitcoin. This can quickly become prohibitively expensive when the dataset is large and it takes many iterations to find the desired weights.

Perceptron

We develop a contract to outsource the training. It is a public bounty that can be collected by anyone offering the right weights that make predictions match outputs for all training dataset inputs. The computationally intensive training is done off chain and the contract only verifies the training is valid, thus making training a perceptron on Bitcoin significantly more cost efficient.

Perceptron Outsource Contract

Perceptron as an Example

Artificial intelligence, especially in the form of machine learning, has recently seen tremendous advances, with applications ranging from face recognition to autonomous vehicles. We propose to combine AI with the Bitcoin blockchain, for many salient advantages unachievable otherwise¹:

  • Open and transparent: both the code and data on the blockchain are public and can be verified by anyone and thus be trusted.
  • Collaborative datasets: everyone can contribute data and access the published data, compared to traditional siloed datasets.

Not only can Bitcoin maintain the datasets on chain for input into AIs, it can also host an AI algorithm itself to work…

sCrypt

sCrypt Inc (https://scrypt.io) is a company with a mission to provide integrated on-chain smart contracting solutions using the original BitCoin Protocol on BSV

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