Brief Explanation of what are Smart Contracts

0 21
Avatar for Treater98
2 years ago

A smart contract is a code which is stored and executed on a blockchain (and its nodes).

It can receive, store and send funds. (In some cases is even needed an interaction with "secondary" smart contracts)

It's main feature, which makes it reliable and secure, is that there is no human interaction, or better, there is no human decision involved in the application of a smart contract.

An example, that will help us to understand better how the smart contract is, is the "vending machine" example.

A vending machine is programmed to obey to determined inputs, which means that if you wanna get something which is inside, the vending machine will give it to you only if you respect the condition imposed by its code, which is just the payment of the price.

This is the base structure of each smart contract: if something happens, then something else is gonna happen.

This cuts off every possible human error. SC are reliable because they work (as every code) in a deterministic way.

If the input by the user is X the machine will give only equal amount of worth, which can be Y item or Z item + change.

SC are immutable (on ETH blockchain), which means that once a contract is released on the blockchain, it will no more be possible to modify it.

SC may even be decentralized, which means that there is not a single computer running the code for every user using it, but every node of the blockchain store and execute the contract in the exact same way.

Smart contracts are trustless, which means that to do an operation, you don't need to have any trust towards the users involved in the operation.

To make things clear let's make another example:

When a person wants to "swap" something for something else (money for goods or money for money or even goods for goods) 2 cases may occur:

-Person A trusts person B and reverse, this way both of them can have no fear of losing what they are involving in the exchange;

-Person A doesn't trust person B, which means that the exchange is not gonna happen peer-to-peer. Instead, there will be "someone" involved in the exchange which will hold for both users the goods/money and will swap them giving to each person what they wanted.

Still in this case, both person A and person B need to trust the "someone" who is holding the 2 goods/money before the exchange. This someone usually is a Bank or a third party trusted service.

These operations anyway have a critical issue, the human factor.

Smart contracts instead don't need any user to trust any other user because it will be the smart contract to make both parts "respect" the operation. Users can trust the smart contract because the code is decentralized and is open source.

Smart contracts are fast compared to ordinary swaps (which can take days) because the single transactions rely on the speed of the blockchain (meant as the time needed to confirm a transaction).

3
$ 0.20
$ 0.20 from @TheRandomRewarder
Avatar for Treater98
2 years ago

Comments