Smart Contracts : What they are how they work

in #blockchain6 years ago

Smart contracts are very popular nowadays, what are they and what problems do they solve. The term “smart contract” was first used by Nick Szabo in 1997, long before bitcoin was created. He is a computer scientist, law scholar and cryptographer. In simple term he wanted to use distributed ledger to store contracts. Smart contrast are just like contracts in real world. The only difference just they are completely digital. In fact a smart contract is actually a tiny computer program that is stored inside a blockchain.

Let’s take an example how smart contracts work. Let’s take example of kick-starter (Kickstarter is large fund raising platform). Anyone can go Kickstarter, create a project, set a funding goal and start collecting money from others who believe in your idea. Kickstarter is essentially a third party that sits between you and supporters. This means both of them needs trust Kickstarter to handle their money correctly. If the projects gets successfully funded project team or you expects Kickstarter to give them their money. On the other hand, supporters want their money to go to the project if it was funded or to get refund when it has not reached its goals. Both the product team and supporters have to trust Kickstarter, but with smart contracts we can build a similar system that does not require a third party like Kickstarter.

So let’s create smart contract for this, we can write a tiny program for this so that it holds all the received funds until certain goal is reached. The supporters of project can now transfer their money to the smart contract. If the project gets fully funded, the contract automatically pass the money to the creator of the project. If the project fails to meet its goal, the money automatically goes back to its supporters. Because smart contracts are stored on a blockchain, everything is completely distributed. With this technique no one is in control of money.
Now, why should we trust a smart contract? Well because smart contracts are stored on blockchain, they inherit some interesting properties. They are immutable and they are distributed, being immutable means that once smart contract is created, it can never be changed again. So no one can go behind your back and temper with the code of your contract. Being distributed means that output of your contract is validated by everyone on the network. So a single person cannot force the contract to release the fund because other people on network will spot this attempt and mark it as invalid. Tempering with smart contract become almost impossible. Smart contract can be applied to many different thing, not just to crowdfunding. For example banks can use it issue loans or to offer automatic payments. Insurance company could use it to process specific claims and postal company could use it for payment on delivery.
So now you might wonder where and how you can use smart contracts. Right now there are handful of blockchains who supports smart contracts but the biggest one is Ethereum. It was specifically created and designed. To supports smart contracts.
Smart contracts can be programed in a special programing language called solidity. This language was specifically created for Ethereum and uses a syntax that resembles JavaScript. It’s also worth noting that bitcoin also has support for smart contracts although it’s a lot more limited compare to Ethereum.
So now I hope you understand what smart contracts are and how they works.

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 70586.26
ETH 3763.77
USDT 1.00
SBD 3.79