/mercury

An ethereum-authenticated API to store and retrieve event logs stored in IPFS (via Orbit DB).

Primary LanguageJavaScript

Mercury

Powered by

Mercury is an API that provides authenticated access to event logs stored in IPFS via Orbit-DB. [TODO]

TODOS

  • add request validation (yup)
  • security considerations
  • test coverage

Setup

  • First, install ipfs. When running the app, run the daemon with pubsub enabled

        ipfs daemon --enable-pubsub-experiment
  • navigate to the root directory and execute

        npm install

    and then

        npm start
  • by default, the API will run on port 3000.

REST API

Login

Add Event

  • URL: host:port/{address}/events
  • Description: Allow the user to publish an event to their event log.
  • Method: PATCH
  • headers:
    • Content-Type: application/json
    • Authorization: Bearer <token> : The JWT retrieved after logging in
  • payload: any string value
  • params:
    • address: The ethereum address to identify a unique docstore
    • docstoreName is the name of the docstore in which the data will be persisted. For more information, view the orbit db documentation.
    • id is the unique id of a resource in the specified docstore.

Retrieve Events

  • URL: host:port/{address}/events/{limit}
  • Description: Allow the user to read events from their event log.
  • Method: GET
  • headers:
    • Authorization: Bearer [token] : The JWT retrieved after logging in
  • params:
    • address: The ethereum address to identify a unique docstore
    • limit is the number of events to retrieve from the log