Back to All Episodes
Season 1Episode 17

Phoria

April 22, 2022
21m
1 Guest

Listen Now

About This Episode

This episode of DevNTell features Marius, who presents Phoria, a customer rewards program built on Solana Pay. Marius explains the project's origins from the Riptide Hackathon and demonstrates its functionality from both merchant and customer perspectives. Phoria enables merchants to set up marketing campaigns with raffle-style rewards, offering a more engaging alternative to traditional percentage-based discounts. The presentation covers the technical stack, including the use of Solana, Rust, React, and TypeScript, and discusses future plans for the project, such as open-sourcing the code and integrating NFT-based rewards.

Key Takeaways

1

Phoria is a customer rewards platform built on top of the Solana Pay framework.

2

The platform shifts rewards from standard percentage discounts to a raffle-based system where customers have a chance to win larger prizes instantly upon payment.

3

Merchants can easily configure campaign parameters, including target sales volume and prize distributions.

4

The technical stack involves Solana programs written in Rust, a React/TypeScript frontend, and Node.js for off-chain monitoring tasks.

5

Future roadmaps for Phoria include NFT giveaways and token-gated campaigns for specific membership tiers.

Featured Guest

M

Marius

Founder of Phoria

Phoria

Timestamps(click to jump)

Episode Transcript

Narb

All right. GM, GA, GE everybody. Welcome to what's going to be another great DevNTell. If you didn't know, DevNTell is a 30-minute window for members of the DAO to showcase something they're passionate about or have been working on. This could be an awesome project you've been working on, demonstrating unit testing best practices, automation goodies, smart contracts, how to structure a project, and so on. Basically, if you've got a passion for something, this is your opportunity to share with the community. And today, I am happy to introduce to you Marius, who will be demoing to us his project Phoria. Hopefully, I pronounced that correctly. Take it away, Marius.

Marius

Yes, you did. Thanks, Narb. Hey, guys, my name is Marius and I've been working on a program, a customer rewards program on top of Solana Pay. And the project name is Phoria. We signed up for the Riptide Hackathon. Unfortunately, we didn't get a money prize, but we did get an honorable mention, which was kind of cool given how little engineering time was spent on this. So, going to go ahead and share my screen. I have to do some Apple security trick to enable this. And I'm back, if you can still hear me.

Narb

Yep, yep. We can hear you.

Marius

I think I should be sharing my screen. All right. Can you guys see it? Perfect. Okay. Cool. So, the story with this is that Solana launched a payment framework earlier this year, I believe it was around January. And this enables merchants to take payments using a Solana wallet using a QR code. And I can display like a simple video of how this would look like in real life. So you just kind of scan a QR code and then pay with your wallet, get your coffee, and you're off for your day.

Marius

What we did on top of the payment system is to add rewards. And given the fact that rewards back in the day, or not back in the day, but right now are just pretty standard across the board, everybody's kind of offering a 10% discount or some kind of points, which is also like a form of percentage discount. What we did is try to showcase something that you can do with a smart wallet, if you will, or like a smart contract. And that idea was to offer raffle-style rewards. When I say raffle, I mean you pay at the register and you get a chance to win a prize from one of the prizes that the merchant has previously set up.

Marius

So that's what I'm going to do right now. I'm going to go ahead to the app and set up a marketing campaign and configure some prizes. Right now it only supports USDC prizes, but we're thinking of extending this to maybe an NFT prize or any other kind of coin that you can think of. So the merchant would go ahead and do this real quick, start creating a campaign and we'll, let's say, target some sales amount for this week. Let's say I'm an ice cream shop and I'm going to sell $1,000 worth of ice cream. And for that $1,000, instead of giving 30% off to everybody, which is, you know, an okay discount or loyalty program, but not as exciting, I could take that $300 and kind of like split it into fewer prizes, but fewer but bigger prizes. So let's say I give the first prize of $100, I give maybe five prizes of $20, and 10 prizes of $10. That's like $300 in total. I can do the math and I can see that I'm offering just as much money as I would if I had given a 30% discount. It's just that I'm giving away 16 prizes, which is going to be pretty cool for the buyers because, guess what? You don't win every time, but once you win, you can win big.

