by Katherine Webb

What is a smart contract?

A contract is an agreement between parties which binds them to certain obligations in the future. The term smart refers to an automatic digital contract, which is self-executing if the contract conditions are met and verified. A smart contract can handle transactions ensuring they are secure, accurate, fast, and cost-effective without involving third parties, such as bankers and lawyers. Smart contracts can be used to govern the transfer of digital assets. Moreover, smart contracts can govern traditional financial instruments, property sales, inheritance, marriage and employment contracts and much more.

History of a smart contract

Smart contracts were initially proposed by American computer scientist and cryptographer Nick Szabo in 1994 and again in 1997. Who interestingly also invented the virtual currency Bit Gold in 1998, a full 10 years before Bitcoin! The initial definition of a smart contract was “a computerised transaction protocol that executes the terms of the contract.”[i] In 2013, Vitalik Buterin went on to propose a decentralized blockchain-based smart contract platform called Ethereum.[ii] In 2015, Gavin Wood, Co-Founder of Ethereum added more formalisation to smart contracts and their implementation on Ethereum, and invented the smart contract programming language Solidity.[iii]

Currently the largest smart contract blockchain is Ethereum, but in recent months we are seeing the development of other smart contract blockchains including Solana, Binance Smart Chain (“BSC”) and Avalanche.

How does a smart contract work?

Smart contracts are self-executing computer codes, which follow very simple programming logic statements, to define an agreement between parties. Smart contracts are stored on a blockchain and are therefore replicated across multiple nodes. Meaning the contracts will benefit from the blockchain’s security, permanence and immutability. This allows a network of nodes to automatically execute the contract when predetermined conditions set within the contract have been both met and verified. If no transaction has been called, then no transaction will take place. Once a contract has been executed and the transaction is processed, a new block is created, meaning that the transaction cannot be cancelled or altered after it has taken place. Smart contracts rely on data from oracles, as well as data associated with any public address or with another smart contract on the blockchain. Smart contracts can become very complex in nature, as there can be as many different prerequisites as the contract’s participants require. For example, Aave, a decentralized lending protocol, stores tokens within its smart contracts, and uses a system of smart contracts to manage their assets.[iv]

When designing a smart contract, the protocol team must decide how they will handle transactions and how to store that data on the blockchain. They must agree on the rules which will govern the operation of the smart contract. Developers should also try to exploit their own contract for flaws and variabilities. Currently, most smart contracts are written in either Solidity, Java, JavaScript, GO or C++, and more recently, newer languages including Haskell and Substrate.

Why are smart contracts important?

The foundation for all decentralized finance (“DeFi”) protocols and dApps functionality is via smart contracts. Current interactions through web server applications such as Amazon and eBay don’t allow the user to see the internal logic function for the application and have no control over the environment in which they are executing that transaction. This requires a user to trust the application due to the lack of transparency. Smart contracts solve this by being in a trustless environment, a blockchain and therefore the contract itself, its transactions, and the tokens being held within that contract can be seen publicly. An additional benefit of smart contracts is security because the blockchain provides cryptographic encryption for any sensitive information that is stored. This data is therefore permanently stored on the blockchain and cannot be altered because the smart contract cannot be changed once it is deployed on the blockchain. Smart contracts work autonomously, without any central authority, legal entity, or external enforcement agency. This massively increases the speed for the transaction as well as reduces the cost compared to traditional financial transactions.

Gas Fees

Smart contracts are deployed on a blockchain, for example the Ethereum network. In such circumstances, a given contract will be executed on all the nodes attached to the ETH virtual machine. In order to power the computational resources needed to execute any transaction a gas fee is required to be paid to compensate the miner, by the party making the transaction. The more complex a transaction is, the more gas it costs to execute. The introduction of gas fees means it is expensive to spam the network, so only transactions that users are willing to pay gas for will be sent. Each operation that a smart contract performs costs gas, a user therefore must set a gas limit, which is the maximum amount of gas they are willing to pay for the transaction. As the price of a gas fee is paid in the network token (ETH for Ethereum, SOL for Solana and BNB for BSC) they are not set and can fluctuate. Gas fees also increase when the network is experiencing high transaction volumes.

Risks of Smart Contracts

Smart contracts can be exploited via security breaches, vulnerabilities in the smart contract code, or improper administration by the protocol team. There are also technological infrastructure failures to consider including the blockchain going offline, like Solana did in September 2021.[v] Developers should ensure they robustly test their smart contracts to ensure they have the ability to mitigate potential risks to its functionality. The team’s network administrator will require a governance process as well as control over the smart contract to deploy or amend an existing smart contract. Oracles provide blockchain networks and the smart contract themselves with data feeds, any issues or attacks (typically implemented using flash loans) on an oracle’s data feed could result in disastrous results, including token price manipulation.

Future

We are seeing ever growing numbers of smart contracts being used on an increasing number of blockchains, with a new DeFi dApp going live almost daily. Ethereum still remains the largest smart contract ecosystem. But briefly in January 2021, we saw transaction volumes and number of unique addresses on the BSC network overtake those on Ethereum, with many users citing expensive gas fees as the reason for migrating to BSC.[vi] This has led to other smart contract platforms gaining popularity, which is reflected in their underlying token prices increasing, as well as the number of active users and transactions. We are also seeing huge amounts of investment activity into smart contract enabled ecosystems, including Solana, Avalanche and Algorand. The recent Alonzo hard fork update will allow smart contracts to be written on the Cardano blockchain.

Further reading

The opinions expressed in the CrossTower Classroom are those of the author(s) and not necessarily that of CrossTower. We appreciate diverse perspectives of our employees and we thank them for having a voice.

Share

CrossTower Inc. provides this content for general information purposes, to better inform you on your digital asset investment journey. We do not provide investment recommendations or provide tax advice. Please consult your investment professional or tax advisor if you require assistance in these areas.

Ready to get started?

Subscribe below and get started on your CrossTower journey. We offer a variety of informational content along with our top tier trading services.