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

221Bravo.App

We’re really excited to share 221Bravo.App, a blockchain explorer for ICP and ICRC tokens. Even more - we’re really proud to say that the app runs fully-on-chain (100% powered by ICP!). What other blockchain could power that?

We think it’s quite magical to be able to have a blockchain explorer fetch data, process it, store it and display it to users without any traditional databases or servers. We do this via a collection of 90+ smart contracts which work together to read and index tens of thousands of transactions from 20+ separate ledgers.

Our aim is to take complex data and present it in an easily accessible and understandable way. 221Bravo provides transparency for some of the top ecosystem projects/ tokens. Top holders, latest blocks, account explorer tools and more!

Background

The small team of developers behind 221Bravo (Saorsa Labs) have been in the ICP Ecosystem since Genesis and have spent countless hours crunching through all types of transaction data. Our first project (IC Genesis NFT) celebrates the first year of the Internet Computer by capturing real transaction data in a collection of 193 static digital artworks.

Building on this foundation, and utilizing the ability of the Internet Computer to host dynamic/ live artworks, we launched our 2nd NFT collection (Genesis II NFT) which pushed the boundaries by creating 1024 live and dynamic NFT artworks which are powered by genuine ICP transaction data. These NFTs have become awesome looking ‘membership cards’ for 221Bravo App.

BoxyGIF

Future

We are committed to building on the Internet Computer over the long term. We have built trust with our actions – delivering promises and not taking the ‘cash grab’ route taken by other projects. In the short term we will continue to build 221Bravo – adding exclusive members’ tools, stats and features. In the medium to long term we would love to decentralise ownership of 221Bravo and let other passionate data-degens build and expand the app (alongside us of course :slight_smile: ).

We are always looking for feedback and welcome partnership with likeminded ICP Projects. Join our OpenChat group here

Take it easy ICPeople!

18 Likes

Fascinating, I would like to ask you where you get the ledger data (transaction details) of the various tokens from… such as ICP, CHAT etc… Do you use the APIs provided by the foundation or do you directly get the data from the blockchain? I don’t know through Rosetta for example?

Hi Buddy!

We get it directly from the associated ledger canisters. The data is processed by our on-chain index canisters which make on-chain calls to their assigned ledger every 60 seconds.

The frontend website can then fetch the processed data from the index canister.

2 Likes

Thank you for your response. Could you tell me how can I get this data from the various ledger canisters? What I’m trying to do is fetch all the transactions for the ICP token and for the various IRC tokens. I read on the forum that to pull all the transactions you need a Rosetta node, but basically I don’t understand exactly how it works. Could you please bring some practical examples? I would appreciate it, thank you.

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

Thank you very much! This is absolutely a great help… I will go through each point and try to figure out what is the best solution for me… in the last few hours I am trying to run a Rosetta node, yes for now with that you can only get ICP transactions, but the foundation is working on supporting IRC tokens as well. Thanks again for your response, I really appreciate it.

1 Like

This looks very interesting and perhaps even more streamlined to implement than other solutions such as Rosetta. From what I understand this is an interface for interacting from the web2 world with canisters, am I right?

Could you please bring back some practical examples of using it to fetch transactions? Thanks.

I forgot to say there are a couple of other agents if you prefer python, c, dart, go, java, ruby.

I’ve had a look through some of my old JS code and unfortunately can’t find an example of fetching blocks from the ICP ledger.

I have however pushed some frontend code to the 221Bravo repo which might help with JS agents.

IC Agent - 221BravoApp_v3/src/frontend/src/lib/code/fetch/icAgent.js at main · SaorsaLabs/221BravoApp_v3 · GitHub

IDL (interface for the canister you are calling)

NOTE - you can get these IDLs from the Dfinity Dashboard for most canisters. Simply go to the bottom of the page and click Javascript under the canister interface heading.

Making a Call

Hopefully that gets you started :slight_smile:

1 Like

This is amazing work!
Is there a way to see the historical balance of accounts? I.e. a timeseries of token holdings per account.

1 Like

We’ve not made a tool for this yet. The indexer keeps a record of all transactions linked to an account so it wouldn’t be too hard to make a tool which processes this data :slight_smile:

Yeah, that’s what I was thinking as well :slight_smile: Was hoping that you guys already had something available but then we’ll parse that ourselves.

If you want access to the 221Bravo indexers let me know. They are gated at the moment as we build out the app but its easy to authorise users/ canisters

Are you guys also planning to add some data about circulating supply for SNS tokens? For example, an indexer that screens all the neurons and subtracts the sum of tokens locked in governance from the total supply to get some info about how many are liquid?

1 Like

Thats a cool idea. We’re quite flexible on our development roadmap - adding features that users want/ ask for. Before that though we’ll roll out our member tools - alerts and addressbook/ naming.

1 Like