fairDataSociety / blossom

Browser Extension based on Fair Data Protocol
Apache License 2.0
5 stars 4 forks source link

Short tech docs from readme #168

Open tfius opened 1 year ago

tfius commented 1 year ago

Blossom Technical Documentation

Introduction

Blossom is a browser extension that acts as a web3 framework for dApps and serves as a Fair Data Society account manager for end-users. It is available on the Chrome web store.

Configuration

Before running the extension, it needs to be configured for proper build and execution. Configuration is stored in the .env file at the root directory. If it doesn't exist, create one using the .default.env template. The main configuration properties are:

Note: Ensure the bee URL in the Swarm extension is set to the correct endpoint.

Installation

  1. Build the extension by running:

    npm run build

    This will generate compiled files in the dist directory.

  2. To load the extension in the Chrome browser:

    • Open a new tab and navigate to chrome://extensions.
    • Enable "Developer mode" in the top right corner.
    • Click on the Load unpacked button and select the dist folder.
    • The extension should now appear in the list of installed extensions.

Note: Currently, only the Chrome browser is supported.

Setting up the Environment

Swarm Extension

The Blossom extension can be configured to retrieve Bee URL and Bee debug URL directly from the Swarm extension. This is required for running tests. Before running tests, ensure the required environment is set up.

  1. Install the Swarm extension in the same browser as the Blossom extension.
  2. Alternatively, build a local version of the Swarm extension by following instructions in its repository or run the script:
    ./scripts/compile-swarm-extension.sh

FDP Play

The Blossom extension requires a blockchain RPC provider and a Swarm gateway. For development, use fdp-play.

  1. Install the environment:

    npm install -g @fairdatasociety/fdp-play
  2. Start the environment:

    fdp-play start

Bee Postage Batch

Ensure there's at least one postage stamp created. To create one in the Bee node, run:

curl -s -XPOST http://localhost:1635/stamps/10000000/18

Development

To start the project in development mode:

npm start

This will watch for changes in source files and compile them on every change.

Tests

Tests include both unit and integration tests. To run tests, ensure all dependencies are started and then execute:

npm test

Note: Tests rely on a fresh state of running services. If tests are run multiple times, restart all docker containers.

Documentation

To run documentation web pages locally, navigate to the docs directory and install dependencies:

gem install jekyll bundler
bundle install

Then start the server:

bundle exec jekyll serve

This documentation provides a comprehensive guide on how to set up, install, and run the Blossom extension. For more advanced interactions and details, developers can refer to the javascript library documentation in the library folder as mentioned in the original README.

tfius commented 1 year ago

Swarm extension is no longer required ! Should be changed in readme and here !

tomicvladan commented 1 year ago

It's already updated in the readme: https://github.com/fairDataSociety/blossom/blob/0920d35daa1d7ebc22ae701fa0c3470480eee574/README.md?plain=1#L45-L60