How to reduce gas fees for deploying smart contract

Hi all,

In my marketplace, There is an option for creating collections of NFTs, for this, we are deploying the smart contract for creating the collection.

But the gas fees for the contract deployment are very high($500), then we check in rarible, in rarible gas fees for smart contract deployment is very low with compared to us ($50), how i can reduce the gas fees.

Also please explain about layer-2

Does anyone help me with this?.

Thank you

Are you sure you are looking at the same chain on rarible? If you are looking to deploy on (eth) mainnet 500usd sounds about right for contract deployment (it’s pretty expensive these days) and if you reduce the gas it might not go through.

Also layer 2s are cheaper and faster chains built on layer 1 chains (like polygon is built on ethereum)

1 Like

@kone Thanks for your reply, and sorry for my last response.

Yes, I’m sure I was checked with the same chain (eth) mainnet, the result is, I got more gas fees in my application compared with rarible.

And also I tested with open-sea there are no gas fees for creating collections there, I don’t know how it is possible.

Can you please explain about layer 2, shall I proceed with layer 2? for reducing gas fees.

Thank you.

You might be looking at lazy minting (not sure on which chain they offer it). And if I explain layer 2 chains breifly are just chains build on top of layer 1 chains (like ethereum) - so polygon (matic) is a layer 2 chain on ethereum for example. They are usually way faster and way cheaper, but are a bit less secure.

And where you want to build is your choice, but layer 2s are cheaper and faster, but some people might have difficulties getting used to them, but it’s not much difference and you can have more users that can actually afford the gas fees. But again it’s your choice

1 Like

Hi @jeevaTrippy

Gas fees for deploying smart contracts are determined by the computational resources required to execute the code on the blockchain. While gas fees are an integral part of any blockchain transaction, there are several strategies that can help reduce the gas fees for deploying smart contracts:

  1. Optimize Your Code: Write your smart contract code in an optimized way to reduce the number of computational resources it requires. For instance, you can minimize the number of loops, use simpler data types, and avoid using complex algorithms that require a lot of computations.
  2. Use a Lower Gas Price: Use a lower gas price when submitting your transaction. However, a lower gas price may result in slower transaction confirmations, so it is important to set a gas price that is appropriate for your needs.
  3. Use a Different Network: Use a different network or blockchain with lower gas fees. There are many blockchain networks available, each with its own gas fee structure. For instance, Binance Smart Chain (BSC) and Polygon (MATIC) offer lower gas fees than Ethereum.
  4. Use Layer 2 Solutions: Use layer 2 solutions like sidechains or state channels to reduce the number of on-chain transactions required to deploy your smart contract. These solutions can help you bypass high gas fees associated with deploying smart contracts on the main blockchain.
  5. Deploy at Off-Peak Hours: Deploy your smart contracts during off-peak hours when the network is less congested. This strategy may help reduce the gas fees associated with your deployment.

I’m Aliena Jose works at Techmango, software development firm expertise in this for years.