Rooted in open gaming

The Root Network is a powerful foundation for seamlessly connected games, content, and experiences.

Unlock the magic of the open metaverse

Create digital content that can be taken anywhere
Build dynamic games or level up existing assets with powerful interoperability, unlocking true player ownership.
Build securely and scale fast with dev-friendly solutions
Leverage our cutting-edge framework built on Substrate, integrated EVM, and custom runtimes.
Outsmart the competition with intelligent assets
Enable interoperable AI experiences for your metaverse assets on demand with our Non-Fungible Intelligence (NFI) Protocol.
Learn more

Purpose-built to bring content to life, 
The Root Network connects seamless player experience with powerful web3 technology.

FOR BUILDERS

Support for every step

Explore trusted resources that help you build and scale open metaverse games, content, and experiences.
NEWS AND UPDATES

In the news

Catch up on what's happening across the ecosystem.

Fee Proxy: Flexible Gas Payment on The Root Network

Simplify user onboarding and optimize the gas fee economy, pay gas fees in any token or pay them on behalf of your users.

Overview

In blockchain ecosystems, transaction fees are typically paid in the network's native currency. For The Root Network (TRN), this means users need XRP to pay for transaction fees. However, this requirement can create friction for users who hold other tokens but lack the native currency for gas payments. To address this challenge, we've implemented the Fee Proxy pallet, which enables users to pay transaction fees using any token - given that it has sufficient liquidity against XRP in TRN's on-chain Decentralized Exchange (DEX).

Understanding Fee Proxy

The Fee Proxy pallet is a critical infrastructure component that intercepts transaction fee payments and enables dynamic token conversion for gas fees. This means users can execute transactions on TRN using any token in their wallet, as long as there's adequate liquidity for that token against XRP in the on-chain AMM.

Key Features

  1. Flexible Fee Payment: Users can pay transaction fees in any token with XRP liquidity
  2. Automatic Token Conversion: Seamless conversion of chosen payment token to XRP for gas fees
  3. DEX/AMM Integration: Utilizes TRN's on-chain AMM for efficient token swaps; this is a natural price oracle since arbitragers are incentivised to balance the price/value of the token(s)
    1. Additional utilization of the AMM - which further incentivises liquidity from liquidity providers
  4. EVM Compatibility: Supports both substrate extrinsics and EVM transactions

How It Works

In traditional blockchains, users must hold the native currency (like ETH for Ethereum) to pay for transaction fees. However, TRN implements a novel gas abstraction mechanism that allows users to pay transaction fees using any token that has sufficient liquidity against the native currency (XRP).

The Role of the DEX in Fee Abstraction

At the heart of this mechanism lies our Uniswap V2-based Automated Market Maker (AMM) implemented as a Substrate pallet. The AMM serves two crucial functions:

  • It provides real-time price discovery for tokens through liquidity pools
  • It enables the actual swap of user's chosen payment token to the native currency

When a user initiates a transaction using a non-native token for fees, the system leverages the AMM's constant product formula (x * y = k) to determine the exact amount of the chosen token needed to cover the gas costs.The price discovery occurs automatically through the existing liquidity pools (specifically of the token and XRP), ensuring that fees are priced fairly according to current market conditions.

Price Discovery and Market Equilibrium

The accuracy and reliability of our gas abstraction system heavily depend on maintaining correct price discovery in the AMM pools.

This is achieved through a combination of market forces and arbitrage opportunities:

Arbitrage Mechanisms

When the price of a token in our AMM pools deviates from external market prices, arbitrage opportunities emerge.

Trading bots and arbitrageurs are incentivized to:

  • Buy tokens from our pools when prices are lower than external markets
  • Sell tokens to our pools when prices are higher than external markets

This constant arbitrage activity helps maintain price alignment with broader market rates, ensuring that users paying gas fees in alternative tokens are charged fair market rates.

Dynamic Pool Rebalancing

The AMM's constant product formula naturally creates price movements as pool ratios change:

  • Large token swaps for gas payments can temporarily impact pool ratios
    • This creates immediate arbitrage opportunities
  • Arbitrageurs quickly restore the balance by taking opposing positions
  • The resulting equilibrium reflects the true market price

For example, if many users pay gas fees using TOKEN-A, gradually depleting the TOKEN-A supply in the pool:

  • The pool ratio shifts, making TOKEN-A more expensive in terms of XRP
  • Arbitrageurs notice the price discrepancy
  • They buy XRP from external markets and trade it for TOKEN-A in our pools
    • This action replenishes the TOKEN-A supply and stabilizes prices

