Composability

Composability in DeFi refers to the ability of various components and systems in the DeFi ecosystem to seamlessly connect and interact with each other

Traditional financial systems are often rigid, isolated, and centralized. This structure limits innovation, as each system operates in a silo, making it difficult to integrate or build upon existing financial services. Users and developers face constraints in terms of accessibility, interoperability, and flexibility, hindering the development of more efficient and inclusive financial solutions.

The lack of interoperability in traditional finance leads to inefficiencies, higher costs, and limited financial products. It restricts users from seamlessly accessing a diverse range of services and confines developers to the capabilities of a single system. This siloed nature stifles innovation and prevents the creation of complex, integrated financial solutions that can better meet the evolving needs of users.

Composability in decentralized finance (DeFi) addresses these issues by allowing various financial services and applications to interact and integrate seamlessly.

What is Composability?

Composability in DeFi refers to the ability of various components and systems in the DeFi ecosystem to seamlessly connect and interact with each other.

This concept is akin to the idea of “Lego blocks” in software development, where different modules or applications can be easily combined or recombined to create new financial services or products.

What is Composability

Key characteristics of composability in DeFi include:

  • Interoperability: Different DeFi applications and protocols should be able to work together and interact without any barriers. For instance, a lending platform in DeFi should seamlessly integrate with a decentralized exchange (DEX) or a stablecoin protocol.
  • Permissionless Integration: In DeFi, any developer should be able to build upon existing protocols or integrate with them without needing permission. This open-access nature would foster a collaborative and innovative environment.
  • Modularity: Dapps should be designed as modules or self-contained units that can be used as building blocks for other applications. This modular design allows for the easy creation of complex financial ecosystems.

Smart contracts, APIs and SDKs are the most important components that act as bellweathers of composability in DeFi.

Smart Contracts as Building Blocks

At the core of DeFi’s composability are smart contracts. These self-executing contracts with the terms of the agreement directly written into lines of code serve as foundational elements.

Developers can use existing smart contracts as reliable building blocks, knowing that these components have been tested and proven in real-world applications. This reuse of code enhances security, as repeatedly used contracts are more likely to have undergone thorough testing and auditing.

APIs as The Connective Tissue

APIs in DeFi act as the connective tissue that enables different decentralized applications (dApps) to communicate and interact with each other. They facilitate the exchange of information and value between different protocols or layers, allowing for the creation of more complex and interconnected financial ecosystems.

This interconnectivity is crucial for creating seamless user experiences, where a user can engage in multiple financial actions across different platforms without ever leaving the ecosystem.

SDKs for Empowering Developers

Software Development Kits (SDKs) in DeFi are like advanced toolsets that empower developers to build dApps more efficiently. They provide a collection of software tools, guidelines, and libraries that streamline the development process.

With SDKs, developers don’t need to reinvent the wheel for each new application; they can leverage existing tools and focus on creating unique features and functionalities.

Types of Composability

Types of Composability

Composability comes in different forms, each with its unique characteristics and implications. Let’s explore the three types:

  1. Syntactic composability
  2. Atomic composability
  3. Morphological composability

These three types of composability in DeFi — syntactic, atomic, and morphological — represent different but complementary aspects of how decentralized financial systems can interact, transact, and evolve.

Each plays a vital role in the development of a rich, flexible, and robust DeFi ecosystem, although they also present unique challenges that need to be addressed.

Syntactic Composability

Syntactic composability refers to the ability of different DeFi protocols and applications to seamlessly connect and work together at a code or interface level. It’s about ensuring that the ‘syntax’ or the set of rules that govern the structure of the code is consistent across different applications, allowing them to interact without compatibility issues.

This type of composability is crucial for the interoperability of different DeFi applications. It means that developers can design new products or services by integrating different protocols or elements without worrying about the underlying code structure being incompatible. For users, it translates into a smoother and more integrated experience across different DeFi platforms.

Achieving syntactic composability requires standardization of coding practices and interfaces within the DeFi ecosystem. Without such standardization, the integration between various protocols can become complex and error-prone.

Atomic Composability

Atomic composability is about transactions or operations that are executed in an “all-or-nothing” manner. In this context, multiple actions across different protocols can be grouped together, and they either all succeed or all fail. This property is essential for maintaining consistency and integrity in financial transactions.

Atomic composability is crucial for complex financial operations where multiple steps are involved. For example, in a decentralized finance operation that involves swapping tokens, borrowing funds, and then providing liquidity, atomic composability ensures that either all these steps are completed successfully, or none are, preventing partial completion which could lead to financial risk or loss.

Implementing atomic composability can be technically challenging, especially in a distributed and decentralized environment like blockchain. It requires sophisticated smart contract logic and often relies on the underlying blockchain’s ability to support complex transactions.

Morphological Composability

