221Bravo - A fully on-chain explorer for ICP tokens

There are a couple of ways to fetch transaction data. Which one you use depends on how you want to fetch it.

Manually
You can fetch transactions by calling your desired ledger canister via Dfinity’s IC Dashboard. For example ICP Ledger Here or ckBTC Ledger Here. To get transactions you can call the ‘query_blocks’ method the first parameter is the starting block and the last parameter is the number to return - try 10562420 and 10 for example.

If you start at a low number eg block 0 it will return the archive canister ID for where that transaction is stored.

Via Javascript Agent
You can use Dfinity’s JS Agent to call any smart contract using javascript/ node etc. You could use this to call each ICP/ ICRC ledger canister and fetch the data you want.

Via Inter-canister Calls
If you are building a smart contract on IC and want to fetch data from the canister you are building, you can use an inter-canister call to fetch the data from the ICP/ ICRC ledgers. For example the 221Bravo Indexer fetches the data here

Via Rosetta API
At the moment I think that only ICP transactions can be downloaded via the Rosetta API (ICRC is being worked on IIRC). You don’t need to run a Rosetta node to do this. I’ve used this code before in node to pull ICP transaction data.

Hope that helps!

2 Likes