SmartContract
Introduction
A blockchain is a growing list of records, called blocks, which are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. By design, a blockchain is resistant to the modification of the data.
Given that a blockchain is a decentralized system that exists between all permitted parties, one of the best things about it is that there is no need to pay intermediaries (middlemen), saves time and removes any potential conflicts among the parties. Blockchains have their problems, but they are rated undeniably faster, cheaper, and more secure than traditional systems, which is why banks and governments are turning to them.
Imagine if there were some self-executing contracts, in which contracts would be converted to computer code, stored and replicated on the system and supervised by the network of computers that run the blockchain. All of this is what makes up smart contracts.
WHAT ARE SMART CONTRACTS?
A smart contract is a computer code running on top of a blockchain containing a set of rules under which the parties to that smart contract agree to interact with each other. If and when the predefined rules are met, the agreement is automatically enforced. The smart contract code facilitates, verifies, and enforces the negotiation or performance of an agreement or a transaction. It is the simplest form of decentralized automation.
In simpler words, a smart contract allows exchanges of any type of assets like money and property in a conflict-free way without the services of a middleman. Hence it facilitates a trustless execution which is an important feature that is promised by a smart contract.
Bitcoin was the first to support basic smart contracts in the sense that the network can transfer value from one person to another. The network of nodes will only validate transactions if certain conditions are met.
Here is an example of a simple smart contract where we use simple set and get functions to increment and decrement some data.
Features Of Smart Contracts
Various features provided by smart contracts are:
Trust: Your documents are encrypted on a shared ledger. There’s no way that someone can say they lost it. Smart contracts allow parties to commit and bind by the conditions and rules written inside it.
Transparency: All the contractual obligations are written inside a smart contract with intricate details so anyone can read the details before agreeing, thus eliminating any chance of future disputes. There is no miscommunication as all the information is open to everyone.
Autonomous: You’re the one making the agreement; there’s no need to rely on a broker, lawyer or other intermediaries to confirm. This also knocks out the danger of manipulation by a third party, since execution is managed automatically by the network.
4.Accuracy: Automated contracts are not only faster and cheaper but also help to avoid errors that could potentially arise from a person drawing up the contract. In a manual contract, contractual conditions may be accidentally omitted or may be misleading but in smart contracts conditions are coded in a logical and detailed form, resulting in fewer errors.
5.Speed: It could take a significant amount of time to interpret, process and execute a contract manually. Smart contracts contain computer code that is executed automatically, saving significant amount of time.
6.Savings: Smart contracts can provide significant savings as it removes the need for intermediaries. For instance, you would pay a lawyer for drawing up a contract manually but in smart contracts it’s all in your hand as the code is the law.
7.Safety: Your data is kept safe by a secure cryptographic encryption. Since this form of encryption boasts the highest level of data security standards, critical data and processes can be safely protected.
PROBLEMS
1.No Business Ready Solution A major problem with smart contracts is that you simply cannot replace it with an upgraded one otherwise you will lose all of your smart contract bound information from the blockchain.
There was also a vulnerability in smart contracts, the infamous DAO hack that caused a breach of about $150 million.
2.Legal Issues The biggest limitation is based on their current inability to account for implied expectations or deal with unforeseen circumstances.
There is also a problem of forgery which can be seen after receiving the product but that transaction can’t be replaced. What to do now?
Eg: Someone was selling a baseball with a sign of someone famous but after receiving the ball you see that the signature was forged a long time ago, under contract law you should be able to return the product but as of now it is not possible.
As of now, it is very difficult to account for all the problems beforehand in a self-executing contract.
3.Writing Contracts Writing smart contracts is extremely difficult as it assumes Turing-complete context which is extremely tough to execute and analyze. It is like proving that a computer program doesn’t have bugs which is extremely tough as every program in existence does have some bugs.
4.Oracles An oracle is just a provider of data. An oracle gives smart contracts answers to questions about the world.
The problem with Oracle is like it’s a third party and completely centralizes the smart contract which loses its main property of trustless execution.
PROBLEM SOLUTION
We can solve some of the problems with smart contracts like upgrade problems by using modular smart contracts. So, we can have modular.sol files while building on Ethereum that can be easily upgraded without losing information.
Using Delegatecall-based proxies for contract upgrading. In delegatecall logic data are kept in separate contracts, but the data contract (the proxy) calls the logic contract through delegatecall. It is difficult to apply the delegatecall-based proxy pattern correctly. The proxy pattern requires that memory layouts stay consistent between contract and compiler upgrades. A developer unfamiliar with EVM internals can easily introduce critical bugs during an upgrade.
The legal issues of smart contracts can only be solved over time as they are in their initial development stage; it will require time.
The major problem of writing smart contracts can be solved by not implementing Turing-complete smart contracts.
And, the oracle problem can be solved maybe by a consensus protocol in the community itself which will help to see how things are in the physical world.
APPLICATION OF SMART CONTRACTS
1.Digital Identity: Smart contracts allow users to own and control their digital identity i.ie data, reputation and assets. It provides enterprises with the opportunity to seamlessly know their customers while individuals may not disclose sensitive data which reduces the frictionless know-your-customer requirements.
2.Financial Data Recording: Financial organizations can utilize smart contracts for accurate, transparent financial data recording. Smart contracts allow for uniform financial data across organizations, improving financial reporting and reducing auditing costs.
By improving data integrity, smart contracts support increased market stability. They also reduce accounting costs by allowing cost sharing among organizations.
3.Healthcare: Personal health records could be encoded and stored on the blockchain with a private key which would grant access only to specific individuals. The same strategy could be used to ensure that research is conducted via HIPAA laws (in a secure and confidential way). Receipts of surgeries could be stored on a blockchain and automatically sent to insurance providers as proof-of-delivery. The ledger, too, could be used for general healthcare management, such as supervising drugs, regulation compliance, testing results, and managing healthcare supplies.
4.Real Estate: You can get more money through smart contracts. Ordinarily, if you wanted to rent your apartment to someone, you’d need to pay a middleman such as Craigslist or a newspaper to advertise and then again you’d need to pay someone to confirm that the person paid rent and followed through. The ledger cuts your costs. All you do is pay via bitcoin and encode your contract on the ledger.
CONCLUSION
Smart contracts do offer a lot and have shown signs of how promising they can be, but they are still in their initial stages so with time maybe we will see their actual potential which could provide for all sorts of social changes which is really exciting.
A big problem lies with the organizations as well, as they are adopting blockchains due to the buzzword but not considering how to use it to its fullest. If organizations manage that beforehand then maybe writing smart contracts can get easier.
But the actual problem still lies in writing smart contracts and gaining the trust of people again after the DAO hack.
In the coming future, we may witness a hybrid of paper and digital content where contracts are verified via blockchain and substantiated by physical copy.
Last updated