Smart Contracts: The Good, the Bad, and the Ugly
Smart Contracts are one of the biggest drivers behind the enthusiasm for blockchain. The idea is that contracts can be translated into code, which is then distributed to multiple nodes in a blockchain. As it executes, the outcome is also recorded in the blockchain: the exchange of assets, the access to property, the receipt of items, among others.
The power of Smart Contracts is that they remove counter-party risk, and with that they make escrows and middleman services redundant. This is better seen with an example:
Say you decide to buy a plot of land in Georgia (the country). They happen to be piloting land titling based on blockchain. You enter into a contract to buy some land by putting a small deposit upfront and committing to pay the full amount by a certain date, while you look for financing. A Smart contract could verify if your payment took place on time, release the funds and change the title on the property, or cancel the contract altogether and liquidate the deposit if you were unable to find financing. There would be no need for an escrow service to keep your deposit, for a title company to verify payments, or for a titling clerk to update the records.
For this to work well, several conditions have to be met – and they speak to the main limitations of the concept:
- First, these contracts would need legal recognition to be enforceable.
- Second, the inputs and outcomes of the smart contract (land title, payments, dates) have to be in blockchain. This does not necessarily mean you have to pay for the land using bitcoins (although that would work), but you need a way to record your payments in blockchain.
These limitations will determine the range of applications for the Smart Contracts. Can we get every clause in a contract modeled in the blockchain? What happens when a judge rules something not considered in the initial design?
In the last year, we built a blockchain solution on Ethereum, one of the first platforms to fully support Smart Contracts. So on top of the big picture issues, we learned a lot about the implementation of and the technology issues that Smart Contracts have:
- They may be buggy, just like any other code. Debugging and testing them is quite involved due to the lack of tools. If Smart Contracts take off in popularity, expect new services and technology focused on doing all types of security checks before they are deployed.
- Contract complexity is limited. In Ethereum, this is expressed as a “Gas Limit”: the fee that you pay to execute your transaction is capped by the network. This prevents issues with buggy or malicious code clogging the system. But your transaction cost depends on lines of code executed – literally- and you may not have full control on that. For instance, loops running a variable number of times can run out of gas in the middle of the execution. As the amount of gas you can spend is capped, you may not be able to process a transaction.
- In the past few months, Gas Limits have been more of an issue because Ethereum lowered them several times to fight the DDoS attacks they experienced. Changing network conditions or specifications on short notice will create havoc: for us, it was contracts that were too big to execute and transactions that could not be processed.
Vitalik Buterin, the co-founder of Ethereum, said in March of this year: “This is still an experiment.” It was a good reminder for anybody working with this powerful technology.
Stay in Touch
Keep your competitive edge – subscribe to our newsletter for updates on emerging software engineering, data and AI, and cloud technology trends.