Smart contracts are simply programs stored on a blockchain that run when some conditions are met which are already defined. A smart contract is a self-executing contract whose terms of the agreement between the contract’s counterparties are embedded into lines of code.
Essentially, a smart contract is a digital version of the standard paper contract that automatically verifies fulfillment and enforces and performs the terms of the contract. The concept of smart contracts was proposed by Nick Szabo, an American computer scientist and researcher of digital currencies, in 1994.
Read More- https://corporatefinanceinstitute.com/resources/knowledge/deals/smart-contract/
How smart contracts work
The group of people who did the agreement should determine the conditions of the contract. After all the conditions are finalized they are converted into programming code. The code shows lots of different conditional statements that decide the possibility for future transactions.
Step 1. Transferring the smart contract conditions into code
Once the code is ready, it's stored inside in the blockchain network and is reproduced among the participants within the blockchain.
Step 2. Code is stored in a blockchain and copy between individuals in the group
After code is run and executed by all computers within the network. If all of the conditions are satisfied and it is verified by all the blockchain networks, after that the transaction is executed.
Step 3. When conditions are satisfied, systems within the network verify.
Benefits
• Speed, efficiency and accuracy:
Once the conditions are met, the contract is executed. because smart contracts are automatically executed, no time is spent confirming errors
• Trust and transparency
In the smart contract, no outside people are involved, and because encrypted transactions records are shared across participants’ no one can make changes manually after the contract is verified
• Security
In transactions, records are encrypted, which is very hard to hack. Each record is connected to the previous. hackers need to change the entire chain to make changes even in a single record.
Smart Contract in Different Blockchain Platforms
Hyperledger Sawtooth
This platform makes the smart contract easy to develop and deploy an application. It provides an abstraction that permits application developers to write down contract logic during a language of their choice. The application is often a native business logic or a sensible contract virtual machine. In fact, both sorts of applications can co-exist on an equivalent blockchain. The term which is used for smart contracts in the sawtooth is “transaction processor”. The sawtooth framework currently enables developers to develop smart contracts in a variety of languages such as python, Javascript, Rust, C++, Go.
By creating a website-specific transaction processor, it's much easier to limit the kinds of actions that will be performed on a blockchain network, which helps to improve security and performance.
https://sawtooth.hyperledger.org/docs/core/releases/1.0/introduction/
Hyperledger Fabric
in Hyperledger Fabric, smart contracts can be written in languages Java, Go, and Node.js. Also called as “chaincode”. Here a number of contracts can run concurrently and deployed dynamically.
Corda
Smart contracts in Corda have three main key elements i.e. executable code, state objects, commands. To write smart contract, Corda uses two programming languages, Java and Kotin programming languages
https://docs.corda.net/docs/corda-os/4.7/tutorial-contract.html
Quorum
Quorum uses language for smart contract programming. Once a sensible contract is made private, it can't be transformed for the general public. This design is imposed to guard the interest of organizations who don’t want their smart contracts to be leaked in any way. Similarly, public smart contracts can't be changed to non-public ones.