GithubHelp home page GithubHelp logo

evm-indexer's Introduction

Multichain transfers squid

This squid captures USDC Transfer events on ETH and BSC, stores them in the same database and serves the data over a common GraphQL API.

The Ethereum processor is located in src/eth and similarly the Binance Chain processor can be found in src/bsc. The scripts file commands.json was updated with the commands process:eth and process:bsc to run the processors.

You can find some useful hints on developing multichain squids on the dedicated documentation page.

Dependencies: Node.js, Docker, Git.

Quickstart

# 0. Install @subsquid/cli a.k.a. the sqd command globally
npm i -g @subsquid/cli

# 1. Clone the repo
git clone https://github.com/subsquid-labs/multichain-transfers-example
cd multichain-transfers-example

# 2. Install dependencies
npm ci

# 3. Start a Postgres database container and detach
sqd up

# 4. Apply the migration
sqd migration:apply

# 5. Build the squid
sqd build

# 6. Run all services at once
sqd run .

A GraphiQL playground will be available at localhost:4350/graphql.

You can also run individual services separately:

sqd process:eth # Ethereum processor
sqd process:bsc # BSC processor
sqd serve       # GraphQL server

Database migration

After making a change to the graphql schema a migration needs to be generated.

npm run build
# apply existing migrations so that only new migrations are generated
npx squid-typeorm-migration apply
npx squid-typeorm-migration generate
npx squid-typeorm-migration apply

Troubleshooting

TypeError: Cannot read properties of undefined (reading 'toLowerCase')

    at /squid/node_modules/@subsquid/evm-processor/lib/processor.js:437:39
    at Array.map (<anonymous>)
    at mapRequest (/squid/node_modules/@subsquid/evm-processor/lib/processor.js:437:28)
    at EvmBatchProcessor.addLog (/squid/node_modules/@subsquid/evm-processor/lib/processor.js:195:20)
    at Object.<anonymous> (/squid/lib/chains/optimism.js:24:6)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)

That is likely caused by missing some env vars like DISPATCHER_ADDRESS_BASE or UNIVERSAL_CHANNEL_ADDRESS_OPTIMISM. Check that you have all the required env vars set in your runtime.

Not ready to serve block N of dataset X

That error usually means that Subsquid's acrhival node is experiencing some issues. If you don't do a huge backfill, set the affected chain gateway like OPTIMISM_GATEWAY to an empty string and restart the indexer. Additionally, go to Subsquid's discord and open a support ticket like this one.

evm-indexer's People

Contributors

inkvi avatar mvpoyatt avatar dshiell avatar

Stargazers

Dogila avatar Javed Khan avatar cagatay artok avatar  avatar Ahmat Mustofa avatar molla202 avatar Shun Kakinoki avatar  avatar

Watchers

 avatar Nicolás Pernas Maradei avatar  avatar  avatar Jack Lafiandra avatar Ian Norden avatar

evm-indexer's Issues

Indexer not reporting relayer transactions

When querying the indexer for transactions on a virtual chain (not eth-sepolia==11155111) with no value transfer it is expected to see many recent relayer txns, however the most recent returned record is showing a block timestamp of 7/29 (1722269380). Health checks and loadtest have been going since then so relayer txns have been occurring.

RELAYER_ADDRESS_BASE --> 0xc760fbfa7e80564052a2e50976450884f5cc41af
RELAYER_ADDRESS_OPTIMISM --> 0xc760fbfa7e80564052a2e50976450884f5cc41af

query MyQuery {
  transactions(limit: 100, where: {value_eq: "0", chainId_not_eq: 11155111}, orderBy: blockTimestamp_DESC) {
    gasPrice
    gasUsed
    chainId
    blockTimestamp
  }
}
{
  "data": {
    "transactions": [
      {
        "gasPrice": "1593106",
        "gasUsed": "30207",
        "chainId": 11155420,
        "blockTimestamp": "1722269380000"
      },
      {
        "gasPrice": "5246581123",
        "gasUsed": "30207",
        "chainId": 11155420,
        "blockTimestamp": "1722178586000"
      },
      {
        "gasPrice": "1000499",
        "gasUsed": "685936",
        "chainId": 84532,
        "blockTimestamp": "1720092820000"
      },
      {
        "gasPrice": "1000525",
        "gasUsed": "687437",
        "chainId": 84532,
        "blockTimestamp": "1720092566000"
      },
      {
        "gasPrice": "33905177",
        "gasUsed": "685936",
        "chainId": 11155420,
        "blockTimestamp": "1720092558000"
      },
      {
...

Fix Juno outstanding issues

  • A frequent error log in prod: pq: unsupported Unicode escape sequence
  • Some blocks are missing - might be caused by the above bug
  • Try to backfill again to see if the removal of isCosmosSdk affected Juno

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.