Try โ€‚โ€‰HackMD

Data Bus Research: On-chain Based Transport Layer

Introduction

During a discussion of the DSM 1.5 specification, the need to diversify the data bus was identified. Currently, the data bus utilizes RabbitMQ, which falls short in several aspects: it doesn't provide the openness, vendor neutrality, or fast deployment required for the project. While exploring options like L2 networks and EVM based networks, the research (findings available at link) concluded that existing solutions could fulfill all the requirements. Therefore, the remaining focus lies in selecting the optimal network as the transport layer for the Data Bus.

This reserch was created before the Dencun update. At the moment, according to the information from https://l2fees.info/, the prices of L2 solutions are still much more expensive than Gnosis and Polygon.

Objective

  • Define network selection criteria
  • Prepare a toolkit for searching networks
  • Based on the criteria and using the toolkit, prepare an overview of popular networks
  • Calculate the approximate cost per day and per year

Network Selection Criteria

  • Low gas price
  • evm-based
  • High network stability >99%
  • Availability of tools: monitoring, block exporters, development and debugging tools

Network Search Toolkit

For effective research, it is necessary to choose a convenient toolkit. Below is a list of services that I used during the research.

L2 Fees

website - https://l2fees.info/

A convenient website that collects transaction prices in L2 networks

L2 Beat

I propose to use this tool as the main tool for searching and evaluating the quality of L2 networks.

This tool covers the main L2 networks, while including deep research collected in one place.

website - https://l2beat.com/ github - https://github.com/l2beat/l2beat

Network Overview

Cost Calculation

Before taking a closer look at each network, we need to narrow down the search. First, let's calculate the approximate cost per day and per year. This way we will immediately understand which solutions are definitely not suitable for us.

The cost will be calculated using the following formula:

const dayInSeconds = 24 * 60 * 60;
const minSigningBlocksPeriod = 150;
const minSigningBlocksPeriodSeconds = minSigningBlocksPeriod * 12;

const depositTransactionsPerDay = dayInSeconds / minSigningBlocksPeriodSeconds;
const councilsCount = 6;
const modulesCount = 2;

const dayPrice =
depositTransactionsPerDay * usdAvgPrice * councilsCount * modulesCount;
const yearPrice = dayPrice * 365;
  • minSigningBlocksPeriod โ€” in deposit messages we pass a signature that needs to be re-signed every 100-150 blocks
  • modulesCount โ€” the calculation is based on two modules, it should be kept in mind that there may be many more modules in the future

Estimated Cost Assessment

Prices are quoted in US dollars at the time of writing.

L2 by l2fees data

Chain Price per day Price per year
ZkSync era 74.88 27331.20
ZkSync lite 144.00 52560.00
Optimism 230.40 84096.00

Different EVM based network

Chain Price per day Price per year
Polygon 10.78 3935.61
Ronin 3.47 1267.12
Gnosis 0.10 37.09
Harmony 0.96 349.21

From the tables, it can be seen that L2 solutions are not suitable for us, the maintenance is too expensive. And with EVM-based networks the situation is much better and we have four networks that we can explore further.

Source code of the price calculator
    
const getAvgPrice = (usdAvgPrice) => {
  const dayInSeconds = 24 * 60 * 60;
  const minSigningBlocksPeriod = 150;
  const minSigningBlocksPeriodSeconds = minSigningBlocksPeriod * 12;

  const depositTransactionsPerDay =
    dayInSeconds / minSigningBlocksPeriodSeconds;

  const councilsCount = 6;
  const modulesCount = 2;

  const dayPrice =
    depositTransactionsPerDay * usdAvgPrice * councilsCount * modulesCount;
  const yearPrice = dayPrice * 365;

  return [dayPrice.toFixed(2), yearPrice.toFixed(2)];
};

console.log('L2 by l2fees data');
console.log()
console.log('| Chain | Price per day | Price per year |');
console.log('|-------------|-------------|-------------|');
console.log('| ZkSync era |', getAvgPrice(0.13).join(' | '), ' | ');
console.log('| ZkSync lite |', getAvgPrice(0.25).join(' | '), ' | ');
console.log('| Optimism |', getAvgPrice(0.4).join(' | '), ' | ');
console.log();
console.log('Different evm based network');
console.log()
console.log('| Chain | Price per day | Price per year |');
console.log('|-------------|-------------|-------------|');
// avg tx price * 5 * token to usd price
// https://polygonscan.com/tx/0x67e28b6adadb12c4cf2ee5a35ba6b8c6a4fbf2c853376aedbbbfe6678de2b720
// https://coinmarketcap.com/currencies/polygon/
console.log('| Polygon |', getAvgPrice(0.003565636714899 * 5 * 1.05).join(' | '), ' | ');
// https://app.roninchain.com/tx/0x4e5b9f29d1b8e755f65ddc1c68fe9b67cb7be30f36328131ea1366a3e1812e2b
// https://coinmarketcap.com/currencies/ronin/
console.log('| Ronin |', getAvgPrice(0.00042 * 5 * 2.87).join(' | '), ' | ');
// https://gnosisscan.io/tx/0x600e1469a299ee5c89318e53c399aa8b562dcef3151e8cbd97bd3c6fcc133e06
// https://coinmarketcap.com/currencies/xdaistable/
console.log('| Gnosis |', getAvgPrice(0.00003528 * 5 * 1).join(' | '), ' | ');
// https://explorer.harmony.one/tx/0xdc103aa33629a554db2f99d3aad6c55bde656fffce973b815405d9af860257c3
// https://coinmarketcap.com/currencies/harmony/
console.log('| Harmony |', getAvgPrice(0.01438116 * 5 * 0.0231).join(' | '), ' | ');

