From the web3 documentation: I use this code sample:

var subscription = web3.eth.subscribe('logs', {
    address: '0x123456..',
    topics: ['0x12345...'] }, function(error, result){
    if (!error)

and I got this error:

TypeError: web3.eth.subscribe is not a function

is "subscribe" deprecated ? Is there a replacement for it ?

up vote 3 down vote accepted

The documentation you are referring to says -

This documentation is work in progress and web3.js 1.0 is not yet released! You can find the current documentation for web3 0.x.x at

That is the reason you are getting this error, you can follow this link for web3 js latest documentation.

Hope this helps.

also address must be a contract address and not an account

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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