Chain abstraction

Chain abstraction is a user experience where the users can interact with dapps without needing to worry about the presence of multiple blockchains.

What problems does Chain abstraction solve?

User problems:

  • Holding the gas token necessary to interact with a specific chain

  • Needing to manually bridge assets between networks

  • Need to be aware of balances across multiple chains

  • Users are blocked from using a dapp because they don't have the token needed associated with the dapp

Ecosystem problems:

  • Liquidity and user fragmentation

  • Technology innovations across blockchains is not possible

In the KGeN ecosystem, we have designed our wallet and application on the principles of chain abstraction. Following are some key technologies we have used to achieve this:

  • For all user transactions like send, offramp, swap, we use meta transactions wherever possible so that users need not worry about chain gas fees.

  • We have developed a technology called “Lazy chain” to provide seamless multichain experience using our kcash token.

Lazy Chain

Why did we develop the Lazy chain?

Gamers demand fast, seamless experiences, especially when interacting with in-game assets and currency. However, integrating blockchain into gaming environments presents several challenges:

  • Delayed Transaction Confirmation: Transactions need to be confirmed on-chain, which takes time, often causing frustration for gamers who expect near-instantaneous feedback.

  • Multiple Chain Integration: Many games are integrated with multiple blockchains, each with its own asset management rules and transaction processing times. Gamers find it difficult to manage their assets across different chains, leading to poor user experiences.

  • Scalability Issues: Processing a high volume of transactions across different chains, especially as games scale to millions of users, becomes increasingly difficult to manage efficiently.

  • Complexity of Managing Native Tokens: As the system is available on multiple chains, it is difficult for the user to keep a track of native tokens across multiple chains, so we charge them in KCash, our currency, and fund their gas.

Architecture

Lazy Chain's architecture is specifically designed to solve these problems by introducing an innovative forward-sync system that separates user interactions from the blockchain confirmation process.

Web2-Like API for Gamer Interaction

Lazy Chain offers a Web2-style API, allowing games to interact with blockchain networks without the need for gamers to handle blockchain interactions directly.

  • Transaction Submission via API: Users (gamers) submit their transactions to Lazy Chain via the API.

  • Immediate Response: The user immediately receives a response from the system indicating that their transaction is pending and will be confirmed.

Transaction Validation & Background Processing

When the user submits a transaction, it goes through a validation process where Lazy Chain checks the following:

  • User Asset Balances: Ensures the user has sufficient funds for the transaction across multiple chains.

  • Chain-Specific Validations: Verifies that the transaction is legitimate and meets the requirements of the chain.

  • Multi-Chain Consideration: Lazy Chain tracks and verifies assets across all chains integrated into the platform.

After validation, the transaction is stored in the database as a pending transaction. In the background, Lazy Chain pushes the transaction to the blockchain asynchronously, decoupling the real-time user experience from the slower blockchain confirmation.

Multi-chain:

Lazy Chain’s multi-chain support is one of its key strengths. By managing assets across different blockchains, it abstracts the complexity away from gamers.

Here’s how it works:

  • Multi-Chain Abstraction: The system abstracts blockchain differences, allowing users to interact with assets across multiple chains (such as Ethereum, Polygon, Binance Smart Chain, etc.) without needing to manage them separately.

  • Simplified User Experience: From the user’s perspective, their in-game assets are managed seamlessly, regardless of which chain those assets reside on. This is achieved through Lazy Chain’s backend processes, which handle multi-chain validation and processing efficiently.

Scale:

Lazy Chain is designed to scale, managing millions of transactions per day across multiple chains. To achieve this, the following strategies are employed:

  • Batch Processing: Lazy Chain batches transactions to the blockchain, reducing the overhead involved in sending transactions individually. This allows the system to handle a high volume of transactions efficiently.

  • Distributed Infrastructure: The system is deployed using Kubernetes (EKS) to handle scalability, ensuring that multiple microservices can process transactions in parallel.

  • Efficient Resource Allocation: Using containerized services deployed on EKS, Lazy Chain ensures it can scale on-demand to meet the growing needs of gamers.

Gas fees management:

Blockchain transactions often incur high gas fees, especially on popular chains like Ethereum. Lazy Chain implements several strategies to minimize gas costs:

  • Batching Transactions: By grouping multiple transactions into a single on-chain transaction, Lazy Chain can spread gas costs across multiple users.

  • Gas Price Optimization: The system constantly monitors gas prices and optimizes the timing of transactions to minimize costs.

  • Layer-2 Solutions: Where available, Layer-2 scaling solutions are utilized to further reduce gas costs while maintaining the security of the underlying blockchain.

These optimizations are crucial for ensuring the sustainability of handling large-scale transactions across multiple chains.

System design

Below is an overview of Lazy Chain’s Forward Sync System, which outlines the key components and how they work together to ensure efficient and seamless transaction processing:

Web2 API Interface

  • Gamers submit transactions via the Web2 API.

  • Lazy Chain validates the transaction and stores it in the database.

Validation Process

  • Asset balance checks: Ensures users have sufficient funds.

  • Chain-specific validation: Handles rules for each integrated chain.

Pending Transaction Storage

  • Once validated, transactions are stored in the KCashTransactions table with a status of "Pending."

Background Processing

  • Asynchronous Push to Chain: Transactions are submitted to the respective blockchain in the background.

  • Status Updates: The transaction status is updated in the database once confirmed on-chain.

Multi-Chain Support

  • Transactions are managed across multiple chains seamlessly, abstracting the complexities from the user.

Monitoring & Alerts

  • Slack alerts for monitoring system performance.

  • Sentry integration for error tracking and monitoring transaction flows.

Last updated