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 ?


2 Answers 2


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 github.com/ethereum/wiki/wiki/JavaScript-API.

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 https://github.com/ethereum/web3.js/issues/1752#issuecomment-404385542

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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