Gnosis

Cost of Use in More Detail

Let's take historical gas price data from https://gnosisscan.io/chart/gasprice

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More โ†’

The graph above shows the gas price for the past year. It can be seen that the initial calculation was based on the most optimistic price. To get a more accurate calculation, I propose taking the median price for the year and updating our calculations.

As a result of calculating the median for the year, we get that we need to multiply our previous result by 3.66, which gives us the following:

  • Price per day: $0.366
  • Price per year: $135

It turns out that even with a less optimistic gas price, the Gnosis-based solution is much cheaper than the competition.

Uptime

The uptime of all services can be viewed on the website https://status.gnosischain.com/

The annual uptime of all services is above 99%, which is a suitable result.

Community

A quick search did not reveal any obvious problems mentioned in the communities.

Conclusion

This network is the cheapest, with excellent infrastructure and high uptime.

Harmony

Here we should also start by comparing the transaction costs for the year. Let's go to the website https://explorer.harmony.one/charts/fee and calculate the median.

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More โ†’

As a result of the calculations, we get that we need to multiply the result of our experiment by 2.64, which gives us the following prices:

  • Price per day: $2.53
  • Price per year: $921

Uptime

The uptime of all network services can be viewed on the website https://status.harmony.one/

Uptime for the last 90 days is 100%

Community

A quick search showed that the protocol was hacked, but it continues to work: https://www.reddit.com/r/harmony_one/comments/1b16cua/harmony_one_what_are_your_thoughts_on_price/

https://www.reddit.com/r/harmony_one/comments/18daylr/harmony_wallet_compromised_metamask/

Conclusion

This network is more expensive than Gnosis, with working infrastructure and uptime.

However, there are security concerns. This issue requires further research. At this point, I recommend using this network only as a backup transport layer in case of problems with the primary network, and only for a limited time.

Ronin

Roninchain does not provide historical transaction cost data in a convenient format.

Community

A quick search did not reveal any obvious problems mentioned in the communities.

Conclusion

Affordable price, good tooling, but only from the main developer, no third-party tooling. It is also difficult to understand the historical cost of gas. At this point, I can only recommend using it as a backup transport layer.

Polygon

image

Polygon has experienced the least gas price fluctuations over the past year compared to other networks.

Our preliminary calculations differ from the median by 1.08. Therefore, the median price will be as follows:

  • Price per day: $11.64
  • Price per year: $4250,45

Community

A quick search did not reveal any obvious problems mentioned in the communities.

Status

The uptime of the service for the last 90 days is quite high, >90%. You can check it on https://polygonstatus.com/

Conclusion

This solution is significantly more expensive than the others, but still cheaper than any L2 solution. However, this network is quite well-known and reliable. We also have many people in our team with experience working with this network. This solution is recommended as a fallback provider, in case we implement fallback provider logic.

Risk Assessment

Currently, the following risks are evident:

  • Sudden network outage: This could be caused by a technical issue or a deliberate attack.
  • Censorship/substitution of Council messages: This could prevent the Council from communicating with other nodes or from sending valid transactions.
  • Sharp increase in gas prices: This could make it prohibitively expensive to use the network.

On-Chain Data Bus Monitoring

This can be implemented as a separate service or as Forta code. We need to monitor the following:

  • Gas cost: This includes tracking the gas price and usage for different types of transactions.
  • Council balance: We need to monitor the balance of each Council to ensure that they have enough funds to pay for transactions.
  • Network availability: This involves monitoring the network uptime and latency.
  • Message consistency: We need to ensure that the messages sent by our Council are consistent with the messages received by other nodes in the network.

Based on the monitoring results, we should notify the Councils about any issues in a timely manner and take preventive measures.

Fallback Network

In the current solution, we use Gnosis as the primary network. However, we need to be prepared for the possibility that this network may become unavailable, transaction fees may increase, or censorship may occur.

To mitigate these risks, we can use a fallback network such as Polygon or Ronin. This would allow us to switch the transport layer from Gnosis to another network and back if necessary.

Conclusion

Based on the research conducted, the following table has been compiled:

Chain Median price per year Uptime No incidents Community (Twitter) Tooling
Gnosis $135 >99% + >70k +
Polygon $4250,45 >99% + > 2kk +
Harmony $921 >99% - > 399k +
Ronin $1267.12 >99% + > 170k +

*Ronin The price for the year was taken from the calculation of a random transfer transaction, as there are no tools to check historical data as there are in other networks.

Harmony seems to have excellent indicators at first glance, but there are problems in the community related to asset theft.

Based on the research, I propose using Gnosis as the primary network and Polygon as a backup network in case of problems with Gnosis.

Additional considerations:

  • Security: Gnosis and Polygon are both considered to be secure networks. However, it is important to note that no network is completely immune to attack. It is therefore important to develop a monitoring and switching/fallback mechanism.
  • Cost: Gnosis has a lower median daily gas price than Polygon. However, Polygon's median yearly gas price is lower. This is due to the fact that Gnosis' gas price is more volatile than Polygon's.
  • Community: Gnosis has a smaller community than Polygon. This could make it more difficult to get support if you encounter problems with the network.