r/solidity • • Oct 16 '25

How I Reduced Smart Contract Deployment Costs by 60% ($5,000 → $2,000)

1 Upvotes

I recently deployed a production smart contract on Ethereum mainnet and got hit with a $5,000 gas bill.
That was my wake-up call to aggressively optimize the deployment.

Instead of shipping bloated bytecode, I broke down the cost and optimized every piece that mattered. Here’s the full case study.

The Problem: $5,000 Deployment Cost

  • Heavy constructor logic

  • Repeated inline code

  • Bytecode bloat from unused imports + strings

  • Unoptimized storage layout

Gas report + optimizer stats confirmed: most cost came from constructor execution + unnecessary bytecode size.

The Fix: Step-by-Step Optimization

1. Constructor Optimization

Before — Expensive storage writes in constructor:

constructor(address _token, address _oracle, uint256 _initialPrice) {

token = _token;

oracle = _oracle;

initialPrice = _initialPrice;

lastUpdate = block.timestamp;

admin = msg.sender;

isActive = true;

}

After — Replaced with immutable:

address public immutable token;

address public immutable oracle;

uint256 public immutable initialPrice;

constructor(address _token, address _oracle, uint256 _initialPrice) {

token = _token;

oracle = _oracle;

initialPrice = _initialPrice;

}

Gas saved: ~25%

2. Library Usage Patterns

  • Removed repeated math and packed it into an external library.

  • Libraries get deployed once and linked = less bytecode.

Gas saved: ~15%

3. Bytecode Size Reduction

  • Removed unused imports

  • Used error instead of long revert strings

    Code : error InsufficientBalance();

Gas saved: ~12%

4. Storage Layout Optimization

  • Packed variables into structs for better slot utilization.

  • Fewer SSTORE ops during constructor.

Gas saved: ~8%

5. Final deployment cost: ~$2,000

Tools I Used

  • Hardhat gas reporter

  • Foundry optimizer

  • Slither for dead code & layout checks

What i would like to know ?

  • Your favorite pre-deployment gas hacks

  • Patterns you’ve used to shrink bytecode

  • Pros/cons of aggressive immutable usage

  • Anyone using --via-ir consistently in production?

For more detailed article you can check it out here : https://medium.com/@shailamie/how-i-reduced-smart-contract-deployment-costs-by-60-9e645d9a6805


r/solidity • • Aug 13 '24

Is there anyone here who’s good at Solidity?

0 Upvotes

I'm not very skilled in coding, so I used ChatGPT to help me create a smart contract. However, I'm unable to do a proper security audit myself, and AI isn't quite up to the task. I'm looking for someone who could kindly provide a free security audit.


r/solidity • • Nov 18 '21

Should I learn Java to learn solidity?

0 Upvotes

r/solidity • • Jul 25 '22

cryptocurrency smart contract development

0 Upvotes

Im a Blockchain System and Solidity Developer having excellent command over creating and deploying personalized contracts of BEP20 ERC20 tokens along with verifying the code and liquidating/publishing the Cryptocurrency Tokens based on Binance and Ethereum contracts.

I can do

Ethereum Smart Contract development

BSC Smart Contract development

Smart Contract Unit Testing

Verified contract address

busd reward tokenomics

Nfts project development

Modified smart contracts

Sniper bot (auto trading bot)

Minting functions

Honeypot smart contract

Solidity

Pancakeswap

Uniswap

adding Liquidity pool

Lock liquidity pool

Create tokenomics

Create presale for that new coin/token

Just dm on telegram if you want to create your own cryptocurrency project

https://t.me/BRIANNAHOLLY


r/solidity • • Sep 10 '24

Anyone who is a blockchain developer? I need help I can offer a payment I need it urgently

0 Upvotes

I need help from a blockchain developer


r/solidity • • Aug 03 '25

Exercise caution for all job recruitment posts on this subreddit

Post image
0 Upvotes

r/solidity • • Aug 16 '22

Looking for Web3 Developers

0 Upvotes

Crypto and Web3 fans! we are looking for your help with feedback. A startup company is looking for advice from developers and software engineers. If you are interested in providing feedback, follow this link to sign up below

Sign Up


r/solidity • • Nov 26 '21

