An Introduction to Blockchain Smart Contracts
Nowadays, ten years after the introduction of Bitcoin, blockchain technologies have been successfully deployed in various financial applications including several cryptocurrencies. Moreover, the blockchain is considered as an enabling technology in many different sectors such as the energy, healthcare and government sectors. This is the reason why there is a growing interest in blockchain programs, such as smart contracts. Smart contracts represent versatile and popular applications that are executed over blockchain infrastructures. Some of the prominent blockchain infrastructures (such as Ethereum) include smart contract frameworks based on Turing-complete languages. As such smart contracts can be used to implement sophisticated functionalities over blockchain infrastructures including functionalities that enforce complex terms in financial and insurance context and also in other contexts where valuable assets are traded. Therefore, understanding smart contracts is a key prerequisite for developing non-trivial applications over state-of-the-art blockchains.
The notion of a smart contact is not new: It was introduced more than twenty years ago, as a key building block of digital markets where valuable assets are traded. At that time, smart contracts were characterized as computerized transaction protocols that executed the terms of a contract by means of satisfying common contractual conditions such as payment terms. Similarly, in the context of a blockchain, a smart contract is considered a secure and continually running computer program which represents an agreement. The main properties of a blockchain smart contract are as follows:
In practice, a smart contract can represent a Service Level Agreement (SLA) between two of more different parties. Smart contract based SLAs can be implemented for various industries, yet the majority of blockchain-based smart contracts focus on financial services use cases.
In order to ease the process of encoding legal agreements and SLAs in smart contracts, the notion of smart contract templates has been introduced. The smart contract templates are standards-based formats that provide a framework for representing legal agreements. They are usually developed based on domain specific languages (DSL), which provide constructs for legally-enforceable programs that correspond to legal documents. To this end, DSLs provide a host of different functionalities, including legal prose and cryptographic functions.
DSLs are in most cases are dedicated to describing applications for a particular area or sector. Hence, they tend to provide quite limited expressiveness that is tailored to the domain at hand. As such, they are optimized for the domain that they target, yet in most cases being inappropriate for expressing and building general-purpose programs. For instance, there are DSLs that support the definition of insurance contracts (i.e. for InsuranceTech applications), such as the Actulus Modeling Language (AML) which is focused on the description of life insurance and pension products. Another example is the DIESEL language, which can represent energy derivatives as a means of facilitating Monte Carlo pricing and analytics. Likewise, Risla is a DSL language that is destined to describe interest rate products.
Smart contracts need not be executed over a blockchain: They can be used to represent and enforce agreements over data residing in conventional databases as well. Nevertheless, integrating smart contracts over a blockchain allows them to benefit from the blockchain’s distributed consensus mechanisms. The block chains provide safety and reliability for the enforcement of smart contracts. Ethereum is the most prominent example of a blockchain that provides native support for the development and deployment of smart contracts.
Smart contracts on the Ethereum blockchain are part of larger applications called Decentralized Autonomous organization (DAOs). They enable richer application logic than the conventional double-spending and transaction-locking functionalities of the Bitcoin blockchain. In practice, Ethereum smart contracts are executed on the computers of the blockchain network which are expected to execute the contracts’ code and to arrive at the same result as part of the blockchain consensus mechanism. Hence, distributed consensus ensures that the smart contract logic has been executed as it should be.
Miners are motivated to run the smart contract in exchange for “Gas” i.e. Ethereum’s currency unit, which is used to represent the reward given for the code execution. Hence, smart contract function calls declare the amount of gas that is associated with their execution. The gas price varies depending on the complexity of the smart contract’s application logic. However, the gas is not only an incentive mechanism for miners. It is also a motivation for developers to write efficient code that requires less gas for its execution.
Contrary to conventional programming languages, smart contracts are not able to access services and APIs, outside the nodes they are running into. This is due to the fact that this could make ultimate consensus impossible. To alleviate this limitation, the Ethereum blockchain provides a solution called “Oracle”, which allows external services and APIs to push data to the blockchain. Based on Oracle, all blockchain nodes are able to access exactly the same data within the blockchain network. Nevertheless, there are some critics for Oracles mainly related to the fact that they break the complete decentralized nature of a blockchain as external data/information is centrally pushed to the blockchain.
It is envisaged that Ethereum smart contracts could serve as a basis for a wide range of applications that could disintermediate all the trusted third parties that are nowadays running popular marketplaces in areas such as e-commerce, crowd-funding and transport services. Nevertheless, relevant implementations are still in their infancy.
Even though the notion of smart contracts is not new, its integration in the blockchain has brought it in the foreground and made it an enabler for a whole new range of applications. In case you are just starting with blockchain infrastructures and applications, it’s likely that you will get involved in understanding and develop smart contracts. We hope that this introduction helps you understand the basic concepts of smart contracts, templates, and DSLs as well as of their integration with blockchain based consensus mechanisms.
Are Blockchains ready for Industrial Applications?
Blockchain in Healthcare: Hype or Tangible Opportunity?
Mandatory Electronic Invoicing: Coming Soon
Cross Border Payment Gateways to Boost your Business
Blockchain Infrastructures for the Enterprise: Thinking Beyond Cryptocurrencies
API Management: A Powerful Tool for Creating Business Value
Hyperautomation: The Basics you need to Know
Outsourcing: How to Pick the Right Partner and Location
Digital Twins: A Vehicle for Safer, Trusted and More Efficient Industrial Processes
Surviving Cybercrime in 2021: Guidelines for Effective Cybersecurity Investments
We're here to help!
No obligation quotes in 48 hours. Teams setup within 2 weeks.
If you are a Service Provider looking to register, please fill out this Information Request and someone will get in touch.
Outsource with Confidence to high quality Service Providers.
If you are a Service Provider looking to register, please fill out
this Information Request and someone will get in
Enter your email id and we'll send a link to reset your password to the address
we have for your account.
The IT Exchange service provider network is exclusive and by-invite. There is
no cost to get on-board;
if you are competent in your areas of focus, then you are welcome. As a part of this exclusive