What is Smart Contract
Content
As more and more digital currencies enter everyone’s field of vision, it is believed that blockchain will rapidly spread to all corners of the world through flood algorithms at an unprecedented speed, so the rooting of major platforms and the development of ecology are naturally inseparable from one. Something magical~~~
Smart contract---aka SMART CONTRACT
When it comes to smart contracts, one has to mention Ethereum, a blockchain platform based on bit blockchain technology created by an American Russian guy. Two magical things were born on this platform, one is the general purpose of Ethereum. Currency, Ether, and the other is a currency token that serves as a currency token.
The entire Ethereum network is a huge number of interconnected nodes (can be understood as countless computers). In fact, the entire network can be regarded as a single entity, referred to as the "Ethereum Virtual Machine" or EVM for short. All transactions that occur and will occur in this network are automatically updated and recorded in an open distributed ledger.
The workflow of the smart contract can be easily understood through the following figure:
Smart contracts are a key role in the establishment of the Ethereum ecosystem. When someone wants to complete a task in Ethereum, they initiate a smart contract with one or more people. This contract is actually a series of instructions, written in the programming language "solidity", which works on the basis of IFTTT logic (that is, IF-THIS-THEN-THAT logic). Basically, if the first set of instructions has been completed, then execute the next function, and then continue to the next function until the end of the contract is reached.
The best way to understand this is to imagine a vending machine. Each step you take is like a trigger for the next execution itself. This is a bit like a domino effect. So, let's take a look at the steps to be taken when interacting with the vending machine:
Step 1: You insert coins into the vending machine
Step 2: You press the button corresponding to the goods you want to buy
Step 3: The goods roll down, you collect the goods
Now look at all these steps and think about it. If the previous step is not executed, can any step work? Each of these steps is directly related to the previous step. There is another factor to consider, it is an integral part of the smart contract. During the entire interaction with the vending machine, you (the requester) just work with the machine (the provider). There is absolutely no third party involved.
So, what if this transaction now appears to happen on the Ethereum network? Suppose you just bought something on a vending machine on the Ethereum network. What about these steps?
Step 1: Invest in the vending machine, which is recorded by all nodes in the Ethereum network, and the transaction is updated in the ledger.
Step 2: Press the button corresponding to the item you want, and update the record in the Ethereum network and ledger.
Step 3: The project comes out, you collect it, this is all the nodes and the ledger that are recorded
It can be seen that every transaction you make through the smart contract will be recorded and updated through the network. The purpose of this is to make everyone involved in the contract responsible for their actions. It makes the entire network transparent and fair, so that every transaction can avoid human greed and malice.