Network up to date on truffle deploy
Asked Answered
C

2

6

I've been working with solidity and truffle for a few days to develop a contract. I'm testing using the network created by Ganache an RPC client for build a local blockchain enviroment.

There is one thing I do not understand though.

I follow these steps:

  • truffle deploy. I deploy my contract on the network.
  • truffle test. I test my contract.It's OK.
  • truffle deploy. I try to update my contract. Say me "Network up to date"

But if I restart Ganache and update my contract with truffle deploy, it works. This is the thing that I don't understand.

Why? Can someone explain it to me?

Cameleer answered 9/1, 2018 at 12:1 Comment(4)
Are you running ganache-cli while you execute the truffle commands? If you are doing that the contracts are deployed in your private ganache network, and I guess if you try to deploy the same contract again it without changes it wont let you because you will deploy contract that is the same as the one you deployed before.Fadein
Thank you for you explain man! I understand now!Cameleer
You can also force a redeploy by running truffle deploy --resetParesthesia
@alvarofvr I would add that restarting Ganache creates a new empty simulation environment and thus truffle deploy starts working again.Hadden
C
27

Like @Augusto Federico Lemble explain in the comment:

"If you are doing that the contracts are deployed in your private ganache network, and I guess if you try to deploy the same contract again it without changes it wont let you because you will deploy contract that is the same as the one you deployed before"

And for correct redeploy like @Adam Kipnis says use:

truffle deploy --reset
Cameleer answered 12/1, 2018 at 9:59 Comment(1)
Thanks that was my issue too. However, I did the following for the current version of Truffle: truffle migrate --reset --network ropstenEmbellishment
B
0

deploy.js=>1_deploy.js In Truffle, deployment scripts are named with numerical prefixes to control the order in which they are executed. This prefixing system ensures that dependencies between contracts are respected during deployment. Token.sol => 1_deploy.js Presale.sol => 2_deploy.js

Blabber answered 17/7 at 14:55 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Arrowy

© 2022 - 2024 — McMap. All rights reserved.