top | item 15807121

(no title)

coryl | 8 years ago

I've also just begun to play with smart contract programming.

One problem I'm having is with event listening.

It seems that MetaMask doesn't yet support subscriptions, nor does my localhost testRPC instance pass it in the web3 object.

Some have suggested I need to run my own node just to listen for contract events. Has anyone figured out an easier solution?

discuss

order

fokinsean|8 years ago

Quick question, do you have to download the full ethereum chain before you can start messing with smart contracts? Or is there a "light" client you can use?

zodiac|8 years ago

You shouldn't use the main ethereum network when testing smart contracts - develop on a local testnet and then if you want, on a public testnet (eg rinkeby or ropesten) first

coryl|8 years ago

You can use a test node called testrpc (now called ganache-cli ???) and connect to that.

jatsign|8 years ago

I've had success listening to events using web3, against both testrpc and geth (on private and test networks). What version of web3 & testrpc are you using?

coryl|8 years ago

I'm using web3 1.0.0-beta.26, ganache-cli 6.0.3

I instantiate the web3 object as such: web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

When I try to setup an event listener, console logs this:

Error: The current provider doesn't support subscriptions: HttpProvider