The smart contract is not, as its name seems to imply, an actual smart contract, but a computer program.
Properties and characteristics of a smart contract
Unlike traditional computer programs, it is not executed by the device of the user who launches it, but by a decentralized network.
Bitcoin, the first decentralized network does not allow for the creation and execution of complex smart contracts, so it is commonly not considered a smart contract network.
Ethereum, on the other hand, is the decentralized network considered par excellence as it is a programmable blockchain. In this sense, the Ethereum network works like a huge world computer distributed over thousands of nodes, each of which is able to execute the instructions contained in a smart contract verbatim and always in exactly the same way.
There are actually many other networks that can do this, including the BNB Chain, Solana, Terra, Cardano, and even the Bitcoin-based Lightning Network.
The principle is the same for all of them. The smart contract is packaged by writing the necessary lines of programming code that contain the instructions to be executed, and then uploaded to the blockchain so that nodes can execute those instructions.
To have them executed, a transaction from or to the smart contract address is sufficient.
Since these networks are decentralized, either completely or partially, you have almost absolute certainty not only that that code will be executed, but also that it will do only and exactly what is written in the instructions in the smart contract. This is why it has been called a “contract” even though technically it is not. The term “smart” on the other hand, refers to the fact that it is executed by a computer network.
What they are used for
With smart contracts, for example, it is possible to create decentralized exchanges, decentralized apps (dApps), and any other program that can be executed using the code supported by individual networks.
In this way, such programmes take advantage of the security, reliability and accessibility of the various blockchains, ensuring free and uncensored peer-to-peer functionality. It is precisely the fact that they do not necessarily require the intervention or management of an intermediary that makes them extremely powerful, even though it has sometimes happened in the past that they have not worked as expected, mainly due to more or less unintentional errors.
Another peculiar feature is that, since networks are public, so are the codes of smart contracts. Anyone can examine them to understand exactly how they work, which means that hackers can also do so in order to look for weak points to exploit for cyber attacks.
What’s more, once a smart contract is uploaded to a decentralized blockchain, it cannot be changed even by its authors, so there is almost absolute certainty that it will always do what it was designed to do. However, it is always possible to upload new ones, to be used in place of or in addition to the old ones.
By using a smart contract to create a DEX, for example, users will be able to exchange tokens among themselves without having to go through or rely on any intermediary, in a totally free and anonymous manner.
Stablecoins are also based on smart contracts, making their use within the decentralized network on which the smart contract has been created unrestricted and uncensored.
It is worth noting that often in these specific cases, several smart contracts are created on different blockchains in order to make these tokens usable on different networks.
The open source and permissionless nature of decentralized blockchains means that absolutely anyone can create and publish a smart contract. Obviously, this does not mean that it will definitely be used by anyone, as fees will have to be paid for every transaction.
Smart contracts within different blockchains
The most widely used programming language is Solidity on Ethereum, but different networks support different languages.
However, there are smart contracts that follow slightly different logics. These are those that are uploaded on networks that are not truly decentralized, even if they tend not to be considered to be really smart contracts.
In fact, on a non-decentralized network, some of the basic characteristics of smart contracts are missing, such as the fact of being trustless, permissionless and incensurable. However, the term “smart contract” is often used in these cases as well, albeit in a highly improper way.
Source: https://en.cryptonomist.ch/2022/05/07/what-smart-contract/