1

I have deployed smart contracts to ethereum main net using the ethereum wallet and remix etc in the past, however I am about to deploy my first web3js project.

My project would interact with the smart contract only to get a value and send an eth address to the contract. I can get this working when testing on my local.

For final production version, would I need to deploy the contracts in the usual way then connect to the live smart contract by providing the contract address and ABI to web3 and truffle? Or is there another recommended way of doing it? All tutorials and examples I have found only seem to mention projects running on local.

1

Yes, for Web3 version 1.0.0, you will create an instance of your smart contract within your dApp by using its address and ABI.

const contractInstance = new web3.eth.Contract(abi, address)

You will of course need the contract address and ABI somewhere within your project directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.