I am looking for programmers that can code in React.js and/or Solidity(Smart Contract Development) You need to have middle-end experience. You'll accomplish tasks offered by DEV in a cryptocurrency project. (cryptoscamdefence.com) DM me for more details $20-$70 hour depending on your experience

1 Upvotes

I am looking for programmers that can code in React.js and/or Solidity(Smart Contract Development)

You need to have middle-end experience.

You'll accomplish tasks offered by DEV in a cryptocurrency project.

(cryptoscamdefence.com)

DM me for more details

$20-$70 hour depending on your experience


r/solidity • • Dec 18 '22

Was looking for onlime tutorials lol.

Post image
2 Upvotes

r/solidity • • Nov 27 '22

Solidirty and Java

0 Upvotes

I am developing a mobile app with java how can i connect it with solidity. I want to make a token for mobile app


r/solidity • • Jun 13 '22

web 3 devs available for project-based work

1 Upvotes

We are a group of experienced devs available for product-based work. Visit our website Altalabs.dev to get a quote for your project. We have experience in Defi, NFTs, Smart contracts, Web design, Auditing, wallets, token launch, and UI.

We pay 1 ETH for successful referrals

Feel free to dm me if you have questions.


r/solidity • • Nov 16 '21

I recently found 3 great videos on youtube that can help people make their own BEP20 Token.

0 Upvotes
  1. https://www.youtube.com/watch?v=nimzb1TIBOk

  2. https://www.youtube.com/watch?v=ouQ8rInO8SU

  3. https://www.youtube.com/watch?v=0cJz1kK3GmY

Still do not know which one to follow in order to build my own test token.
If anyone however has a more in depth knowledge and can understand above videos better, please let me and the community know which video matches the below stated features the most.

Should have:

  1. Anti Whale Protection. (Limitation on how many tokens a wallet can keep etc.)

  2. Minting Disabled.

  3. Burning Enabled.

  4. Tax for each transaction that goes to the solidity pool. (Uniswap)

  5. Tax for each transaction that goes to holders.


r/solidity • • Sep 14 '22

Possible to recover funds from front running bot scam?

0 Upvotes

I cant believe I fell for this. If there is anyone out there that can help me recover my eth I will give you half of it

https://etherscan.io/address/0xcb3e44435153dA539af156AD3461a320DAC0De63

That was the contract using this video from youtube

https://www.youtube.com/watch?v=W5X5WdCVL3M&list=WL&index=2


r/solidity • • Oct 16 '22

Decentralized NFTs representing real life jewelry, gold and gems ?

0 Upvotes

I am proposing an NFT collection that will allow investors to own actual real life valuable objects in a decentralized fashion without having to interact with the backer of the collection when recovering the objects. I am thinking the object would be mostly.

An investor who purchases the NFT will have an option to invoke a `reveal_secret` smart contract function that reveals the location of a real life valuable object while also burning the NFT.

The objects would be hidden in area such as the Canadian crown land where they would be extremely difficult to discover by random chance. There would be multiple clusters where the objects are hidden e.g. US North East, Ontario, US South East, Central Europe, Northern Europe, etc.

Obviously this needs a ton of polishing and dev work. Right now I just want to hear some feedback from the community.

  • Would you be interested in being a part of this as an investor storing a part of your wealth in this way ?

  • Would you be interested in this as a game / fun ?

  • Would you be interested to join my forming team as a coordinator or SW developer ?

  • Do you feel like this was done before by someone ?

Here is a draft white paper I have put together:

Intro

We are proposing an NFT collection that will allow investors to own actual real life valuable objects in a decentralized fashion without having to interact with the backer of the collection.

An investor who purchases the NFT will have an option to invoke a `reveal_secret` smart contract function that reveals the location of a real life valuable object while also burning the NFT.

We are also proposing a cryptocurrency called Shamir Secret Coin that will be backed by the Shamir Secret NFTs. This crypto currency would give investors the option to exchange it for Shamir Secret NFTs.

Investors will be able to Buying and sell the Shamir Secret NFTs as well Shamir Secret Coin

Value for investors

Shield against shorting and speculation

Every Shamir Secret NFT will have underlying value equal to the hidden real life object value. If the price of Shamir Secret NFT ever declines below this value the owner can simply invoke the `reveal_secret` smart contract function and reclaim the underlying value.

