<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raul Laprida on Medium]]></title>
        <description><![CDATA[Stories by Raul Laprida on Medium]]></description>
        <link>https://medium.com/@raul_17349?source=rss-816d9edd4130------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fw8UVBJoeh6daODW.jpg</url>
            <title>Stories by Raul Laprida on Medium</title>
            <link>https://medium.com/@raul_17349?source=rss-816d9edd4130------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:44:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raul_17349/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[RIF Enveloping: sponsored transactions]]></title>
            <link>https://medium.com/rootstock-tech-blog/rif-enveloping-sponsored-transactions-f2ab624c7c4d?source=rss-816d9edd4130------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2ab624c7c4d</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[rsksmart]]></category>
            <category><![CDATA[meta-transactions]]></category>
            <category><![CDATA[rif]]></category>
            <dc:creator><![CDATA[Raul Laprida]]></dc:creator>
            <pubDate>Wed, 13 Jan 2021 19:09:34 GMT</pubDate>
            <atom:updated>2021-10-07T17:10:06.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*TJVBxW_WfmeHfKslyVucGQ.jpeg" /></figure><p>With the advent of DeFi, several fiat-pegged tokens have become a preferred means of payment and savings for both users and miners. Most blockchains rely on a single native token to pay for transaction fees. This results in the inability of users to use other tokens as methods of payment. <strong>Meta-transactions </strong>are<strong> </strong>special types of transactions that separate the gas payer from the sender, allowing users to pay for transactions with any token through relayers.</p><p>This article represents the continuation of <a href="https://medium.com/iovlabs-innovation-stories/evaluation-of-meta-transaction-proposals-58f1161ddef0">our research</a> on the evaluation of existing meta-transactions solutions. We introduce the final meta-transaction design for the RSK Blockchain based on counterfactually-created <a href="https://medium.com/iovlabs-innovation-stories/evaluation-of-meta-transaction-proposals-58f1161ddef0">smart-wallets</a>.</p><h3>Why sponsored payment?</h3><p>The main purpose of meta-transactions is to reduce usability friction that prevents user adoption of blockchain services (e.g, DeFi solutions). Users have token preferences that usually do not coincide with the native token required for transaction fees of a blockchain service. Forcing users to obtain this token might deter them from using the service. Furthermore, some users may not even know that a native coin is required in the first case. It is up to the developers of the blockchain service to overcome this difficulty.</p><p>In the meta-transaction context, a <strong>Sponsor</strong> (terminology taken from <a href="https://eips.ethereum.org/EIPS/eip-2711">EIP-2711</a>) is the entity that provides or is part of the offered service. As the name suggests, the Sponsor offers an easy way for users to pay for transaction fees apart from the native token. These sponsors proactively participate in the meta-transaction architecture as Relayers of meta-transactions, since it is in their best interest to simplify the users’ experience and prevent any negative impact on user adoption. A Sponsor may accept any meta-transaction request, or just accept requests for users of its respective solution/application. The meta-transactions may be fully or partially subsidized. For example, a sponsor could provide free meta-transactions for users of their service, allow requests from others at full cost plus an extra charge, or partially subsidize costs if the destination is a specific contract that is being promoted.</p><h3>What are Smart Wallets?</h3><p>Ethereum-compatible blockchains have two types of accounts, externally owned accounts (EOA) controlled by their respective private keys, and smart contract accounts (SC) controlled by their contract code. Both types of accounts are identifiable by a 20-byte account address.</p><p>EOAs do not have associated code, they only hold the balance of native token and a sequence number called nonce that is used to order transactions and to prevent replay attacks. Contract accounts contain associated code and storage of the current state.</p><p>Any call to an SC account must ultimately originate from an EOA (an external call) since these are the only accounts that can sign a transaction (they own a private key). Any SC call made by another SC can never be an external call (it is originated and funded by an EOA that signs and submits the transaction). As mentioned previously, every transaction has to pay for its execution. The execution cost is measured in units called gas. This gas is paid with the corresponding blockchain’s native crypto token (e.g. rBTC in RSK, ETH in Ethereum, etc). Before execution begins, each transaction buys a specified amount of gas establishing a <strong>maximum</strong> amount of units that can be consumed by the transaction. If this maximum is reached during transaction execution, the transaction reverts. If the transaction executes successfully, any remaining gas that was funded but not consumed by the transaction is reimbursed to the EOA that submitted the transaction.</p><p>Smart Wallets are smart-contracts that mimic the basic functionality of an EOA (perform payments and contract calls) plus additional functionality that is specified by contract code. For our meta-transaction system, we’ve implemented a custom smart wallet that is split into two components: one EOA to store native currency and an SC that stores tokens (eventually also native currency). The SC embeds additional rules in its code to enhance the security of the wallet and optionally extend its functionality. The owner of this SC is the EOA, and that ownership cannot be changed or revoked. These two components are hidden to the user, who interacts with the smart wallet as a unified native coin and token vault. The public address of the smart wallet is the address of the SC component.</p><p>A delegate account is defined as an EOA or another SC that has special permissions over the smart wallet. For example, the delegate may be authorized to transfer funds to another account in case of private key loss or after a predefined period of inactivity, etc. Our smart wallets have the capability to specify a delegate account, and this is key to enable meta-transactions.</p><h3>Introduction to Gas Station Network</h3><p><a href="https://github.com/opengsn/gsn">GSN</a> is a meta-transaction solution created for the Ethereum blockchain. In the GSN workflow, the user wallet creates a transaction request message, which is signed and then sent via HTTP to a Relayer Server, who is in charge of submitting the meta-transaction to a special smart contract in the blockchain called RelayHub. The RelayHub then forwards the request to a Paymaster contract which is in charge of validating it, making sure the alternative method of payment for the gas is possible, and finally, it is the one in charge of paying the Relayer with the <strong>native</strong> token. There can be different active instances of the Paymaster contract enabling different use cases. For example, one Paymaster can subsidize the gas cost to the user (e.g, when the Paymaster is owned by a Sponsor with massive user adoption as their primary objective). In this scenario, the paymaster pays the Relayer but it does not charge (or partially subsidizes) the user.</p><p>The user-signed request defines a destination account address to be invoked, native token value to transfer, and a msg.data field with extra information if the destination is a smart contract’s method. This is just as any regular blockchain transaction payload is defined; the main difference between the transaction request and a normal transaction payload is that the transaction request defines extra information as a result of the negotiation between the user and the Relayer (e.g, base relay fee, Paymaster to use, etc)</p><h4>Limitations of GSN</h4><p>GSN requires the destination contract to be “GSN-aware”, meaning that the user can not call any SC with this meta-transaction system, only contract accounts that “understand” GSN. An example would be trying to transfer <a href="https://github.com/makerdao/dss/blob/master/src/dai.sol">DAI</a> tokens using meta-transactions: the destination of the call would be the address of the DAI SC in the blockchain, and the method and parameters would be encoded in the <em>data</em> field of the request. However, since DAI is not GSN-aware, it can not be called with this meta-transactions solution.</p><p>What does it mean to be GSN-aware? A destination contract instance knows of the existence of a “Trusted Forwarder”, the <strong>only</strong> contract account allowed to forward meta transactions to it. Any other msg.sender would be treated as a “regular call”, not as a meta-transaction. Since the caller in a meta-transaction is the trusted forwarder and <strong>not</strong> the user (who signed the transaction request), then the destination smart contract must fetch the actual msg.sender (user’s EOA address) and proper msg.data by parsing the calldata received from the Trusted Forwarder.</p><h3>New architecture introduced by RIF Enveloping</h3><p>RIF Enveloping is a meta-transaction system created by IOV Labs to be used in the RSK blockchain. Version 1 of RIF Enveloping (the current <a href="https://github.com/rsksmart/enveloping.git">master</a> branch of our repo) shares some of the architecture with GSN, but there are some critical differences. RIF enveloping introduces the concept of the Smart Wallet and removes the “Trusted Forwarder” and “GSN-Aware destination” concepts. Another difference is the set of fields that the user signs within the transaction request. In RIF Enveloping, this set includes the method of payment (token address to use) and the amount to charge. The Smart Wallet code enforces payment of the fee, and the Paymaster is relieved from that responsibility. The next version of RIF Enveloping (v2) will remove all responsibilities from the Paymasters, although they may be used for local verification of the request.</p><p>The main advantage of using Smart Wallets is that they allow <strong>any </strong>SC to be called using meta-transactions, there is no “Trusted Forwarder” entity, the account that calls the destination contract <strong>is </strong>the Smart Wallet (the SC component, to be precise). This means that any contract, already deployed or not, can support meta-transactions via RIF Enveloping. Destination contract methods that receive a signature as a data parameter and require msg.sender to be the signer (instead of, for example, passing the signer address as another parameter or fetching it from the state) must implement a solution like <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md">EIP-1271</a>. An overview of the main components of RIF Enveloping V1 can be found <a href="https://developers.rsk.co/rif/enveloping/">here</a>.</p><h3>What does counterfactually-created mean?</h3><p>Creating an address for an EOA is free: it does not require interaction with the blockchain (off-chain), and can be done by any user without restrictions. On the other hand, knowing the address of a smart contract generally requires the deployment of an instance of that contract code, and in the case of a Smart Wallet, that instance must be owned by the user’s EOA so it requires a specific state. Deploying a contract requires sending a transaction to the blockchain, which is not free.</p><p>To overcome this limitation, Ethereum introduced the concept of <a href="https://forum.openzeppelin.com/t/getting-the-most-out-of-create2/785">counterfactually-created contracts</a>. A counterfactually-created Smart Wallet can be deployed only when absolutely necessary. The user can deterministically calculate their Smart Wallet address without actually deploying it, thanks to the <a href="https://eips.ethereum.org/EIPS/eip-1014">CREATE2</a> (EIP-1014) opcode that exists in blockchains such as RSK or Ethereum. This opcode is used by RIF Enveloping to instantiate Smart Wallets counterfactually. Any user or smart-contract can send tokens to this calculated address and only when the Smart Wallet owner needs to use those tokens (or to interact with any other account through meta-transactions), the actual contract code is deployed.</p><p>To associate the user’s EOA with the SC component of the Smart Wallet, the enveloping system uses the <em>salt </em>attribute defined by EIP-1014. The Smart Wallet factory simply puts the owner’s EOA as one component of that attribute, which guarantees that any other user will have a different salt.</p><h4>Chicken and Egg problem</h4><p>If in order to pay for a normal transaction the user needs the blockchain’s native token, and to use meta-transactions the user needs to deploy a Smart Wallet, how does the user deploy the Smart Wallet without paying the transaction fees with native tokens? RIF Enveloping has a mechanism implemented to solve this problem. The sponsor (Relayer) of the deployment transaction will receive a signed “promise of payment” from the user. When deploying the Smart Wallet contract, the first thing the Smart Wallet code will do is to pay the negotiated token amount to the sponsor. If that payment is not possible, the deployment transaction is reverted. Although the user can deploy their Smart Wallet using any token as a method of payment, the most likely scenario is that the Relayer acts as the sponsor and subsidizes the deployment of the user’s Smart Wallet. Let’s not forget that the main idea of this solution is to ease the user onboarding and to reduce the complexity of using on-chain solutions such as DeFi.</p><h3>Next steps</h3><p>IOV Labs Research &amp; Innovation team is working on the second version of RIF Enveloping, with the objective of greatly reducing the overhead gas costs associated with the submission of meta-transactions to the blockchain. In the next version of RIF Enveloping the on-chain Paymaster execution is removed, as well as the native token payment to the Relayer. The RelayHub, originally inherited from GSN, which still remains in version 2, was completely rewritten.</p><p>The overall overhead cost was reduced from almost 200K gas to 90K gas and we plan to reduce it even more. <a href="https://eips.ethereum.org/EIPS/eip-712">EIP-712</a> signatures (which allow the user to see the data structures they are signing and not just an ineligible hash) are preserved. We plan to take the overhead gas reduction to a new minimum with transaction batching, a feature currently being designed. Transaction batching will allow the Relayer to submit several transaction requests in a single transaction payload, reducing the overhead cost for each included meta-transaction even further.</p><p>Stay tuned for the next articles where we explain in detail the rationale behind each component of RIF Enveloping, and the highly anticipated article where we explain with great detail the changes introduced by RIF Enveloping V2!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2ab624c7c4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootstock-tech-blog/rif-enveloping-sponsored-transactions-f2ab624c7c4d">RIF Enveloping: sponsored transactions</a> was originally published in <a href="https://medium.com/rootstock-tech-blog">RootstockLabs: Research &amp; Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>