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.
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.
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.
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.
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.
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.
The IDE can automatically optimize and reduce the resulting Script by up to 50%. This directly translates to enormous savings of running smart contracts.
Code can be automatically formatted to look consistent. This is especially useful when multiple developers are collaborating on the same codebase.
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.
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³.
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.
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…
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…
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.
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.
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¹:
Not only can Bitcoin maintain the datasets on chain for input into AIs, it can also host an AI algorithm itself to work…