New Bridge Automated Fee Feature

New Bridge Automated Fee Feature

In the recent past, there have been some pain points associated with maneuvering the Palm network bridge which have negatively impacted the user experience. The Palm network is happy to announce that we have implemented a solution that automatically calculates and adjusts the fees based on average Ethereum gas prices. This tool updates every three hours, so the fees should reflect the cost of gas incurred by the bridge, more accurately.

We’d like to share a bit more about how the bridge fees worked and the new solution with you.

Gas prices on Ethereum are very volatile, and can fluctuate in an instant. The chart below highlights how quickly the costs can ramp up. The bridge is designed to be cost-neutral, and the Palm network does our best to set the price in a fair and predictable way that doesn’t change too much, even when the underlying gas prices do.

Chart 1: Gas prices over the past 3 days showing significant volatility

More on the technical aspects of how this will work:

When transferring to Ethereum, there are two transactions executed by the bridge on Mainnet. The first one confirms that the tokens on the Palm network side are definitely locked in the bridge (when moving NFTs) or are burned (when moving DAI or other ERC-20 tokens back to Ethereum). The second transaction will transfer the token to the recipient wallet address. Depending on the token type, the gas consumed by these transactions is usually just under 400,000 units total. The gas cost is calculated by multiplying gas usage by gas price, ie.  400,000 x 100 gwei = 0.04 Ether. When gas is 50 gwei, consumption will be 0.02 Ether.

Designed to be cost-neutral, the median gas prices for the past 72 hours are calculated based on snapshots taken of price at 2 minute intervals. This helps smooth the fluctuation of prices during periods of network congestion. 

Given that fees are charged in DAI, but are charged to the bridge in Ether, we then calculate an moving average exchange rate using the previous 7 days ETH/DAI exchange rates, with an adjustment factor of one standard deviation to reduce the effects of exchange rate volatility.

Once we have calculated the fee in DAI, we update the relevant fee information in the bridge smart contracts.

Chart 2: Theoretical bridge fees for the past 7 days calculated using moving-median gas prices (50th percentile)

The chart above shows what the automated fee would have been for the past week. There may be times where you will pay a little more than the actual transaction costs, and other times when you’ll pay a little less. But given that the prices are being updated more frequently, they should be pretty close to the actual cost.

Before we automated the fee changes, we previously used the same pricing model outlined above every couple of weeks or so, but it was a fairly significant manual effort to collect the data, calculate an appropriate price and update the fee smart contract. There were perhaps more times where the fee was not presented accurately, leading to a poor user experience.

We’re currently evaluating and planning the migration steps to integrate updated contracts that use less gas, which will lead to lower fees in the future. The Palm network will keep you updated on our progress in addressing these improvements on our Discord server. We’re always keen to improve how we can keep bridge prices as low as possible, and would be happy to hear your feedback or suggestions.