Skip to content
BACK

Speakers:

  • Diego Masini, IOVLabs Head of Research and Innovation
  • Raul Laprida, IOVLabs Senior Researcher

The Research and Innovation team led by Diego Masini held a webinar on 26th April 2021 to introduce the RIF Enveloping Project to the RSK community.

The RIF Enveloping team comprises of:

  • Diego Masini
  • Raul Laprida
  • Julian Len

The main motivation behind RIF Enveloping is to allow users to pay for transaction fees using their preferred tokens, driving down the barriers to DeFi adoption by simplifying the UX. RIF Enveloping makes it easier to onboard new users by removing the need to get blockchain native currency to operate, allowing users to work only with the tokens they prefer.

Features:

  • Users will be able to find a sponsor willing to pay for their transaction fees in exchange for tokens on the network.
  • Send a signed message to the sponsor with transaction details, along with a payment in tokens.

The sponsor will need to be incentivized to ensure that transactions sent to the sponsor are submitted to the network, and also incentives for the users to ensure that the user does not try to cheat the sponsor of his payment.

A potential solution for this type of problem is the Gas Station Network (GSN). Due to the drawbacks of the GSN, it couldn’t be adapted to the RSK Network.

GSN Drawbacks

  • Existing contracts need to be adapted to use GSN
  • The solution is expensive for users

To solve these problems mentioned above, a redesign of GSN was made, this is known as Enveloping.

Improvements

  • Provide users with an address ready for enveloping (Smart Wallet), controlled by the respective user’s EOA.
  • Changed the architecture to remove unnecessary contract interactions, and optimize remaining contracts

RIF Enveloping Design

RIF Enveloping is designed to provide users with enveloping-ready addresses (Smart Wallet is deployed through a sponsor only when the user wants to submit a transaction. The smart wallet is designed in such a way as to ensure that the sponsor gets paid. Users in the RSK network can stop using Enveloping at any time once they get enough RBTC to operate on their own.

How it Works

Relay Transaction Flow

In the image above, the user collects a request for all the information needed to perform the execution of the transaction plus all the information to send the payment to the sponsor. The user sends this information to the relay server, through a relayProvider (Web3 provider). The server then creates a transaction, using the information from the user as payload, then sends this transaction in an off-chain call to the relayVerifier, to verify that the transaction will be successful and well-formed. Once the server determines the request is valid, it then sends the request to the relayHub, which is an on-chain contract using a relay worker account, once the relayHub receives this transaction, it opens it and gets the payload, then submits it to the Smart Wallet proxy (which pays the token contract), reimbursing the money spent by the relayWorker using tokens, and then executes the destination contracts.

A similar flow is followed when the user wants to deploy a transaction.

Deploy Transaction Flow

The user creates the requests with all the information for deployment, plus the payment. The RelayServer verifies that the deployment is going to be successful, using a deployVerifier, then if the request is valid, it sends the request to the relayHub contract using the relayWorker but now instead of interacting directly with the smart wallet because it doesn’t exist, the relayHub interacts with the SmartWalletFactory. Proxies were used for the smart wallets to further reduce the cost of the solution. The smart wallet factory deploys the actual smart wallet and pays the relay worker in tokens.

Raul Laprida then demoed a live solution to display these features.

Getting Started

Want to integrate enveloping in your dApp project?

Visit the RIF Enveloping Documentation and also see the Enveloping User Guide.

See the Glossary Section for an explanation of key terms.

Follow our

news!