How to implement gasless transactions with Moralis?

I followed Moralis’ How to clone Rarible tutorial, but I need to pay for gas when an item is minted (one transaction) and the buyer needs to pay for gas when the item is bought (one transaction).

How do platforms like Mintable allows users to publish their NFTs gaslessly? Because as far as I know, an item needs to be minted in order for it to be bought. So, there must be a mint transaction and a buying transaction. Therefore, two transactions.


Their docs don’t really explain this from what I could see looking around there quickly.

Off the top of my head I would think

  • If any transaction takes place at all, then the costs are subsidized by the contract (i.e. project owners)
  • Maybe no transaction takes place… perhaps just the meta-data is stored to IPFS and a future transaction will create the actual NFT on chain
  • Maybe they take a bigger cut of the sale price to compensate for on-chain costs

That’s what I thought. Nice to see we’re on the same page. Thanks for the response mayjer!

Hey Mayjer! It’s Mauricio here again. How are you?

I’ve been trying to implement this idea, but I’m having a lot of difficulties in terms of the gass fees. I’m minting the NFT only when it is bought (the minting process takes one gas fee), and then I also need to make sure the marketplace is approved (another gas fee), then I also need to transfer the funds from the buyer to the seller (and that’s another gas fee)

Could we be able to put these transactions together so that only one gas fee is charged?

Thanks a lot.

This is something you’ll need to research.

You can do more than one action at time in a smart contract function so long as it doesn’t run out of gas. The user would still need to make a separate transaction for approval however as the Market contract can’t approve itself.

I would like to do this gasless NFT thing tooo.
with the Registrar Project we have over 6,000 canvases to process.
hopefully in batch method style.
there are also several series of Limited Edition Prints with unique custom print process that can not be easily reproduced.
so we really need to implement GASLESS Registration before transaction occurs.

I may have found what we need on github;
I think the term , I hit pay dirt , applies here

About: Gasless NFT Creation

however, I am still not familiar enough with any code to isolate what makes the gasless setup part work or how to grab it and integrate it to my project.

@maufcost perhaps you can dig through these files to find the relevant code we all need and report back here with some confirmed references.



You could call the setApprovalForAll function so they only need to set approval once and just let the user know that’s what they are doing. And also give option to revoke that approval as well just in case some are hesitant. That would definitely save the user on gas down the road. Or maybe give both approvals as options

1 Like

I totally agree with you :slight_smile:

Since I am fairly new to Solidity, I was just wondering if there is a way to get to just 1 gas fee when a buyer buys an NFT (it’s very common on OpenSea, Rarible, Mintable, etc).

Currently there are these operations and EACH of them charges 1 gas fee:

  • Mint item
  • Approve market
  • Transfer funds from buyer to seller

So, 3 gas fees are charged. Is there a way to put these operations together somehow so that I’m only charged 1 gas fee? I’ve been researching that a lot. Thanks in advance.

@maufcost, @Cacao

Rarible has a lazy-mint package which you may find useful:

Thanks to @rph for pointing this out. If you’re curious what that hypernft-web project is doing you can find info about the contracts in this file and then look them up on Etherscan.


That is perfect! Thank you very much for sharing these resources with me. Time to dig in.

1 Like

hey @maufcost please let me kow what you come up with.

it will also be informative for @dbgoodrich and @CasNWK

it gets better every day right 8)

thank you

Not sure if this will help but here is some good info and code example of a lazy mint
I also believe Opensea stores there lazy mint data somewhere centrally as I am able to edit a item that is lazy minted even after I sell it and I buy it back I can edit it but only the creator is given this option not the owner but there is also a freeze data option when editing which then saves to IPFS and cost a minting fee as the item is now on chain

1 Like