Re-Introducing: Portis Direct Purchase

We’re thrilled to announce the reactivation of our Direct Purchase feature! Dapp users can now sign transactions, even if they don’t have any ETH in their wallets, completing the purchase with their credit card

Tom Teman
Portis
6 min readDec 1, 2020

--

Starting today, Portis will once again let users complete their transactions within Dapps through a simple e-commerce experience, powered by Banxa.

This feature existed before, however, since fiat-to-crypto is still uncharted territory fraught with an evolving AML and KYC regulatory framework, we had to pause the feature temporarily, but now it’s back!

At Portis, we’re always looking for ways we can bridge the gap between security and usability, in order to help Dapps reach mainstream users. One of the recurring pain points brought up by Dapp developers, especially in the gaming, social and marketplace ecosystems was letting users purchase items as easily as they currently can on centralized platforms.

For example, buying a loot box or custom skin on Fortnite is as simple as putting in your credit card details, and for blockchain to reach the same scale of user adoption, it has to be at least as simple as that.

The benefits of blockchain technology need to be coupled with a user experience that is just as simple and friendly as what they already know.

Unfortunately, without resorting to centralized escrow solutions (we’re big believers in self-custody, so that’s gonna a be a no from us dawg), users cannot complete a transaction until they have the required amount of crypto in their wallets. Otherwise, their transaction would simply get rejected by the network once they submit it.

This means, that if your user has no crypto (which is extremely likely if your Dapp is targeting mainstream users, as it probably should), their “checkout” flow will look something like this:

  1. Tries to sign a transaction
  2. Sees “insufficient funds” message
  3. (Hopefully) Redirected by their web3 provider to purchase crypto on an external exchange
  4. Completes crypto purchase (this is a big drop off point for most users)
  5. Waits until crypto is in their exchange wallet by periodically checking if it went through
  6. Withdraws crypto from exchange wallet to web3 provider wallet
  7. Once the crypto is inside their web3 wallet — goes back to your Dapp and restarts the flow that leads to re-signing the transaction (hopefully the NFT they had their sights on is still available)

That final purchase step is fragile enough, since someone is making a decision to spend their hard-earned cash on your product.

So how does Direct Purchase solve this?

When a user goes to sign a transaction but has insufficient funds, we let them sign the transaction anyway, but we don’t submit it to the network. We then send them to purchase ETH through Banxa, pre-populating the precise amount of ETH they need and their wallet address.

Only after they complete the purchase and we automatically detect that the ETH is in their wallet, we submit their pre-signed transaction to the network.

It’s not like we’re letting users do anything they couldn’t otherwise do themselves, we’re simply making their lives easier by constructing the flow in a manner that resembles the one they know and love from existing web apps.

By doing that, we’re empowering the developers using Portis, since they can improve their purchases’ conversion rates. To top it off, those same developers don’t have to change a single line of code, as our Direct Purchase flow kicks in automatically for users that don’t have enough ETH.

No crypto? No problem!

Here’s how it looks when creating a GitHub bounty on Gitcoin:

We’ve set up a bounty for the JS library five.js, because why not? 😎 (https://github.com/jackdclark/five)

“But wait, there’s more!”

We wanted to get this feature back into Dapps as quickly as possible since you all let us know how much it was missed. But as anyone who worked on a coding project knows — you can’t do it all at once. Therefore, I wanted to share some of the features we started working on, to be published in a future release:

Offline transaction submission

We want to allow users to complete a transaction even if they close the Dapp window midway between confirming their Banxa information and the pending transaction. Currently, leaving midway (or even just hitting refresh) will cause the transaction to abort (but the purchase will still take place). By caching these immutable transactions on our server, we can fulfill them later automatically.

Nonce shifting

A replay attack is when a valid data transmission is maliciously or fraudulently repeated or delayed. These attacks are of particular concern for blockchains since all communications are public and could be used to steal funds. Blockchains avoid these attacks by requiring wallets to issue consecutive nonces, short for “number only used once”, to sign transactions. These nonces are issued in sequential order.

If you try to submit a transaction with a nonce of N+1 before the pending transaction with nonce N, transaction N+1 will not get accepted by the network until the previous one goes through. Anyone who paid low gas fees for a transaction has felt this pain, as the unconfirmed transaction acts as a chokepoint for your subsequent pending transactions, preventing them from going through. Since in some cases a Direct Purchase might take a while (waiting for the credit card purchase and KYC to go through), this means you won’t be able to submit any more transactions to the network while you’re waiting.

Users on etherscan.io be like

In the future, to circumvent this issue, we will automatically shift the nonce of the pending Direct Purchase transaction ahead of the new transaction a user wants to submit while he’s waiting for his Banxa purchase to go through, thus unclogging the nonce bottleneck. You can learn a bit more about nonces and replay attacks here.

Automatic token swaps

What’s the point of joining one of the largest and known exchanges in the ecosystem if we can’t upgrade our token swap game? So if you need your users to pay with a specific token in their transaction instead of plain ETH, we will be able to handle the token exchange behind the scenes, while your users only deal with entering their credit card details.

To expand on the e-commerce example from before, imagine buying something on eBay that requires foreign currency. Nobody expects you to do it yourself, your credit card company takes care of that automatically. Automatic token swaps will offer the same familiar experience but in a completely self-custodial manner.

We have a lot more on our roadmap, but we wanted to share some of our more imminent features with you. Please let us know what you’d like to see next, we’d love to hear your thoughts!

Happy coding!

The Portis Team

Have any questions? Join the conversation on our Telegram and Twitter.

Ready to #BUIDL? Head on to our docs.

Got any suggestions? We 💙 feedback!

--

--

Tom Teman
Portis
Writer for

#BUIDLing @ Ethereum Foundation, Account Abstraction (ERC 4337). Previously CEO and founder of Portis (acquired by ShapeShift)