Cover Image
If you don’t have time to read but want to know what’s there in this post. Find the quick read 👇
Smart contracts are digital contracts stored on a blockchain that are automatically executed when predetermined terms and conditions are met
On this Post
In this post, we are going to look at the following about Smartcontracts
What are Smartcontracts
How Smartcontracts works
Benefits of Smartcontracts
Limitations of Smartcontracts
Smartcontracts Languages
1. What are Smartcontracts
A smart contract is a computer program compiled from code that can control events and actions according to the terms set within the contract’s code. Smartcontracts typically are used to automate the execution of an agreement so that all participants can be immediately certain of the outcome, without any intermediary’s involvement or time loss. They can also automate a workflow, triggering the next action when conditions are met.
Much like vending machines, we can program smart contracts with various functions. Vending machines allow consumers to insert a currency and then press a button to execute that transaction. A refreshing soda or a candybar is dispensed, and any leftover change that the consumer is owed is dispensed as well.
Smart contracts can be programmed to accept payment and can return an item in place of that payment. An example of this would be a “mint” button on a project’s website.
2. How Smartcontracts works
Simple “if/when…then” phrases that are typed into code and placed on a blockchain are how smart contracts operate. When predefined circumstances have been verified to have been met, a network of computers will carry out the actions. These can entail paying out money to the right people, registering a car, sending out notices, or writing a ticket. When the transaction is finished, the blockchain is then updated. As a result, the transaction cannot be modified, and only parties to whom permission has been granted can view the outcome.
As many conditions as are required to reassure the participants that the activity will be successfully accomplished can be included in a smart contract. Participants must agree on the “if/when…then” rules that govern those transactions, consider any potential exceptions, and design a framework for resolving disputes in order to set the terms. Participants must also decide how transactions and their data are represented on the blockchain.
A developer can then construct the smart contract, though more and more businesses using blockchain for business are using templates, web interfaces, and other online tools to make creating smart contracts easier.
3. Benefits of Smart contracts
Speed, efficiency and accuracy — Once a condition is met, the contract is executed immediately. Because smart contracts are digital and automated, there’s no paperwork to process and no time spent reconciling errors that often result from manually filling in documents.
Trust and transparency — Because there’s no third party involved, and because encrypted records of transactions are shared across participants, there’s no need to question whether information has been altered for personal benefit.
Security — Blockchain transaction records are encrypted, which makes them very hard to hack. Moreover, because each record is connected to the previous and subsequent records on a distributed ledger, hackers would have to alter the entire chain to change a single record.
Savings — Smart contracts remove the need for intermediaries to handle transactions and, by extension, their associated time delays and fees.
4. Limitations of Smartcontracts
Smart contracts alone cannot get information about “real-world” events because they can’t send HTTP requests. This is by design. Relying on external information could jeopardise consensus, which is important for security and decentralization.
5. Smartcontracts Languages
There are two types of active and Smartcontract languages
Solidity
Vyper
Solidity
Object-oriented, high-level language for implementing smart contracts.
Curly-bracket language that has been most profoundly influenced by C++.
Statically typed (the type of a variable is known at compile time).
Solidity Supports
Inheritance (you can extend other contracts).
Libraries (you can create reusable code that you can call from different contracts — like static functions in a static class in other object oriented programming languages).
Complex user-defined types.
Vyper
Pythonic programming language
Strong typing
Small and understandable compiler code
Efficient bytecode generation
Deliberately has less features than Solidity with the aim of making contracts more secure and easier to audit.
Vyper does not supports
Modifiers
Inheritance
Inline assembly
Function overloading
Operator overloading
Recursive calling
Infinite-length loops
Binary fixed points
Congratulations!!!
In this post we have seen the basics of Smartcontracts, how smartcontracts works as well as it’s limitations.
Will catch up in a new post with more interesting crafts till then Happy Learning :)