Polymath recently announced that we are building Polymesh, the purpose built blockchain for regulated assets, capital markets and open finance, using the Parity Substrate framework.

In this post I am going to talk about one of the novel parts of Polymesh’s architecture — Smart Extensions. A key to the success of Polymath’s Ethereum based protocol has always been its flexibility. Whilst certain functionality is provided by default (for example an ERC-1400 compatible security token) we allow organisations to extend our protocol using modules that fall into various categories such as STOs, Compliance Rules, Dividends.

When we were architecting Polymesh we had a similar problem to solve. Whilst Substrate allows blockchain builders to provide base layer primitives, in the form of runtime modules, our ambition has always been for Polymesh to be an open platform that can be easily extended. This is driven by our belief that, whilst securities laws vary across different asset classes and jurisdictions, a successful open finance platform must be able to accommodate and ensure the compliance of any type of asset and jurisdiction.

Financial Primitives

Polymesh will provide key core functionality at its base layer. These financial primitives are implemented as runtime modules, giving users of Polymesh easy access to sophisticated tools to issue, distribute and manage regulated assets and associated functionality such as compliance, capital distribution, settlement and corporate governance.

Included in these financial primitives are a general transfer manager that issuers can use to drive identity based compliance rules for their assets. Identity in turn is managed through an identity primitive which provides all network participants with a self-sovereign identity and key management functionality fit for purpose in regulated markets.

However, it is impossible to cover every possible permutation of compliance rule and functionality that asset issuers and investors may need across all asset classes and jurisdictions. Polymath has been working with the Parity team since early November to help solve this problem in a flexible and general way, allowing Polymath to add the capability and tools for Polymesh users to directly extend our financial primitives, ensuring that asset issuers and investors are not limited to utility provided at the base layer of Polymesh, and can bring their own compliance rules and other functionality to Polymesh.

“We are happy to announce a collaboration with Polymath to help them build the Polymesh security token platform on Parity’s Substrate blockchain framework. We’ll be building Substrate features which will be used extensively by Polymesh, including communication between smart contracts and runtime modules.” — Björn Wagner, CCO Parity Technologies

What is a Smart Extension?

A Smart Extension is a smart contract, written in a domain specific language to a specific interface, which can be attached to an asset through one of Polymesh’s financial primitives.

As a simple example, suppose that you issue an asset in the Middle East, and there is a regulatory rule which establishes that the asset must not trade on a Friday.

An issuer of an asset that wishes to enforce this compliance rule would either develop, or select from a pre-existing library, a Smart Extension of type Compliance Rule which implements this behaviour, then attach it to their asset. All transfers of that asset would check with this Compliance Rule that a trade is valid (i.e. not being executed on a Friday) before allowing the trade to proceed.

Domain Specific Languages (DSLs)

Currently Smart Extensions are being implemented using a combination of Rust / WASM based smart contracts, and purpose built financial primitives that leverage these Smart Extensions to extend their own capabilities.

Smart Extensions in Polymesh will cover functional areas such as:

Compliance Rules

Settlement and Security Token Offerings

Capital Distribution (e.g. structured cashflows, dividends, redemptions)

Corporate Governance

Each of these areas is associated with a particular business domain and the language used to write a Smart Extensions should reflect this. Substrate provides a general purpose language for smart contracts, Ink!, but over time we intend to switch this out for DSLs which are specific to the type of Smart Extension being written. This allows business experts to contribute to and understand Smart Extensions directly, and ensures that the rules and functionality encoded by Smart Extensions is tailored specifically to their use-case.

Using a DSL rather than a general purpose language, it is also possible to add other types of safety guarantees around these types of extensions, giving users of Polymesh additional confidence in extending their assets through Smart Extensions, and opening up the network to allow third party developers to provide Smart Extensions that can be used by many asset issuers.

Financial Primitives and Smart Extensions

Smart Extensions cover a number of different use-cases, and will be incrementally rolled out in Polymesh, with an initial focus on compliance and settlement, but eventually covering many different areas.

This approach allows core, standardised functionality that is intrinsic to all security tokens to be captured at the base layer of Polymesh, whilst providing the facility for organisations and developers to innovate on top of this base logic across multiple functional areas.

To allow for rich and sophisticated use-cases, Smart Extensions must be able to interoperate with Polymesh’s financial primitives. For example a Smart Extension for a new compliance rule may need to pull data from the Identity financial primitive, and a Smart Extension for a structured product may depend on details of the asset and the distribution of its investors.

Community

Substrate is a modular and flexible toolkit for building blockchains. Being able to extend primitive functionality (runtime modules) through the use of smart contracts is hugely important for security tokens, but is also useful for many other projects building on Substrate.

Polymath is working with Parity to specify and build the low-level functionality required to allow smart contracts and runtime modules to interact in a safe and managed manner, and this functionality is expected to be merged back to the main Substrate project so that the whole community can leverage it.