How Groundhog uses the Gas Station Network

Generalizing meta-transactions to improve Ethereum UX

Scott Burke
Groundhog Network
Published in
4 min readAug 12, 2019

--

Groundhog is building tools and solutions to bring the subscription economy to crypto e-commerce, and enable the next generation of companies, projects and creators to easily get paid.

A quick primer on meta-transactions

A key part of our architecture is something called meta-transactions.

Meta-transactions are a form of trust-minimized contract interaction where a third party can be responsible for paying the cost of gas to submit transactions to the blockchain.

Meta-transactions are comprised of parameters and data, along with signature that you generate. You sign the data with your private key to prove you’ve seen and approve the transaction.

A third party can relay this transaction to the blockchain for you, wrapping the meta-transaction in an actual L1 transaction, including paying the gas. The contract being called must be able to understand and support meta-transactions.

Cold start problem eliminated

Someone else pays the gas for you! You eliminate the “cold-start problem” of wanting to interact with a smart contract but not having any ether in your account! Isn’t that great?

So who pays the gas for you in a meta-transaction? The idea is that the Dapp, product, or service you’re interacting with can subsidize your gas partially or completely — shifting the gas burden from the user on to the to incentivized party. Dapps may subsidize gas to smooth onboarding, promote usage, reduce friction, etc.

Here’s how we use meta-transactions as we process recurring payments between a Groundhog wallet and Groundhog merchant wallet through the GroundhogPay payment gateway.

  1. You sign a subscription commitment with a web3 provider linked to your Groundhog contract wallet.
  2. Groundhog stores this signature as your cryptographic commitment.
  3. Then, Groundhog or the merchant triggers a call in the Groundhog Pay API to process your monthly payment.
  4. Groundhog sends the meta-transaction data to our relayer, and
  5. The relayer creates and submits a Layer 1 transaction, making a call to your on-chain Groundhog contract wallet which, if valid, triggers the actual Layer 1 payment from the consumer to the merchant wallet.

Throughout this entire process, Groundhog users and merchants never deal with gas.

Enter the Gas Station Network

That’s meta-transactions in a nutshell, and how Groundhog leverages them. Now, who actually relays these transactions to the Ethereum blockchain? The product you’re using can operate a relay and do this themselves — this is how Gnosis Safe and Groundhog work, for example. But our relayers are a point of centralization. How can this be improved? What if we had a generalized, decentralized network of transaction relayers so that you didn’t have to rely on just one? Enter the Gas Station Network (GSN) and the GSN Alliance.

The GSN is a decentralized network of relayers that generalizes the process and availability of relaying meta-transactions to the Ethereum blockchain.

Here is a great overview of the GSN from Ramon Recuero’s “GSN: The Ultimate Ethereum Onboarding Solution” announcement post.

GSN is a network of servers — called relayers — that are waiting to execute transactions. Each relayer gets paid for every transaction put on the blockchain. Relayers are incentivized to behave correctly and not cheat.

Best of all, GSN doesn’t require any centralized server or entity to organize it. Your application gets a response with all the available relayers. These relayers are stored on Ethereum inside the RelayHub smart contract. Your app can choose the relayer that is going to execute the transaction based on its reputation. Once you choose a relayer, it immediately replies to you confirming the request. If it doesn’t, you can switch to another relay right away.

The service is open and transparent. Anyone can run a relayer. We welcome everyone to join us and add new relayers to the ecosystem. You can set your own fee and you will be rewarded for every transaction that you submit to the blockchain.

However, if you just want to use GSN, you don’t need to run one. You can just modify your dapp to integrate with the GSN via OpenZeppelin contracts and interact with it via a new Web3 provider. You only to specify under which conditions your dapp pays for the transactions and that’s it.

Thank you to everyone who has been instrumental in bringing the Gas Station Network to life, particularly Yoav Weiss and his team at TabooKey, who originally conceived and built the GSN.

First of all, we want to highlight that GSN is an open-source project. A project created by a collaborative effort from the Ethereum ecosystem and the Metacartel group in particular. TabooKey envisioned the concept behind it and created the initial prototype presented during ETHDenver. Then, OpenZeppelin audited the system and pushed the project until where it is today. Support from Portis, Groundhog, BurnerWallet, and Pillar has been also instrumental in releasing this project.

To learn more about the GSN or use it in your applications, visit the following links:

GSN Website

Github Repo

Open Zeppelin Docs

Join the conversation in the OpenZeppelin forum

For more on Groundhog

Visit the Groundhog website. We also just upgraded our Twitter handle from @GroundhogPay to @Groundhog! Tweet at us there. Happy building!

--

--

Scott Burke
Groundhog Network

CEO of Groundhog. Techstars 2018. Tachyon 2018. Top 25 Up and Coming Canadian ICT Company.