Smart Contracts | A Beginners Guide

smart contracts

A smart contract can be thought of as self-explanatory: a “contract” or contractual terms, that are “smart” by way of computerized, self-execution. Smart contracts are the foundation of blockchain technology, digitizing traditional business transactions and saving trees one paperless contract at a time. So, what exactly do they do?

This article will walk you through the history and interworking of smart contracts, the legalities, and helpful tips on creating your own, hopefully answering the most frequent questions regarding these complex programs.

What is a Smart Contract?

In the words of Nick Szabo, the smart contract developer himself, “a smart contract is a computerized transaction protocol that executes the terms of a contract. The general objectives of smart contract design are to satisfy common contractual conditions (such as payment terms, liens, confidentiality, and even enforcement), minimize exceptions both malicious and accidental, and minimize the need for trusted intermediaries.” 1

Like a traditional contract, smart contracts contain mutually agreed upon terms, rules, or promises between parties. However, rather than written and signed, they take the form of programmable computer codes that are automatic and self-executing.

These codes are stored on a “publicly accessible ledger that relies on a distributed proof system to prevent falsification of records” (”Blockchain”). 2 Computer codes are programmed on a blockchain to trigger an action when pre-determined conditions are met, thus executing the contract terms securely and accurately. 3

Imagine someone buying a drink from a vending machine; they first deposit $1.50 and press a3, then the machine dispenses the coke from the a3 slot. If the vending machine receives the required value, then the determined action will be executed. Szabo used this analogy to explain smart contracts – the underlying program functions using if-then logic.

A smart contract is coded such that if an initial X action takes place, then a Y action will be executed. Then a Z action, and so on.

Smart contracts have become the backbone of the crypto industry, allowing developers to build decentralized applications, tokens, decentralized autonomous organizations, and other custom protocols.4 Operating on a blockchain allows for secure, immediate, and decentralized transactions that are immutable, transparent, and publicly accessible.5

A Digital Vending Machine | The History of Smart Contracts

>
Years before blockchain technology and even Google were invented, cryptographer and computer programmer Nick Szabo published a paper conceptualizing a new way to “formalize a relationship” through software and technology, a development he believed would be made possible by the digital revolution.

Coining the term “smart contract,” he defined them as a “set of promises, specified in digital form, including protocols within which the parties perform on these promises.”6 He introduced four objectives of a smart contract design: (i) observability, (ii) verifiability, (iii) privity, and (iv) enforceability. 7

Transparency of execution and performance, security, and self-enforcement were the framework principles of Szabo’s design and are still reflected in the traits of smart contract adaptations today.

The introduction of blockchain technology provided the foundation for Szabo’s idea to come to life. The decentralized and transparent nature of a blockchain network allowed for the “self-execution” layer of Szabo’s original concept, finally presenting the optimal infrastructure for the program’s capability.8

Utilizing this technology, Vitalik Buterin became the first to introduce smart contracts in practice with Ethereum, a decentralized, open-source blockchain designed as a platform for smart contract functionality.9

Ethereum elevated smart contracts’ popularity and implementation; today there are over ten smart contract platforms run on various blockchain networks and hundreds of apps that use them. However, Ethereum remains the most popular platform for creating smart contracts to date.10

Decoding the Technology: How It Works

To understand how a smart contract works, it is important to understand blockchain technology. A blockchain is a decentralized network that stores a continuously updating list of records, in the form of “blocks,” linked through cryptography.11 There is no central database; the information stored is shared across all computers on the network and any changes to a record will be updated across the entire network.

Transactions that are executed on a blockchain, such as those using a smart contract, are grouped in blocks and linked on a chain in a linear chronological sequence. A block must be completed for a new one to be created, and the new block will contain a “cryptographic hash,” an algorithm that translates data into a numerical string used to verify the validity of the data,12 of the previous block.13

smart contract steps

The functionality of a smart contract can be understood through a sequence of steps. First, as with any traditional contract, there must be an agreement made between two or more parties. The terms or conditions that will “complete” the smart contract must then be established by the involved parties. They must agree upon how the transactions will be represented on the blockchain, the if/then rules that will govern those transactions, possible exceptions, and a conflict resolution framework.14

These conditions could include simple events such as payment authorized, shipment received, or maximum reached; more complicated events can also be encoded like calculating the value of a derivative and processing its trade or releasing payments if a certain event takes place.15

The agreed-upon terms are translated into programmable code and written into the smart contract, which is then recorded and stored in the blockchain network. The specified actions are executed by a set of nodes once the terms of the contract have been satisfied.

The transaction is verified using a proof-based consensus mechanism such as Proof-of-Work or Proof-of-stake, where each node proves that it has executed the specific operation or owns a certain value.16 The first to present its validation is allowed to record their results on the blockchain; the result gets written into a block that is added to the blockchain and updated across the entire network.17

