-
Notifications
You must be signed in to change notification settings - Fork 90
docs: document Paymaster for gasless transactions #4499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -304,6 +304,80 @@ Expected response: | |
| ] | ||
| } | ||
| ``` | ||
| --- | ||
|
|
||
| ## Paymaster (Gasless Transactions) | ||
|
|
||
| Starting in v0.71, the relay supports a Paymaster-style mode that allows operators to sponsor gas fees for selected users or contracts — enabling gasless transactions and simpler onboarding. | ||
|
|
||
| ### Overview (Paymaster) | ||
|
|
||
| In traditional Web3 environments, every transaction must include a gas payment from the user’s account. | ||
| Hedera’s Paymaster-style model allows a relay or operator to safely and predictably cover gas fees for users. | ||
|
|
||
| #### Why It Matters | ||
|
|
||
| - Better UX — users can act without holding HBAR. | ||
| - Flexible monetization — sponsorship via credits or fiat. | ||
| - Enterprise and consumer use cases — onboarding, delegated submissions, sponsored dApps. | ||
| - Seamless integration — no changes to `msg.sender`. | ||
|
|
||
| ### Configuration Overview | ||
|
|
||
| | Parameter | Description | Type | Default | | ||
| | ---------- | ------------ | ---- | -------- | | ||
| | PAYMASTER_ENABLED | Enables Paymaster functionality. | Boolean | false | | ||
| | PAYMASTER_WHITELIST | Whitelisted addresses eligible for sponsorship. Use `*` for all. | String | "" | | ||
| | MAX_GAS_ALLOWANCE_HBAR | Max HBAR subsidy per transaction. | Decimal | 0 | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding the codebase https://github.com/hiero-ledger/hiero-json-rpc-relay/blob/main/packages/relay/src/lib/clients/sdkClient.ts#L182, this is not a decimal. Here is the official doc https://docs.hedera.com/hedera/sdks-and-apis/sdks/smart-contracts/ethereum-transaction. This value is denominated in tinybars, and yeah, the config name is a little bit misleading. |
||
|
|
||
| **Note:** `MAX_GAS_ALLOWANCE_HBAR` applies only if Paymaster is enabled and sender is whitelisted. | ||
| Senders must set `gasPrice=0` to trigger sponsorship. | ||
|
|
||
| ### Behavior Summary | ||
|
|
||
| 1. Enable Paymaster mode (`PAYMASTER_ENABLED=true`). | ||
| 2. Define eligible addresses (`PAYMASTER_WHITELIST`). | ||
| 3. Relay attaches a gas allowance up to `MAX_GAS_ALLOWANCE_HBAR`. | ||
| 4. Payer covers cost; otherwise transaction proceeds normally. | ||
|
|
||
| ### Example Configurations | ||
|
|
||
| ```bash | ||
| # Demo / testnet | ||
| PAYMASTER_ENABLED=true | ||
| PAYMASTER_WHITELIST=* | ||
| MAX_GAS_ALLOWANCE_HBAR=0.15 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| ``` | ||
|
|
||
| ```bash | ||
| # Production | ||
| PAYMASTER_ENABLED=true | ||
| PAYMASTER_WHITELIST=0xabc123...,0xdef456... | ||
| MAX_GAS_ALLOWANCE_HBAR=0.10 | ||
| ``` | ||
|
|
||
| ### Example Use Cases | ||
|
|
||
| | Scenario | Description | Typical Settings | | ||
| | -------- | ------------ | ---------------- | | ||
| | App onboarding | Cover first user actions | PAYMASTER_ENABLED=true, PAYMASTER_WHITELIST=*, MAX_GAS_ALLOWANCE_HBAR=0.2 | | ||
| | Enterprise backend | Relay sponsors contract writes | PAYMASTER_ENABLED=true, PAYMASTER_WHITELIST=<contracts>, MAX_GAS_ALLOWANCE_HBAR=0.5 | | ||
| | Community relay | Sponsored dApp usage | PAYMASTER_ENABLED=true, PAYMASTER_WHITELIST=*, MAX_GAS_ALLOWANCE_HBAR=0.1 | | ||
|
|
||
| ### Best Practices | ||
|
|
||
| - Always explicitly enable Paymaster. | ||
| - Use whitelisting for control. | ||
| - Start small (≤0.1 HBAR). | ||
| - Track and log sponsorship spend. | ||
| - Avoid `PAYMASTER_WHITELIST=*` in production. | ||
|
|
||
| ### References | ||
|
|
||
| - PR #3941 — [Detailed Paymaster discussion](https://github.com/hiero-ledger/hiero-json-rpc-relay/pull/3941) | ||
| - [Relay Configuration Docs](https://github.com/hiero-ledger/hiero-json-rpc-relay) | ||
|
|
||
| --- | ||
|
|
||
| ## Support | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Paymaster is still in the experimental stage, could you please add a short disclaimer section to mention that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is meant by experimental? Isn't it deployed and anyone deploying their own JSON-RPC relay can use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Keith sorry for the late response. So by experimental I meant that the Paymaster was implemented based on a POC and hasn’t gone through a full acceptance criteria review yet. It was built for a specific experimental use case requested previously, and only validated against successful (“happy path”) scenarios, not failure cases. So it might be unstable or prone to failure for now. That's why we should put a disclaimer for the section.