Smart Contract

A smart contract is a self-executing program based on if-then logic[1]. Since smart contracts have been running on blockchains, app. from 2017 onwards, they gained huge popularity over time and made decentralized Finance possible.
## Overview A smart contract is in principle, like any other contract, a **documented agreement between parties** but it has three features which make it "smart": 1) The contract conditions are layed down in programming [[code]]. 2) It is safety secured on a [blockchain](wiki/blockchain) and thus public, decentrally stored and immutable. 3) If certain conditions of the contract are met, the contract can trigger automatically certain (financial) [[transactions]]. The term "smart contract" was created by [[Nick Szabo]] already in the 1990ies, several years before the appearance of the first blockchain[2] . He defined them as digital protocols that enable information transfer using mathematical algorithms to execute transactions over computer networks instead per law, secured by cryptography. Experts estimate that the use of smart contracts on blockchains will growing significantly, especially in insurance, banking, government, and other sectors with similar needs, to run their operations more efficiently and use the advantages of smart contracts, accuracy, transparency and cost saving[3]. Some blockchains feature per default smart contracts, others not (at least not on their [[layer 1]]). [[Bitcoin]] and [[Hive]] are blockchains without smart contracts. [[Ethereum]] was the first blockchain offering this capability, also e.g. [[Cardano]] and [[Solana]] allow smart contracts. ## Some use cases of smart contracts ### DeFi DeFi (Decentralized Finance) stands for all kind of decentralized financial services, made possible by smart contracts. E.g. [[Uniswap]] is a popular [DApp](/wiki/Decentralized-Application) that allows peer-to-peer transfer and exchange of cryptocurrencies and tokens and operates on the [[Ethereum]] blockchain. It is also an example of a [DEX](/wiki/Decentralized-exchange) (decentralized exchange). ### ERC-20 tokens These tokens (created as L2-tokens on the [[Ethereum]] blockchains) are smart contracts as well. ERC-20 tokens are fungible which means one token of the same type is completely identical to another one. This separates them from non-fungible tokens ([NFTs](/wiki/NFT)) which have a unique identity. They were created 2017 after a proposal by developer Fabian Vogelsteller (comment no. 20 on a github page as an Ethereum Request for Comment, hence the name ERC-20)[4]. ### Smart contracts on Hive The second layer platform [Hive-Engine](/wiki/Hive-Engine) allows smart contracts for example to create tokens for games like [SPS](/wiki/Splintershards) or for investment like [[SPI]], but also to create and manage [DeFi](/wiki/Smart-Contract/###DeFi) applications like [liquidity pools](/wiki/liquidity-pool). Website: Currently still in development is the smart contract platform VSC which will allow fully customizable smart contracts in any language and decentralized Bitcoin wrapping. A testnet went recently online [5]. ## Downsides of Smart Contracts These include (currently) minimal acceptance by governments and thus limited protection and insurance against bad actors. Smart contracts may also contain logic mistakes (or malignant code) which could lead to exploitation by hackers who know the weaknesses of certain smart contracts. This risk can be mitigated by independent code audits. ## References 1. 2. 3. 4. 5. ## Related Articles [[Code]] [[Transactions]] [[Nick szabo]] [[Layer 1]] [[Bitcoin]] [[Hive]] [[Ethereum]] [[Cardano]] [[Solana]] [[Uniswap]] [[Spi]]