What is cardano-rest ?
The cardano-rest Web API is an extensible framework that is used to retrieve transactions, addresses, and time periods (epochs and slots) from the cardano-db component of cardano-db-sync. It provides a series of method calls including a Web API interface used for building HTTP web-based services that can be accessed via HTTP URL. For a full list of available endpoints please consult the documentation here.
The cardano-db-sync is a node that synchronizes chain data with the PostgreSQL engine. The PostgreSQL engine consists of:
- cardano-db - a PostgreSQL database used by cardano-rest to retrieve chain data upon HTTP request and
- cardano-db-sync that connects directly to the cardano-node following the chain while inserting data directly into the PostgreSQL database.
For more information please see Readme.md.
Prerequisites for running cardano-rest
The cardano-rest has been built for and tested on Linux and will support Docker as a target environment. It may also run on Mac OS X or Windows operating systems, but they are not officially supported.
cardano-rest web API reference
cardano-rest includes a Web API as an extensible framework for building HTTP based services that can be accessed in different applications on different platforms such as web, windows, mobile, etc. This service is used for searching for information about transactions, addresses, and time periods (epochs and slots) in the Cardano network.
Currently, the cardano-rest web API provides a series of methods to obtain information from the Cardano network. The servant Haskell library that provides a modular approach to API-building is used. This library uses combinators both to build atomic HTTP actions and to glue these atomic methods together to form larger and more complete APIs. Documentation for explorer web API is available here.
Using the cardano-rest web API
Option 1: To build the cardano-rest API using Docker (Recommended):
Alternatively, all components are built automatically using docker-compose. To build all components using docker-compose see the following GitHub pages for instructions here
Once you have completed these steps, you will be able to use the cardano-rest API to view data from the PostgreSQL database, and the submit transaction API to submit transactions.
Option 2: To build the cardano-rest web API using Nix:
Follow the instructions in iohk-nix/docs/nix.md to install Nix and set up the IOHK binary cache.
- Set up and run a local Cardano node
- Set up a new PostgreSQL for Cardano DB Sync
- Set up and run a local Cardano DB Sync node
- Set up and run cardano-rest API
- Set up and run cardano-submit-api