Getting Started | From the three cases of Bitcoin, EOS, and MakerDao, what is a smart contract?

Author: Huang Shiliang

Source: Lightning HSL

Original Title: "Preliminary Clear Understanding of Smart Contracts"

In 1995, computer scientist, jurist, and cryptographer Nick Saab introduced the concept of smart contracts. However, even if it is as powerful as Nick Saab, it does not clearly define what a smart contract is.

The invention of the blockchain, especially the release of Ethereum, has made the concept of smart contracts hot in the blockchain space. But up to now, Ethereum has been running for more than 4 years, and various products that call themselves smart contracts have been running for more than 4 years. But what exactly is a smart contract?

Since Ethereum, I have wanted to understand what a smart contract is. But for several years, I don't know yet.

I think if this concept cannot be clearly defined, then smart contracts will be metaphysicalized, and various scammers will use smart contracts to cheat. This is a tragedy for the industry.

Since I can't fully understand smart contracts, today I settled for the second, first understand a subset of the smart contracts that have consensus in the current blockchain industry-smart digital currency asset disposal contracts. I coined this word. The current programmatic disposal of digital currency assets on Ethereum is definitely the scope of smart contracts. Let's first understand this subset clearly.

We limit the scope of the discussion to digital currency assets, and what is a smart contract is very clear. First look at three examples.

01

The process of Bitcoin mining to obtain BTC rewards is a smart contract.

The rules for Bitcoin mining block rewards have been set since the first bitcoin node software was released in 2009, and will continue to run according to this rule. The circulation of Bitcoin genesis blocks is 50 BTC, and then one block can be mined on average in 10 minutes, and one block rewards 50 BTC. After every 210,000 blocks are mined, the reward for each block is halved. Now it has been executed to the second halving, and each block rewards 12.5BTC.

Anyone can participate in mining, as long as you follow the rules of proof of work, you can join the mining army. The rules of mining proof of work have been stipulated since the first version of bitcoin software. Always open and transparent to the world.

All mining reward transaction records are completely and transparently recorded in the Bitcoin blockchain. It cannot be tampered with or deleted.

The entire design of mining is like a labor contract. As long as you submit the workload agreed to by the rules to the Bitcoin system, the system will reward you with salary. The entire contract is fixed in the system in the form of code. Moreover, the execution of the entire contract is purely automatic and does not require any external intervention.

This is the smart contract (contract). Participants in the contract are free to enter and exit. The “labor party” of the contract submits “work load”, and the system automatically verifies the “labor load”, and the “labor party” receives “BTC salary”.

Contract rules are fixed in code form; participation in the contract does not require authorization to enter and exit freely; execution of the entire contract is purely automatic and requires no intervention; 100% open and transparent, history is 100% recorded, and cannot be tampered with or deleted.

This smart contract for bitcoin mining has been operating stably for more than 10 years without problems. Niubi exploded.

In real life, you know how we sign labor contracts, go to work, and get paid. What is the difference compared to mining.

02

Bitcoin mining is similar to a "labor service in exchange for BTC wages" smart contract. Let's look at a "commodity sale" smart contract.

On June 26, 2017, EOS started the ICO, which lasted until one year later, setting a record of 4 billion US dollars in financing. One of the most successful financings in history.

This is how EOS's ICO is executed. BM has developed a "program (smart contract, for convenience of description, this program is called EOS-ICO program)", and the program runs on the Ethereum blockchain.

The EOS-ICO program has an address for receiving ETH, and any user can transfer ETH to this address.

Every 23 hours, the EOS-ICO program will count how much ETH was received at that address, and how much ETH was transferred from which user's address.

The EOS-ICO program will then evenly distribute 2 million EOS-erc20 tokens to these ETH.

Users who have transferred to ETH can use their Ethereum account again to call the payment function to the EOS-ICO program. The payment function will return an EOS-erc20 token to the user's address.

This is a typical process of paying currency (ETH), smart contracts, and delivering goods (EOS-erc20 tokens) to users.

In the end, all ETH received by this EOS-ICO program can only be extracted by BM (or block.one company), they control the private key of this program.

The EOS-ICO program is a smart contract. It is a smart contract that automatically collects user ETH and automatically delivers goods to users.

Similarly, contract rules are fixed by code; participation in the contract does not require authorization; contract execution is purely automatic; 100% open and transparent, cannot be tampered with and cannot be deleted.

EOS-ICO, a smart contract, has been operating steadily for a year with a total of 361 issues without any errors. A total of 1 billion EOS-erc20 tokens were sold, with a total financing amount of more than $ 4 billion. Niubi exploded.

