Smart contract is one of the hottest topics among entrepreneur, developers, architect, and strategists. This subject is critical especially when you need to put automation and comply it with the digital transaction’s regulations before storing it on the blockchain.
What Is Smart Contract
If you are thinking from an abstract definition, that a contract is a document which has terms and the legal law written and it has to comply with the respective industry or domain, then you are correct.
A contract is something where more than one parties agreed to do some business together under some sort of policy or law. So before the transaction is made, both parties must follow the terms and steps should be written in the contract to initiate any transaction.
For instance, a legal contract between the landlord and his tenant, where the tenant should pay some certain amount monthly or yearly. Also, in an agreement there might be a clause like after the end of some duration, 5% should increase the value of the rent. If one of the party disobeys the contract, then it will create the dispute, and if this dispute grows between the participants then obviously country’s legal jurisdiction will be involved.
How Automated Contracts Can Help
Similarly, this concept can be applied in the digital world where you can deploy such contracts on the blockchain’s network. This automation will help in an automatic deduction of the payment from the tenant’s wallet and transfer to the landlord’s wallet.
So, in this case, the landlord and his tenant are the participants, and they have their particular smart contract on the blockchain network. If tenant tries to pay less amount than the decided terms which were mentioned in the contract, then automatically the transaction will be rejected.
So as if a landlord would like to increase the rent before the end of the contract then his request will be rejected as well since everyone has to obey the digital law.
All these transaction’s decisions like rejection or acceptance of the transaction will come through the smart contracts. So no human intervention will be allowed nor could anyone distort the history or the data.
Smart Contract VS Traditional Software Code:
The smart contracts are nothing but scripts or code; The developer can create it by his magical hands. In other words, It is a software piece which has the if-then-else type conditions, and it executes on all the nodes in same time before anything would be written on the distributed ledger.
The concept is very powerful, and the difference between traditional software and the smart contract is the network-based execution before allowing the data on the blockchain. These smart contracts work on the protocol level of the blockchain’s development stack.
From traditional programming perspective smart contracts do not deploy only in one place, but instead, they will get deployed on several nodes. Remember, these nodes do not provide the high availability concept as compared to the traditional paradigm of distributed computing, in blockchain every node runs the same code regardless if any node is down or not. So every single node will execute the same transaction at the same time, and afterward consensus mechanism decides to put this data on the blockchain or reject it.
This powerful concept makes sure that even if one of the nodes is compromised then still other distributed nodes will do the consensus to add this data or reject it. Amazing concept isnt it?
How DAPPS can utilize smart contracts and data (Developer’s Perspective)
Now assume that you have developed an app called MyRentApp, where participants are tenants and landlords. You are storing some of the data like tenant name, address, profile and every month’s rent.
Now you are interested in taking your data on the blockchain, and your purpose is to get the benefit of the immutability or provenance of the data. Remember the blockchain data is decentralized, and no one can change its history. Or maybe you are now interested that every single tenant must pay to their landlord the cryptocurrency instead of the fiat currency.
So every month all tenants must pay their rent to the landlord, and you want to convert your App into a DApp by adopting the blockchain technology.
So one of the development steps is to make all the regular contracts into a smart contract of the “MyRentApp,” where each tenant must pay cryptocurrencies as rent for their landlord. To fulfill this purpose, the developer must write a smart contract on the Solidity language and deploy it on the Ethereum network. Let say the smart contract will check if the tenant belongs to the proper landlord, if the payment is equal to the decided terms and if the payment is according to the proper duration or date.
So every time any transaction will occur it has to go through these terms and once all things are validated, then the deduction will be made from the tenant’s wallet to send crypto rent to the landlord’s wallet.
I know the idea is fascinating, and this is the basic concept behind the Smart contract which you can expand in other similar industries.
Farhan Khan
https://www.linkedin.com/in/farhanhk/