Smart Contracts

Smart Contracts - The concept and Applications

By Sumukh | CryptoBomb | 4 Dec 2020


The Concept Of The Smart Contract

                                                                Eth

Smart contracts are programs or we can simply say its a buzzword for a program, which is just a computer code.

For example,

  • Take a look at how a credit card work, imagine you have set a auto payment date on 20th of every month which will make the credit card company to automatically make the payment of the card balance. For this, we make a deposit or a checking account with the credit card issuer where the money gets debited on 20th of every month according to the balance of your credit card.
  • If there is not enough money on your checking account to cover the payment, we will likely get a late payment penalty. In practice, the whole arrangement is nothing but a bunch of computer code sitting on a server of the issuing bank.
  • For instance, there could be some sort of code to check whether the day of the month is 20 if yes, then it may initiate a debit transaction for the amount owed. Then, there can also be a code to check whether the checking account balance is lower than the balance owed. If so, it rejects the transactions and add some penalty to it. This can all be done with some sort of if else or some decision making or conditional statements.
  • we could have this same code running on a decentralized network of nodes like Ethereum blockchain. If the issuer and the checking account bank are all connected to the network, the code could be uploaded and run there and achieve exactly same effect.
  • This is the idea of the Smart Contract.

In the Bitcoin Blockchain, the only code that we can upload are the simple transactional values like who gave to whom and when etc. But, The Ethereum blockchain expands the functionality by allowing us to upload almost any code we like. Therefore, the nodes need to record more complex tasks than simple transfers, tasks like credit card auto payment example.

More complex the programs are, the higher the Gas or the transactional fee will be.

Ethereum have its own programming language solidity for users to write the programs, the language is quite similar to python. On the Blockchain the data is stored exactly the same way in the hash formats and the linked lists. In the Ethereum blockchain the general scripts are included along with the conditions of the scripts, the conditions are called program states.

Let's see how these codes can be implemented

                                                         8159fea9c2446ca05cf9441061dd81cbc5b35bf94a187eac24bcd14ab937a365.jpeg

  • As we know in Bitcoin, we could send some Bitcoin from our address to another, signed using our private key.
  • Now in Smart Contracts, instead of sending it now, suppose we want to send it tomorrow, we can send it tomorrow by simply writing a program to send the required amount of Ether to the destination address tomorrow.
  • The code could be a conditional statement If the date is matched with tomorrow's date then the transaction is done else not done, so these will be the conditional statements which could be coded as smart contract.
  • So, Smart contracts in Ethereum can run any kind of code from simple to complex, from basic hello world! scripts to fully complex codes.

Applications of Smart Contracts

In Ethereum we certainly cannot run large scale programs or complex simulation based programs, as it would take more time and because of its complexity the transaction fees will touch the sky.

So, while it generally cannot support super complex programs, any output of the programs and the associated conditions are all recorded on the blockchain, and the blockchain is the permanent record of execution of the program.

The best use of Ethereum blockchain is to execute programs that are simple to  compute, but the verification or trust is important.

  • For instance a seller selling a product to a buyer, it could be a simple business contract where the seller promises to deliver the goods by a certain date and the buyer promises to pay upon the receipt of the good with correct proof for delivery.
  • The above contract will not have many conditions and can be easily coded in a programming language like Solidity, they can simply write a code with specific product type, delivery date and the price with the proof of delivery and also today's date. And then, both seller and buyer can sign the code with their keys.
  • The nodes will then store the code and will start monitoring the conditions like the current date, the date of delivery and whether the approval of delivery has been uploaded by the parties etc.
  • Consequently, the blockchain is not actually used much for general business contracts they are used more for launching new crypto tokens.
  • With the idea of blockchain it is easy to launch our own token without even having our own blockchain, this can be done with just simple lines of smart contract codes. This is the reason why many number of tokens exploded in the markets.

 

THANK YOU

 

Hope you liked it!, Don't forget to like..

 

NOTE

  • All the images used in this are allowed to use for commercials and is from Flickr site : https://www.flickr.com/

 

 

How do you rate this article?

11


Sumukh
Sumukh

I'm a Computer Science Engineer, Programmer and a Cryptocurrency enthusiast, want to explore more by reading some of the very useful and interesting topics here and also publish some of mine.


CryptoBomb
CryptoBomb

All about cryptocurrencies... +_+

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.

Page not displaying correctly?