Halborn Logo

// Blog

Smart Contracts

What Is a Smart Contract?


Rob Behnke

March 4th, 2021

Not that long ago, when someone said “contract”, they were referring to a document written to be difficult to understand and that defined a relationship between two or more parties.  Now, depending on context, the word contract can mean something else.

After Satoshi Nakamoto created the blockchain with the introduction of Bitcoin, people have been building on the concept to expand its capabilities.  One of the bigger innovations built on blockchain is the smart contract platform, which implements a “world computer” that runs on top of the blockchain.

How Smart Contract Platforms Work

A blockchain is designed to create a distributed and decentralized digital ledger.  Unlike existing systems, the blockchain doesn’t need a centralized authority to define the “official” version of the digital ledger.  The blockchain network works together to add new data to the ledger and ensures that each node’s independent copy of the ledger is in agreement.

Bitcoin was designed to store financial transaction data on the ledger, but a digital ledger can store other types of information as well.  Smart contract platforms use the digital ledger to organize and store code that runs on the “world computer”.

Each node in the network stores a copy of the distributed ledger, meaning that, with the creation of each block on the blockchain, they get a copy of the code that it contains.  Each node in a smart contract platform also has a copy of a virtual machine (VM) designed to run this code.  If every node in the network runs the exact same code on identical VMs, they should receive the exact same result.  This makes it possible to create a “world computer” built using completely distributed and independent nodes.

Blockchain and the Smart Contract

Smart contract platforms make a world computer possible by ensuring that independent nodes can run code and get the same result.  Smart contracts are the programs that these nodes run.

The details of smart contract platforms and smart contracts can vary significantly from one implementation to another.  Some, like Ethereum, have custom programming languages and virtual machines written specifically for them.  Others, like EOS.IO, use existing programming languages (like C++) to make themselves more accessible to developers.

Regardless of the details, smart contract platforms work similarly at a high level.  The code to be run is stored in transactions, which is run by nodes in their copies of the VM.  This makes a distributed, decentralized “world computer” possible.

Blurring the Lines Between Legal and Smart Contracts

Legal contracts and smart contracts are different things, but they may not necessarily stay that way.  Some blockchain projects are pursuing the concept of a Ricardian smart contract.

A Ricardian smart contract is a legal contract that is implemented as executable code.  This allows the contract program to be run and automatically enforced, rather than legal contracts only being enforceable in a court of law.

While smart contracts are currently capable of defining relationships between parties, they’re currently written solely by programmers.  Ricardian smart contracts may make these programs more accessible to lawyers and other people, expanding their adoption.

Securing Smart Contracts

The use of smart contracts is growing rapidly.  Smart contract platforms like Ethereum are struggling to scale to meet demand, and smart contracts are central to the decentralized finance (DeFi) movement.  These contracts encode relationships and have the ability to transfer and store massive amounts of value.

As smart contracts become more widely used and valuable, securing them grows as a priority.  The recent rash of DeFi hacks underscores the importance of security audits for smart contract security. Contact Halborn today at halborn@protonmail.com to inquire about our smart contract security audits.