Smart Contracts
Units of logic and functionality
Last updated
Units of logic and functionality
Last updated
Smart contracts are by no means a new concept, and certainly not directly linked to blockchain, traditionally speaking. The term was coined in the 1990's long before blockchain was conceived of.
However, because of the way smart contracts have been used to implement general computational logic and mechanism on different blockchains, especially Ethereum, any computer program that implements a certain logic can be regarded as a smart contract in the context of blockchains and distributed ledgers.
For more information on how to develop smart contracts using Ontology, please follow this link.
Smart contract, or simply digital contract was conceived in their original form to mimic real world contracts, but with the inception of distributed ledgers and blockchain coming into picture, it is safe to say that smart contracts can be used to execute various form of complex logic and functionality in different industries, almost certainly going beyond finance.
A few ways in which smart contracts can be used in tandem with either completely, or partially decentralized blockchain technology:
Intellectual Property (IP) protection
Supply chain management
Research and development
Legal Industry
Government sectors
Smart contracts carry out functions by releasing assets on single, or multiple chains based on the business logic and architecture, when certain pre-determined contractual clauses are fulfilled or fail to fulfill. The important thing to note here would be that these clauses and all the steps of this process are publicly visible. This brings a whole new level of transparency to systems that are notoriously untraceable and hence face issues in terms of communication, co-ordination, responsibility and role management, etc. As the competition grows and blockchain technology develops further, smart contracts will play bigger and more important roles.
Ontology Smart Contracts support dynamic features including high scalability, high performance, multilingual contracts, cross-chain, cross-virtual-machines, etc., all integrated into one system. The programming languages supported currently include Python, C#, and Rust. While Java, C++, Go, and JavaScript will be supported in the future.
Ontology also supports EVM contracts written in Solidity.
Smart contracts have a lot of strong points such as transparency, precision, cost-effectiveness and practicality.
Smart contract can be used as safeguards, to ensure that certain assets are released only when the fixed contractual clauses are satisfied. But there is a security vulnerability that arises due to the transparency of smart contracts. Not only are the clauses on public display, so are any issues and vulnerabilities.
Considering the fact that smart contracts cannot be altered after being deployed, it is important to look into the smart contract logic and perform rigorous testing by subjecting them to practical scenarios so as to avoid any mishaps such as the popular 2016 DAO attack. There are several smart contract auditing services that have come up since the attack. But here are other tips that one can follow to write good smart contracts:
Follow general programming best practices to avoid any limitations brought about by the programming language being used.
Write blockchain specific code with the level of decentralization in mind instead of writing general logic.
Testing, testing, and more meticulous testing. Ensure that the contract works as intended under various different calculated circumstances.
Limit functionality to only the essentials. This might seems a little counter-intuitive, but more functionality generally equates to more loopholes that can be exploited, generally speaking.