Currently I'm writing an app to interact with NFTs in a game. Therefore I want to implement a function to buy and sell an NFT by using a QR code.

The seller should be able to create a QR code for his token including the price and obviously his address. The buyer just scans the code and sends the amount plus gas fees. He shall not be able to edit the amount. The NFT should then be transfered to the user.

Since the app/mod is inside a game there is no option to use a browser. Does anyone has some links or information for me that could help?

1 Answer 1


The general concept you're going for is generate a QR code link that will make an API call to likely a cloud function that has access to a node that talks to your contract's ABI.

I suggest following a tutorial similar to this to create the URL for a http request https://tommorris.org/posts/2019/qr-codes-cloud-functions/

That URL calls the cloud function on a node that talks to your contract ABI like https://moralis.io/

Assuming the wallet is connected it should ping back a request to confirm (metamask or w/e).

  • Creating the QR code to invoke a smart contract function is afaik directly possible by using the data field. My problem is more about allowing the token to be bought for an amount via the smart contract by someone at any time - so the buyer is not known when "listing" the token by the seller. I found this article medium.com/blockchannel/… but it is more about directly sending a token for amount to a buyer adress.
    – MKM
    Feb 3, 2022 at 12:29
  • I'm not exactly sure how to do it, but from what I've read before you setup a signature that offsets the cost to the future buyer for when that transaction goes through.
    – FudgyDRS
    Feb 3, 2022 at 12:46

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.