Auto payments from Visa via L2-blockchain StarkNet

Photo - Auto payments from Visa via L2-blockchain StarkNet
Visa has created a recurring automatic payment service for the Ethereum ecosystem assets. These transactions are a common practice for the traditional banking system, but they are a completely new solution for the cryptocurrency industry.
The Visa international payment system has realized that the direction of cryptocurrencies and blockchain is a new trend that is going to last. Meaning that you need to learn how to make money on it, rather than ignore it. Therefore, Visa promptly reformed the organizational structure and created a division that purposefully created and tested new services and products in virtual currencies and blockchain.
Visa has several collaborations for issuing cryptocurrency payment cards: Binance Visa Card, The Crypto.com Visa Card, and most recently, Huobi Visa Card. Partnerships with leading crypto exchanges are a truly successful marketing ploy, which confirms Visa's focus on new markets and the openness of this MEA to modern technologies. Then they had a shot at stablecoins and tested how payments with automatic conversion from crypto to fiat work.
Now, the turn has come to new services, and Visa decided to migrate from traditional banking to the cryptocurrency industry.


Attempt to replicate the Standing Order and Direct Debit service on the blockchain

Of course, Visa started by trying to replicate good old blockchain banking. A standing order is an order that is regularly repeated to the same counterparty. Direct Debit is a regular payment that is directly and automatically debited from the balance without requiring any confirmation or electronic signature from the payer, except for granting the bank permission to conduct such regular debiting. Visa decided to create and test this payment format on the Ethereum blockchain.

During the implementation, it was decided to test a new concept, proposed by the Ethereum developers, known as account abstraction, and explore how smart contracts can be helpful for programming recurring payments. As a result, with the help of a specially created smart contract, they launched a solution that can automatically and with certain regularity debit funds and send a payment in cryptocurrency from a non-custodial wallet.


Use case

Visa offers a hypothetical scenario: Today is February 25. Alex is going on vacation to the Alps and will return on March 10. She has to pay a monthly mortgage, cable TV, and utility bills by the 5th. She needs more money to pay for it before she leaves (air tickets and the tour cost were not cheap), but she’ll have enough after the salary arrives on March 1. How will Alex enjoy her ski vacation without missing out on all those essential payments?


Holiday pay calendar

Holiday pay calendar

The complexity of transactions

Unfortunately, Visa failed at the first attempt to implement such a service. One might say, “These are regular payments! What’s so difficult about them? It is a standard service!” And they will be right. Indeed, if Alex had a bank account, it would be an easy task. All she would have to do is set up recurring payments on her Visa card to pay her bills automatically. However, this wasn't easy to implement on the blockchain. To understand this, let's look at the current capabilities and limitations of the Ethereum blockchain. Let's start with the terms, which will help us better understand the essence of the problem.


Accounts on Ethereum

There are two types of accounts on the Ethereum network today: externally owned accounts (EOA), commonly referred to as user accounts, and contract accounts (CA), which are called smart contracts. A user account, controlled by a private key, can send transactions. A smart contract has an associated executable code, but the contract cannot initiate transactions independently. Transactions must always be made from a user account and signed with their key. By a transaction, we mean a simple transfer of crypto assets between user accounts on the Ethereum blockchain and a more complex use case that needs a series of operations through smart contracts.


The inability to make automatic payments on Ethereum for non-custodial wallets

Let's go back to Alex's situation. Suppose she has a user account and a wallet where her salary is deposited and from which she would like to pay her mortgage, cable TV, and utilities automatically. To pay her bills, Alex must initiate a transaction that will transfer crypto assets from her EOA to a user account owned by the recipient, who generates bills and awaits payment. Alex’s EOA has an associated private key known only to her.
This private key is used to activate the Elliptic Curve Digital Signature Algorithm (ECDSA), the key to creating such a transaction. And that’s actually the problem! If Alex is on vacation and doesn't have access to the wallet, who will generate the signature to create the transaction to make the payment?

One solution is to use Alex's custodial wallet. With the help of this wallet, the service provider controls the private key. In other words, Alex trusts a third party to hold her funds. The advantage here is that Alex can set up an automatic payment. Since the provider is the party that manages the wallet and has access to its private key, it can create the signature needed to make transactions and send scheduled recurring payments. The downside to this option is that while the custodial wallet solves Alex's problem, it requires her to trust the provider that holds the funds.

Using a non-custodial wallet, the owner has complete control over their assets and private key. But due to personal (without intermediaries) control over everything, Alex cannot set up an automatic payment since she must use her private key to sign the payment and personally initiate the transaction. But she has no time for these tedious transactions in the Alps, where she enjoys snow, skiing, and friends.
So, what should Alex do if she wants to avoid trusting her assets to intermediaries and simultaneously intends to use a non-custodial wallet and make regular payments in cryptocurrencies?


Account abstraction and delegation function

Account Abstraction (AA) is a solution that combines user accounts and smart contracts into one new type of Ethereum account, allowing user accounts to function as smart contracts. Thus, based on AA, it becomes possible to create a convenient solution for automatic recurring payments.
Another critical and necessary option for this is the delegation feature. It allows AA to create automatic payments in practice.
Visa's solution is to use AA and create a new delegable account. The concept of a solution based on smart contracts is based on keeping the rules for creating transactions of a particular type and all the conditions for delegating the rights to create them autonomously in the code. AA allows you to delegate the ability to instruct the user’s account to initiate a push payment to a pre-approved auto payment smart contract. Difficult, but as it is.


Automatic recurring payment solution with an abstract account, smart contract, and delegable account

Automatic recurring payment solution with an abstract account, smart contract, and delegable account

Due to imperfections and strict "protocol" requirements, such an implementation on the Ethereum blockchain was considered highly complex and rejected.


Visa Choice – StarkNet Second Layer Blockchain

Since Ethereum still does not support AA, Visa decided to implement a solution for delegable accounts on StarkNet, a layer 2 solution for the Ethereum blockchain. It was created to increase the throughput of the L1 blockchain (Ethereum), and it has some other exciting options.
The StarkNet blockchain was developed by the StarkWare crypto startup. The StarkNet account model is what has been described as AA so far. While concrete L1 blockchain accounts check if a transaction is coming with the correct signature, StarkNet abstract accounts track whether a transaction is coming from a given address.
With abstract accounts, if someone sends an ERC token to your address, such a transaction will trigger an interaction with that asset's smart contract. As a result, the cryptocurrency owner is changed by simply replacing the sender's address with the recipient's.

Thanks to the StarkNet blockchain, Visa implemented an automatic recurring non-custodial wallet payment service using delegable accounts. This service is still being tested before Visa offers it to the open market. But it looks like that moment will come soon...