Cardano SL Explorer

As mentioned earlier, Explorer is a service for searching information about transactions, addresses and time periods (epochs and slots) in the Cardano network.

Explorer Backend Workflow

Explorer starts with CLI-options. All supported options can be viewed by cardano-explorer --help command.

Then explorer runs “internal” node via cardano-sl library. So we can think of explorer’s backend as of a common node with two special plugins: explorerPlugin and notifierPlugin.

The first plugin is for serving explorer web API. The second one starts notification server. This websocket-based server notifies frontend about changes with blocks/transactions.

Explorer Backend API

Currently, the explorer 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.

HTTP API

Explorer web API is defined here. If the event requests fail, there is a ExplorerError type, which is simply a wrapper over Text to show what happened.

Documentation for explorer web API is available here.

socket.io API

We currently have these events a client can register to:

data ClientEvent
    = Subscribe Subscription
    | Unsubscribe Subscription
    | CallMe

A subscription can be to the following events:

data Subscription
    = SubAddr
    | SubBlockLastPage
    | SubTx

And the corresponding server events are here:

data ServerEvent
    = AddrUpdated
    | BlocksLastPageUpdated
    | TxsUpdated
    | CallYou

A user can call the desired events and subscribe to them:

var client = require('socket.io-client');
var socket = client('http://localhost:8110');

socket.on('CallYou', function(msg){ console.log(msg); })
socket.emit('CallMe', 'test');

You can also try running purescript repl (pulp psci) and then playing around with the events:

import Prelude
import Control.SocketIO.Client
import Control.Monad.Eff.Console

let socket = connect "http://localhost:8110"

socket >>= \soc -> emit soc "CallYou" "test"