Morphological composability refers to the ability to create new financial products or services by combining or modifying existing ones. This type of composability is about the flexibility and adaptability of DeFi protocols and applications to evolve or morph into new forms.

This type fosters innovation in the DeFi space. It allows developers to experiment with existing financial products, modify them, or combine them with other products to create entirely new offerings. Morphological composability can lead to the rapid evolution of financial services and the constant emergence of novel solutions tailored to specific needs or market gaps.

The primary challenge with morphological composability is maintaining security and robustness as products evolve. As new configurations are created by combining various elements, ensuring that these new products are secure and function as intended can be complex.

Composability vs Interoperability vs Modularity

Learners are often confused by the three terms; composability, interoperability, and modularity.

All three concepts aim to improve efficiency, flexibility, and user experience in technology systems. Because they often lead to similar end results (like enhanced functionality or scalability), it can be difficult for learners to distinguish between their unique roles and contributions.

In many systems, these concepts work in tandem. For instance, a modular system might also be highly composable and interoperable. This interplay can blur the lines between each concept, making it hard to understand them as distinct entities.

However, they are all very different from each other. Below is a table that will help you recognize where one concept ends and the other begins.

Composability

Interoperability

Modularity

Definition Ability to connect and interact seamlessly with other systems or components. Ability of different blockchain networks to work together. Design approach where a system is built with distinct, interchangeable modules.
Primary Focus Interaction within a single platform or ecosystem. Interaction between different blockchain platforms or ecosystems. Design and architecture of individual platforms.
Key Benefit Fosters innovation by allowing developers to build upon existing projects. Expands the reach and functionality across different blockchain ecosystems. Facilitates flexibility and scalability in system development.
Impact on Development Encourages creation of interconnected services and products. Requires protocols and standards for cross-chain communication. Allows for independent development and improvement of specific system parts.
User Experience Seamless and integrated services within the same ecosystem. Access to a wider range of services and assets across multiple blockchains. Stable and potentially more efficient services due to specialized components.
Scalability Dependent on the underlying platform’s scalability. Enhanced by the ability to tap into multiple platforms’ resources. Enhanced by the ability to update or replace individual modules.
Example in DeFi A lending platform integrating with a decentralized exchange on Ethereum. A DeFi application on Ethereum interacting with another on Binance Smart Chain. A DeFi platform where lending, trading, and other services are separate modules.

Top DeFi Projects that Leverage Composability

Composability allows DeFi protocols to integrate and build upon each other’s functionalities, solving persistent problems in the space.

These five DeFi protocols — Loopring, Aave, Synthetix, 1Inch, and Liquity — demonstrate the powerful use of composability in solving persistent problems in the DeFi ecosystem.

Loopring: Reinventing Order Book Exchanges

Loopring stands out as a pioneering protocol that leverages composability to revolutionize order book exchanges. Traditional order book exchanges on blockchain suffered from slow transaction speeds and high gas fees. Loopring addresses these issues by utilizing zkRollups, a scaling solution that enables high-throughput, low-cost trading.

By doing so, it combines the efficiency of centralized exchanges with the security of decentralized ones. Composability comes into play as Loopring can integrate with other DeFi protocols, enabling users to access a wider range of services like swapping, lending, and more, all within its ecosystem.

Aave: Innovating in Money Markets

Aave has been a forerunner in the DeFi money market space, offering lending and borrowing services. Its unique approach to composability allows users to lend and borrow a wide variety of cryptocurrencies in a trustless manner.

Aave’s composability is evident in its integration with other DeFi protocols, allowing for features like flash loans and rate-switching. These innovations address issues like liquidity and high collateral requirements in traditional lending, demonstrating the power of composability in creating more flexible financial products.

Synthetix Network: Expanding Synthetic Assets

Synthetix Network is a prominent player in the synthetic asset space, allowing users to create and trade synthetic versions of real-world assets like stocks, commodities, and currencies on the blockchain.

The protocol uses composability to integrate with various oracles and other DeFi protocols, ensuring accurate price feeds and expanding its range of synthetic assets. This approach solves the problem of limited access to traditional asset classes in DeFi, making it more inclusive and diverse.

1Inch: Aggregating DeFi Services

1Inch has carved its niche as a DeFi aggregator, addressing the problem of navigating the fragmented DeFi landscape. By using composability, 1Inch aggregates liquidity from various decentralized exchanges (DEXs) to offer users the best possible trading rates.

This not only solves the issue of liquidity fragmentation but also ensures lower slippage and better price execution for users, exemplifying how composability can enhance user experience in DeFi.

Liquity: Stabilizing Stablecoins

Liquity is a unique stablecoin protocol that uses composability to offer interest-free loans against Ethereum collateral. Its integration with other DeFi protocols enhances its stability and efficiency.

