All posts

7daystobecomeaNEARdatawizard

Unlock the secrets of NEAR blockchain data with this comprehensive guide that takes you from the basics of sharding and transactions to crafting advanced queries on Dune, empowering analysts of all levels to dive deep into blockchain insights.

GuideJanuary 20, 20255 min read
@Alsie L.
Alsie L.Content Marketing Manager at Dune

New to analyzing NEAR data and want to learn? Then you’re in the right place! Whether you’re a Dune veteran or just starting out this course will cover everything you need to know to get started analyzing the NEAR blockchain using Dune.

This guide is accompanied by a detailed video tutorial for those who prefer learning visually.

This course is for all levels:

  1. If you are new to NEAR, spend some extra time on the beginning sections understanding how NEAR transactions, receipts, and sharding work. This will help set your foundation as we learn which tables to pull information from
  2. If you are familiar with NEAR but new to Dune, focus on the ‘Getting Started with Dune’ section of the guide. Navigating the Dune UI and finding the right tables will make your learning journey smooth.
  3. If you are familiar with both NEAR and Dune, feel free to dive right into the educational queries. We’ll cover beginner, intermediate, and advanced queries.
  4. Follow Dune on socials
    Stay updated by following us on X (formerly Twitter), LinkedIn, and signing up for our newsletter. You’ll get new tutorials, product updates, and resources to level up your skills.
  5. Join the Dune Discord
    Connect with a community of fellow wizards, ask questions, share tips, and get inspired by other analysts working with NEAR data.
  6. Document your learning journey
    Share your experiences on socials! Tag @Dune and use #NEARwizard to amplify your posts and engage with the community.
  7. What inspired you to become a NEAR Data Wizard?
  8. Highlights from your learning journey: a simple SQL query, new datasets you discovered, or complex questions you’re tackling.
  9. Dashboards or charts you’ve built after following this guide.
  10. Insights you’ve uncovered about the NEAR blockchain ecosystem.
  11. Feedback about the tutorials, the Dune platform, or NEAR blockchain itself.
  12. Anything else you want to share—your creativity is the limit!

Note:Note:Note: This guide is structured into daily lessons to guide you through the process step by step. However, feel free to learn at your own pace and explore the areas that interest you most!

Getting Started

Day 1:

Overview of NEAR blockchain

