What is GSN?
Anyone who sends an Ethereum transaction needs to have ETH to pay for gas fees. This forces new users to pass KYC (Know Your Customer) and purchase ETH before they can start using any Decentralized Application (dapp). This can be a major hurdle for users without prior crypto experience that are unfamiliar with the concept of needing to keep ETH in their wallet for gas.
Ethereum Gas Station Network (GSN) abstracts away gas to minimize onboarding & UX friction for dapps. With GSN, clients with no Ethereum can interact with Ethereum contracts without them having to pay for gas fees.
This guide targets developers who have Ethereum and wish to sponsor their users in making transactions to a given contract.
How does it work?
Source: Open GSN
Instead of signing an Ethereum transaction, which would require ETH for gas, a user signs a message containing information about a transaction they would like to execute and sends it to a relay server. Before the relay server pays, it verifies that it will get refunded by a Paymaster contract.
A Paymaster holds ETH and can implement any business logic to decide whether to accept or reject a meta transaction. For example, accepting only transactions by whitelisted users, or to the contracts methods required for onboarding users, or only transactions that include a repayment in tokens to the Paymaster, etc.
Assuming that the Paymaster is willing to pay for transaction, the transaction gets forwarded to our contract, executing the function logic of issue, revocation, minting etc.
Initial idea
Given a service provided, we wanted a way for the provider to pay for the transaction (this means that clients would not need to own any Ethereum to interact with the Smart Contract). For example, GovTech could be holding on to a Paymaster while subsidiaries are only required to have a empty wallet address to interact with GovTech's Smart Contracts.
Next steps
Now that we understand how GSN can be helpful as developers and how they work, we can move on to deploying the Paymaster and creating a GsnCapableDocumentStore.
Additional Resource
Below is a list of additional resources for more information: