0

I am trying to deploy the contract using [email protected] enter image description hereenter image description herei have mentioned the error and code that i have typed i m stuck in line 10

5
  • 2
    Gee, you couldn't think of a better way than taking a photo of your screen with a camera??? I can see the background of your room there. A screenshot is just one simpler option, which is also not reccommended here, since users cannot copy/paste parts of your code into their answers. A copy/paste of your code into the question is the preferred way for posting questions here. Please do so. Feb 28, 2020 at 10:21
  • var Web3 = require('web3') var web3 = new Web3(new Web3.providers.HttpProvider("localhost:8545")); web3.eth.accounts code = fs.readFileSync('blockchain/voting.sol').toString() solc = require('solc') compiledCode = solc.compile(code) abiDefinition = JSON.parse(compiledCode.contracts[':Voting'].interface) VotingContract = web3.eth.contract(abiDefinition) Feb 28, 2020 at 10:56
  • This is d code i m trying and it gives error Feb 28, 2020 at 10:57
  • Downvoted, pictures are not searchable, please add code.
    – DRP
    Feb 28, 2020 at 14:03

2 Answers 2

5

Obviously, I didn't replicate the code. You should try to upload code blocks that would allow us to replicate your code fast.

Nevertheless, my guess is that the error on you line 10 is caused because of web3.eth.Contract(...) expecting 2 arguments, ABI and Address of Contract, and you just gave it the ABI. Check the documentation and the following example they have here. Also, the function Contract is with a capital 'C'. Hope that helps

3
1

In web3.js v0.x, use web3.eth.contract.

In web3.js v1.x, use new web3.eth.Contract.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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