Economic Incentives

The system's stability is reinforced by several economic incentives:

  • Arbitrageurs earn profits by correcting price discrepancies
  • Liquidity providers earn fees from all swaps, including gas payment conversions
  • Users are protected by specifying max_payment limits on their transactions

This creates a self-sustaining ecosystem where market participants are naturally incentivized to maintain accurate price discovery, ensuring the gas abstraction mechanism remains reliable and cost-effective for users.

Integration with The Root Network

The Fee Proxy pallet implements the OnChargeTransaction trait, which is the core mechanism for handling transaction fee payments on Substrate-based chain.The Fee Proxy pallet is deeply integrated with TRN's infrastructure:

Transaction Payment Configuration

impl pallet_transaction_payment::Config for Runtime {
    type OnChargeTransaction = FeeProxy;
// ... other configuration parameters
}

EVM Configuration

impl pallet_evm::Config for Runtime {
    type Runner = FeePreferencesRunner<Self, Self, Futurepass>;
    type OnChargeTransaction = FutureverseEVMCurrencyAdapter<Self::Currency, TxFeePot>;
// ... other configuration parameters
}

The trait implementations (FeeProxy and FeePreferencesRunner) highlighted above allow the FeeProxy components to hook into relevant pallets which deal with withdrawal of funds/XRP for a transaction. The fee proxy itself integrates with the Dex pallet to perform the swap.

The flexibility and ergonomics of substrate allow us to achieve all these integrations in a clean way.

Substrate Layer Implementation

Fee proxy pallet

The pallet handles fee calculation and token conversion through several key steps.When a user initiates a transaction with fee preferences, the following process occurs:

  1. Gas Estimation: Calculate required gas based on transaction parameters
    1. The user specifies their preferred payment token and maximum payment amount
  2. XRP Fee Calculation: Convert gas requirements to XRP amount
    1. The pallet calculates the required XRP amount for gas fees
  3. Token Amount Calculation: Determine required payment token amount based on AMM rates
    1. The specified payment token is swapped for XRP through the AMM internally within the on-chain protocol code
  4. Swap Execution: Perform the token swap through the AMM
  5. Fee Payment: Use converted XRP for transaction execution
    1. The underlying transaction is executed using the converted XRP for gas fees

The entry point to executing a fee-proxy transaction is the following extrinsic in the FeeProxy pallet:

// Execute a transfer while paying fees in a custom token
fee_proxy.call_with_fee_preferences(
    origin,
    payment_asset_id,// The token to pay fees with
    max_payment,// Maximum amount willing to pay with token
    Box::new(transfer_call)// The actual transaction to execute
)

The fee abstraction is implemented through a specialized extrinsic called fee_proxy.call_with_fee_preferences.

This proxy acts as a wrapper around the actual transaction, handling the token conversion process transparently.

How it works:

  • The user specifies their preferred payment token (payment_asset_id) and the maximum amount they're willing to pay (max_payment).
  • Before executing the main transaction, the system queries the AMM to calculate the required amount of payment token based on:
    • The estimated gas cost in native currency (XRP)
    • The current exchange rate from the liquidity pool
  • The system performs an atomic swap through the DEX pallet, converting the user's token to XRP
  • The actual transaction (transfer_call) is executed using the swapped XRP for gas fees
  • Any unused tokens are refunded back to the user

This mechanism ensures that while the blockchain continues to use XRP for actual gas payments internally, users enjoy the flexibility of paying with their token of choice, as long as there's sufficient liquidity in the corresponding AMM pool.

Flow

EVM Layer Integration

The Fee Proxy functionality is also accessible through an EVM precompile, allowing smart contracts and EVM transactions to utilize the same flexible fee payment system. The precompile interface is straightforward:

interface FeeProxy {
    function callWithFeePreferences(
        address asset,// Token address to pay fees with
        address target,// Target contract address
        bytes calldata// Encoded function call data
    ) external;
}

When using the EVM interface, the gas parameters (gasLimit, maxFeePerGas, and maxPriorityFeePerGas) determine the maximum gas cost in XRP, which is then converted to the equivalent amount in the chosen payment token based on current AMM rates.

The caller is responsible for performing the calculations (required gas/XRP) - which can be done via the estimateGas RPC call, then converting this to amount of tokens required (and ensuring that they possess the required amount).

