I need to listen ethereum transactions for current count of addresses using web3j. I know that I can use subscribe to get transactions, but how can I add some filter to listen a certain number of accounts?

Subscription subscription = web3j.transactionFlowable().subscribe(tx -> {// some code});

If you want to listen to transactions on an account you can do the following:

web3j.transactionFlowable().filter({tx -> tx.to == "0xaddress" })

However, you should note that under the hood it will be getting every transaction using the rpc endpoint.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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