Git Product home page Git Product logo

graph-research's Introduction

npm install

-> install dependencies

npm run start

-> start local jaccard-scoring server

You can then lookup any address's score at http://localhost:3030/ADDRESS. The top 250 matches will be returned.

Make sure to set up the data first, as outlined below:

Setting up the data

Grab the source repo

https://github.com/dOrgTech/cent-social-index

From db folder containing the sqlite database

sqlite3 -header -csv cent.dev.sqlite "select * from events;" > out.csv

Then using mysql (these steps may take some time):

mysql -u root

CREATE DATABASE graph;

USE graph;

CREATE TABLE events (
    id              INT PRIMARY KEY,
    block_number    INT,
    nft_name        VARCHAR(100),
    txn_hash        VARCHAR(66),
    txn_type        VARCHAR(10),
    gas             BIGINT UNSIGNED,
    value           VARCHAR(78),
    from_hash       VARCHAR(42),
    to_hash         VARCHAR(42),
    token_id        VARCHAR(78),
    timestamp       DATETIME,
    createdAt       DATETIME,
    updatedAt       DATETIME
);

LOAD DATA LOCAL INFILE 'out.csv' INTO TABLE events FIELDS TERMINATED BY ',' ENCLOSED BY '"' IGNORE 1 ROWS;

CREATE INDEX sender ON events (from_hash);
CREATE INDEX recipient ON events (to_hash);
CREATE INDEX contract ON events (nft_name);
CREATE INDEX members ON events (nft_name, to_hash);

CREATE TABLE collection_owner (
    id              INT AUTO_INCREMENT PRIMARY KEY,
    nft_name        VARCHAR(100),
    owner           VARCHAR(42)
);

INSERT INTO collection_owner (nft_name, owner)
SELECT DISTINCT nft_name, to_hash 
FROM events;

CREATE INDEX c_o_name ON collection_owner (nft_name);
CREATE INDEX c_o_owner ON collection_owner (owner);

graph-research's People

Contributors

chejazi avatar

Watchers

 avatar

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.