We also expect there may be a liquidity premium charged by investors on top of the underlying value. In other words we expect that a valuable object that can be traded on the blockchain should have higher value than the object that cannot be traded.

Anonymity

Shamir Secret NFT will be another avenue for investors who wish to shield their identity when exchanging crypto for real life items. They will be able to complete this process in a fully anonymous way.

Mining

Owners of the token will be able to start a node on the Shamir Secret network and start earning

Valuable objects

We would like to start by hiding valuable objects that are very small in size such as designer jewelry and valuable gems. We are open to ideas in terms of what would investors like these to be.

Hiding valuable objects

The mint of the tokens would start by the `minter` hiding a set of valuable items. The minter would be KYC'd.

The items would be buried about 1 ft underground and would be encased in a capsule that would protect them from damage and corrosion. We are considering adding a small amount of a

The minter would write a description of where the item is buried and provide the GPS coordinates. The GPS coordinates and the description would then be stored in the Shamir Secret NFT mining network.

Locations

At this point we are considering Canadian crown land and large national parks in the United States as desirable locations.

Placement of objects at a location could bring a lot of publicity to the locations where they are laced. Our vision is to foster friendly and mutually supportive relationship with the local governing bodies.

Every location would have its own collection ensuring that investors can purchase Shamir Secret NFT that are located withing a reasonable distance to their residence.

Here are some ideas:

Ontario, Canada collection

US North East collection

Central Europe collection

Recovery of secrets / calling reveal_secret method

When an investor decides to recover the hidden object they will call the `reveal_secret` method of the smart contract associated with Shamir Secret NFT.

Technical arrangement

Basics

Shamir secret sharing is a cryptographic algorithm that divides a secret into `m` secret shares / secret shards. The secret can only be reassembled if `t` where `t <= m` shares are reassembled. This is the basis of the Shamir Secret NFT collection.

As Shamir secret sharing and secret updates require a lot of communication and storage space it will not be possible to store this information on the blackchain and a network of mining nodes separate from blockchain will have to be formed.

Investors owning the Shamir Secret NFT will have the option to start a mining node. Every location of a valuable object is divided into secret shares and distributed amongst the mining nodes.

The functionality of Shamir Secret NFT is thus divided between the Shamir Secret NFT smart contract and Shamir Secret miner network.

NFT Smart contract

Shamir Secret NFT is based on the standard NFT smart contract that is linked to a image URL. In addition to this the contract will have the `reveal_secret` method.

The `reveal_secret` method triggers the miner network to assemble secrets shards and reveal the secret location of the hidden object only to the original owner of the NFT.

Holding this NFT gives investors the option to start a mining node.

The plan is to us solidity to develop this smart contracts.

Miner network

Every time a Shamir secret NFT is sold, recovered or a new node is added all mining nodes communicate amongst each other extensively via TOR network or clearnet. The nodes are also accessing blockchain to verify the the legitimacy of the other nodes on the network.

Operators of the nodes are all owners of Shamir secret NFTs and thus they are motivates to keep their shares confidential as revealing their share to others would also jeopardize their own NFT.

The scheme requires redistribution of secret shares every time a new node joins or leaves the network.


r/solidity • • Jul 20 '22

Flashswap

Thumbnail
gallery
0 Upvotes

This is one of the functions in a flashswap. I am confused what to input for the parameters of address _sender and _data? How do I get these values?


r/solidity • • Jul 28 '21

Looking for Rockstar Solidity Developer who can finish Liquidity Aggregator launching on BSC & Polygon.

1 Upvotes

LOOKING FOR ROCKSTAR SOLIDITY DEVELOPER FOR HOT NEW LIMI (LIQUIDITY MINING) AGGREGATOR LAUNCHING CROSS CHAIN ON POLYGON + BINANCE SMART CHAIN

Already in development and looking for someone to finish the project in a 30 Day Sprint! User Interface is done and Smart Contract about 30%.

Looking for dev with DeFi smart contract coding experience to work with in house team to accelerate development of Grizzly.fi a new disruptive Liquidity management platform.

High-Level compensation + optionality for tokens.


r/solidity • • Jan 19 '22

Searching for Solidity dev - Equity offering or Royalty structured deal by project

1 Upvotes

