I'm using a local Ethereum testnet and it seems to me that the price of uploading a smart contract is a bit too high.

This is the code for the smart contract:

contract Transfer {
    address owner;

    function Transfer () {
        owner = msg.sender;

    modifier isOwner ()
        if (owner == msg.sender) {

    function sendEther (address dst) isOwner payable {
        if(msg.value<=0) revert();

    function getBalance () constant isOwner returns (uint) {
        return msg.sender.balance;

    function () payable  
        if(msg.value<=0) revert();


After deploying it with truffle, I've seen that the balance of the account from which that contract has been deployed, has been reduced by 0.045 Ether, which would be something around $15 at today's exchange rate.

I don't know if this is normal, but to me it seems way too expensive.

The gas price in my testnet is 20000000000 and current gas price (seen on https://ethstats.net/) is even higher (35500000000). So, if I'm not wrong, deploying it to the mainnet would be even more expensive!

So, in short, my question is: Is this price normal or am I missing something?

EDIT: Solidity browser says that for this very contract, "Creation: 20435 + 126600", which translates to less than $1... is truffle stealing my Ether somehow?!

Thanks a lot in advance! :)

2 Answers 2


You are missing something.

The amount of gas a transaction requires to submit depends on the amount of processing that miners have to do. A reasonable proxy to this is the amount of input data associated with a transaction.

When submitting a contract you submit the encoded bytecode of the contract. The cost you incurred is significantly more than such a simple contract should incur. Without details of how exactly you submitted the contract, no-one can know if you did something wrong.

35.5 Gwei is the current average gas price. You can specify any gas price you want. Example gas prices are outlined here. It just discerns how quickly your transaction will get mined.

  • Oh, ok... So this just might be that truffle is charging me an insanely high fee in order to publish the contract instantly. That would be a very logical explanation. Thanks a lot, Thomas! :)
    – JaVinci
    Sep 6, 2017 at 10:39

You can set gas limit and gas price for each network in truffle.js Here is sample of truffle.js,

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
    migrations_directory: "./migrations",
    networks: {
        development: {
        host: "",
        network_id: "*", // Match any network id
        gas: 13245300
    ropsten: {
      host: "localhost",
      network_id: "3",
      gas: 4600624,
      gasPrice: 22000000000,
      from: "address to own the contract"
    mainnet: {
      host: "localhost",
      network_id: "1",
      gas: 4324530, 
      gasPrice: 2000000000, 
      from: "address to own the contract"    

when you try to deploy, do something like truffle migrate --network ropsten --reset.

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.