๐ซ pallet-feeless: Feeless Transactions with Rate Limiting for Substrate ๐ซ
Welcome to pallet-feeless โ a plug-and-play solution to enable fully feeless transactions in any Substrate-based blockchain! โจ
Instead of charging transaction fees, this pallet uses a rate-limiting system to ensure fair usage and network security. It's perfect for applications where user experience, accessibility, and cost-efficiency are top priorities.
๐งฉ Introduction
Most blockchains rely on transaction fees to prevent spam and incentivize validators. While effective, this system can create friction, especially for:
- Microtransactions ๐ธ
- New users ๐งโ๐ป
- Developers building free-to-use apps ๐
This pallet removes transaction fees altogetherโeven during congestionโby using a rate-limiting extrinsic extension. This makes your blockchain:
- ๐ซ Free from fees
- ๐ Predictable for users
- ๐ก๏ธ Secure against spam
๐ก How It Works
Instead of fees, each account is subject to a rate limit:
- โฑ๏ธ Max Transactions per Period: The number of transactions allowed per account in a set block window.
- ๐ฆ Max Size per Period: The total size of allowed transactions during that window.
This is enforced via a custom extrinsic extension (CheckRate) that plugs into Substrateโs transaction validation pipeline alongside checks like:
CheckNonceCheckWeightCheckEra- ...
All validation and accounting are performed before and after dispatch, with minimal storage access to preserve performance and security.
โ๏ธ Runtime Integration
1. Define AccountData in frame_system
type AccountData = AccountData;
This custom account type stores balance, last block, and rate data per account.
2. Set Up AccountStore in pallet_balances
type AccountStore = Account;
Required to track the accountโs storage location and enable rate tracking.
3. Configure pallet_feeless
Add your custom settings in the runtime:
4. Update Your Transaction Extensions
Extend the runtime transaction validation to include CheckRate:
pub type TxExtension = ;
5. Benchmarking and Payload Setup
In benchmarking.rs or similar:
let tx_ext: TxExtension = ;
let raw_payload = from_raw;
โ Benefits
-
๐ซ No Transaction Fees
Users never worry about price fluctuations. -
โ๏ธ Built-in Fairness
Every account gets a rate limit, ensuring equal access. -
๐ ๏ธ Developer Friendly
Build dApps without forcing users to hold or buy tokens. -
๐ Accessible UX
Lower onboarding friction and support for micro-use cases.
โ ๏ธ Considerations
While this system improves user experience, keep in mind:
- โ๏ธ Fine-tuning required: Limits must strike a balance between usability and protection.
- ๐ฏ No validator fees: Block rewards or other models must be used to incentivize validators.
- ๐ก๏ธ Spam resistance: Rate limits must be sufficient to deter Sybil attacks or multi-account spamming.
๐ฆ Want to Try It?
Just include this pallet in your Substrate runtime and configure the limits to your needs. No additional infrastructure or fee logic is required!
๐ License
MIT โ open-source and ready to use in your blockchain projects.