Marius

Going to go ahead and create this campaign. And once the campaign is created, I have to deposit the $300 upfront. And now the money sits in a vault in a smart contract, so nobody can tamper with them. And once I start a campaign, I can go ahead and open a point of sale. You can see my campaign here, started today. And I can open a point of sale and I can start taking payments. Let's say somebody comes in and buys $15 worth of product. And I'm going to use my Phantom wallet, or you can use any kind of Solana wallet, including the custodian wallets like FTX also supports this QR code. Interaction going through on my wallet and now it should be processing here as well.

Marius

Once it's complete, I'm kind of like poking at the rewards program. You probably saw like a very small glimpse of Phoria Rewards and I'm going to do this again. And during that time, the contract is determining whether this particular buyer is eligible to win one of these prizes. It's like a random algorithm that happens behind the scenes. And hopefully I win this time, if not, I'm probably going to do it one more time and then I'll call it quits. So right now what happens, because there's no async methods on Solana, I'm using like a, an army of crankers. Oh, look, I won this time, which is cool. So I won nine bucks. And if I look in my wallet now, the nine bucks should be already transferred, right? So the interaction is pretty much instant. You don't have to wait, you don't have to submit any other kind of details. So from the buyer's perspective, this is pretty seamless. You're automatically enrolled and so on.

Marius

And if I go on the merchant's side and I look at this campaign, I refresh to make sure that I have the latest data. I can see that I'm making progress to the sales volume. So I'm like already 3.5% out of my $1,000 and I already gave out $10, which is just one prize. Usually these numbers should be the same. So the more progress I make into the campaign, the more prizes I should be awarding. That's kind of the mechanics of it. If I go to the winners tab, I can see that this is my wallet that I used to pay and this is the guy that won. So I can, I don't know, DM them, send them an NFT with a coupon or whatever, I can interact with this person without having a bunch of data from them. And yeah, that's about it. I think I'll open it for questions now.

Narb

Yeah, this was fantastic, man. Is it possible to have multiple campaigns running at the same time? So like if you're running your ice cream shop, can you have two campaigns running, one for just the everyday customer and then another one for if the customer is like a loyalty points member or something with your company? Is that possible or is it only one at a time?

Marius

So right now it's only one at a time, but that's a great suggestion that something that can be added in the future for sure. It's not too hard to change.

Narb

Sweet. Can you speak a little bit about the inspiration behind the project? Like what made you want to do this for that hackathon?

Marius

Yeah. So I think there was a need for customer rewards just because point of sale was something that already comes with a framework. So the natural thing to come from there is to bring in the buyer side. And the one way to bring the buyer side is to incentivize them somehow. And yeah, as I mentioned before, there's like all these existing types of discounts and loyalty points that are already out there, but what is cool is that you can build something new and like a more fresh experience, if you will.

Narb

Excellent, excellent. Can you speak a little bit on like the tech stack? I know you said it's built on Solana and whatnot. And also is your project open source?

Marius

Yeah. So the project is not open source yet, working on doing that. There's three components to it. The first component is a small little program where you can deposit the funds and it takes care of distributing the funds in like a fair manner. So that's a Solana program written in Rust. There's the frontend, which is the biggest piece of it, to configure the campaign and to launch the point of sale. And that's React with TypeScript. And there's a third component, which is what I was talking about when I mentioned the crankers or, if you will, the liquidators that are executing async tasks so that what they do is they watch, they monitor transactions, they validate that a transaction is correct and is associated with a campaign key and they call into the Solana program to see if that transaction has won or not. So that's like a Node.js program that ideally everybody would be able to run, kind of like if you're running liquidators for a lending borrowing program, you let everybody run like a Node.js server to perform the liquidations.

