5

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?

  • 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. – Jesse Busman Dec 8 '17 at 14:06
  • I the constructor writes to memory, that will also be very expensive. – Thorkil Værge Apr 24 '18 at 17:49
6

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.

  • 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 Dec 8 '17 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.