I've tried to create an instance of a contract using:
VotingContract = web3.eth.contract(abiDefinition)
but I get: TypeError: web3.eth.contract is not a function
So I've tried: VotingContract = new web3.eth.Contract(abiDefinition)
as suggested here: web3.eth.contract is not a function when making contract
But then when I try to deploy the contract on my test blockchaing (launched with EthereumJS TestRPC) I get the following:
deployedContract = VotingContract.new(['Rama','Nick','Jose'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
TypeError: VotingContract.new is not a function
at repl:1:38
at ContextifyScript.Script.runInThisContext (vm.js:44:33)
at REPLServer.defaultEval (repl.js:239:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:433:10)
at emitOne (events.js:120:20)
at REPLServer.emit (events.js:210:7)
at REPLServer.Interface._onLine (readline.js:278:10)
at REPLServer.Interface._line (readline.js:625:8)
at REPLServer.Interface._ttyWrite (readline.js:905:14)
at REPLServer.self._ttyWrite (repl.js:502:7)
at ReadStream.onkeypress (readline.js:157:10)
at emitTwo (events.js:125:13)
at ReadStream.emit (events.js:213:7)
at emitKeys (internal/readline.js:420:14)
at emitKeys.next (<anonymous>)
at ReadStream.onData (readline.js:1006:36)
at emitOne (events.js:115:13)
at ReadStream.emit (events.js:210:7)
at addChunk (_stream_readable.js:252:12)
at readableAddChunk (_stream_readable.js:239:11)
at ReadStream.Readable.push (_stream_readable.js:197:10)
at TTY.onread (net.js:589:20)
Any suggestions?
web3.version
? I found today that at some point after 1.0.0-beta.11 a bunch of the contract creation functionality broke, so I reverted from .15 to .11 and it's working again. – benjaminion Aug 7 '17 at 20:56web3@1.0.0-beta.16
, I've tried to move toweb3@1.0.0-beta.11
usingnpm install web3@1.0.0-beta.11
as you suggested but I get the same error. – ilopezluna Aug 8 '17 at 10:20