AI Features Arrive on Blockscout Block Explorer

Blockscout is training an AI model to simplify complex blockchain data.

Block Explorer AI: Artificial intelligence f transaction summaries

You’ve just completed a token swap on Uniswap 🦄. To verify that everything went through properly, you head to a block explorer and check the transaction. On the transaction page you start to sweat😓. It's a long list of details and strings of numbers, showing things like the transaction hash, the status (🤞successful) the block number, a timestamp, the numerical address a transaction was sent from, the gas fee, the burnt fees, executions that happened in the transaction, and a bunch of other confusing details.

To a typical user, many of these details are overkill. They are important to have if and when needed, but if you are just checking to see if a transaction was successful, you need to see 1) the status and 2) a simple summary of what happened. This is standard for most consumer receipts which clearly show the amount that was spent and the name of the item that was purchased (not the numerical code of the item, the inventory, or other unnecessary details).

Of course blockchain transactions are often more complicated than simple purchases, and can involve complex data, contract addresses, multiple transfers, and different fees. Translating this data into simple human-readable summaries is no small feat.

Fortunately, explorers have been making a lot of progress in this area…and there is still room for improvement.

An Example Transaction in Action

Etherscan offers a Transaction Action section which shows “Highlighted events of a transaction”. This offers a general idea of what happened, including the names of protocols and tokens. However, it can still be confusing. Let’s take this example:

https://etherscan.io/tx/0x45b2e45fe1aa782e7e6dab226b7afcae4f8922f951bf2015dcdd502e476f0ce6

In the transaction itself, we went to Uniswap and transferred ~ 1.98 Billion PNDC for 2 ETH. The experience was a single transaction, so why are there 2 actions here showing differing amounts? 

The reason is that behind the scenes Uniswap used both V2 and V3 to complete the transaction. But from a summary standpoint, we don’t need to know the way Uniswap parsed this transaction, we just need to know the end result.

This can be even more confusing when using an aggregator which hits multiple exchanges. If we want these additional details, we can look into the details on the transaction page. Including them in the summary is confusing and unnecessary, especially for newer users.

Details on the transaction page show all the transfers that occurred.

Thanks to AI, Blockscout is doing a better job at combining actions to provide more useful information. In this same transaction viewed on Blockscout, we see a simple summary of what happened along with truncated numbers for easy readability.

 https://eth.blockscout.com/tx/0x45b2e45fe1aa782e7e6dab226b7afcae4f8922f951bf2015dcdd502e476f0ce6

Rather than simply taking the transaction and extrapolating out the details, Blockscout’s AI model combines data points for an easier-to-understand summary. There is still room for improvement (for example 1,984M would be better expressed as 1.984B); fortunately these types of changes will come as the AI model learns and grows.

Implementing AI with Blockscout

Blockchain data provides a fertile ground for AI training. New data is constantly flowing in, and it often mirrors historical data while incorporating minute variations. Data patterns can be digested and interpreted as the dataset and the blockchain itself evolves with new methods and features.

At Blockscout we’ve been exploring AI integration for some time. We initially looked at using a ChatGPT model for search and smart contract readability functions. Etherscan incorporated an OpenAI based tool which can be useful for interpreting functions within smart contract code. However, we found this model was not scalable for our use case and concluded a direct integration wasn’t necessary for the explorer itself (it’s easy to copy and paste this code directly into chatGPT for the same result).

We also explored multi-layered search which would use an AI model to combine different data points for various complex searches. For example, this model could be used to search “What was the most expensive NFT sold in 2022”.  While this is interesting, we didn’t see immediate value for the cost of developing this type of tool, and moved it to a later development phase.

The immediate value we did find was in simplifying transaction summaries and improving human-readable transactions. This is something that is needed for users now, and is a perfect first use case for implementing an AI model into Blockscout. 

Training an AI Model

To get started, we partnered with an agency specializing in AI training to develop the basic model. We chose the open-source Llama 2 model and started with simple templates for single transactions and interpretations. In the initial training we included 12 basic types of common transactions along with varying examples of each.

typeMap: {
    Mint: 100,
    Sale: 97,
    Unwrap: 100,
    Burn: 100,
    Transfer: 200,
    Wrap: 100,
    Swap: 100,
    Approved: 200,
    Collect: 100,
    Register: 100,
    Deposit: 100,
    Withdraw: 99
  }

We then setup and ran the interpreter, made some manual corrections to any incorrectly interpreted results, and continued to iterate through the transactions, as the model fine-tuned the results over multiple runs.

The model quickly became efficient at identifying and categorizing transaction types, and an API support application was setup to provide fast results. The API is designed to be user-friendly on the frontend, providing template-based responses for easy language generation.

Actions that fit the trained criteria are now interpreted by the AI and provided as a transaction summary for transactions. If a transaction falls outside of this criteria, it is currently classified as unknown (rather than incorrectly interpreted). Next, we will continue training the AI model to classify these unknown transactions into human-readable summaries.

Future Blockscout AI Directions

Providing simple transaction summaries is only the beginning of the Blockscout AI integration! With the initial AI training in progress, we plan to incorporate more nuanced actions and features including: 

  • Bridging transactions which involve external metadata (the explorer needs to know the contract is a bridge contract). AI can start to catalog this data and bring it in to understand funds are being sent to a bridge rather than a standard contract. AI-classified metadata can also be provided for other contexts within the explorer and beyond.
  • Staking and other complex transactions. Additional templates including project-specific templates will be developed to decipher and summarize complicated transaction types.
  • Account abstraction. Blockscout will support account abstraction (fee-less transactions) and the AI engine will be used to interpret AA transactions.
  • Recent transaction summaries for individual wallets. Right now it takes too long to interpret a list of transactions into human-readable summaries. As the process becomes more streamlined, we’ll provide a list of the latest 20 transactions for each wallet address in an easy-to-read summary format.

Collective Intelligence

By providing accurate and understandable details, block explorers serve as a vital source of information to users. Blockscout is using artificial intelligence to make this effort more efficient by quickly classifying data and providing context and readability for complicated transactions. 

Once the model is out of beta, we plan to release templates for public access so users and projects can contribute. At Blockscout we believe that open access is the best way to provide transparency and quickly grow the space using our collective intelligence, both artificial and human! 

Blockscout news updates go out to all MyAccount community users on supported chains. We would love to get your feedback on topics you'd like to see covered or any questions you have. Visit us on X or Discord to get your explorer questions answered or get your project added to our growing network list ⬇️