Searching for past transactions to/from specific addresses

I tried searching for this in the forums before posting it. I’m trying to find a way I can search for transactions on harmony to or from specific addresses. I have multiple addresses and I basically want to see any activity to/from them.

Is there a way to pass a list of addresses, or do I have to iterate through each block looking for a txn from those addresses? The former would be more ideal.

Would I need to use Rosetta for this with the /search/transactions endpoint, or Web3 similar to this post and pass the harmony chain? Or is there a better option?

Any examples or help appreciated.

You can get transaction history from a specific address by using the hmyv2_getTransactionsHistory method via RPC.

example from the docs:

{
    "jsonrpc": "2.0",
    "method": "hmyv2_getTransactionsHistory",
    "params": [{
        "address": "one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7",
        "pageIndex": 0,
        "pageSize": 1000,
        "fullTx": true,
        "txType": "ALL",
        "order": "ASC"
    }],
    "id": 1
}

Api docs and examples here:

API docs / Postman

docs.harmony

I am not aware of an endpoint that takes in a list of addresses, most likely because that could return a LOT of data and there is already pagination for a single address.

This call requires no gas but of course it can be costly request wise if you use http.

I would recommend using a websockets connection which will provide the best performance.

@Maffaz again I appreciate the response. And yes when I said costly I’m thinking compute time and iteration. Performant would have been a better choice. If i have 1000 addresses I’m following that’s at minimum 1000 API calls. Websockets is unfortunately not as reliable when it comes to ensuring we haven’t missed a transaction as our application needs to ensure it catches all transactions for specific addresses.

Is it possible to request all transactions for each block? It seems more performant and reliable to know the last block we processed and iterate through each block.

@Maffaz This filter allows us to pass it a list of addresses along with a block. Do you know if that could be used to accomplish finding txn’s for addresses?