Advantages and Disadvantages

Advantages

Decentralization, Speed, and Accuracy

The key to smart contracts is the lack of intermediary or authority, allowing them them to be highly decentralized. The self-execution allows for immediate and precise transaction absent of human error.

Trust and Transparency

Since the blockchain is immutable and public, anyone can analyze the transactional history, creating a trust-less relationship. There is no need to doubt the integrity of the contract.

Security

Transactions recorded on a blockchain are encrypted and linked to previous and subsequent transactions. They are also shared across the entire network. This makes it extremely difficult to hack or tamper with.

Cost Effective

Since there are no intermediaries, you avoid extra fees.

Disadvantages

Weak Legal Support

There is a lack of legal recognition of smart contracts, and legal support often requires finding a lawyer who has knowledge of the smart contract technology.

Technology Dependent

While smart contracts help mitigate most human error, it is still possible that the developer makes mistakes when writing the code. Furthermore, since they are technology dependent, there is also the chance of software bugs.

Immutable

Ironically, one of the biggest pros of a smart contract is also a con. Since blockchain records are immutable, it is extremely difficult to alter or void a smart contract.

Top Platforms

top platforms

Latest data obtained Dec. 9, 2022

Creating a Smart Contract

Step 1: Contract Concept

You can’t reach a goal without first defining a goal! What do you want your contract to do? What problem do you want to solve? What conditions do you want to include?

Knowing the basic intentions and characteristics of your desired smart contract will help provide clarity and preciseness through the coding process.

Step 2: Choosing a Platform

It is crucial to perform due diligence on the various platforms available for you to implement your smart contract. Each platform has its own distinct perks and flaws, so knowing a platform’s advantages and disadvantages can help you decide which is best suited to host your program.

Some platforms such as Ethereum and Solana provide their own guides to smart contract development on their platform. That’s why it is helpful to determine your desired platform first; your process may be simplified with step-by-step instructions depending on which you choose.

Step 3: Choosing Your Tools

There are several development tools that can be utilized in the creation of a smart contract. Some tools are essential to a smart contract’s functioning, while some are optional for contract enhancement.18

Programming Languages

The programming language is essential to the coding process and normally determined by the blockchain. Here are some of the languages you should be familiar with:

  1. Solidity. A high-level object-oriented language used on Ethereum that is statically typed and enables inheritance, libraries, and sophisticated user-defined types.
  2. Vyper. A PYTHON-based language also used on Ethereum. It is contract-oriented and uses strong security, easy code readibility, and compiler simplicity, making it more developer-friendly.
  3. Rust. A performance-based language used both in and outside of smart contracts. Using a rich type system and ownership model, it allows for easy bug elimination. Rust can run on Ethereum or other blockchains.

Others include Javascript, C++, Go, C, and DAML.

Development Environments

These tools help write and test the code.

Remix, EthFiddle, Visual Studio Code, and Atom, are common examples of these tools.

Frameworks

A framework is essential for effective testing and deployment. Your choice of framework should reflect your personal preference and experience level.

Some common frameworks include:

  • Hardhat
  • Truffle
  • Brownie
  • DappTools
  • ApeworX

Testnets

A testnet enables you to test your protocol in a controlled environment to make sure it’s operating as expexted.

Common testnets include: Rinkeby, Kovan, Hyperledger Umbra, Ropsten.

Wallets

In order to access and interact with web3 decentralized applications, you must first have a smart contract wallet.

Popular wallets include Metamask, Phantom, and Coinbase Wallet.

Step 3: Development

Now that you have your contract characteristics, your platform, and your tools, you are ready to start developing your code!

To assist in writing your code, developers can use templates or open-source libraries. Accordingly, every blockchain has an internal development toolbelt. For example, OpenZeppelin is popular when building Ethereum smart contracts.

Step 4: Testing

Once the smart contract is deployed on the blockchain, there is no way to go back and amend the code. This is why it is vital to test the contract before deployment and resolve any possible errors.

The aforementioned testnets are utilized in this stage. Generally, your choice of blockchain will determine the testnets available to use.

Step 5: Deployment

The last step in creating your smart contract is deployment. The smart contract must be converted into the appropriate file before deployment; this is where the framework tools come in handy.

Once the contract is converted and ready, it’s time to “go live” and deploy!

FAQ

  • Are smart contracts legal?

A smart contract is normally a legally binding agreement, however it is not necessarily always legally binding. They must meet all of the legal requirements of a traditional contract, which may vary depending on jurisdiction. Be sure to research federal and state contract laws prior to creating a smart contract.

  • Are smart contracts enforceable?

