I am using
truffle migrate --reset --compile-all
to deploy the contract to local network
but in order to use new web3.eth.Contract(jsonInterface[, address][, options]), i should be able to know the contract address,
so how could know the address which truffle is deploying?
Best Answer
There are a few ways to do this:
1) In your blockchain node (testrpc|ganache or your test/live network with geth/parity), the contract deployments will be logged and you can see the address created then
2 & 3) You can get the address via the artifact after the contract is deployed, either from the artifact directly or by using the artifact and getting the contract instance.
Example: log from deployment file: (migrations/2_deploy_contracts.js)
(Note: I've used the deployment file as the example, but you can retrieve the address from any javascript file where you've imported and made available the artifact)