How do you all solve multi-network development with truffle? Whenever I try migrations between networks (i.e. local ganache to rinkeby) I always get an error that compiling was done with a different compiler version so I have to end up deleting the build folder in order to migrate but then when I try going back to the intial network I get t`this contract has not been deployed to detected network` because I deleted the build folder

Mar 25, 2021, 11:05 PM
https://www.trufflesuite.com/docs/truffle/reference/configuration#networks
Mar 25, 2021, 11:22 PM
Thanks, so I just have to change the contracts_build_directory and that's where the networks build will live?
perfect
or wait
thats global
so that wont help
how do I do this for multiple networks?
Mar 25, 2021, 11:24 PM
simply define the networks on your truffle-config.js (see networks: {} ), then upon migrating, add a new flag --network (network_name)
Mar 25, 2021, 11:30 PM
this doesnt work
I have to delete the build folder in order to migrate on a new network
and then my old networks build is lost
is there a way to have multiple builds across different networks or do I have to have different git branches for each one which is what I'm currently doing (and its a huge pain)
Mar 25, 2021, 11:31 PM
as far as I know, the build will be the same regardless of the network/infrastructure
Mar 25, 2021, 11:32 PM
No that's not true, network details are stored in the artifact
This is the network ID which is my openethereum node running in kubernetes.

If I try to run migrations on Rinkeby, (network ID 4) it fails because this artifact is in the build folder under network ID 17
These contracts are upgradeable so I need to preserve the builds across all my networks.
and so deleting the build folder is out of the question. I have to have seperate git branches for each network but that is so convoluted and cumbersome, there must be somethign I'm missing
Mar 25, 2021, 11:35 PM
I don't think I have this in my artifacts
Mar 26, 2021, 1:15 AM
You do. It's in all the compiled json files under build
Mar 26, 2021, 2:11 AM

© 2024 Draquery.com All rights reserved.