QR code for sending tokens

Is there a way to generate a QR code that when scanned would execute a pre-configured transfer of a token to the scanners wallet (without knowing know the scanner will be in advance). Basically the exact opposite of how you can generate a receive code for a specific amount.

I tried googling it but Google doesn’t seem to understand I don’t just want to sign up for Coinbase :sweat_smile:

Hello welcome to the forums.

I am assuming you want this solution for a custom Smart Contract ERC20 token.

There are several approaches, my approach would be…

  1. Set up a QR Scanning website or server that connects to your smart contract via Web3.

  2. When the QR code is scanned, the website/server uses code to do some checks to make sure a legitimate QR code was scanned.

  3. Then the website/server calls a smart contract function using Web3 to either Mint or Transfer tokens to the wallet address of the scanner.

You would need to figure out how to ensure that a legitimate QR code was scanned in order to properly validate a correct call. You don’t want just anyone to be able to call the function and mint/transfer an unlimited amount of tokens. An approach for this would be to use a Controller system, where QR codes get scanned, the Controller Validates, then the function gets called.

You would also need to figure out how to ensure what wallet the scanner has. How does the “scanning” know what wallet the scanner has? When the scan happens, do you ask to connect up to their wallet to get their address? Basic security practices tell me I wouldn’t do that. So when scanning, it should be clear to the user what operation you are doing.

1 Like