I am trying to interact with a simple solidity contract using MetaMask. I can run truffle migrate and run the front-end with no trouble but when I try to interact I get the error:
Unhandled Rejection (Error): This contract object doesn’t have address set yet, please set an address first.
I was told I need to change my network as the issue relates to chain id or network id with Ganache. I’ve tried changing the network ID in Ganache and setting up the network in MetaMask, but then I can’t migrate my contracts in truffle anymore error message:
Error: The network id specified in the truffle config (5777) does not match the one returned by the network (1337). Ensure that both the network and the provider are properly configured.
I tried then to add some configuration settings in the truffle-config file, including specifying the correct network and creating a new network and specifying it when migrating, but also no luck.
Another potential solution I have found was to run ganache-cli with specific network and chain Id, which I have tried however I don’t know how to migrate my contracts to that network.
When I run truffle migrate it looks for 5777 every time but I need it to deploy to 1337. No idea how to change it. This is all very new to me so I hope it is something simple that I don’t understand yet.
Any advice would be great, thanks
Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.