Giter Site home page Giter Site logo

cosmscan-rs's Introduction

⚠️ Caution ⚠️

Cosmscan is not ready to go in production.

This is very rapidly changed and under developement.

Cosmscan

Opensource indexer engine & explorer web for cosmos blockchain.

Motivation

In ethereum, Blockscout is best opensource blockchain explorer, as you can see here It seems super-duper enterprise level blockchain explorer, and the cool thing is that it's open source!

But, In cosmos ecosystem there is no fansy opensource explorer. So then many teams rely on validators who built un-opened blockchain explorer such as mintscan.

Therefore, I wished to build opensource blockchain explorer and anyone can install their own server. It would be very helpful for teams to only focus on developing appchain.

Setting up the Database.

Install diesel

# if you're on linux OS, must install prerequisite of postgresql dev tools,
$ sudo apt install libpq-dev

# install diesel
$ cargo install diesel_cli --no-default-features --features postgres

Create set of tables.

$ cd models && diesel migration run && cd ..

If you want to create tables to remote database, not local, Change the DSN in models/.env file before running the above command

Revoke migration

$ diesel migration redo

Run on localhost for test

# this command runs simple gaiad app & postgres database
# when you run services via this scripts, sample tx will be automatically sent every seconds.
$ docker-compose -f docker-compose.flood.yml up

# migrate schema
$ cd models && diesel migration run && cd ..

# this start to run explorer runtime application
$ RUST_LOG=info cargo run --bin indexer -- --filename config.toml

Contribution Guidelines

Feel free to open an issue or pull request.

Database

cosmscan-rs's People

Contributors

scalalang2 avatar

Stargazers

Aleksandr Volkov avatar dzmitry-lahoda avatar Sigrid Jin (ง'̀-'́)ง oO avatar Ellie Lee avatar  avatar

Watchers

 avatar Ellie Lee avatar

cosmscan-rs's Issues

e2e test environment

Provide a simpler way to test the services (engine and api-server) like below.

$ cd e2e
$ docker-compose up

Then it starts all the component we need to test.

First Milestone API Server Implementation

Endpoints to be implemented.

  • GET /api/chains

  • GET /api/block/by_height/{height}
  • GET /api/block/latest_height
  • GET /api/block/list?skip=0&limit=50

  • GET /api/transaction/{hash}
    • the response includes messages and events
  • GET /api/transaction/list/by_height/{height}

Use `sqlx` instead of `diesel-rs`

After few days using diesel in our data store.

I feels that I cannot fully control what will happens to our database.

I decided to migrate from diesel-rs to sqlx

Configure CORS policy to be accessed from the different host

Background

API server is inherently designed as standalone server
It wouldn't contains any frontend sources

So, if frontend website is needed to access to our server
We must allow different host to access to the api server

Details

  • Add allowed_host to the config.toml
    • "*" means any website, if specific host is needed, then wite hostname like http://localhost:3000/
  • Write response with header Access-Control-Allow-Origin for each api handlers.

Serve REST API

  • /block/{hash}
  • /blocks?start=2&limit=50&sort=desc
  • /blocks?top=50
  • /txes_in_block/{hash}
  • /tx/{hash}

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.