Near Meta-Transactions And Relays

    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Understanding Meta Transactions on NEAR Protocol

    Meta transactions, introduced through NEP-366, allow users to interact with the NEAR blockchain without needing to own NEAR tokens for gas fees. This innovative approach lowers the barrier to entry for users and applications by enabling off-chain transaction construction and fee delegation to a third-party relayer. Here's how it works:

    What are Meta Transactions? A meta transaction enables a user to perform blockchain actions without holding native tokens for gas fees. Instead, a relayer submits the transaction on behalf of the user, covering the required gas costs.

    This system is particularly beneficial for:

    New users who might not yet hold NEAR tokens but wish to use the network. DApps aiming to provide a frictionless user experience by abstracting gas fees.

    The Role and Compensation of Relayers Relayers are essential to the meta transaction process as they act as intermediaries between the user and the blockchain. They:

    Pay the gas fees for the transaction. Verify and process DelegateActions. Compensation:

    Relayers may charge users for their services. Payment can be arranged: Off-chain through traditional means. On-chain using fungible tokens, which can be included as part of the DelegateAction. Challenges:

    Payment Risks: A relayer may process a transaction only to find the user's token balance insufficient for payment. Mitigation: Relayers can pre-check balances, but no system can fully guarantee payment due to potential race conditions or other user actions.

    How Do Meta Transactions Work? Transaction Creation (Off-Chain):

    The user constructs a special type of transaction called a DelegateAction, which includes: A list of actions to execute (e.g., token transfer, contract call). The intended recipient of the transaction. The user signs the transaction off-chain using their private key. Role of the Relayer:

    The signed DelegateAction is sent to a relayer, a third-party service. The relayer performs necessary checks, such as verifying the user's signature and ensuring any payment (e.g., in fungible tokens) is included if required. The relayer wraps the DelegateAction in a standard NEAR transaction and submits it on-chain. On-Chain Execution:

    Once submitted, the DelegateAction is unpacked and validated: Is the user’s signature valid? Is the nonce correct to prevent replay attacks? If valid, the inner actions are executed as specified.

    Key Takeaways Lower Barriers to Entry: Meta transactions simplify user onboarding by removing the immediate need for NEAR tokens. Enhanced User Experience: Applications can abstract complex blockchain interactions, allowing users to focus on functionality without worrying about gas. Relayer Trust: Successful implementation relies on trust and robust mechanisms to ensure relayers are compensated fairly. Meta transactions represent a significant step toward making blockchain more user-friendly and accessible, aligning with NEAR’s mission to scale usability for decentralized applications.

    Paying Relayers with Any Token

    Meta transactions on NEAR provide flexibility in how users compensate relayers. Instead of requiring NEAR tokens, users can pay relayers using any fungible token they hold. This enables seamless interaction for users who might not yet have NEAR but own other assets.

    How It Works:

    • Users include a payment action within the DelegateAction to transfer a specific amount of their token to the relayer.
    • The relayer, in turn, uses this payment as an incentive to offer gas in NEAR, covering the transaction fees on behalf of the user.

    This model aligns the interests of both parties:

    • For Users: They gain access to NEAR’s network without the upfront need for NEAR tokens.
    • For Relayers: They receive compensation in fungible tokens, which can later be converted or used within the ecosystem, creating a sustainable incentive to provide their service.

    By allowing payment in alternative tokens, meta transactions further lower barriers and encourage adoption of decentralized applications.