Gas consideration for when Subnet checkpoints blocks to Mainnet(Post-XDC2.0)

Before going in-depth, I’m giving credit to @wanwiset for his research on this topic.

XDC subnet by Design, along with the subnet’s consensus, uses Sovereign-Rollup to send the batches of XDC Mainnet to add additional security to Subnet through middlewares called Relyer and Checkpoint smart contract.

This post focuses on the gas consideration when a subnet sends a batch to Mainnet and the relayer basically will pay for the gas on Mainnet. Also, going deeper into post-XDC2.0.

Note: Post-XDC2.0 means the gas fee has been increased 50x. Link

Assume the current price of XDC is 0.03 USD:

1000 XDC is ~30 USD,
if one block is mined every 2 seconds,
1000 blocks cost 5 XDC, then
1000 XDC can checkpoint 200,000 blocks,

The result is, that it will take ~4-6 days to reach 200,000 blocks
AND ~30 USD / 5 days(on average) = ~6 USD per day.

This means a subnet’s relayer will be charged ~6 USD per day to post/checkpoint Blocks on mainnet.

This post is just a workout on the Subnet to bring more related conversations and start building Subnet community around it. Check out Subnet docs here
Pls, leave your thoughts and feedback below.

Thanks for reading, Cheers!

6 Likes

1.We can use Lite CSC to replace the Full CSC

CSC(Check point Smart Contract) is a smart contract deployed on the mainnet for checking the subnet block headers. Its function is to verify and store the block headers pulled from the subnet by the relayer on the mainnet.

By using a full CSC, you need to store every block, which will inevitably consume a significant amount of gas.

Lite CSC does not require submitting every subnet block header; it only needs to submit the gap and epoch blocks of the subnet. For every 900 blocks, only 2 blocks need to be pushed.

This can reduce transaction fees by 99.7%. However, it won’t store all the subnet block headers, meaning it’s not possible to obtain all subnet Merkle tree roots to recover block data on the mainnet. As a result, XDC Zero won’t be compatible with Lite CSC.

Refer to XDC-CSC/contracts/LiteCheckpoint.sol at master · XinFinOrg/XDC-CSC · GitHub

2.Implement EIP-4844 to change the rollup logic.

EIP-4844, also known as Proto-Danksharding, is a proposal aimed at improving the scalability of Ethereum by introducing a new type of transaction that carries “blobs” of data. These blobs are large, ephemeral data packets that are stored off-chain and only accessible for a short period (around a month). The key goal is to make Layer 2 rollups much cheaper and more efficient by reducing the data costs associated with storing transaction data on the Ethereum network.

However, this will completely change the mechanism of the relayer. We need to rethink and redesign the entire subnet relayer mechanism and develop EIP-4844 in the Golang code, which will take a significant amount of time. Additionally, XDC Zero will also become unavailable.

3.We can design a POW economic model for the relayer, allowing it to be shared with users so that all users have the right to run the relayer and make it profitable for them.This way, there is no need to spend a large amount of gas fees at a single address, and it can help grow the relayer POW network, making it more decentralized.

3 Likes

Hello sir/madam. How can I contact XDC support for XSwap wallet? I don’t know how to start a new post? I want to get help from anybody at XinFin XSwap support who can advise me what to do if I recovered my wallet but the address is different - not showing my coins in my original wallet