Smart Contract vs. “Smart” Contract

Contract Scripts Series (Ⅰ)

J1149
Project PAI
4 min readApr 2, 2019

--

It is a misunderstanding that the Bitcoin blockchain is not recognized for its ability to facilitate smart contracts.

The term ‘Smart Contract’ is more commonly used with other blockchains: such as Ethereum, EOS, and TRON. Whereas the Bitcoin protocol describes contract scripts that are smart enough to provide automation without the security risks associated with similar contracts on Ethereum and other chains.

J1149.com is an informational website that provides documentation and code examples for the Project PAI ecosystem, which makes use of contract scripts like Bitcoin, but for the development of PAI blockchain applications.

PAI blockchain is an open-source public blockchain built on Bitcoin standards, which include contract scripting and a security-first design principle. This provides a balance between easy-to-implement contract automation and rigorous security when compared to other chains.

Smart Contract Overview

A smart contract is an agreement whose execution is automated.

https://georgetownlawtechreview.org/wp-content/uploads/2017/05/Raskin-1-GEO.-L.-TECH.-REV.-305-.pdf

The term, smart contract, is often overused in order to describe a wide swath of automated scripts on the Ethereum network. These Ethereum-specific contracts contain sets of rules with execution enforced by the consensus protocol. They typically facilitate, verify, or enforce the negotiation or performance of terms via the Ethereum blockchain. However, it’s widely accepted that there is a trade-off between Ethereum’s popular smart contract functionality and security.

In January 2019, Ethereum had to postpone its Constantinople upgrade at the last moment because of a security flaw that allowed smart contracts to be exploited by attackers to steal funds.

“Smart contracts on Ethereum are worse than even non-financial commercial code; as of May 2016, Ethereum contracts averaged 100 obvious bugs per 1000 lines of code.”

— — Attack of the 50 Foot Blockchain Chapter 10 by David Gerard

Researchers at the National University of Singapore have expressed similar concerns. In their research, they found vulnerabilities in approximately 30% of the Ethereum smart contracts that they examined. Considering the fact that Ethereum has one of the best communities of developers, one can imagine how many issues exist in other smart contract platforms.

“Smart” Contracts based on Bitcoin Scripts

As Bitcoin has evolved, it has extended support for writing contracts on a blockchain. Many different types of smart contracts can be built with Bitcoin script. While not as simple to create as Ethereum smart contracts, Bitcoin contract scripts have higher security and safety design constraints.

“Contracts are transactions which use the decentralized Bitcoin system to enforce financial agreements. Bitcoin contracts can often be crafted to minimize dependency on outside agents, such as the court system, which significantly decreases the risk of dealing with unknown entities in financial transactions.”

— — Bitcoin Developer Guide

PAI blockchain, an open-source public blockchain built on Bitcoin standards, has adopted Bitcoin’s contract scripting. Accordingly, PAI Coin contracts can be implemented in a variety of applications, including financial instruments (e.g. escrow, micropayment channels), autonomous governance applications (e.g., Multi-party decentralized lotteries, Inheritance), etc.

We introduce one such case in this article and continue discussing other use cases in the following articles of this “Contract Scripts” series.

Example №1 — Escrow and Dispute Mediation

Alice wants to buy a product from Bob, but neither of them trusts the other person. Alice wants to make sure that Bob won’t get paid unless she gets her merchandise. And Bob has to make sure that Alice can’t get the merchandise and keep her payment. Now they need an escrow contract and the help of a mediator in case things go wrong.

Alice sends her PAI Coins to an output which can only be spent if two of the three people (Alice, Bob, Mediator) have approved. Now Alice can approve Bob’s upon receipt of the merchandise, and Bob can invoke a mediator if Alice does not approve the payment.

You can find the specification of the escrow contract in the Bitcoin Developer Guide. Escrow contracts can provide safer transactions and are especially useful when purchasing different types of goods, information, or services with cryptocurrency.

Choosing Bitcoin

There are dozens of Bitcoin forks that focus on grievances with protocol-level governance, block size, privacy, and other points of contention.

In contrast, Project PAI builds on Bitcoin as a secure base layer, so that it can focus on helping developers build PAI applications. This choice prioritizes Bitcoin’s security-first design principles along with PAI-specific extensibility (see https://github.com/projectpai/pdps).

We will continue to show the power of Bitcoin-inspired contract scripts with examples in this Contract Scripts series.

--

--