What are Smart Contracts? How Do they Work?

3 min, 2 sec READ

Smart contracts are the main thing differentiating Ethereum and Bitcoin. Smart contract functionality is what makes Ethereum so much more than just digital money.

The contracts are basically pieces of code that can be run on the Ethereum Blockchain. You can have either a user account or a Smart Contract account in the Ethereum network. A user account consists of just an address (similar to your bank account number, which also exists on Bitcoin), and a balance (how much Ether you have). In contrast, a Smart Contract account contains an address, a balance, a state, and some code.

The state of a Smart Contract account is the state of all fields and variables declared in the contract. It behaves similarly to field variables in programming languages. A Smart Contract can be easily viewed as an instantiated object from a class. The difference is that the object lives forever (unless coded for self-destruction).

The byte-code that Ethereum nodes run, compiles the code of the contracts. The code executed on the creation of the contract contains functions that the user can call.

How Do Smart Contracts Work?

Ethereum allows developers to program their own Smart Contracts, or 'autonomous agents', as the Ethereum white paper calls them. Smart Contracts can function as 'multi-signature' accounts so that funds are spent only when a required percentage of people agree. They can manage agreements between users, for instance, if one buys insurance from the other. They can provide utility to other contracts (similar to how a software library works) and store information about an application, such as domain registration information or membership records.

When a Smart Contract is deployed to the network, users can call its functions. Some contracts can include security features that block some users from accessing it.

The execution of code is paid by the caller in Gas, a form of payment which is paid per execution of instruction. So, it is very important that Smart Contracts remain simple because the more complicated they are, the more expensive and difficult to secure they are.

The user sets the max amount of Gas he wants to spend on a particular call. If the code called by the user goes into a loop, no more than the max Gas on the execution would be spent. The cost of Gas is decided by the nodes that are running the code.

What Industries Could Smart Contracts Help or Disrupt?

Ethereum and its Smart Contracts are truly revolutionary technologies that will help humanity as a whole to organize and to establish a more connected worldwide community. It also promises to disrupt and displace many industries and service providers due to its decentralized, autonomous nature. Some relevant examples of how this technology has been used to improve private and public business are:

  • Smart Contract VC-related deals totaled $116 million in Q1 of 2016, more than twice as much as the prior three quarters combined and accounting for 86 percent of total Blockchain venture funding.
  • An Ethereum-based organization has raised over $150 million to experiment with and develop Smart Contract-driven applications.
  • The Australian Securities Exchange is developing a Blockchain-based post-trade solution to replace its current system using Smart Contracts.
  • The Post-Trade Distributed Ledger Group, an organization launched to explore post-trade applications on the Blockchain using Smart Contracts, has 37 financial institutions as members.
  • Five global banks are building proof-of-concept systems with a trade finance and supply chain platform that uses Smart Contracts.
  • Barclays Corporate Bank plans to leverage a Smart Contract bill-of-lading platform to help its clients reduce supply chain management costs.
  • The state of Delaware announced initiatives to utilize Smart Contracts for state-recognized “distributed ledger shares” and to streamline back-office procedures.
Helpful? Yes No
67% of people found this helpful.