In real life, we know what the process of "commodity auction sale" looks like. After being designed as a smart contract, how big is the difference.

03

Finally, let's look at a MakerDao that “completes the responsibility of the central bank to issue currency smart contracts”. The MakerDao contract is complex and worrying. Complexity is the way out.

The main role of the central bank is to issue currency and regulate money market interest rates. MakerDao smart contracts do just that.

The MakerDao contract has two parties, the mortgage lender, and the market rate adjuster.

Mortgage lenders replenish their ETH into the MakerDao contract mortgage, and the contract sends Dai to the lender. Dai is a stable currency, and it is expected to be anchored to the US dollar 1: 1.

The mortgage rate is assumed to be 60%, that is, 100 USD worth of ETH, and 60 Dai (60 USD) can be mortgaged. Assume that the liquidation line is 125%, that is, if the value of the collateral falls to 1.25 times the loan amount, the system auction process will be triggered. Other users can purchase Dai below the market price by issuing Dai to the auction process (we assume 3% lower). The auction process prompts mortgage borrowers to repay Dai in time to redeem collateral when prices fall.

So how can Dai achieve the goal anchored with the dollar?

The first question to ask is, how could a MakerDao smart contract know the exchange rate between Dai and the US dollar? The MakerDao contract itself is not known, but someone will provide this kind of data to the contract, which is the market interest rate regulator.

MakerDao issued a coin called MKR. MKR holders have the right to dividends from contract operating income (such as the commission for Dai borrowing). The mortgage rate of ETH lending Dai, the liquidation line, and other contract parameters are determined by the voting of MKR holders.

MKR's dividend rights give currency holders the incentive to maintain the stable anchoring of Dai and the US dollar. One strategy is to adjust mortgage rates and liquidation lines. The second strategy is market arbitrage.

MKR holders are the most volatile arbitrageurs of Dai and the US dollar. They are the most active participants in the auction process in order to hedge the difference between the auction price and the market price. If 1Dai is less than $ 1, MKR holders will redeem Dai to reduce Dai's supply on the market. Conversely, if 1Dai is higher than 1 USD, MKR holders will mortgage ETH to issue Dai to increase Dai's supply.

The above design forms a logical and self-consistent mortgage issuance system.

The MakerDao program is a smart contract. This smart contract contains the "labor contract" attribute of bitcoin mining. The system encourages participants to discover market interest rates and arbitrage from it; it also contains the "commodity sale contract" attribute of EOS-ICO smart contracts. Participants can use ETH to Contract "Buy Dai".

The entire contract is the same. The contract rules are fixed by the code. Participation in the contract does not require authorization. The contract execution is purely automatic.

MakerDao has been operating stably for more than two years. The market pledged 100 million Dai, or $ 100 million. No problem. Niubi exploded.

From the above three examples, we can see the definition of smart contracts after discussing the scope of the encrypted digital currency asset scope.

Smart contracts are an extension of the concept of contracts in our familiar economic life on the Internet. Smart contracts are smart contracts.

The three most important attributes of a contract are: money or property; the rights and responsibilities of the parties to the contract; and how to deal with breach of contract.

The three most important attributes of smart contracts are: cryptocurrency; conditions and benefits of participating in the contract; and contract rules.

Contracts rely on the conventions and customs of the real life world, legal guarantees, and people's promises and credits.

Smart contracts rely on code regulations, so they are widely recognized as code is law.

The important characteristics of smart contracts include: the contract terms are fixed in code; participation does not require authorization; the contract is automatically executed; open and transparent, cannot be tampered with, and history records cannot be deleted.

In the end, I failed to give a highly abstract definition of smart contracts. For the time being, this is a limitation of the times, and the entire industry cannot give a clear definition.

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Number said | In the first half of 2019, blockchain private placement financing of 11.851 billion yuan exceeded 60% of funds invested in the US market

As the cryptocurrency undergoes the “Bear Bull” conversion, the blockchain private equity financing mar...

Opinion

a16z evaluates the regulation of Web3 in the United States The regulatory situation is much more optimistic

This article analyzes and rates cases involving Coinbase, Uniswap, ZeroEx, OPYN, and Deridex, and finds that the regu...

Blockchain

How terrible is the IEO? 62% of 87 projects broke, with a maximum loss of 99%

87 IEO projects, raising more than 2 billion, 62% broken "Bitcoin is about to plummet to $5,000." "Cry...

Blockchain

Indian crypto exchange lifts ban: trading volume soars 6-fold, is it global buy?

Text | Li Zheweng Sources | PANews The Indian exchange Koinex, which failed to survive the cold winter, fell in the h...