Smart contracts: What actually is a smart contract?
Smart contracts are a key cornerstone of decentralised finance (DeFi). But how do smart contracts actually work?
This article is taken from the Academy of BTC-ECHO. There you will find exciting background information as well as Bitcoin Trader interesting introductory courses on Bitcoin, Blockchain and Co.
A smart contract is an algorithm that provides for decentralised execution of „contracts“. A traditional contract away from blockchain technologies consists of an agreement made between several people. Typically, the contract ensures that both parties can insist on their claims and present the contract as evidence in the event of a dispute to justify certain claims and rights. A classic contract is the tenancy agreement, which in simple terms consists of two elements:
The tenant transfers the rent to the landlord
The landlord leaves the flat to the tenant
Thus, contracts often consist of sequences in „if-then“ form. When the tenant pays his rent (for the first time), he receives the key for the flat. This process can be simplified through smart contracts, as the sequence can be automated.
Smart contract applications
A smart contract is nothing more than a sequence of activities that are executed when a certain event occurs. This can range from a rental contract to complex financial transactions. What is the difference between smart contracts and traditional contracts?
Third parties are eliminated
The decisive factor is that smart contracts generally do not involve third parties. No notary is required to conclude a smart contract, as would be the case, for example, with the transfer of real estate with conventional contracts. Instead, the smart contract is executed by the nodes in the network.
Activities are executed automatically
The if-then structures ensure that as soon as the event occurs, the subsequent activity is executed. If person A and person B enter into a smart contract and A fulfils its condition, then the network automatically executes the necessary action that follows. It is not necessary for B to be active or a third party to be informed at that time. Instead, the nodes can check the status themselves at any time.
All participants are informed about status changes
The decentralised structure requires that the individual nodes process consistent information. This means that all nodes know about status changes when an event occurs.
How is a smart contract executed?
There are different types of smart contracts. The best-known platform is Ethereum. There, smart contracts themselves are treated like an account that acts autonomously. There are no single individuals who have access to this account. Instead, the actions to be performed are carried out in the network. In simplified terms, this account can be thought of as a set of instructions (programme code) that are executed. These include performing computation, storing information and sending transactions to other accounts.
Although the smart contracts are written by humans and stored on the blockchain, afterwards the execution is the sole responsibility of the network and the user no longer has the possibility to make changes. This means that errors can still occur due to incorrect programming.
How reliable are smart contracts?
It is important to differentiate between the virtual execution of the contract and its significance in the real world. After all, only the actions to be executed are stored on the blockchain. This does not mean that they are valid in the real world. From a purely technical point of view, it can be executed correctly, but it cannot automatically serve as evidence in court to prove a certain claim.