Close Menu
Chain Tech Daily

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    As Hyperliquid cools, is XYZVerse the next $1 memecoin?

    July 13, 2025

    Crypto tax software and accounting services

    July 13, 2025

    Stablecoin regulation is evolving and builders to step in

    July 13, 2025
    Facebook X (Twitter) Instagram
    Chain Tech Daily
    • Altcoins
      • Litecoin
      • Coinbase
      • Crypto
      • Blockchain
    • Bitcoin
    • Ethereum
    • Lithosphere News Releases
    Facebook X (Twitter) Instagram YouTube
    Chain Tech Daily
    Home » The Graph vs Alethio vs web3JS
    Crypto

    The Graph vs Alethio vs web3JS

    James WilsonBy James WilsonJuly 13, 20254 Mins Read
    Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    A practical exercise using the Aave protocol

    Introduction

    There is always talk about the clarity of blockchain, that everything is traceable and everyone can see what was written but is it easy to access this information? How can I get data to do my analysis in a simple way?

    In this post we are going to see three ways to do it, using the DeFi Aavesome protocol as an example, in which we are going to obtain the history of deposits made on the platform, using three different methods:

    • The Graph: A protocol for building decentralized applications using GraphQL.
    • alethio: An API rest to obtain data from the blockchain in a friendly way.
    • Web3 Foundation Team: Reading the events directly on the blockchain using the web3js library

    Aave Data

    In order to access certain data on the blockchain, the easiest way is to query the events. When a function in a smart contract is called, if a certain action is executed, an event can be emitted, which can listen at that time by clients who are listening for that particular event, or in the future, accessing their history, which is recorded on the blockchain.

    In this case we want to see the history of deposits made in the Aave protocol, so we look inside its code if there is an event related to this.

    In its documentation, we see that if there is an event for this and it contains the following data:

    Aave docAave doc

    But if we don’t want to trust the documentation and see it in the code, let’s see the contract deployed on mainnet and look in code in the part:

    EtherscanEtherscan

    Which contains this event, if we want to see in detail the moment in which it is generated we see that it is done once the deposit function is finished, therefore it is what we are looking for:

    The Graph vs Alethio vs web3JSThe Graph vs Alethio vs web3JS

    Getting the data

    Once we are clear about what we are looking for, we will obtain these data in three different ways.

    The Graph

    Aave’s team has created a subgraph that can be tested in this playground.

    As an example, we want to extract the deposit id, and the amount that was deposited in it, to then do our analysis, for this we use the query

    {
      deposits(first:1000, skip:0){
       id,
       amount
      }
    }

    that returns the data of the same

    transactiontransaction

    We would have to repeat this query n times, advancing the skip parameter from 1000 to 1000 to bring up the next block of data.

    Alethio

    Now we are going to obtain it using the Alethio api, for this we will use the endpoint:

    https://api.aleth.io/v1/log-entries?filter[loggedBy]=0x398eC7346DcD622eDc5ae82352F02bE94C62d119&filter[hasLogTopics.0]=0xc12c57b1c73a2c3a2ea4613e9476abb3d8d146857aab7329e24243fb59710c82

    Where we query the logs of the Aave’s smart contract address, and filter the logs, with the hash of the Deposit function

    The object returned by this endpoint indicates the event, with its parameters and the link to the “next” pages to bring in a new data block.

    Alethio apiAlethio api

    We iterate all of these “next” links by increasing the number of existing “Deposit” events.

    web3.js

    As a third option we will read the events directly from the blockchain, to do that, we will use the web3js library and we will get all the events of type “deposit” in the Aave contract, with a script like the following:

    const contract = new web3.eth.Contract(LendingPoolABI, LendingPoolAddress)
    return contract.getPastEvents('Deposit', {
       fromBlock: initBlock,
       toBlock: endBLock
    }, function (error, events) { return events })

    Comparing results

    Once we have created the three methods, we are going to execute them at the same time, to see that we have the same number of deposits and the information is correct, from three different sources, for this we execute the three methods and write the total number of events:

    console.log('Number of events with Alethio:', (await getDepositsAlethio()).length)
    console.log('Number of events with web3js:', (await getEventsWeb3js()).length)
    console.log('Number of events with The graph:', (await getDepositsGQL()).length)

    The output shows us:

    Number of events with Alethio: 31810
    Number of events with web3js: 31809
    Number of events with The graph: 31682

    Oops…. We have a discrepancy, in the case of Alethio and web3js, it is only one event, which occurred between executions, but the difference with The graph is bigger.

    Doing several tests I have verified that there is a certain delay from the generation of an event, until it is indexed in The graph, so if this event is consulted, nothing else is not found in The graph, but a few minutes later if it is, hence the discrepancy in the number of events recorded.

    In these three ways, you can consult the data, creating your own datasets with which build models, and verify that the information shown by these protocols is true. Do you think your bank would allow you to access the deposit history?



    Source link

    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    James Wilson

    Related Posts

    Crypto July 13, 2025

    As Hyperliquid cools, is XYZVerse the next $1 memecoin?

    Crypto July 13, 2025

    Crypto tax software and accounting services

    Crypto July 13, 2025

    Stablecoin regulation is evolving and builders to step in

    Crypto July 13, 2025

    A word about Decentralization – CoinCodeCap

    Crypto July 13, 2025

    Shiba Inu is Back? Forgotten Memecoin on a Comeback

    Crypto July 13, 2025

    10 Best Knowledge Management Systems – CoinCodeCap

    Leave A Reply Cancel Reply

    Don't Miss
    Crypto July 13, 2025

    As Hyperliquid cools, is XYZVerse the next $1 memecoin?

    Disclosure: This article does not represent investment advice. The content and materials featured on this…

    Crypto tax software and accounting services

    July 13, 2025

    Stablecoin regulation is evolving and builders to step in

    July 13, 2025

    A word about Decentralization – CoinCodeCap

    July 13, 2025
    Stay In Touch
    • Facebook
    • Twitter
    • YouTube
    • LinkedIn
    Our Picks

    As Hyperliquid cools, is XYZVerse the next $1 memecoin?

    July 13, 2025

    Crypto tax software and accounting services

    July 13, 2025

    Stablecoin regulation is evolving and builders to step in

    July 13, 2025

    A word about Decentralization – CoinCodeCap

    July 13, 2025

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    Don't Miss
    Crypto July 13, 2025

    As Hyperliquid cools, is XYZVerse the next $1 memecoin?

    Disclosure: This article does not represent investment advice. The content and materials featured on this…

    Crypto tax software and accounting services

    July 13, 2025

    Stablecoin regulation is evolving and builders to step in

    July 13, 2025

    A word about Decentralization – CoinCodeCap

    July 13, 2025

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    About Us
    About Us

    ChainTechDaily.xyz delivers the latest updates and trends in the world of cryptocurrency. Stay informed with daily news, insights, and analysis tailored for crypto enthusiasts.

    Our Picks

    For Many Women, The Pain Of The Pandemic Led To Stronger Friendships

    January 15, 2020

    How A ‘Healthy’ Lifestyle Can Be Making You Tired

    January 15, 2020

    Fashion Influencers To Follow On Instagram In 2021

    January 15, 2020
    Lithosphere News Releases

    Imagen Network Deploys XRP-Based Modules to Expand Liquidity Support for Web3 Social Frameworks

    July 11, 2025

    Imagen Network (IMAGE) Launches RLUSD-Based Components for Stable AI-Powered Social Transactions

    July 10, 2025

    Imagen Network (IMAGE) to Integrate Advanced Llama 4-Based AI for Multimodal Personalization

    July 9, 2025

    Imagen Network (IMAGE) Taps Grok AI to Power Scalable Personalization in Decentralized Social Systems

    July 8, 2025
    X (Twitter) Instagram YouTube LinkedIn
    © 2025 Copyright

    Type above and press Enter to search. Press Esc to cancel.