For a smart contract to be enforceable, they must follow basic contract law requirements:

  1. The contract must have Offer, Acceptance, Consideration to be legally enforceable.
    • Offer: One or both parties offer the terms of the agreement.
    • Acceptance: Both parties accept the terms.
    • Consideration: There is an exchange of something of value.
  2. The terms of the contract must be legally enforceable.
  3. Smart contracts must be legally eligible for electronic signatures.

While smart contracts are not typically involved in transactions requiring a written signature, it is still helpful to know the types of agreements that are not legally permitted to be signed electronically, such as wills or court orders.

  • Can you have a smart contract without a blockchain?

Yes! Smart contracts can be executed without utilizing blockchain technology in various ways. For instance, remember the vending machine example used by Nick Szabo?

Other applications for smart contracts without blockchain include:

  • Automating processes such as sending invoices.
  • Servicing legal agreements
  • Automating the operations and data organization involved in creating legal contracts.

 

The information provided on this website does not, and is not intended to, constitute legal advice; instead, all information, content, and materials available on this site are for general informational purposes only. Securities law is complex and highly fact-specific to any given circumstance, and readers should contact an attorney for advice regarding any legal matter.

1Nick Szabo, Smart Contracts (1994), https://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.best.vwh.net/smart.contracts.html.

2Jonathan Bick, Are 'Smart Contracts' Smart Enough?, N.J.L.J. (Aug. 14, 2017, 1:21 PM), https://www.law.com/njlawjournal/almID/1202795405206/.

313 Wash. J. L. Tech. & Arts 313.

4See Jodie Gunzberg, The Smart Contract Platform Sector Explained, Coindesk (last updated Aug. 24, 2022, 3:36 PM), https://www.coindesk.com/markets/2022/08/02/the-smart-contract-platform-sector-explained/.

5What is a smart contract?, Coinbase (last accessed Dec. 2, 2022), https://www.coinbase.com/learn/crypto-basics/what-is-a-smart-contract.

6Nick Szabo, Smart Contracts: Building Blocks for Digital Markets (1996),  https://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.best.vwh.net/smart_contracts_2.html.

7Id.

8Sudarshan M, A Guide on the History of Smart Contracts, Crypto Adventure (last updated May 19, 2022), https://cryptoadventure.com/a-guide-on-the-history-of-smart-contracts/.

9Alyssa Hertig, How Do Ethereum Smart Contracts Work?, Coindesk (last updated March 9. 2022, 3:35 AM), https://www.coindesk.com/learn/how-do-ethereum-smart-contracts-work/.

10Id.

11CFI Team, Smart Contract, Corporate Finance Institute (last updated Nov. 10, 2022), https://corporatefinanceinstitute.com/resources/valuation/smart-contract/.

12Cryptographic Hash Function (CHF), Security Encyclopedia, HYPR (last accessed Dec. 2, 2022), https://www.hypr.com/security-encyclopedia/cryptographic-hash-function#:~:text=A cryptographic hash function (CHF) is an equation used to,size numerical string — the hash.

13Supra note 11.

14Smart contracts defined, IBM (last accessed Dec. 2, 2022), https://www.ibm.com/topics/smart-contracts.

15George Lawton, Ben Cole and Francesca Sales, Smart Contract, TechTarget (last accessed Dec. 2, 2022), https://www.techtarget.com/searchcio/definition/smart-contract.

16Jesse Anglen, Top 10 Smart Contract Platforms in 2022 [Other Than Ethereum], Linkedin (Aug. 10, 2022), https://www.linkedin.com/pulse/top-10-smart-contract-platforms-2022-other-than-ethereum-jesse-anglen/.

17Id.

18Kate Valihura, How to Create a Smart Contract in 2022: A Complete Tutorial, Light It Global (last accessed Dec. 9, 2022), https://light-it.net/blog/how-to-create-a-smart-contract/.

Legal Disclaimer

The information provided in this article is for general informational purposes only and should not be construed as legal or tax advice. The content presented is not intended to be a substitute for professional legal, tax, or financial advice, nor should it be relied upon as such. Readers are encouraged to consult with their own attorney, CPA, and tax advisors to obtain specific guidance and advice tailored to their individual circumstances. No responsibility is assumed for any inaccuracies or errors in the information contained herein, and John Montague and Montague Law expressly disclaim any liability for any actions taken or not taken based on the information provided in this article.

Contact Info

Address: 5472 First Coast Hwy #14
Fernandina Beach, FL 32034

Phone: 904-234-5653

More Articles

examples of digital assets

Navigating ICOs: Securities Law Implications for ICOS in 2025

 Initial Coin Offerings (ICOs) often face scrutiny under U.S. securities law, with the SEC using the Howey test to determine if digital assets qualify as securities. This blog explores key court decisions, the application of the Howey test, and what these rulings mean for ICO issuers and investors navigating regulatory landscapes.

Read More