NEAR is a layer one, sharded, proof-of-stake blockchain. That was a lot. So what does this all mean?

  1. Sharding for Efficiency: NEAR employs sharding to split the network into parallel processing units to increase transaction speed and performance.
  2. Proof-of-Stake Consensus: By using a proof-of-stake mechanism, NEAR minimizes energy consumption.
  3. Human readable accounts/addresses: ‍
    ‍NEAR uses human-readable account names like sector.near, instead of hexadecimal-encoded addresses such as 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 used on EVM (Ethereum Virtual Machine). You can think of this like using ENS names natively.
  4. Native Account Abstraction
    User accounts can also be contracts! You also don’t always need your own gas to transact.
  5. Raw data tables have human readable actions and logs on Dune!
  6. Navigate to Data Explorer on the left menu.
  7. Scroll down and click on "Raw Blockchain Data". This will display raw datasets for all chains supported by Dune.
  8. Scroll down the list or use the search bar to type "NEAR".
  9. Select NEAR from the list to access its datasets.
  10. A transaction is a high-level operation submitted by a user/account to interact with the blockchain.NoteNote

    Note: Unlike many blockchains with a transactions table on Dune, NEAR does not have a near.transactions table. Instead, transaction-related data is captured in the near.actions table. This table breaks down transactions into their individual actions, with each row representing a unique action. So what are actions? I’m glad you asked.
  11. An action is a discrete operation within a transaction that defines what the transaction aims to accomplish. A transaction can include multiple actions, such as transferring tokens or calling a smart contract. Here is the full list of available actions available:

    - CreateAccount
    - DeployContract
    - FunctionCall
    - Transfer
    - Stake
    - AddKey
    - DeleteKey
    - DeleteAccount
    - Delegate
  12. These actions are grouped together within a single transaction and processed sequentially or asynchronously, depending on their complexity.
  13. After a transaction is submitted and executed (via the ExecutionOutcome), it is converted into a series of one or more receipts. These receipts are used to process the actions specified in the transaction, enabling asynchronous execution. This structure is critical for cross-shard operations and can get quite complex. For now, all you need to know is that transactions are converted into receipts, which carry the necessary information to interact with smart contracts and execute the desired actions.
  14. Finally, after a receipt is executed, logs are emitted by the smart contracts. We’ll be using near.logs on Dune to extract useful information.
  15. All successful transaction actions get converted into one or more receipts. Note: Not all actions generate a unique receipt.
  16. An additional unique receipt is created when an action requires further asynchronous execution (e.g., cross-contract calls or sending funds to another account).
  17. Actions that are resolved immediately (e.g., token transfers or local contract calls) do not generate additional receipts.
  18. Initial Receipt: A receipt is first created when a transaction is submitted, representing the set of actions in the transaction.
  19. Execution Receipts: If a transaction involves cross-contract calls or complex interactions, additional execution receipts are created to handle the intermediate steps.
  20. Final Outcome: The receipt system ensures that all actions within the transaction are executed, even if they span multiple shards or contracts.
  21. Official NEAR Docs
  22. Additional Documentation
  23. Working with JSON, VARCHAR, ARRAY data types
    Dune documentation
    Trino DocumentationTrino-Oreilly-Guide.pdfTrino-Oreilly-Guide.pdf
    Trino-Oreilly-Guide.pdf
  24. Let's look at a transaction example:
    dune.com/queries/4575420
  25. How many successful transactions occurred on 2025-01-01?
    Answer: dune.com/queries/4575423
  26. How many times was each action_kind called on 2025-01-01?
    Answer: dune.com/queries/4575426
  27. Find all 'simple pools' deployed on ref-finance
    Answer: dune.com/queries/4575590
  28. What are the weekly number of pools deployed? Deployers?
    Answer: dune.com/queries/4575594
  29. What is the most common 'simple pool' pair(tokenA-tokenB) deployed?
    Answer: dune.com/queries/4575601
  30. Bonus Questions: Find power users: Top 10 Pool Deployers
  31. Find all swap on Ref.Finance after 2025-01-01
    Answer: dune.com/queries/4575620
    Note: I technically should have joined the near.actions table with the near.logs table to verify the parent transaction was successful, not just the receipt.
  32. What was the daily number of swaps for all USDC/wNEAR pairs?
    Answer: dune.com/queries/4575631
  33. What was the daily swap volume for all USDC/wNEAR pair?
    Answer: https://dune.com/queries/4575638
    Note: I made a silly mistake carrying incorrect decimals in the video tutorial. I’ve fixed this on the linked query.
  34. Bonus Questions:

    How many users (accounting for relayers) have swapped USDC AND wNEAR in 2025?

    Find the top ten users that have gained the most swap referral fees on Ref.Finance?

    Find the amount of liquidity added and removed from any pool. What is the current liquidity of the pool? Which pool has the most liquidity?

Day 7:

Final Challenge

Now that you’ve learned the fundamentals, it’s time to put your skills into action!

Find a protocol you’re passionate about, analyze its data, and share your findings with the community on twitter. Make sure to tag @0xSector and @Dune team as we’d love to see your results and provide feedback to help you refine your analysis!

Congratulations on mastering the basics of NEAR data on Dune! 📊

You’ve just taken a huge step toward understanding and analyzing NEAR’s blockchain data. From crafting queries to building dashboards, you’re now equipped to explore insights that power the NEAR ecosystem.

Remember, data is only as powerful as the questions you ask. Keep experimenting and refining your skills. If you have any questions or feedback my DM’s on Twitter are always open. Let’s keep learning together.

Related

VIEW ALL

Make real impact with onchain data

JOIN US

Looking to use Dune for your company?