Blockchain Smart Contract Basics

What is a smart contract

To put it simply, a smart contract is a program that is executed when certain conditions are met. For example, a vending machine is similar to a smart contract system.

1. Put enough coins into the vending machine and press the button

2. The vending machine supplies the goods

3. The vending machine returns to the initial state

How Smart Contracts Work

A smart contract is a program (a collection of code and data) that can be deployed to run on a blockchain network that supports smart contracts (such as Ethereum).

The smart contract is a deterministic "single-threaded" program. The result of a deterministic program running on all nodes is the same. The blockchain is used to determine the order in which the smart contract runs, and the final data is determined by a distributed consensus method. Exactly the same, that is, there is "verifiability".

Simply understood, the operation of a smart contract is similar to a transaction, only triggered by "programming".

A smart contract can be deployed by a transaction, triggered by a transaction, or triggered by a smart contract call (provided that the contract has already been deployed)

Guess you like

Origin blog.csdn.net/m0_57219794/article/details/124864844