New answers tagged

1

There are a few different things that can be wrong here, and they all stem from whether your contract is really at that address in your code: Have you actually deployed your contract yet? Your code there assumes that the listed contract is already deployed at that address, it doesn't do any deploying. Are you sure Metamask is connected to the same network ...


1

Try with this events.returnValues['0']. Or did you try something like this: let myArr = [] tokenContract.events.AddressList({ fromBlock: 6020474, toBlock: 'latest' }, (error, events) => { myArr.push(events.returnValues['0']) } ); Or did you try this tokenContract.events.getPastEvents(event[, options][, callback])


1

In the new version you should change const Tx = require('ethereumjs-tx') to const Tx = require('ethereumjs-tx').Transaction


0

the problem is my get function takes a parameter just modify this : var getUserFunction = function(cb,_contractAddress = contractAddress, _jsonFile = JSONFile){ var abi = JSONFile.abi; var contract = new web3.eth.Contract(abi,_contractAddress); contract.methods.getUser('0xF15372bcF1FdD963Ea5514Dc96432Da8e795A8de').call().then(function(_data){ cb(...


0

Classic bug! You need to provide a function, rather than actually calling the function. The key here is onClick="App.validate()" By adding the () after validate, your code is instantly calling validate when the page loads -- the return value of App.validate() is what's actually being set as onClick. If you change it to onClick="App.validate" then you'...


2

check this question - https://stackoverflow.com/questions/5786851/define-global-variable-in-a-javascript-function If web3 is not defined as a global variable, but you have "web3 = new Web3(web3.currentProvider)" inside a function - the web3 object will be local for that function only, while with window.web3 it will be globaly accessible


Top 50 recent answers are included