Eli5 what is a smart contract? Or what does a smart contract do?


Eli5 what is a smart contract? Or what does a smart contract do?

In: 5

Normal contract. Gotta hold them to it.

Smart contract. Holds you to it automatically.

With the premise that coins hold value it’s a computer program that mimics a financial transaction. You know a translator program will accept a word and spit out a different word. A token exchange smart contract works by taking a coin and spitting out another one. The translator doesn’t need an escrow since the translator is an open program. Similarly a smart contract doesn’t need an escrow since it is an open program. It could be as simple as, “if wallet A receives coin X from wallet B then wallet A will send coin Y to wallet B (assuming there is enough stock and that the smart contract controls wallet A).

Smart contracts go beyond token exchanges and even then the mechanics are a lot more nuanced.

There are many types, but I’ll use Kickstarter as an example. Say you want to fund your project through kickstarted and have a goal of $10,000 or it doesnt get funded. Uh oh, only $8,000 gets raised in this time so you dont get funding! People should now get their money back right? Of course, those were the rules, but now we have a situation where Kickstarter is the authority in this situation. They could A) give the money back to the people, B) Give the money to your project anyways, or C) Steal all the money for themselves.

In this scenario, we have to rely on and trust Kickstarter as the centralized organizer of this fundraiser. They are the 3rd party between you and the donators who makes sure things go to plan.

Now, what if we simply replace Kickstarter altogether with a smart contract? The contract is simple yet effective code that says: if $10,000+ is raised, release money to developer. If $10,000 isnt raised, transfer NO money. Since the smart contract is on the blockchain, everyone is able to confirm how much has been raised, and if not enough is raised, they all confirm that this amount was not reached.

Since the contract see’s everyone agreeing the conditions were not met, it does not transfer any of the funds. The developer cant scam the system or change the conditions as the contract is distributed on the blockchain to everyone. If he hacks/changes his copy of the agreement, the thousands of other versions are going to still say “he gets no cash” and majority wins.

The smart contract is open source and can be seen by everyone. It has no free will and cannot “steal” the cash like Kickstarter theoretically could once they have posession. Essentially, only 2 outcomes can happen both of which are exactly what we want based on the inputs.