Smart contracts
The idea of a smart contract is to be a program that runs autonomously whenever agreed conditions are met. In the blockchain environment, we can think of smart contracts as programs executed by a virtual machine, where it is possible to update the network state. This makes it possible to create computer programs on top of the security and immutability of the blockchain.
Smart contracts were proposed by cryptographer Nick Szabo in 1994 and implemented in networks such as Ethereum and Neo. Before that, blockchains had a single purpose, as in the case of Bitcoin, or a finite set of purposes. Smart contracts have made it possible for a blockchain to be general purpose, able to run any program and implement any business logic.
The introduction of smart contracts made it possible, for example, to create customized tokens with their own logic. This opened up many possibilities in what is known as decentralized finance, short for DeFi. Unlike Bitcoin, whose ledger had the sole purpose of storing information about the transfer of coins, blockchains that implement smart contracts can store information about the ownership of any asset.
Thus it has become simple to register the authorship of a work of art or the ownership of a piece of land. As the blockchain works as a tamper-proof database, it is virtually impossible to falsify a record. And since blockchain records are immutable, the entire transfer history of an asset is public and cannot be erased.
Despite their name, smart contracts are neither legal nor smart. They are blocks of code with a well-defined execution pattern inscribed in the blockchain. Once written in some programming language and deployed on the blockchain, any user can interact with it. As it is a public code, its rules can be consulted before interacting with it.
We can think of smart contracts in analogy with vending machines. They also have a well-defined execution pattern. Once you insert notes or coins into it and choose the item to be purchased, they will deliver the product and calculate the change. Like smart contracts, they implement business logic and rely on users interacting with them. Unlike smart contracts, however, its algorithm is not public.
Before smart contracts, it was necessary to establish its own network to create an application with the security of the blockchain. From then on, just write the business logic and send it to the blockchain. We can think of Ethereum and Neo as global computers and smart contracts as the software that runs on those computers.