A smart contract is a program code formed to execute instructions. Smart contract is a concept proposed by Nick Szabon in academic papers in the 1990s, and DApp (decentralized application) is a series of linked smart contracts.
Relationship with the public chain
Public Chain is a public blockchain, like a large public database. This database is composed of computers all over the world. Each computer is a node. Anyone can conduct transactions and activities on the chain. DApps can be built on the public chain through programming languages.
Execute Decentralized Smart Contracts with DApps
The smart contract can perform various service functions according to the program code. The generated user APP is a DApp. The smart contract is always a vending machine, and the DApp is the vending machine body seen by the user. When you put enough coins in You can successfully trigger the machine function and you can buy the drink you want.
Conversely, if not enough coins are put in, the machine function will not be performed. The writing of smart contracts requires task execution, trigger points, conditions, etc. If the conditions are met, the contract content will be automatically executed, such as receiving, checking, verifying, returning data, etc., without any agency intervention or certification, it can be automatically executed. effective execution.
Three characteristics of DApp
Are all apps developed on the blockchain all DApps? The answer is no, a DApp must be open source, use tokens, and have constant algorithm support to be considered a DApp.
Open Source
DApps must be completely open source, allowing anyone to share and operate, applications can run autonomously, no entity can control tokens, and all data must be encrypted and stored in a decentralized public decentralized block chain.
Tokens
DApp must generate native virtual currency (Coin) through algorithm or use smart contract to generate token (Token), and further use it as a reward or operating basis, or use the token reward mining mechanism.
Algorithm
DApps generate tokens through algorithms. The tokens must be related to the services provided by the application. If any contribution or reward mechanism must be made through this algorithm, the algorithm will be published on the blockchain and cannot be modified. For example, Bitcoin is generated according to an algorithm, and miners are rewarded in Bitcoin for their contribution to the Bitcoin blockchain.