A Hackers Guide To Gnosis Pay

A Hackers Guide To Gnosis Pay

A Hackers Guide To Gnosis Pay

A Hackers Guide To Gnosis Pay

on Apr 19, 2024

by Gnosis

in Research Hub

Gnosis has long been a pioneer for Web3 infrastructure for the past 7 years. Our company has successfully incubated and launched several industry leading industry projects, from Safe to Cow Swap. And now, one of Gnosis' newest projects, amongst others, is Gnosis Pay

Gnosis Pay is the first full self custodial wallet that's connected to a Visa debit card where you can spend the crypto that you have full custody over. This is significantly different from the debit cards offered by exchanges like crypto.com or Coinbase. If those intermediaries were to shut down you would lose your funds. With Gnosis Pay? If Gnosis Pay were to shut down tomorrow, you would still have access to all of your funds in your wallet. 

Ok but, how does Gnosis Pay work to enable that?

Lets dive in 👇

How A User is Onboarded Onto Gnosis Pay

  1. You, the user, orders a Gnosis Pay Card. 

  2. You go through a KYC process with our partner, Fractal

  3. A Safe account is created

  4. Your IBAN(International Bank Account Number) is linked to your card, the card is mailed to you

  5. You top up your Safe Account with EURe along with a KYT of funds(Know Your Transaction)

  6. You're now able to use your Gnosis Pay Card!

  7. Transactions are made in EUR on the Gnosis Pay network and which works as a bridge between off chain visa transactions and on chain transactions on Gnosis Chain.

    This is important to note, as many people attempting to build products on top of Gnosis Pay assume that you can track which vendors that you're spending your funds at on-chain. At the time of this writing, this is not possible to track. 

  8. You can then see your Gnosis Pay transactions on chain. Gnosis Pay Safe transactions are public on the Gnosis Chain(fyi: project idea for anyone who wants to help make things a little more private for GP users😉).

The Lifecycle of Gnosis Pay Transactions 🦉💳

There are two types of Gnosis Pay Transactions: transactions that are triggered with the Gnosis Pay Card, and transactions that the user triggers on-chain with their Gnosis Pay Safe Account. 

You can see a diagram of both transactions below with the respected explanations after. 

https://link.excalidraw.com/readonly/MuvKjCJySvjrcPSocViE

Card Transactions

Now, lets go one step deeper to what actually happens when you swipe your Gnosis Pay card at a kiosk. 

  1. You tap your card on the terminal at an ice cream shop. A 2 second timer starts ticking. Why is that? Its an industry standard that payment providers like Gnosis Pay must comply with to approve transactions in less than 2 seconds for users. It typically happens significantly faster than that. 

  2. Gnosis Pay receives an authorization request from Visa. Gnosis Pay checks the presence of accessible funds in the user’s Safe and replies 'yes or no' based off the account balance. 

  3. The Gnosis Pay network triggers a transaction with the Roles Module(will explain this later, but this is a module attached to the user's safe account) to transfer the EURe to the Issuer's Safe at the same time as the Visa request. The Issuer is an intermediary between Gnosis Pay & Visa that settles transactions with Visa offchain with the funds in the Issuer Safe at the end of every business day. 

On Chain Transactions

What makes Gnosis Pay special of course, is that you have your own self custodial wallet attached to a Visa Card. With that self custodial wallet, you can do whatever you want as you typically would on chain. 

  1. When you trigger a transaction with your Gnosis Pay Safe Account, let's say a swap, you send a transaction through the Delay Module(another safe module attached to the GP Safe Account), where there is a 3 minute transaction delay on the Safe Account. 

  2. The 3 minute delay is in place to avoid double spending by Gnosis Pay users when triggering on chain transactions. 

  3. The transaction is put into the queue of the Delay Module, and during this time the Gnosis Pay Card cannot be used. 

Understanding The Delay/Roles Module

When you're building on top of Gnosis Pay, one of the first things that you find out is that Gnosis Pay Accounts are Safe Accounts with two Modules attached, the Role and Delay Modules. These two smart contracts are essentially protections for both of the parties involved in a Gnosis Pay Transaction, the card user and Gnosis Pay themselves. 

In the Roles Module, this permits the Gnosis Pay network to only spend EURe and GBP. Gnosis Pay does not have access to any tokens outside of those, keeping your other investments safe. The tokens are accessible only up to a certain daily limit modifiable solely by the user permissionlessly

In the Delay Module, this is to prevent users from double spending their tokens on their Safe Account and is solely for on-chain transactions, most hackers of course will be dealing with this module. 

How To Develop Products on top of Gnosis Pay 🦉

Gnosis Pay is quite the hit amongst a lot of indie hackers at hackathons and a startup teams, excited to bring innovation to crypto payments. We want to properly explain to you all the design space that exists and whats feasible / not feasible. 

The Design Space for Gnosis Pay is simple. Get EURe/GBP into the Safe Account. You don't need to build payment integrations and sdks etc. Gnosis Pay acts as a regular Visa card and many of those things work outside of the box in the real world, and your traditional self custodial wallet on-chain. 

Don't look at Gnosis Pay as a payments api like Stripe, but rather a DeFi wallet with a Visa debit card attached to it. What kinds of things would you do with that context? 

  • Generate yield for GP users on their EURe by depositing it into lending protocols and removing those positions just in time for transactions? 

  • Top up a user's Gnosis Pay Safe with LP tokens that are earned by providing liquidity into AMMs? 

  • Airdrop NFTs / tokens to Gnosis Pay users as on-chain loyalty reward programs? 

The potential design space around Gnosis Pay is unlimited. Users can do all of the crazy defi staking, lending, etc. activities as long as they have enough EURe tokens on their debit cards by the time they have to make a transaction with their debit card. 

One more important note to acknowledge however is that at the time of this writing, any modules attached to the Gnosis Pay safe account outside of the Delay and Role modules blocks the account from the network. The best way to work around this is, instead of attaching a custom module to the safe account, you can attach a module to the Delay Module instead of the account. We call this a virtual module. You can see an example of this from a team building on top of Gnosis Pay, RoboSaver. Their Github is here.

So, what's next?

Build with Gnosis Pay! We have documentation here filled with all of the talks and code examples that you need. 

https://gnosis-pay.gitbook.io/gnosis-pay/

Still not helpful? Here's the Telegram group chat with the Gnosis DevRel's and Gnosis Pay engineers where you can ask anything that you need!

https://t.me/+xBArjAV-UuEzMGQx

Happy Hacking! 🦉💳🟢