-1

This question already has an answer here:

I want to get list of transactions by address and found example using web3.eth.subscribe. I wrote simple code from example

const Web3 = require('web3')
const web3 = new Web3(new Web3.providers.WebsocketProvider('ws://localhost:8546'))

web3.eth.subscribe('logs', options, function (err, res) {
    if (err)
        console.log(err)
    console.log(res)
})
.on("data", function(log){
    console.log(log)
})
.on("changed", function(log){
    console.log(log)
})
.on('error', function (err) {
    console.log(err)
})

but i dont get nothing. No console info or something like this.

marked as duplicate by Roman Frolov, Richard Horrocks, Achala Dissanayake, Luiz Soares, Jesse Busman Jan 20 '18 at 17:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

web3.eth.subscribe works for subscribing to events, which can be coded in a smart contract. In your code sample you are looking for events named logs, error, changed and data.

In order to get all the transactions of one address, you need a fully unpruned Ethereum node.

Possible Duplicate Question: How to explore all transactions for a given account?

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