Narb

Sweet. Thank you. Does anybody else in the crowd have any questions for Marius? Don't be shy.

Narb

All right. If not, I still have a few questions. Do you have anything in terms of a project roadmap you'd be able to share or is it too early on for that?

Marius

Nothing to share, but I guess a few ideas that came from this was one would be like giving away NFTs, which is pretty simple with the Solana framework because they're also SPL tokens. And two would be, as you mentioned, right, the campaign only for certain types of members. So if you're like, I don't know, a gold member, platinum member, or whatever NFT you would have in that wallet would verify you to make sure you're eligible to kind of be part of this campaign.

Narb

Sweet. And is there plans for this to eventually be open-sourced?

Marius

Yes, yes. I'm trying to get some audits on the program, so that would be the first component that would be open-sourced.

Narb

Nice. And I suppose if somebody were interested in helping out, do you have any particular areas of need or skill sets that you'd be looking for? We have a lot of passionate builders here in the DAO, right? So I'm sure a lot of people would be chomping at the bit to help out.

Marius

Sure, for sure. Any frontend devs or designers or even Solana programmers would be more than welcome to contribute.

Narb

Perfect, perfect. And I guess what's the best way for people to kind of keep track of Phoria's progress? Is there a Twitter handle or something people can follow?

Marius

Yeah, there's a Twitter. The Twitter is @tryphoria. So it's kind of like the website. Nice. If you can see this, yeah, tryphoria.com. Ah, excellent. And that's the same Twitter handle, you said.

Marius

Yes, yes, perfect.

Narb

Cool, cool. We're about at 10-ish minutes left. Does anybody in the crowd have any questions for Marius? What was the most difficult thing you had to deal with during this build?

Marius

Um, there were a few difficult things. I guess one thing that was a blocker for a while was generating randomness on-chain. There's oracles for doing that, but they're very, very expensive. So we're just using some kind of hack in the Solana framework, very similar to how folks in Metaplex are doing it with Candy Machine. It's like a pseudo-random thing, but it's good enough for now. How was it working with the Phantom wallet in terms of just, you know, getting things set up with the project and whatnot? Were there any interesting issues when it came to working with that or was it simple, like what was that experience like? With Phantom specifically or just wallets in general?

Marius

Yeah, yeah, with, you know, just integrating it into your project and being into that ecosystem. No, Phantom is really, really cool. Yeah, I had no issues at all developing on Phantom. Actually, there's like some dev wallets on Solana that I wouldn't recommend. I forgot the name, but there's some web ones that are pretty bad and I actually got hacked on them at one point. So I would definitely recommend Phantom if you want to develop. It's very easy. I just want to ask a quick question, why Solana?

Marius

I think from my information, Solana is or was the first one to enable point of sale payments. So there's this spec right when you see that QR code, that's not something that I built. That's something that Solana Pay has built, and that spec has to be implemented by all the wallets in the ecosystem. And obviously, because they're Solana, they're able to push that spec through all the Solana wallets. And I guess the reason that this will be the first chain to try to take on payments is because the transaction fee is very, very low and fast enough to be processed in real time. I see. Thank you. I would love to have other chains. Like when I built this, I was thinking that this could be, it would be amazing if you can be a real POS for any type of wallet, right? Let's say whatever Avalanche wallet or Near wallet or any blockchain that's cheap and fast. As a merchant, you'd like to take all kinds of wallets, right? You don't want to be able to kind of say no to your buyers because they use one wallet or another. But yeah, would love to explore more if you have knowledge of other chains supporting payments, I think that would be amazing. I'd love to implement that.

Listen On

Resources & Links

Share This Episode

Share on X

Watch Episodes Live!

Subscribe to our event calendar and never miss a live episode.

View Event Calendar