We introduce a completely new way to designing smart contracts on Bitcoin. In all our previous contracts, everything is embedded in Bitcoin Script and validated by miners. In the new approach, we combine previous contracting with transactions/contracts held and validated off chain. Surprisingly, it can maintain the trustless nature of on-chain contracts, while being drastically more efficient and private. We exemplify the general idea by improving a fair coin toss contract.
Using a hash-based commitment scheme, we introduced a contract to achieve fair coin toss without a trusted third party. There is a caveat for it to be practical. …
We show how machine learning techniques can be applied in Bitcoin, inspired by the latest Bitcoin Class. Specifically, we demonstrate how Singular Value Decomposition (SVD) can be applied to enable trustless purchase of an original image, based on a low-resolution preview.
SVD is a type of matrix decomposition that decomposes/factors a single matrix into matrix U, ∑ and V* respectively.
Intuitively, it can be seen as converting one complex transformation in 3 simpler transformations (rotation, scaling, and rotation), in which
Today we will show you how to build a decentralized application (a.k.a, dApp), on the Bitcoin SV blockchain. We will walk through the entire process of building a full stack decentralized application, including:
By the end, you will have a fully functional tic-tac-toe app running on Bitcoin.
Before we dive into the app, make sure you have the following dependencies installed.
The basic idea is to store the state of the game in a contract, using the general approach detailed before…
Secure multiparty computation (MPC) protocols enable multiple parties to jointly compute a function over their inputs while keeping those inputs private. For example, two millionaires decide who is the richer and should pay for dinner, without revealing their actual wealth¹. Or a group of employees can calculate the average salary of the group without disclosing their individual salaries.
One fundamental limitation of MPC is that it cannot force parties to respect the outcome. In the millionaires example, one can refuse to pay after he finds out he is richer.
We use Bitcoin to solve this challenge², by linking the outcome…
We design and implement a secure auction system on Bitcoin. It is open and transparent, where everyone can participate and the highest bidder wins when the bidding is over. Bidders are binded to their bids and auctioneers to the auction results.
There are many ways to extend this basic contract. For example, if the item auctioned is tokenized and stored in a UTXO (e.g., an NFT), when the auctioneers closes the auction, it can be demanded one input is the token UTXO and one output is transferring it to the winner, thus making the closing atomic and cheating impossible.
We introduce a recurring payment contract that allows a customer to deposit money in and a business to collect payment at a regular interval.
The contract have three public functions.
Using Blum’s Protocol
Previously, we implemented a fair coin toss on Bitcoin using XOR. We introduce an alternative way of implementing it using Blum’s original coin tossing protocol¹.
It consists of the following steps:
Without Trusting a Third Party using Bit Commitment
Alice and Bob decide to flip a coin, but they have no physical coin or they want to do it over the Internet. They can achieve fair coin tossing by following protocol on Bitcoin.
Additional measures have to be taken in case one party decides to abort when he/she finds out he/she loses, by refusing to reveal their secret number. For example, instead of letting winner taking all, we could have the loser take 0.5X bitcoins and thus incentivise him to proceed even though he will lose.
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.
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.