EVM Chains

This page describes how ETH and EVM chains are implemented

Chain Client

Example for Ethereum.

Observer And Signer:

https://gitlab.com/mayachain/mayanode/-/blob/develop/bifrost/pkg/chainclients/ethereum/ethereum.go?ref_type=heads

Router

The EVM Bifrost is different to others in that it uses a router to handle deposits into and out of MAYAChain vaults. The Router is just a means for capturing token deposits and emitting memos.

The Router holds all ERC20s, but forwards ETH to the TSS vault. This allows the TSS Vault to call into the Router and pay gas to move token allowances to vaults.

Instead of paying ERC20s to vault addresses, an allowance to spend is given on the Router. The depositing user gives this allowance to the Asgard vault.

Additionally because of this, the Router is a permissionless contract with no special privileges (there is no owner).

The Router is necessary because the ERC20 standard has no "push" functionality, and no ability to attach native memos. The Router uses the transferFrom "pull" and emits an event with a memo string.

Scanning Blocks

The block scanner monitors the Router events, and can create a witness transaction based on this event.

Confirmation Counting

Incomings are "conf-counted" by comparing their value with ETH (using MAYAChain pool pricing) and then delayed based on the ETH value of the deposits compared with the ETH block reward + fees.

ETH Cancellation Logic

ETH was found to have very dynamic gas fees, causing vaults to lock up. Since it does not have child-pays-for-parent, each node has tx cancellation logic which it invokes if it finds it has made gas that is still pending after 20 mins.

It does this by simply spending 0 ETH back to itself using the same nonce as the tx that is stuck, using the latest Gas prices.

Gas Fees and Limits

Each node will use up to 200k Gas to make an outbound tx (this covers most ERC20s), however the real cost is closer to 80k Gas units so the user is charged based on spending 80k (the fee they paid is deducted from the final transaction out).

Since it is really disruptive if a tx does not go thru (since it locks up vaults) the ETH Bifrost uses a gas fee which is 1.5x what the current "average" gas price is for a block. This puts the gas fees that Maya uses close to "fastest" gas prices.

Re-orgs

The ETH chain re-orgs a lot, and Maya is able to monitor and post re-org data to MAYAChain.

Last updated

Was this helpful?