web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

web3.eth.subscribe() not working for account addresses

Open rajeshsubhankar opened this issue 7 years ago • 1 comments

Description

web3.eth.subscribe('logs', {address: 'account address'}) is not returning any logs.

Expected behavior

For every new transaction initiated by the specified address, I should get the transaction log.

Actual behavior

If the specified address is a smart contract address then I am getting the log whereas there is no response if it is an account address.

Steps to reproduce the behavior

web3.eth.subscribe('logs', {
    //0xE95CdDC188553f80bc24FF1A1B8989583C7149CB - Contract address(ropsten)
    address: '0x5409ED021D9299bf6814279A6A1411A7e866A631' // Account address(ropsten)
}, function(error, result){
    if (!error)
        console.log(result);
})
.on("data", (log) => {
    console.log(log);
})
.on("changed", (log) => {
    console.log(log);
})
.on("error", console.error);

Versions

  • web3.js:1.0.0-beta.27
  • nodejs: v11.11.0
  • ethereum node: Geth/v1.8.23-stable-c9427004/linux-amd64/go1.11.5

rajeshsubhankar avatar Apr 02 '19 11:04 rajeshsubhankar

The logs subscription of the JSON-RPC PUB/SUB API of Geth can't subscribe to account logs. But it's listed as "possible future subscription".

With Parity, it's possible to subscribe to the balance of an account as describe here. I will add the Parity subscription eth_getBalance asap.

nivida avatar Apr 02 '19 15:04 nivida