By allowing users to borrow against their Ethereum holdings with zero interest, Liquity addresses the issue of high interest rates in traditional stablecoin platforms. The protocol’s composability feature plays a critical role in maintaining its collateral ratio and ensuring the stability of its stablecoin, LUSD.

Downfalls of Composability in DeFi

While composability offers remarkable benefits, like flexibility and innovation, it also comes with its own set of challenges and downfalls.

Systemic Risk and Domino Effect

When multiple systems or protocols are highly interconnected through composability, a problem in one can quickly spread to others, like a row of dominoes falling over.

Imagine a chain of people each holding a card; if one person drops their card, it can cause a chain reaction where others also drop theirs. In DeFi, if one protocol that is heavily integrated into others fails (like a smart contract bug), it can cause a ripple effect, impacting the entire interconnected network.

Dependency on External Protocols

Composability often means relying on other protocols or services. If these external services have issues or make changes, it can directly impact your system.

Think of building a house using components from different suppliers. If one supplier delivers faulty materials or changes their design, it affects the integrity of the entire house. Similarly, in DeFi, if a protocol depends on another for a critical function and that external protocol changes or fails, it can compromise the dependent protocol’s functionality.

Complexity and User Confusion

As more components are combined, the overall system becomes more complex, which can be confusing or overwhelming for users.

Consider a remote control with too many buttons. While each button has a purpose, the sheer number can be overwhelming, leading to mistakes. In DeFi, as services become more intertwined, understanding how they work together and the risks involved can be challenging for users.

Security Vulnerabilities

The more components you integrate, the greater the surface area for potential security vulnerabilities.

Imagine a castle with many doors. Each door is an opportunity for an invader to enter. In a composited DeFi system, each integrated protocol or smart contract is like a door, potentially offering entry points for hackers.

Scalability Issues

Highly composited systems can face scalability challenges, as the efficiency and performance of one component can depend heavily on others.

Think of traffic on a busy road. If one car slows down, it can cause a traffic jam. In DeFi, if one protocol in a composited system becomes slow or congested, it can affect the performance of the entire system.

Upgrade and Maintenance Complications

Updating or fixing one part of a composited system can be complicated because it might affect other parts.

Upgrading the software on your phone sometimes causes problems with your apps. Similarly, in DeFi, updating one protocol might cause compatibility issues with others that rely on it.

Case Study: Ledger ConnectKit Security Breach

The recent (December 2023) issue with Ledger’s ConnectKit can be considered a classic example of the inherent risks of composability in decentralized finance (DeFi).

Ledger, a hardware wallet manufacturer for cryptocurrencies, experienced a security breach affecting its Connect Kit tool. This breach was a result of a phishing attack on a former Ledger employee, through which a hacker gained access to Ledger’s NPMJS account, a platform for hosting code packages for developers.

The attacker uploaded a malicious version of the ConnectKit library, affecting several DeFi protocols and leading to the theft of around $484,000 in cryptocurrencies.

If you were affected by this exploit, you can file a claim with Ledger here.

How is it related to composability?

Chain Reaction of Failures: In the Ledger ConnectKit incident, the compromise of a single component (the ConnectKit library) had a cascading effect on multiple DeFi applications that relied on this library for their operations​​. This shows how a vulnerability in one part of the system can potentially impact a wide range of interconnected applications and services.

Dependence on Third-Party Code: DeFi projects often rely on third-party libraries and codebases, as seen in the Ledger case. If these external components are compromised, the security of the entire ecosystem that relies on them can be jeopardized. In the Ledger incident, a former employee’s compromised credentials were used to inject malicious code into the ConnectKit library, impacting its dependents​​.

Rapid Propagation of Malicious Code: Once the malicious code was injected into the ConnectKit library, it was rapidly propagated through the DeFi ecosystem, affecting numerous applications and users before it could be contained​​.

Final Thoughts: “No need to reinvent the wheel”

The essence of composability in DeFi can be captured by the phrase “No need to reinvent the wheel.” It highlights the efficiency and innovation that result from leveraging existing solutions.

In DeFi, developers can build new financial products and services by integrating and adapting proven protocols and smart contracts. This approach not only saves time and resources but also mitigates risks, as it relies on tested and audited components.

Composability fosters a collaborative ecosystem where developers can focus on unique innovations rather than basic functionalities, accelerating the growth and diversity of financial solutions.

However, it’s important to recognize the potential systemic risks, as dependencies on interconnected systems can propagate vulnerabilities.

Want to learn more such interesting concepts about DeFi and web3? Follow the Paybis blog to stay up-to-date.

Disclaimer: Don’t invest unless you’re prepared to lose all the money you invest. This is a high‑risk investment and you should not expect to be protected if something goes wrong. Take 2 mins to learn more at: https://go.payb.is/FCA-Info