Giter Site home page Giter Site logo

mmahut / cardano-db-sync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intersectmbo/cardano-db-sync

0.0 2.0 0.0 6.32 MB

A component that follows the Cardano chain and stores blocks and transactions in PostgreSQL

License: Apache License 2.0

Shell 1.94% Haskell 82.68% PLpgSQL 6.49% Nix 8.88%

cardano-db-sync's Introduction

Cardano DB Sync

The cardano-db-sync component consists of a set of components:

  • cardano-db which defines common data types and functions used by any application that needs to interact with the data base from Haskell. In particular, it defines the database schema.
  • cardano-db-sync which acts as a Cardano node, following the chain and inserting data from the chain into a PostgreSQL database.
  • cardano-db-sync-extended is a relatively simple extension to cardano-db-sync which maintains an extra table containing epoch data.

The two versions cardano-db-sync and cardano-db-sync-extended are fully compatible and use identical database schema. The only difference is that the extended version maintains an Epoch table. The non-extended version will still create this table but will not maintain it.

Architecture

The db-sync node is written in a highly modular fashion to allow it to be as flexible as possible.

The cardano-db-sync node connects to a locally running cardano-node (ie one connected to other nodes in the Cardano network over the internet with TCP/IP) using a Unix domain socket, retrieves blocks and stores parts of each block in a local PostgreSQL database. The database does not store things like cryptographic signatures but does store enough information to follow the chain of blocks and look at the transactions within blocks.

The PostgreSQL database is designed to be accessed in a read-only fashion from other applications. The database schema is highly normalised which helps prevent data inconsistencies (specifically with the use of foreign keys from one table to another). More user friendly database queries can be implemented using Postgres Views to implement joins between tables.

Troubleshooting

If you have any issues with this project, consult the [troubleshooting][troubleshooting] page for possible solutions.

Further Reading

  • BuildingRunning: Building and running the db-sync node.
  • Docker: Instruction for docker-compose, and building the images using nix.
  • Example SQL queries: Some example SQL and Haskell/Esqueleto queries.
  • SchemaManagement: How the database schema is managed and modified.
  • SQL DB Schema: The current PostgreSQL DB schema, as generated by the code.
  • Validation: Explanation of validation done by the db-sync node and assumptions made.

cardano-db-sync's People

Contributors

arjunyel avatar arturwieczorek avatar cleverca22 avatar codiepp avatar coot avatar craigem avatar dcoutts avatar disassembler avatar erikd avatar hamishmack avatar iohk-bors[bot] avatar jbgi avatar karknu avatar krishanik avatar ksaric avatar marcfontaine avatar mrbliss avatar newhoggy avatar oneedoubled avatar redoracle avatar rhyslbw avatar sebastiengllmt avatar sevanspowell avatar tatyanavych avatar

Watchers

 avatar  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.