1

I know the question it may be dumb but I'm having troubles finding an answer for it, I need to generate a NFT and I thought of doing it on my backend NodeJs API via an API-REST call, the user makes the request (it mints it) and on the backend I generate a JSON object which then I save it to the infura IPFS and get the link which represents the NFT stats and image.

Then once the URL is generated I call my ERC721 to mint the NFT providing this URL, but of course I'm paying the transaction cost as is my backend server the one who interacts with the SC at the end of the day.

I want to know if there is a way where the user can make this call and transact by himself avoiding me paying the fee.

How do people do this logic? How the cyberpunks were minted?

Thanks in advance!

1 Answer 1

1

It sounds from your description that your NFT creation logic is partially centralized. Your mint should normally be fully decentralized and happen via Solidity smart contract from A to Z.

There should always be a way for the user to mint the NFT fully just by calling your smart contract directly.

Normally you offer two options to the end users to mint NFTs:

A) Your application UI (web interface, for example, that connects with Metamask) -> Web3.js or Web3.py -> call mint() function of your smart contract.

B) Directly via smart contract. Users can do it via Etherscan which shows buttons in its web interface for your smart contract if it's deployed correctly.

Both options should be available to your users so they can choose whatever they prefer. Also (B) is your backup option in case your frontend fails under load or in case some users don't trust your frontend.

In this scenario user calls the contract functions and pays for the gas.

4
  • Hello Taras Filatov, thanks for you answer but still I have some doubts left: How then I "design" those NFT's? By deploying the smart contract and then setting 10.000 URL's which represent different combinations, and then inside the contract I take an incremental value which generates the NFT on mint? Also, it is 100% not possible to the user pay the backend fee? Because I was thinking on rewarding the user with nft's by questing, but that requires to go though my backend Dec 15, 2021 at 10:25
  • There are multiple options. One is you could generate users metadata in JSON for them in your backend, but then they have to "Claim" their NFT which basically mints it with given parameters and bakes in the metadata pre-generated by your backend. Another option is use your backend endpoint to return metadata and specify that endpoint link inside URI value instead of IPFS link. Maybe if you could provide a specific example/scenario we could help you better. Dec 15, 2021 at 13:09
  • Hey again, if you prefer we could talk outside stackexchange and provide with more examples and content to resolve this issue, but yes I'm understanding your process and it could work, but still better if we could share more ideas together, add me on tg: @sportacus777 Dec 15, 2021 at 14:35
  • Sorry about the delayed reply, really busy with work at the moment, I think the way SO / stackexchange works is you could try to describe your issue in better detail but without any irrelevant or confidential specifics, so that we can solve it not just for you but for others who also have it. This way more people could also comment and offer solutions. Dec 22, 2021 at 17:32

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.