LeoGlossary: Smart Contract
A *smart contract is a self executing agreement between two parties. Both the action of buyer and sellers are determined by the code that is in the contract. There are no external entities that are involved in the transactions.
Digital assets are often created via smart contracts. The code is establish to create different synthetic assets and anyone who is on chain can utilize the contract. The contract is what acts as the intermediary providing the "rules" of conduct.
Ethereum was the one that kicked off the smart contract craze within blockchain. This was not the invention of them.
This can go to Nick Szabo who came up with the idea in the 1990s. His vision was to use smart contracts to revolutionize the legal profession. Decades later, the idea was integrated into blockchain. Much of this enabled the formation of other cryptocurrencies.
How Does It Work
A smart contract is an Ethereum address, similar to other wallets. However, it is not controlled by any individual. Basically it is a collection of code (function) and data (state) that resides at the specific address.
They can have balances while engaging in transactions. Instead of an individual having control, they are deployed by the network and run according to the coding. All transactions in irreversible and the contracts cannot be deleted. Like any contract, they operate according to the rules established.
Digital Vending Machine
Nick Szabo came up with the analogy of a smart contract to a vending machine. As such, specific inputs generate predetermined outputs.
Here is a summary of his analogy:
You select a product The vending machine returns the amount required to purchase the product You insert the correct amount of money The vending machine verifies you have inserted the correct amount The vending machine dispenses the product of choice
Unless all conditions are met, nothing comes out of the vending machine. The same is true for a smart contract. If any of the pieces are missing, then the contract will not execute.
Some of the use cases for smart contracts:
Stablecoins Creating and distributing unique digital assets An automatic, open currency exchange Decentralized gaming An insurance policy that pays out automatically A standard that lets people create customized, interoperable currencies
These are just a few of the possibilities of blockchain-based contracts.
Code Is Law
One of the main ideas behind smart contracts is "code is law". This stems from Szabo's idea to replace lawyers and rework the legal profession where coded contracts were the basis for all decisions.
The key to smarts contract is they are automated. Using the vending machine analogy, as soon as the conditions are met, the contract executes. No human interaction is required. This removes any decision making from the equation. All of that is done at the time of coding.
This leads to the predicable outcomes. Since the code is what drives the results, we know what the outcome will be once the conditions are met. There is no room for interpretation. What is coded is what happens.
Blockchain are public databases. All information is transparent. However, the individual wallets engaging with the blockchains do not require KYC. This means it present anonymity to the wallet holder.
When interaction with a smart contract takes place, all activity is posted to the blockchain. This allows others to review what occurred. Engagement with the smart contract, since it is through said wallet, provides individual anonymity.
Smart contracts are responsible for many hacks and the theft of billions of dollars in tokens. Vulnerabilities in the contracts themselves led to numerous exploitations. Most are written in Solidity, a newer programming language. Hacks took place often due to oversights in the code.
The hackers were able to steal the tokens in a few different ways. One was simply to access the wallet tied to the smart contract. Another was to create a huge number of tokens and sell the for the pair in the liquidity pool, usually ETH. This allowed them to then move the coins out to another wallet.
No Third-Party Resolution
A contract, under real world circumstances, is an agreement between two parties. There are specific obligations contained therein for each party. Failure to fulfill the terms puts the party in default.
Obviously, with contracts, disputes can arise. This often requires the intermediation of a third party, usually the legal system. That means the government interjects itself into the private affairs.
Smart contracts remove the middlemen from the equation. This is in keeping with the tenets of blockchain whereby no third party trust is required.
Posted Using LeoFinance Beta