Smart Contract Meaning
What is a Smart Contract in Crypto?
They are lines of codes that trigger a specific action once the predetermined agreement terms are fulfilled. Think of a smart contract like a vending machine. The vending machine dispenses snacks or drinks when you press specific buttons and put in the right amount of money.
Snacks selection + right amount of money = Snack dispensed
Smart contracts operate similarly using the “if/when… then…” logic. The “if/when” states the conditions, and “then” stipulates the action to execute.
Similar to a legal contract, it contains the terms of agreements between the parties. Except in the case of smart contracts, the agreements are written in a coding language. The contract is created on a blockchain network and unlike legal contracts which require a third-party to ensure execution, there are no intermediaries needed in a smart contract.
For example, a contract is set up on a blockchain network and contains the following terms:
- If the buyer pays the agreed upon purchase price to the contract’s address, then the contract will automatically transfer the ownership of the property to the buyer.
- If the buyer fails to pay by the agreed upon date, then the contract will refund the buyer’s deposit to the buyer’s address.
- If the seller is unable to transfer the clear title of the property to the buyer within the agreed upon timeframe, then the contract will refund the entire purchase price to the buyer and transfer the ownership back to the seller.
In this example, the smart contract is able to automatically execute the terms of the agreement based on certain conditions being met (or not met), such as the receipt of payment or the transfer of clear title. This eliminates the need for a third-party intermediary to manually process and enforce the terms of the agreement.
How do Smart Contracts Work?
Smart contracts act like the regulatory body that moderates agreements between two parties on a blockchain. They do this by executing the required actions when both parties either meet or don’t meet the contract terms.
Smart contracts are essential to blockchains and decentralized protocols because they enable a decentralized and trustless system. With smart contracts, blockchains don’t need a trusted party to oversee transactions. They are also permissionless, meaning that anyone can write and deploy them.
Smart contracts contain three main components:
- The signatories: The signatories are the parties to the agreement, e.g., the lender and borrower on a lending protocol.
- The agreement subject: This refers to the object or subject of the agreement and exists within the smart contract environment,for example, the crypto assets a lender deposits to lend to the borrower.
- The agreement terms: These are the predefined conditions of the agreement written into the lines of code. The terms dictate reward or punishment for fulfilling or not fulfilling the contract. Therefore it must be clear and specific. For example, “If a borrower doesn’t return the loan by X date, then liquidate collateral and return money to the lender.”
Which Blockchains Support Smart Contract?
Ethereum is the first and most popular blockchain network that supports smart contract functionalities. Though Ethereum is the most prominent network, several blockchains support smart contracts for building decentralized protocols and applications, including EOS, NEO, Tezos, Tron, Polkadot, Solana, and Polygon.