Sequencer Fee Sharing
In the AppChain, built on the Arbitrum Nitro stack, block production is managed by a sequencer. The sequencer plays a key role by:
- Confirming transactions and updating the state
- Constructing and executing L2 blocks
- Submitting user transactions to L1
Until fault proofs are fully implemented, sequencers are centralized for security and are managed by AppChain. This means AppChain gets all the sequencer fees. To share these fees with developers, we have the Sequencer Fee Sharing (SFS) system.
Developers can earn a portion of the network sequencer fees by registering their smart contracts in the Fee Sharing Contract.
The SFS contract acts as a registry that tracks and stores balances. Once you deploy your contract and register it in the SFS, you start earning fees whenever your contract is used.
When you register your contract, the SFS mints an NFT as a claim to the earned fees. This NFT is sent to the _recipient
you specify when calling the register function. The SFS NFT allows anyone who possesses it to claim the rewards for that particular smart contract. Whether the NFT is in your wallet or a smart contract, the entity trying to withdraw the earnings needs to hold the NFT to withdraw funds.
Frequently Asked Questions
1. What is Sequencer Fee Sharing (SFS) in AppChain Testnet?
SFS in AppChain Testnet is a system that lets developers earn part of the network's sequencer fees. By registering their smart contracts with the SFS contract, developers get a share of the fees from transactions involving their contracts.
2. How does a developer benefit from SFS?
Developers earn a share of the sequencer fees each time their registered smart contract is used in a transaction. This provides an additional revenue stream, encouraging developers to build and maintain high-quality, frequently used contracts on the network.
3. What is the process to register a contract in the SFS?
To register a contract in the SFS, developers must call the register function from within their smart contract. This action mints an NFT, which serves as a token of ownership and entitlement to the fees generated by the contract's usage.
4. What is the role of the NFT in SFS?
In SFS, the NFT acts as a digital certificate, showing the holder's right to claim fees earned by a specific smart contract. It's a unique representation of ownership and fee entitlement, linked directly to the contract's activity.
5. Can a contract be registered multiple times in the SFS?
No, each smart contract can only be registered once in the SFS. This ensures a clear and unambiguous link between a contract and its corresponding NFT for fee collection.
6. How is the msg.sender
used in the register function?
In the register function, msg.sender identifies the smart contract initiating the registration. This ensures that the contract itself, rather than an external account, is registering for fee sharing, maintaining the integrity of the SFS system.
7. What is the purpose of the assign function in SFS?
The assign function is used to link a smart contract to an existing SFS NFT. This is useful for dApps with multiple contracts, allowing them to accumulate revenue from all contracts under a single NFT, simplifying the fee collection process.
8. How often are fee balances updated in the SFS?
In the SFS, fee balances are updated every two weeks on the mainnet and every 24 hours on the testnet. This periodic update reflects the accumulation of fees generated by the registered contracts.
9. Who can withdraw earned fees from the SFS?
Withdrawal of earned fees is restricted to the holder of the SFS NFT linked to the smart contract. This can be either an Externally Owned Account (EOA) or a smart contract, provided they possess the NFT at the time of withdrawal.
10. What happens if the withdrawal amount exceeds the earned fees?
If the requested withdrawal amount exceeds the available earned fees, the system automatically adjusts the withdrawal to the maximum available amount. This ensures that withdrawals are always within the bounds of the actual fees accumulated by the contract.