I try to interact with Ethereum node via web3 lib. (meteor add ethereum:web3)



if (typeof web3 === ‘undefined’){
web3 = new Web3(new Web3.providers.HttpProvider(‘’));


web3.eth.defaultContractEvent = “0x*************************************”;
contract_event = web3.eth.contract(abi_event).at(web3.eth.defaultContractEvent);
 var events = contract_event.allEvents({fromBlock: 0, toBlock: ‘latest’});

get error at last line


TypeError: XHR2 is not a function
 at [object Object].HttpProvider.prepareRequest (packages\ethereum_web3.js:4315:15)
 at [object Object].HttpProvider.sendAsync (packages\ethereum_web3.js:4364:22)
 at [object Object].RequestManager.sendAsync (packages\ethereum_web3.js:6369:19)
 at Object.send [as newFilter] (packages\ethereum_web3.js:5080:42)
 at new Filter (packages\ethereum_web3.js:3568:25)
 at [object Object].AllSolidityEvents.execute (packages\ethereum_web3.js:2716:12)
at server/main.js:135:30

at Function.time (C:\***\.meteor\local\build\programs\server\profile.js:309:28)
at C:\***\.meteor\local\build\programs\server\boot.js:348:13
at C:\***\.meteor\local\build\programs\server\boot.js:389:5

Exited with code: 1

what is the problem?


Apparently there is a problem for event handling on server side when meteor+web3 is being used. I've been looking for an answer to this since 2 weeks now. :(


I've found a guy trying to fix this in github but it was way out of my league.

Let me know if you find something... Cheers.

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.