subquery / developer-guild

A repository of all SubQuery Grants
15 stars 4 forks source link

[$7,000] Alternative subql dictionary generation #9

Closed ianhe8x closed 2 years ago

ianhe8x commented 2 years ago

Prize Title

Alternative substrate-like chain dictionary generation

Prize Bounty

Total Grant Award: $7,000 USDC

Challenge Description

This is a typical dictionary project: https://explorer.subquery.network/subquery/subquery/polkadot-dictionary, which is generated from a subquery project: https://github.com/subquery/subql-dictionary.

The performance of generating a dictionary is becoming a challenge and a potential solution is to use another way (other than a normal subquery project) to generate a dictionary that shares the same DB schema and same result.

Submission Requirements

  1. Fork and extend substrate-archive to generate basic subql dictionary (events, extrinsics, spec_version) for polkadot
  2. The generated dictionary should use same db schema as original dictionary project so we can use @subql/query to provide GraphQL as before, populate same data and only index finalised blocks as a normal subql project does.
  3. The speed of this dictionary generation should be faster than 50 bps.

Bonus

Depends on the achievements of following tasks, we will add bonus to the challenge.

  1. Make the solution be configured to work with moonbeam, moonriver and moonbase-alpha
  2. Generate evm subql dictionary (evm_logs, evm_transactions) for moonbeam
  3. Make substrate-archive able to accept json like type definition so archiving a new chain doesn't require source code changes and re-compiling.

Judging Criteria

Winner Announcement Date

Within 1 wk from the closing date of the hackathon

Resources

DB Schema

create table events
(
    id           text    not null        primary key, -- {blockHeight-eventIdx}
    module       text    not null,  -- with index
    event        text    not null,  -- with index
    block_height numeric not null  -- with index
);
create table extrinsics
(
    id           text    not null        primary key, -- {blockHeight-extrinsicIdx}
    tx_hash      text    not null,  -- with index
    module       text    not null,  -- with index
    call         text    not null,  -- with index
    block_height numeric not null,  -- with index
    success      boolean not null,
    is_signed    boolean not null
);
create table spec_versions
(
    id           text    not null        primary key, -- {specVersion}
    block_height numeric not null
);
create table evm_logs
(
    id           text    not null        primary key, -- {blockHeight-logIdx}
    address      text    not null,  -- with index
    block_height numeric not null,  -- with index
    topics0      text    not null,  -- with index
    topics1      text,
    topics2      text,
    topics3      text
);
create table evm_transactions
(
    id           text    not null        primary key, -- {blockHeight-txIdx}
    tx_hash      text    not null,  -- with index
    "from"       text    not null,  -- with index
    "to"         text    not null,  -- with index
    func         text,  -- with index
    block_height numeric not null,  -- with index
    success      boolean not null
);

For support,

Please join our Discord channel #technical-support and #hackathon Read our documentation at: https://doc.subquery.network/ Learn the basics of SubQuery with our Hero’s course (https://doc.subquery.network/academy/herocourse/)

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 7000.0 USDC (7000.0 USD @ $1.0/USDC) attached to it.

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 1 week, 6 days ago. Please review their action plans below:

1) singulart has started work.

Extend substrate-archive to provide alternative dictionary generator with better performance. 2) seeergo has started work.

I will come up with a scalable, performant solution to build chain archives 3) binsta has started work.

Alternative subql-node, subql-query for moonbeam & moonriver 4) unicornideas has started work.

This project will query rocksdb for blocks info and store it in the postgres database.

Learn more on the Gitcoin Issue Details page.

gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 7000.0 USDC (7000.0 USD @ $1.0/USDC) has been submitted by:

  1. @seeergo
  2. @singulart
  3. @unicornideas

@seandotau please take a look at the submitted work:


gitcoinbot commented 2 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 7000.0 USDC (7000.00 USD @ $1.0/USDC) attached to this issue has been approved & issued to @singulart.