1

I want to make a point of sale system project using solana with spl tokens. One thing where i'm stuck and where I need answers is the wallet funding. When someone makes a new wallet(trust wallet for example) without any solana and we want to send them our spl token, we have to fund it. Could it be possible to do the funding, without using the cli commands after creating the token?

Imagine the person working at the bar sells 5 tokens and proceeds to send the tokens from a phone app, he/she would have to send the spl token + manually do another transaction for a x sol amount to allow it to do any transactions.

I'm playing around with some ideas, but I wanted to get a input from the community. Thanks a lot in advance!

2 Answers 2

3

Without having to send SOL to your customers, you can use a relayer to solve this problem.

Imagine a person who wants to participate in a transaction involving an SPL token that they hold but who has no SOL with which to pay the network fee. The idea is that they partially sign the transaction then send it to a relayer, who will pay the network fee on their behalf.

A relayer may want to get paid for this service (eg. by taking a cut of the assets being exchanged). It can do so by enforcing that the transaction must include an instruction that pays its fee.

For an example of such a transaction relayer, see https://github.com/solana-labs/octane

2

I can think of 2 options that might work, but it's a bit hard to know exactly what you're trying to achieve.

  • You could create a transaction that sends both SOL and SPL tokens to the wallet you want to fund. You probably can't do that with a normal wallet app, but you can have multiple instructions in a transaction and one could send SOL while another sends SPL tokens. So you could have your own little web app that does that so it's just one action for the person working at the bar?
  • You could use transactions where the person paying with SPL tokens is not the fee payer. Anybody can be the fee payer, but they do have to sign the transaction as well. So again that's not going to work with a normal wallet app send UI, but you can create transactions where someone sends you SPL tokens and you pay the fee. This way they don't need any SOL in their wallet at all. The best way to achieve this would probably be with Solana Pay transaction requests. It'd be a bit more complex your side, but the end user would just need to scan a QR code and have any wallet installed that supports it.
4
  • 1
    Agree with this answer. For me, Solana Pay is the way to go. Check the Github of Solana Pay, it has a Point of Sale ready to use, and you can configure it with any spl token.
    – Andres
    Aug 2, 2022 at 19:50
  • @Andres agreed, but (a very sensible default) the person scanning is the fee payer in that point of sale - so they'd need the SOL for that. The simplest way to achieve this probably is to write a script that sends SPL + SOL in one transaction, then use the default solana pay PoS with that token. Otherwise you need transaction requests to be customising the fee payer and it gets a lot more complex/less off the shelf
    – Callum M
    Aug 2, 2022 at 19:55
  • The first thing what @CallumM mentioned is what came to mind as the primary direction where I'd take it. I'll check Solana pay as well. Thanks a lot, great stuff!
    – vibes
    Aug 2, 2022 at 20:04
  • 1
    Ah ok, I understand. Check this repo, I have it in my favorites but never tried, I think it could help: github.com/solana-labs/octane
    – Andres
    Aug 2, 2022 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.