Scout Chart Creator
  • Overview
  • Get Started
    • Tutorial 1: NMR Daily Transaction Count
    • Tutorial 2: LPT Weekly Volume (USD)
    • Tutorial 3: NMR vs LPT Daily comparison
  • Pipeline
    • Filter
    • Project
    • Group
      • Accumulators
    • Sort
    • Unwind
    • Custom
  • Data Source
    • Transactions
    • States
    • Contracts
    • Aragon
    • Livepeer
    • dYdX
    • Set
    • Token holders
  • Operators
    • Math operators
    • Logic operators
    • Function operators
    • Array operators
    • String operators
  • Config
  • Protocols
    • Dodo
      • 24H trade volume
      • Deposit & Withdraw
    • Livepeer
    • dYdX
      • Making sense of the trade data
    • MakerDao
    • Pickle Finance
      • Example: Daily deposit and withdraw of jar 0.88
      • Example: Listing all borrows of a strategy
  • FAQ
    • Dealing with "logs" field in "Transaction"
    • How to handle "Query Timeout" error?
    • How to use a variable in a Pipeline
  • Research
    • The circulating supply of DODO tokens
    • How are bitcoins doing on Ethereum? (as of Jan 20th 2021)
Powered by GitBook
On this page

Was this helpful?

  1. FAQ

Dealing with "logs" field in "Transaction"

PreviousFAQNextHow to handle "Query Timeout" error?

Last updated 4 years ago

Was this helpful?

When working with the data source, "logs" field is the most frequently used field. Since each transaction contains multiple event logs and it could be challenging to transform an array type data field to your desired format. But after this article, you will be an expert.

For example, we want to extract certain values through the logs "LogTrade" from Dydx protocol. (When a trade is made through Dydx, a log called "LogTrade" will be left on the blockchain)

Step 1: We get all the transactions which contain the "LogTrade" event logs.

Finally, from this point on, you can use any field in the data easily.

Step 2: Since each transaction could contain multiple other logs, let's only keep "LogTrade" logs and remove the rest. You can use with a operator.

Step 3: Since some transactions might contain more than one "LogTrade" logs, we can make it even easier to work with by using to flatten the remaining array.

Unwind
Transaction
Project
filter
Fin all the transactions which have "LogTrade"
Use "filter" to only keep "LogTrade" logs
Use "Unwind" to flatten the array.