4 ms·
> currently in the thousands of dollars on the main Ethereum network That’s not right. Here’s a recent contract that cost less than $20 to deploy. https://eth
by mattdesl 4y ago
> currently in the thousands of dollars on the main Ethereum network
That’s not right. Here’s a recent contract that cost less than $20 to deploy.
https://etherscan.io/tx/0xd21e1757649ace2fa5d9a1c0f36ddfb49580e38a78e7a62dcff09ded32cff01a https://etherscan.io/tx/0xd21e1757649ace2fa5d9a1c0f36ddfb495...
- LegionMammal978 4y agoThat's interesting. It appears that the resources I was looking at were mostly from last year, which had both higher gas fees in gwei and higher ETH prices in USD. This contract (at 1.2 M gas) still only comes out to the hundreds of dollars at most; perhaps it is smaller than the kind of contracts that most people were considering at the time. (Incidentally, why is it so difficult to find any good order-of-magnitude estimates of the gas usage of deploying a contract?)
- pcthrowaway 4y agoDetermining how much a contract will cost to deploy is really easy for blockchain devs (the "user-friendly" resources probably don't make this easy because it's not relevant to people who aren't doing it). Transactions on Ethereum all contain a certain amount of data which will live on the blockchain forever (often ~100 bytes, for non-contract-deployment transactions). Ethereum processes one block every 12 seconds, and blocks can contain up to 1 MB of data, so effectively people "bid" to get their transactions on by including the fee-per-byte they're willing to spend with their transaction (I'm glossing over a lot here, they're also bidding on computation resources for transactions which call code, and there is some dynamic targeting of fees, all to say that block sizes are typically much closer to 80 KB than 1MB) In order to get an idea of how much it would cost to deploy a contract, you first compile it (get the bytecode size) and then look at the typical "gas cost" (what transactions are currently paying in fees). You can get this data from the chain directly, or go to https://etherscan.io/ https://etherscan.io/ and look at the "Med gas price" (currently 14 gwei, or 0.000000014 ETH). Your dev tooling can tell you how much gas should be required to deploy the contract based on the bytecode size, the storage (space in the virtual machine reserved for that contract's variables), and the amount of computation that needs to happen in the contract's constructor. Once you know how much gas will be required to deploy the contract (the "gas amount") you multiply that by the gas price to get an amount of ETH. A very large contract might cost 8 million gas to deploy (gas is basically a unit used by the Ethereum virtual machine to price operations and storage). So if that's you, you multiply that by 0.000000014 ETH and get 0.112 ETH at the current gas price. If you want to pay less, you could always submit your transaction with a lower gas price (like 0.000000001 ETH lets say, to pay closer to 0.01 ETH); it'll just take longer to get validated (an indeterminate amount of time depending on how heavily the network is being used) Obviously I've glossed over a lot here to make things more approachable, but hopefully that explains the situation well enough. By the way, the tooling around blockchain development is still really primitive relative to its complexity; but contract deployment gas estimation isn't too hard for anyone doing it.