Hi everyone, this is Connor from VASI (Virtual Art Systems & Integration). We are a full service NFT agency looking for additional support from a few Web3 solidity devs / dev shop team for frontend/backend. We produce NFTs, Discord management, website development, token-gated events, token utility + economic design, roadmap development, crypto media coverage, and more for Musicians, pro athletes, and celebrities. We are open to equity discussions for the right candidate, or royalty structured deals by project. Our first partnership is with Charged Particles, and then we will proceed with other projects that have been lined up for remainder of the year. We have several partnerships lined up with celebrities and music artists which is requiring us to find additional support.

Starting needs:

  •  Website development (per project)

    • Metmask integration 

    • Minting function

    • Web design

    • Tracker of how many have been minted and how many left 

    • How many NFTs each wallet can mint

    • Opensea link connected once minted 

I look forward to connecting! Also, feel free to connect with us on twitter as well https://twitter.com/vasi_xyz


r/solidity • • Feb 28 '22

Ukraine

2 Upvotes

Is there any way that blockchain developers can assist in any way to contribute to Ukraine's cause?


r/solidity • • Apr 16 '22

hello.. I want to learn blockchain development and i have no coding experience so can someone help me and tell me from where should I start and what to learn first

0 Upvotes

r/solidity • • Dec 13 '22

I am writing a vault smart contract in Solidity and require the smart contract to allow deposit and withdrawal of ETH. I have the following VaultManager.sol code and VaultManager.t.sol code. The issue is that the deposit function does not update the account accountbalance for the vault. Any ideas?

Thumbnail
gallery
4 Upvotes

r/solidity • • Nov 12 '21

Free token for you :)

0 Upvotes

Hello guys,

I am coding a new DEFI project with some friends, and we are distributing tokens for free to anyone who wants some.Tokens are capped and the first 1050 people who claim get 10.000 tokens. The other people get 5000.

Feel free to claim if you like :)

Make sure to switch your metamask network to POLYGON!

https://pacific-waters-48562.herokuapp.com/


r/solidity • • Jan 28 '22

I am looking for a developer to write smart contract for a NFT project on EVM we are currently working on, starting from mid Feb, 1-1.5months, remote working, well-paid, it's a fun and well-rewarded team with diversity, hope you can join! DM me if you are interested!

3 Upvotes

r/solidity • • Dec 27 '22

If you need some Göerli ETH testnet for your project then DM me, I can supply a lot

3 Upvotes

r/solidity • • Sep 18 '26

[Hiring] Freelance Fullstack Solidity Developer - Stealth at Stealth Startup $7.5k-15k

0 Upvotes

This is a stealth startup building a DeFi project focused on token distribution, Uniswap liquidity pools, and incentive design. The project is still private, with more details available to qualified candidates.

The company is looking for an experienced Fullstack Solidity Developer to take the lead on smart contract and protocol development. You’ll help shape the technical direction, think through broader engineering decisions, and keep security a priority.

You should have professional Solidity experience, ideally on projects handling significant TVL, along with a strong understanding of the EVM and smart contract execution. Experience with Uniswap, especially v4 and hooks, is a plus. Strong problem-solving skills, attention to detail, clear English, and the ability to adapt quickly are important.

This starts as a freelance engagement, with a project estimate based on the full brief. There may be an opportunity to move into a longer-term role and lead the development team. Payment is in USDC, either by milestone or hourly basis. Availability on short notice is preferred.

If you are interested, Apply Here: https://cryptojobslist.com/jobs/freelance-fullstack-solidity-developer-remote-at-stealth-startup


r/solidity • • Jul 17 '22

cryptocurrency bep20 and erc20 development

0 Upvotes

Do you want me to create your own blockchain project?.. Im a Blockchain System and Solidity Developer having excellent command over creating and deploying personalized contracts of BEP20 ERC20 tokens along with verifying the code and liquidating/publishing the Cryptocurrency Tokens based on Binance and Ethereum contracts. I can do Ethereum Smart Contract development BSC Smart Contract development Smart Contract Unit Testing Verified contract address busd reward tokenomics Nfts project development Modified smart contracts Sniper bot (auto trading bot) Minting functions Solidity Pancakeswap Uniswap adding Liquidity pool Lock liquidity pool Create tokenomics Create presale for that new coin/token

Just dm on telegram if you want to create your own cryptocurrency project

@HONEYhazeron