Flow

Caveats to the EVM integration

Integrating the fee-proxy with the EVM proved to be a bit more difficult than anticipated. This is due to the fact that Ethereum based transaction flows take a different route in the code compared to Substrate extrinsics; resulting in slightly different implementations of the fee-proxy for the 2 different transaction flows.

The major difference however was the usage of the fee-proxy with frontend/browser wallets. Before allowing a user to execute a transaction; wallets (such as MetaMask) make an Eth RPC call to first simulate the transaction; but in this process, the transaction validation can fail due to the user having a 0 XRP balance. This is a state which should be accounted for; i.e. the user should still be able to execute a transaction while having no XRP, if they have another token to pay gas with.

^ To address this behaviour, we needed to make a change in frontier (our EVM implementation); essentially allowing custom logic (providing a trait) for the transaction validation.

The implementation for this trait is in the runtime:

pub struct HandleTxValidation<E: From<InvalidEvmTransactionError>>(PhantomData<E>);

impl<E: From<InvalidEvmTransactionError>> fp_evm::HandleTxValidation<E> for HandleTxValidation<E> {
	fn with_balance_for(
		evm_config: &CheckEvmTransaction<E>,
		who: &fp_evm::Account,
	) -> Result<(), E> {
		let decoded_override_destination = H160::from_low_u64_be(FEE_PROXY_ADDRESS);
		// If we are not overriding with a fee preference, proceed with calculating a fee
		if evm_config.transaction.to != Some(decoded_override_destination) {
			// call default trait function instead
			<() as fp_evm::HandleTxValidation<E>>::with_balance_for(evm_config, who)?
		}
		Ok(())
	}
}

Here we essentially check the target address of the the transaction, and if it is targeted towards the fee-proxy precompile address, then we simply allow the balance validation to go through.

With this change we have made frontier pallet transaction handling logic more flexible, while providing our own custom override for transaction validation.

Use Cases and Benefits

  1. Enhanced User Experience
    • Users can transact without holding XRP
    • Seamless fee payment in preferred tokens
    • Reduced friction for new users
  2. DApp Integration
    • DApps can incentivise and potentially subsidise gas fees for their users by via providing liquidity for their tokens against XRP
      • Eases usecases for gas sponsorships; for example any app can setup a liquidity pool with its token and XRP; then allow users to pre-buy (or buy at a discount) these tokens - which could be used for transaction fee payment
    • Simplified onboarding for new users as they could potentially interact with dapps even though they may not have the native currency at hand
    • Better UX for multi-token applications
  3. Additional utility to all assets
    • Since any token can be used to pay for transactions; this essentially gives native utility to all tokens to be used as gas tokens
  4. Cross-Chain Interactions
    • Easier integration with other chains and bridges
    • Simplified token management for cross-chain applications

Future Improvements

Several potential enhancements could further improve the Fee Proxy system:

  1. Gas Token Aggregation
    • Support for multi-hop swaps through multiple AMM pools
    • Optimal routing for better rates
  2. Fee Abstraction
    • Account abstraction integration for more flexible fee payment models
    • Support for meta-transactions
  3. Advanced Fee Strategies
    • Dynamic fee token selection based on market conditions
    • Batch transaction optimization

Conclusion

The Fee Proxy pallet represents a significant step forward in improving blockchain accessibility by removing the requirement for users to hold native tokens for gas fees. By leveraging TRN's on-chain AMM and implementing robust safety measures, the pallet provides a secure and efficient solution for flexible fee payment.

This innovation not only enhances user experience but also opens up new possibilities for DApp developers and cross-chain applications. As The Root Network continues to evolve, the Fee Proxy pallet will play a crucial role in fostering broader adoption and usability of blockchain technology.

To learn more about The Root Network's features and custom pallets, visit our documentation. Stay updated with our latest developments by following us on X and joining our Discord community.

Looking Ahead: The Root Network

With cutting-edge features and a focus on inter-chain connectivity, decentralization, and growth, this year will set new standards in open gaming.

As we step into 2025, The Root Network and its ecosystem are powering up for a bigger year than ever. With over 60 projects rooted in open gaming and more on the way, The Root Network is steadily evolving, scaling, and pushing the boundaries of interoperability. As the year progresses, the pace of transformation is set to accelerate even further, with a focus on inter-chain connectivity, decentralization, and new initiatives designed to drive community and network growth.

