My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Dumb or Smart Contracts?

Dumb or Smart Contracts?

Are smart contracts really smart? A few dislikes about the language behind smart contracts.

Johnson awah Alfred's photo
Johnson awah Alfred
·Jul 10, 2021·

3 min read

The blockchain is great, likewise, it's growing ecosystem. With bitcoin being the first generation of the blockchain, we've experienced speedy growth which has given birth to more decentralized solutions like the Ethereum blockchain. With the birth of Ethereum comes the "Smart Contract" that runs on the Enthereum Virtual Machine where programs are executed in exchange for gas fees.

For the short while learning about blockchain technology, there's been this argument attached to the Ethereums Smart Contract, are they really smart? For total newbies with little or no knowledge about this technology, you would really think they are smart as the name implies. The ultimate goal of this article is to express my opinions and ideas about why the term 'Smart' should be replaced.

About Smart Contracts

A smart contract is a self-executing contract with the terms of the agreement between buyer and seller being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. The code controls the execution, and transactions are trackable and irreversible. They are written in a programming language called solidity.

As a form of encouragement, here are a few interesting things about the smart contract and its associated language.

  • Solidity as a language is statically typed, and to my best of knowledge has to be one of the best features a language should come with out of the box.
  • Memory management is awesome.
  • Cryptographically secured transactions.
  • User-Friendly syntax.

It's about time to talk about why the ethereum team should have a second thought about renaming "Smart Contract". These points of mine are with respect to the solidity language because yeah, it's totally behind birthing any smart Contracts. These points are not particularly pitfalls of the language but more of a few things that are left out and implemented wrong ( to me ) as listed below.

1. String Comparison

There are a few weird things about using strings while working with solidity, particularly comparing a string with other data types.

Wrong Code

 if (username == "deepak") //error: operator == is not compatible with string ?
        {
            return true;
        }

Like why can't I do it like that?? 😔😔

Correct Code ✅

function compareStrings(string memory a, string memory b) public view returns (bool) {
    return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b))));
}

It's the stress for me 😶 . Not so smart

2. Poor debugging

For popular languages like javascript, it ships with the console.log debugging feature. There's probably a reason behind this, most likely behind the architecture of the technology. The absence of something similar to this makes it less smart. 🏃‍♀️🏃‍♀️

3. Cost money to perform function calls

Honestly, taking extra cash for transaction calls is regular with the Ethereum Blockchain. Saving me some funds would be a smarter move yunno.

With these few points of mine, I hope to convince and not confuse the Ethereum Community to re-consider renaming smart Contracts to something we can all relate too without doubts.