6

What is the cost of deploying contracts on Ethereum?

What is the cost of deploying contracts on Ethereum? Intuitively, the cost should to be proportional to the size of the contract.

How is the cost computed? And how can I check the size of my contract before deploying it, so that I know the cost of deployment?

2
  • 1
    The cost is mostly proportional to the size of the contract, but it is also increased by the complexity of the constructor function. If the constructor has loops in it that do a lot of computation, that will also increase deployment cost.
    – Jesbus
    Commented Dec 8, 2017 at 14:06
  • I the constructor writes to memory, that will also be very expensive. Commented Apr 24, 2018 at 17:49

2 Answers 2

7

Deploying a contract has a minimum fee of 32000 gas, plus 200 gas per byte of the source code, as per Appendix G in the Ethereum yellow paper (The Create and CodeDeposit opcodes)

You can write out your contract in Remix and test a deployment to check how much it would cost for a more specific estimate.

1
  • Wouldn’t it be more fair if the cost per byte was the same as that for contract storage? Contracts on Ethereum are also is stored in persistent storage, right?
    – Shuzheng
    Commented Dec 8, 2017 at 17:32
0

The base cost of a create operation is a whopping 32,000 gas, and added to that is the base cost of 21,000 gas for entering a new transaction onto the block itself. 53 000 gas is the base cost. Ethereum has a cost for storage according to the whitepaper of 20,000 gas per 256 bits. A kilobyte of data adds up to a whopping 640,000 gas.

Origin article on medium

Deployment of my MVP contract costs me 3075161 gas which under current currency exchange rate (August, 2022) would cost 7,718,654 USD.

update: it was stated we should use gwei instead of wei in cost calculator, but even 3075.161 gwei would cost enormous amount of money which also is not in sync with publicly presented tokens on market.

2

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.