Insolar Smart Contracts

Insolar Team
Mar 28, 2019 · 6 min read

Smart contracts have been billed as the transactional technology of the future, but what value do they bring to blockchain and how are they implemented on the Insolar platform?

Smart contracts — what are they?

A smart contract is a code stored on blockchain that, when executed, can change its state and store the resulting state to the blockchain. The execution can be triggered by an external event or by another smart contract in what is termed a “call”. As such, a smart contract can be seen as a program or a service which users call to in order to operate with the information or capability the smart contract represents.

You may have realized from the above explanation that if a smart contract can be added to a blockchain “on-the-go”, then the blockchain can be extended and tailored to provide services and conduct operations which were not initially available. But before we get into the possibility of upgradeable smart contracts like those on the Insolar blockchain, let’s take a look at previous generations of smart contracts.

Evolution of smart contracts

In fact, just as any other blockchain, bitcoin also has smart contracts in two forms: (1) built-in logic that enables core functionality with addresses and transactions, and (2) a special script for a transaction, which specifies whether a transaction can be added to the bitcoin blockchain.

With the appearance of the Ethereum blockchain, another aspect to smart contracts came about: one in which the behavior and capabilities of the blockchain network is not limited by developers of the core blockchain, and can be driven by users and communities by adding and using a new smart contract.

This was the revolution and it has sparked lots of interesting developments around Ethereum. As well as bringing to light various limitations of the original approach taken by the developers at Ethereum.

There are a number of technical limitations like keeping code with data, replicating code, use of non-industry standards, new virtual machine and language, and others.

For example contracts store full code with every change of data. As such, popular contract ledgers continually grow as more transactions are performed, which makes working with them expensive for users. This is because more storage space costs more and these costs are passed on to the end user in the price of a contract’s execution. Furthermore, there may be aspects of the code that the user has no need for, but pays for the storage space it takes up.

Whilst such technical aspects can be resolved, there are also a few other design decisions that makes the practical use of Ethereum-like smart contract solutions problematic for full-scale business implementation.

For example: if your smart contract calls someone else’s contract, you take full responsibility for any changes that take place as a result of the call, including all incurred expenses, regardless of whether they are incurred as a result of a malfunction or error. This means that users need to fully understand and take responsibility for all of their actions. Such an approach is clear and simple from a technical point of view, but is completely the opposite to the service-style approach we have in our daily lives and business. When someone orders a pizza — there is a price for the pizza to be paid on delivery, and there is no need to understand the full production cycle, starting from tomato farming in Italy and ending with wages and the work-hours policy of a last-mile delivery courier.

Issues like these are something that we took into account when creating the Insolar blockchain platform.

Smart contracts on Insolar

The Insolar platform enables a set of unique features for smart contracts that enable efficient use under different scenarios.

First of all, Insolar treats smart contracts as a “black-box service”: contracts do not need to know about each other’s contents unless they make calls to each other. The smart contracts use a specific version of a code, uses and updates state, and can receive and generate calls, while its code and all incoming and outgoing information is stored on blockchain. This enables Insolar to use different Virtual Machines to run contracts. Moreover, there is a strict requirement on the reproducibility of smart contract behavior, which is checked during the validation of every call (transaction).

Of course, this doesn’t provide a 100% guarantee on the reproducibility unless special types of Virtual Machines are used, but it enables users and developers to choose what is best for them.

Additionally, Insolar provides a few different mechanisms to help developers and users easily tailor smart contracts to their needs:

  • Hierarchical governance with domains — a contract can be deployed within a domain (a special contract) and accept control of the domain over code versioning, access policies, consensus rules and storage requirements.
  • Composition of smart contracts — a contract can include other contracts to reuse their functionality, but limit external access to/from them to some degree.
  • Delegation to composite contracts — an advanced version of composition when a smart contract allows dynamic delegation of some functions to the embedded contracts. This enables the dynamic upgrade of the functionality of an existing contract without changes to the code, but by the inclusion of another contract.

Insolar’s goal is to build a platform so that everything is a contract. This means that everything from built-in functions, to platform behavior extensions is accessible and organized as contracts, with the same addressing and calling schemes. Even external integrations are represented as special smart contracts which declare APIs for incoming and outgoing external calls.

Address stability

Each contract is saved in the ledger and get its own address, which never changes throughout its lifetime and is defined by the address of the creation record. Every change of smart contract state also gets an address, but these aren’t considered as contract addresses.

Just as in standard contractual relations, parties prefer not to disclose all details to the public. As such, Insolar has structured its platform so that smart contract code and data are only disclosed to nodes that were allocated to execute a contract instance.

Upgradeable smart contracts

We do not live in a perfect world: just as legislation needs to be amended over time or where gaps in the laws set out are uncovered, so do problems in the codes of smart contracts need to be updated to resolve issues. As such, another feature of Insolar blockchain is the ability to enable code upgrades for smart contracts. When the code of a smart contract is published on blockchain, the rules for upgrading it (defining what is required to change code version) are also published. These rules usually delegate upgrade decisions to the relevant domain, but domain policy can either seize full control of upgrades or, for instance, the decision to upgrade a contract can be taken or declined by a committee. Via the same procedure, it is possible to have immutable and tamperproof contracts and ensure that a contract only calls unmodifiable ones too.

At Insolar, we don’t enforce, but allow upgradeable smart contracts. Upgradeable contracts function in conjunction with existing regulations and allow legally empowered organisations, such as courts, to correct transactions. The use of this mechanism allows for mistakes to be easily corrected, meaning contract execution can be regulated and there is no need to roll back in order to resolve issues.

Coordination of smart contracts

As in all smart contracts, the contract contains data and its state. The simple way to access contracts is by read-only calls, where multiple read-only calls to the same object can be served simultaneously. However, some operations may require changes of state, and even coordinated changes of state across multiple contracts, while each contract is a “black box”. Handling this requires various ordering and locking techniques that are already implemented by many database applications. This simplifies contract creation as Insolar provides infrastructure which is closer to Insolar provides transparent support of distributed transactions across multiple contracts, together with isolation concepts tailored to the specific nature of blockchain (e.g. “validated” and “finalized”, instead of “committed” etc.).

Smart contracts bring tremendous value to blockchains but have had implementation issues in previous blockchains. Insolar smart contracts introduce several new features to the realm of process automation, whilst they reduce costs and increase privacy for transactions. These innovations make Insolar one of the most advanced blockchain platforms around and a significant improvement on smart contracts offered by other blockchains.


Insolar is an open-source enterprise-grade blockchain platform to enable seamless interactions between companies and new growth opportunities powered by distributed trust.

Insolar Team

Written by

Distributed business networks



Insolar is an open-source enterprise-grade blockchain platform to enable seamless interactions between companies and new growth opportunities powered by distributed trust.

More From Medium

More on Blockchain from Insolar

More on Blockchain from Insolar


Anri Nap
Mar 30 · 2 min read

More on Blockchain from Insolar

More on Blockchain from Insolar

HitBTC上市Insolar XNS!

Anri Nap
Mar 27 · 1 min read

More on Blockchain from Insolar

More on Blockchain from Insolar

XNS Mini-series: Token vs Coin

Insolar Team
Mar 30 · 2 min read
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade