The concept of storing data in a secure ledger is expanded to include computation in a smart contract. Therefore, they are essentially contracts that are carried out automatically and without the aid of a third party. It can be compared to a tiny computer programme that is kept inside the blockchain.
Smart contracts operate very much like a virtual vending machine and use the "if this, then that" logic. The snack of your choice will immediately be given to you if you agree to insert money and make a selection. No other party is necessary for the contract to be executed in this automated agreement between the person and the program.
Users can invoke functions in these smart-contract programmes, subject to any limits set out by the programme, just like in the aforementioned example, and the function code is performed concurrently by the miners. Users can build their own programmes to act on the output of other programmes and can trust the output without having to redo the computation. The reason that Smart contracts are especially powerful when combined with a cryptocurrency platform is that the programmes in question can handle money—own it, transfer it, destroy it, and, in some cases, even print it.
For instance, Bitcoin uses a constrained programming language for smart contracts. In this language, a "standard" transaction is defined as a short script that transfers money from one address to another. While on the other hand, Ethereum has been used in far more applications than Bitcoin because it provides a more open and robust language.
Nick Szabo first put forth the concept of smart contracts in 1994. He gave them the name because he saw them as analogues of legal contracts with automated enforcement. According to him, smart contracts are “a computerised transaction protocol that executes the terms of a contract. The general objectives of smart-contract design are to satisfy common contractual conditions (such as payment terms, liens, confidentiality, and even enforcement), minimise exceptions both malicious and accidental, and minimise the need for trusted intermediaries. Related economic goals include lowering fraud loss, arbitration and enforcement costs, and other transaction costs.”
NFTs are a typical instance of how smart contracts are used in the blockchain. NFTs are minted through smart contracts that assign ownership and reassign it when transferred or resold. Smart contracts serve as a tool to carry out a sale agreement on a fundamental level. Similar to the vending machine illustration. Additionally, they guarantee that NFTs cannot be divided and that the digital assets are unique.
