-
Notifications
You must be signed in to change notification settings - Fork 137
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
NEP-366: Meta transactions #366
Changes from 3 commits
f08cf90
09bdb8e
7cf1baa
6c6720e
00cebb3
acd3fea
56ddd62
4d1ac73
003e589
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 | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,62 @@ | ||||||
--- | ||||||
NEP: 366 | ||||||
Title: Meta Transactions | ||||||
Author: Illia Polosukhin <ilblackdragon@gmail.com> | ||||||
DiscussionsTo: https://github.com/nearprotocol/neps/pull/366 | ||||||
Status: Draft | ||||||
Type: Protocol Track | ||||||
Category: Runtime | ||||||
Created: 21-Jun-2022 | ||||||
--- | ||||||
|
||||||
## Summary | ||||||
|
||||||
In-protocol meta transactions allowing for third-party account to initiate and pay transaction fees on behalf of the account. | ||||||
|
||||||
## Motivation | ||||||
|
||||||
NEAR has been designed with simplify of onboarding in mind. One of the large hurdles right now is that after creating an implicit or even named account user doesn't have NEAR to pay gas fees to interact with apps. | ||||||
ilblackdragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
For example, apps that pay user for doing work (like NEARCrowd or Sweatcoin) or free-to-play games. | ||||||
|
||||||
[Aurora Plus](https://aurora.plus) has shown viability of the relayers that can offer some number of free transactions and a subscription model. Shifting the complexity of dealing with fees to the infrastructure from the user space. | ||||||
|
||||||
## Rationale and alternatives | ||||||
|
||||||
Proposed here design provides the easiest for users and developers way to onboard and pay for user transactions. | ||||||
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.
Suggested change
nit: grammar |
||||||
There is no requirement on the user account, including user account may not even exist on chain and implicit account can be used. | ||||||
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.
Suggested change
nit: grammar |
||||||
|
||||||
An alterantive is a proxy contracts deployed on the user account. | ||||||
ilblackdragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
This design has severe limitations as it requires user to deploy such contract and additional costs for storage. | ||||||
|
||||||
## Specification | ||||||
|
||||||
Next changes to protocol are required: | ||||||
- New Action kind: `DelegateAction(receiver_id, Action, signer_pk, signature)` | ||||||
- On conversion to Receipt, such action is sent as `DelegateAction` to the `receiver_id`. | ||||||
- On processing Receipt, it verifies the `signature` over the given account and `signer_pk`. Unwraps into `receiver_id: AccountId`, `action: Action` inside into new Receipt with given `receiver_id` and `action`. This means that `predeccessor_id` of such action has been overriden. | ||||||
|
||||||
ilblackdragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
See the [DelegateAction specification](specs/RuntimeSepc/Actions.md#DelegateAction) for details. | ||||||
|
||||||
## Security Implications | ||||||
|
||||||
Delegate actions do not override `signer_pk`, leaving that to the original signer that initiated transaction (eg relayer in meta transaction case). Although it is possible to override `signer_pk` in the context with one from `DelegateAction`, there is no clear value to do that. | ||||||
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.
Suggested change
|
||||||
|
||||||
See ***Validation*** section in [DelegateAction specification](specs/RuntimeSepc/Actions.md#DelegateAction) for security considerations around what user signs and validation of actions with different permissions. | ||||||
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.
Suggested change
|
||||||
|
||||||
## Drawbacks | ||||||
|
||||||
Increases complexity of the NEAR's transactional model. | ||||||
ilblackdragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
Meta transactions take an extra block to execute, as they first need to be included by the originating account, then routed to the delegate account and only after that to the real destination. | ||||||
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.
Suggested change
|
||||||
|
||||||
Delegate actions are not programmable as they require having signatures. Original proposal contained a new `AccessKey` kind that would support programmable delegated actions. On the other hand, that would be limiting without progamability of smart contracts, hence that idea evolved into [Account Extensions](https://github.com/nearprotocol/neps/pull/0000). | ||||||
ilblackdragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## Future possibilities | ||||||
|
||||||
Supporting ZK proofs instead of just signatures can allow for anonymous transactions, which pay fees to relayers in anonymous way. | ||||||
ilblackdragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## Copyright | ||||||
[copyright]: #copyright | ||||||
|
||||||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
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.