Probably this is not possible, but I still have to ask.

Let me follow the example created in truffle init. It contains a contract called MetaCoin.sol. Say,

  1. I have deployed it on the network (the first version of it).
  2. Then I have extended it with a foo() method.
  3. Now I want to deploy a new modified version of the contract with the same name MetaCoin but the new code of it. Is there a way of doing it?

As the hint there is a contract called Migrations.sol which has a method called upgrade():

function upgrade(address new_address) restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); }

that sets a new address for the code of the contract. Is there a better way of doing versioning or upgrades (deploy rollouts) of the coins code?

  • Probably the way to answer it is written here by calling new() as in ..You can use this method to deploy a completely new instance of a contract onto the network. Maybe I simply misunderstand the whole instances thing. May 28, 2017 at 20:55
  • Adding alternative link to migrations in truffle. Jul 17, 2017 at 15:25

4 Answers 4


you should use truffle(.cmd) migrate --reset to redeploy it on the network.
everytime you run migrate an new address and new contract is created.

(sorry reputatio too low to comment)

  • 2
    I've upvoted this answer to give you +10 rep.
    – Badr Bellaj
    Jul 14, 2017 at 15:02
  • 1
    reset sounds like the wrong name :/ but I think it's the way to go. What if I have 10 contracts and I only changed 1, would reset deploy 10 of them or the one changed?
    – EralpB
    Sep 1, 2017 at 8:29
  • marking as an answer as it seems a correct one after some time of working with truffle framework. I would in general recommend another security framework called openzeppelin.org Dec 27, 2017 at 9:29

Since google lists this question pretty far on top by searching for "truffle deploy new contract" and accepted answer does redeploy all(!) contracts I post following solution for redeploying a single contract:

You need to use both flags --f NUMBER and --to NUMBER with the command "truffle migrate" (look here)

Example, for redeploying a contract with the migration file "5_mycontract_migration.js":

truffle migrate --f 5 --to 5

To redeploy a single contract MyContract:

  • create a new migration with truffle create migration my_new_migration_name
  • in the new migration file (found in the migrations folder), you can redeploy using deployer.deploy(MyContract)

You can also use the truffle deploy "force" feature: truffle deploy -f migration_name reruns a specific migration


You can not "update" a contract, once you deploy it , it is in the chain block.

But you can redeploy it (with a new contract address).

Use truffle migrate --reset to recreate already migrated contract.
Or just copy the old migration file and rename it to a new migration.

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.