Zero Gas Fees
Gas Fees
Section titled “Gas Fees”Blockchains contain a fee model that requires users and developers to pay for transactions. This fee is often known as a gas fee [or sometimes a transaction fee]. Gas fees are utilized for two (2) reasons:
- To pay for the compute resources requires to execute a transaction
- To prevent spam and DDoS attacks on the network
While gas tokens are not always bad, they can be a barrier of entry for users and developers. The most common issues found with valuable gas are:
- Users and developers must purchase gas tokens to interact with the network
- Users and developers must manage gas tokens to ensure they have enough to interact with the network
- Network congestion can lead to spikes in gas consumption which can lead to high gas fees
While solving the first two (2) issues is ideal for building applications that can be adopted globally, the third issue is a bit more complex. Network congestion is a common issue on blockchains and often results in dApps becoming unusable or unavailable during periods of congestion.
Zero Gas Fees
Section titled “Zero Gas Fees”SKALE solves the above issues with a unique design known as zero gas fees. There is a gas token on SKALE, however, it has no monetary or economic value. This token operates just like Ether on Ethereum, however, with no moneary value it cannot be traded or sold.
The token on SKALE exists for two (2) reasons:
- To ensure compatiblity with popular EVM tooling. This allows developers on existing EVM based blockchains like Ethereum to quickly start building on SKALE
- To prevent spam and DDoS attacks on the network
SKALE Fuel
Section titled “SKALE Fuel”The native gas token on every SKALE Chain is known as SKALE Fuel or sFUEL for short. sFUEL is something that is distributed by either the SKALE Chain Operator, the dApp to users, or a public faucet.
-
For Developers: With the zero gas fee model, developers can start building on SKALE instantly without having to first purchase gas tokens. Additionally, putting more onchain and having larger smart contracts or many smart contracts is no longer a concern.
-
For Users: Even better, users do not need to purchase gas tokens to interact with dApps on SKALE. With sFUEL being given to users invisibily during onboarding to a dApp — which is a process called sFUEL Distribution — users can start interacting with applications on SKALE and never even know they are “onchain”.
SKALE Gasless Transactions
Section titled “SKALE Gasless Transactions”A gasless transaction is a blockchain transaction native to SKALE Network that does not require the user to have any gas in their wallet to interact with the network. The steps of a gasless transaction are as follows:
- Determine the sender address, the sender address nonce, and the gas limit of the transaction.
- Use Proof of Work to generate a magic number.
- Build the transaction with the gasPrice of the transaction set to the value of the magic number
- Execute the transaction, even without sFUEL in the sender’s account
Exploring Proof of Work
Section titled “Exploring Proof of Work”Proof of Work [on SKALE] is a method that allows wallets to mine sufficient amount of sFUEL to any address to send a transaction. The act of mining is computationally expensive and requires a user to solve a complex mathematical problem to generate a magic number. This computation cost is what makes it such a great deterrent from being used to spam the network since it would cost a bad actor a significant amount of money to do so.
Understanding Magic Numbers
Section titled “Understanding Magic Numbers”SKALE uses the concept of “the magic number” in conjunction with Proof of Work to allow the sender (i.e the client) and SKALE Chain to agree that a transaction is valid EVEN IF there is not a sufficient amount of sFUEL (inclusive of 0 sFUEL) in the sender’s account. This also allows gasless transactions to remain fully compatible with the Ethereum Virtual Machine and most popular tools.
Proof of Work Algorithm
Section titled “Proof of Work Algorithm”- The client generates a random 256-bit X (i.e the magic number) by a formula which is equal to a unique gasPrice value
- Check whether X is allow to run transaction
- If , then back to the first step
- If , then send the transaction with gasPrice =
X
andgasLimit
= freeGas(X)
Popular Usecases
Section titled “Popular Usecases”Invisible Transactions
Section titled “Invisible Transactions”Buliding using gasless transactions allows developers to create applications that have no “blockchain” that is visible to the user. Creating seamless experiences that have no friction for new users is critical toward building applications that can be adopted globally and pass the grandma test (yes, even grandma can use it)!
While invisible transactions can be done with zero gas fees gasless transactions can really help take your dApp to the next level.
sFUEL Distribution
Section titled “sFUEL Distribution”sFUEL Distribution is a process that allows developers to invisibly give users gas to interact with their dApp. This process is critical to ensuring that users can interact with your dApp especially with the sFUEL token being unpurchasable. While many developers choose to lean on servers to operate the distribution, using gasless transactions allows developers to lean on public faucet infrastructure or custom distribution contracts that have no operational overhead. This can greatly reduce the costs of operating a dApp and greatly increase security for applications that may be popular targets for bad actors.
True Decentralization & Enhanced Security
Section titled “True Decentralization & Enhanced Security”With sFUEL on SKALE being metered by operators and developers to properly secure the chain from being spammed; the truest path towards decentralization of your application is using gasless transactions. Switching or starting with the proof of work method means that you as a developer never have to worry about having “enough gas”.
Community Tools
Section titled “Community Tools”Name | Description | Language |
---|---|---|
@eidolon-labs/gasless | Generate magic numbers using SKALE Proof of Work with Rust | JS/TS/Rust |
skale.dart | Generate magic numbers with Dart | Dart |
skale-gas-miner | Generate magic numbers in Unity | C++/C# |