Source: Ethereum fans
How to introduce the use of Ethereum and smart contracts in financial contracts to those who have not yet touched the concept of Bitcoin? Here is an attempt. First introduce the blockchain, explain why it deserves people's trust, then introduce the smart contract, then introduce the Ethereum system, and finally introduce the combination of smart contracts and financial contracts.
- Liberation Army Daily: The military application of blockchain is not yet mature, and there are still four major risks.
- Supervision clearly "open the door to block the evil door" ideas "chain Shanghai South" into a digital asset test field
- Behind the difficulty of recruiting on the blockchain: the number of job seekers reaches 7 times the recruitment demand
- Looking at the blockchain project from the "God perspective"
- In the past week, the total amount of Bitcoin’s large transactions plummeted by 97%. What does this mean?
- Samsung SDS uses zero-knowledge proof technology to provide high-level privacy protection for its blockchain platform users
❖ Bitcoin consensus mechanism
Bitcoin's core technology blockchain can be understood as a copyable, shared book.
The core innovation of Bitcoin: It teaches the world how to transfer value over long distances without the need to trust third parties.
People can of course transfer face-to-face physical banknotes, but before Bitcoin appeared, we couldn't do it: transfer value to someone remotely without the need to trust a centralized third-party agency (post office, bank, etc.).
It is as if the infrastructure of the traditional transfer mode of banks and payment systems was refactored into a peer-to-peer payment network. This transition is shown in the following figure:
Bitcoin opens the door to a peer-to-peer electronic value transfer model that is completely different from today's banking systems, central banks and payment systems.
However, the above diagram does not explain how Bitcoin achieves point-to-point value transfer.
The answer is: the Bitcoin system is built on a "copyable, shared book." Each participant (full node) in the Bitcoin network has a complete copy of the transaction book. The magic of this system is how it works to keep everyone's copy consistent with other people's copies.
Therefore, the correct diagram should be as shown below, and each participant can get information from the same replicable and shared ledger.
The trick with Bitcoin and other decentralized consensus systems is how they ensure that each has a copy of the ledger and that everyone is convinced that their books are in sync with someone else's books.
If everyone has a copy of the ledger that is the same, then people no longer need a centralized agency to record who owns what. When your book is updated and a new change in ownership of the asset is recorded, the other person's book will change the same.
A smart contract program is more than just a computer program that can be executed automatically: it is a system participant itself. It responds to the received message, it can receive and store value, and it can send out information and value.
This program is like a person who can be trusted to temporarily keep assets and always follow the rules.
The following diagram is a smart contract model: a piece of code (smart contract) that is deployed on a shared, replicated ledger that maintains its state, controls its assets, and responds to incoming external information or assets. ￼
Smart Contract Model: A computer program that runs on a replicable, shared book that processes information, receives, stores, and sends value.
The Ethereum project draws on the technology of the Bitcoin blockchain and extends its application range. If Bitcoin is a dedicated calculator that utilizes blockchain technology, then Ethereum is a general-purpose computer that utilizes blockchain technology. Simply put, Ethereum = Blockchain + Smart Contract.
Compared with Bitcoin, the biggest difference of Ethereum is that it can support a more powerful scripting language (in Turbine's complete scripting language), allowing developers to develop arbitrary applications and implement any smart contract. This is also the most powerful part of Ethereum. As a platform, Ethereum can be compared to Apple's app store, any developer can develop applications on it and sell it to users.
Each type of financial contract can be written as a smart contract in the form of a program code.
Financial derivatives are the most common application of "smart contracts" and one of the easiest to implement in code. The main challenge in implementing financial contracts is that most of them need to refer to an external price issuer; for example, a very demanding application is a smart contract used to hedge Ethereum (or other cryptocurrency) relative to dollar price fluctuations. , but the contract needs to know the price of the Ethereum relative to the US dollar. The easiest way is through a "data-providing" contract maintained by a specific organization (such as Nasdaq), which is designed to enable the agency to update the contract as needed and provide an interface that allows other contracts to send a The message is given to the contract for a response containing price information.
When these key elements are in place, the hedging contract looks like this:
Wait for A to enter 1000 Ethereum.
Wait for B to enter 1000 Ethereum.
The dollar value of 1000 Ethereum, for example, x dollars, is recorded to the memory by querying the data providing contract.
After 30 days, A or B is allowed to "reactivate" the contract to send an E-coin worth $x (re-query the data offer contract to get the new price and calculate it) to A and send the remaining Ethereum to B.
There are many applications for the token system on the blockchain, from sub-currencies representing assets such as US dollars or gold to company stocks, individual tokens representing smart assets, secure unforgeable coupons, and even completely unrelated to traditional values. A token system for rewarding points. It is easy to realize the implementation of the token system in Ethereum. The key point is to understand that all currency or token systems are fundamentally a database with the following operations: subtracting X units from A and adding X units to B, provided that (1) A There are at least X units before the transaction and (2) the transaction is approved by A. Implementing a token system is to implement such a logic into a contract.
Suppose Alice wants to make sure her money is safe, but she is worried about losing or being stolen by a hacker. She put the Ethereum in a contract with Bob, as shown below, the contract is a bank:
Alice can withdraw up to 1% of the funds each day.
Bob can withdraw up to 1% of the funds per day, but Alice can use her private key to create a transaction to cancel Bob's withdrawal rights.
Alice and Bob can withdraw funds at will.
In general, 1% per day is enough for Alice, and if Alice wants to cash out more, she can contact Bob for help. If Alice's private key is stolen, she can immediately find Bob to transfer her funds to a new contract. If she loses her private key, Bob can slowly raise the money. If Bob shows malicious, she can turn off his cash withdrawal authority.
A person can easily create a financial derivatives contract by using weather conditions instead of any price index as data entry. If an Iowa farmer buys a financial derivative that is reversed based on Iowa's rainfall, then if there is a drought, the farmer will automatically receive the compensation and if there is enough rainfall he will Very happy because his crop harvest will be very good.
Multi-signature smart contract
Bitcoin allows for multi-signature-based trading contracts. For example, if you combine 3 private keys, you can use the funds. Ethereum can be more refined. For example, 5 private keys can be used to collect all the funds. If only 3 are spent 10% of the funds per day, only 2 will only spend 0.5% of the funds per day. .