How Does Gas Work on Facet V2?

Paying For Gas on Facet

Facet, like all EVM chains, has a gas mechanism to prevent DOS attacks. Also like other EVM chains, Facet gas is paid in Facet's native currency, which is called Facet Compute Token (FCT). This is where the similarities end, however.

In order to preserve Facet's commitment to decentralization, we have adopted a unique approach when designing FCT.

Why Does Facet Need a Unique Approach?

Let's look at the "standard L2 gas token approach," its deficiencies, and how we might fix them.

On the Ethereum L1 the native currency is ether. Other Layer 2s try to simulate the experience of having ether as the native currency by using a bridge. Users deposit L1 ether into an L1 smart contract and in return they are minted L2 ether. Users burn L2 ether to withdraw L1 ether from the L1 smart contract.

The bridge approach can be convenient, but it isn't secure. Why?

First, note that the L1 bridge smart contracts must be upgradeable. This is for two reasons. First, these bridges are sufficiently complicated such that it's not possible to prove that they are bug-free. With billions of dollars at stake, L2 operators must retain the power to fix bugs.

Second, when the L2 protocol is upgraded, the L1 smart contracts might require upgrades as well. This is because the L1 smart contracts must verify whether a user is eligible to withdraw under current protocol rules, and if the L1 smart contract didn't keep up with L2 protocol rule changes it could incorrectly prevent or allow withdrawals.

And if the L1 contracts can be upgraded, the person or people who control the private keys to do so will always be in a privileged position over ordinary users. In the extreme case they can drain the L1 contract and burn the L2 ether, but even in less extreme cases they can subtly bend protocol development to their advantage.

On the Ethereum L1, by contrast, there are no privileged keys. As far as the protocol is concerned you have just as much power as Vitalik. This is possible because ether is not "backed by" another currency. Instead it is issued in a neutral manner to anyone who follows the appropriate protocol rules.

Facet Compute Token works the same way.

But Ethereum issues its native token as a reward for securing Ethereum's consensus mechanism. Facet has no consensus mechanism of its own (it inherits Ethereum's). Given this, how can Facet have a neutral, unbridged, native token?

Enter Facet Compute Token (FCT)

Users earn Facet Compute Token (FCT) by spending L1 ether in the creation of Facet transactions.

Here's how it works:

  1. As discussed in Transaction Structure, Facet transactions are sent within a regular Ethereum transaction sent to the Facet inbox address containing special calldata payloads. Here's an example. We’ll call this an Ethereum “envelope” transaction.

  2. You pay for this using Ethereum’s gas (ether), just like any other Ethereum transaction. But since Facet transactions are sent to a burn address (the Facet inbox), and not a smart contract address, they are treated as wallet-to-wallet transactions, avoiding the higher gas fees triggered by smart contract operations. Expect 90+% gas savings on typical L1 transaction scenarios.

In it's simplest form, all you need to know is that when sending Facet transactions, you pay gas with your L1 gas (ether).

Behind the scenes, there’s a process that converts a portion of your L1 gas into FCT. Here’s the end-to-end process:

  1. User spends ether on an L1 Ethereum envelope transaction containing a Facet payload in the transaction calldata.

  2. Facet mints FCT at a defined rate, based on the payload’s calldata size.

  3. Facet consumes a portion of the minted FCT to process the transaction.

  4. Post execution, Facet credits any remaining FCT to the user’s wallet.

Because the FCT credit is applied before the user is required to pay for the gas of their Facet transaction, and because users earn FCT for something they were doing anyway (submitting a Facet transaction), in the majority of cases users won't have to worry about gas at all on Facet, much like they didn't on Facet V1.

A Note on Smart Contracts

L1 smart contracts can create Facet Transactions, and yet they don't pay gas. This means they don't burn ether and ordinarily wouldn't earn any FCT. Under the default rules this means that if you wanted an L1 smart contract to initiate a Facet Transaction for your benefit you would have to first send that smart contract FCT, which is inconvenient.

For this reason, when there are multiple calls in an Ethereum transaction that creates one or more Facet Transactions the FCT mint is split equally between the from addresses on each of the separate calls.

Last updated