Is there a way to convince truffle to launch a smart contract to a specific address, (on local RPC) basically to do testing on a dapp without having to change the contract address in the dapp every tweak...

What I've noticed is that it uses the same contract addresses but when you are deploying multiple contracts it deploys them to one of the addresses that it uses, not always in the same order...

Jul 31, 2020, 6:28 AM
Every time you deploy it should be a new address because your client's nonce is increased. So, no, there is no easy way to keep the same address - you'd either have to reset your client or use something like CREATE2. You can read more here: https://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed

If truffle really does give the same address (sometimes?) then I guess it cheats and reuses nonces locally, but I somehow don't think this is the case
Jul 31, 2020, 6:48 AM
yeah i reset ganache using the same mnemonic
I get the same accounts array and private keys that way, but on deploying three contracts, i get ABC one time and then BAC every so often
Jul 31, 2020, 6:49 AM
ah, right. but I would recommend you to accept the new address and configure things so that they use the new address. This way you could use the same setup for real networks as well
Jul 31, 2020, 6:50 AM
I am being lazy, I can do that ad nauseum but the issue is that it's ad nauseum
Jul 31, 2020, 6:51 AM

© 2024 Draquery.com All rights reserved.