Here’s a look at what’s coming:

Key Initiatives Roadmap

  • Rewards Program
    • Dynamic rewards program that incentivizes users and builders across the The Root Network ecosystem, ensuring contributions to the network such as liquidity and transactions are both recognized and rewarded.
  • Pass Attribution
    • A novel protocol that creates rewards for the lifetime value of users that partners and brands onboard onto The Root Network, and drive monthly active wallets (MAWs).
  • Vortex Payouts On-Chain
    • Transition The Vortex payout distribution to a full automated and decentralized process.
  • Substrate Upgrade
    • Upgrade to Substrate framework version Stable2409-1 (or newer). This enhancement will bring improved scalability, security, and performance to the ecosystem.
  • Gas Fee Optimization
    • Ongoing enhancements to further optimize EVM transaction costs to bring them closer in line with extrinsic transaction expenses.
  • IBC Protocol
    • Inter-Blockchain Communication (IBC) Protocol to enable cross-chain interoperability. This development will serve as an intermediate step to the future implementation of parachains, enabling seamless interactions between blockchains.
  • Decentralized Governance
    • Decentralization takes center stage with the introduction of a decentralized governance model. This framework will empower the community to play a more active role in shaping the future of The Root Network.

TRN Labs Launches

As The Root Network’s builder and developer communities gear up for an exciting 12 months of growth, games, and opportunities, we have another significant update to reveal. Today, we’re thrilled to share the launch of TRN Labs, an independently-organized initiative dedicated to driving innovation, fostering collaboration, and maximizing The Root Network ecosystem’s potential. Led by builders, TRN Labs is aiming to drive builder and community initiatives in collaboration with Futureverse, with the objective of scaling the The Root Network’s ecosystem.

Key Initiatives

TRN Labs aims to identify new projects and provide resources to foster community growth. Whether a project is just starting out or aiming to scale, TRN Labs offers a variety of initiatives including Project Incubation, Technical and Infrastructure Support, Community Engagement, Sustainable Growth Models, and Expanding Network Connectivity.

Follow TRN Labs on X to stay up to date with the latest news and updates.

In the year ahead, The Root Network will continue leading the development of seamlessly connected games, content, and experiences. Thanks to key infrastructure updates, innovative new features, and fresh opportunities for builders and developers, the future of the network and its ecosystem has never been so bright. We look forward to growing and building together in 2025.

Girin Labs launch new user-centric wallet on The Root Network

The Girin Wallet – an ultimate digital wallet designed to enhance experiences within The Root Network and XRPL ecosystems – is now available for iOS and Android.

A brand new wallet that combines the ease of social login with robust non-custodial security has just launched on The Root Network. Available for iOS and Android devices, the Girin Wallet is designed to make digital asset management easier across The Root Network and XRPL.

The concept for the wallet was born when the Girin Labs team recognized the need for a simple, secure, and accessible wallet that could onboard $XRP’s 50 million holders and introduce them to the magic of The Root Network – empowering users with easy access to the open metaverse.

Innovative technology and intuitive design collide

Built in collaboration with The Root Network, the Girin Wallet leverages our powerful infrastructure to provide native support for The Root Network and enhance interoperability between the XRPL and our ecosystem. The Root Network’s developer-friendly tools, scalability, and EVM compatibility enabled Girin Labs to efficiently integrate multi-chain functionality and focus on creating a superior user experience.

"The Root Network is a versatile and supportive platform which is providing Girin Labs with the tools and community needed to build scalable, user-focused applications like the Girin Wallet." – Claud, CEO, Girin Labs

Discover a new gateway to web3

Ready to unlock a new tool that lowers the barriers to web3 and enhances interoperability between the XRPL and The Root Network? Simply download the app, connect to FuturePass via the Wallet Connect function, and you’re away. You can find more onboarding guides, feature walkthroughs, and incentives for early adopters on the Girin Labs X account and blog.

Download the Girin Wallet for iOS or Android now:

This is more than just a wallet launch – it’s a step towards building a connected and thriving web3 ecosystem for the XRPL and The Root Network. There are plenty of exciting updates planned for the coming months with lending and staking features, expanded multi-chain compatibility, and user experience updates in the works. Girin Labs are also planning incentive programs for wallet users and are constantly looking for innovative ways to introduce new users to The Root Network ecosystem.

Find out more about the Girin Wallet:

View More
Please rotate your device or view on a larger screen size.