In Short

  • Introducing data paths
  • Types of data paths
  • Mutable data path vs. immutable data path
  • How cross-chain builders can create safer applications

Introduction

Blockchains are distributed, decentralized databases providing robust data validations and transparency at the cost of scalability.

Unlike centralized infrastructures, blockchains in today’s world are limited by computational power and massive storage requirements.

For starters, in traditional Web2 infrastructures like AWS, a database is stored in 2-3 replicas to prevent data corruption.

In the case of blockchain, it’s stored across multiple computers.

This is not what we’re going to explore in this article, but why am I saying this?!

OK, let me dive in real quick. For scalability like centralized infrastructures, such blockchains need to interoperate.

For interoperability between blockchains, multiple infrastructures are being developed by companies.

Inter-Blockchain Communication (IBC) protocols are numerous, but without applications built on top of them, they don’t fulfill their purpose. This article is intended to help IBC application developers build safer cross-chain applications.

Data Path

In traditional computer science, a datapath is a collection of functional units (including Arithmetic units or Logic units) that perform data processing operations.

I took this term because it sounds synonymous. In cross-chain applications, a data path marks the flow of data across chains.

Example of a data path Example of a data path

The data paths can be cyclic or acyclic and immutable or mutable.

For a cyclic data path, the start chain will be the end chain. For an acyclic data path, the start and end chains would differ.

  • Start chain: the blockchain where the data originates
  • End chain: the blockchain where the data executes its final state change

Cyclic data path Cyclic data path

Cyclic data paths are often used in cases where the start chain requires an end chain’s state changes.

Immutable & Mutable Data Paths

A data path where the state travels without any change throughout its entire lifecycle is known as an immutable data path. It is the most secure and ideal design for cross-chain applications.

An immutable data path An immutable data path where the value of x remains unchanged throughout its entire lifecycle

On the other hand, in a mutable data path, the state gets updated during its lifecycle by intermediary blockchains.

A mutable data path Mutable data path where intermediary chains alter the value of x.

The Way to Safer Cross-Chain Applications

There are multiple ways to exploit a cross-chain application. A few of them aren’t in the control of cross-chain application developers.

For example, a compromised validator network or IBC protocol can affect the application’s security.

But this article explains how an application can be designed to prevent such security threats.

  1. Follow immutable data paths whenever and wherever possible: If the state change remains in the control of the application, then the possibility of tricking the application is close to nil.

  2. Validate state at each intermediary chain: Validating the state at each intermediary chain can prevent tampered state from being injected during the data path’s lifecycle.

  3. Cyclic Feedback Loop: Cyclic data paths are often advisable, though gas consumption will be higher. The start chain would often know the end chain’s expected state change; validating it would help prevent security issues.

  4. Resistive Looping: In a cyclic data path, if the end chain’s state change is not desirable, execute the data path until it is. Make sure you don’t run out of gas.

Resistive looping Resistive looping

There are multiple ways to design data paths for cross-chain applications, and this guide should help you understand the different ways of constructing one.

Have you got queries? Feel free to contact me via somraajsujith@gmail.com or on Twitter (@sujithsomraaj).