massalabs / DeWeb

On-chain Decentralized Web Gateway
MIT License
2 stars 1 forks source link

DeWeb: On-chain Decentralized Web Gateway

DeWeb is your gateway to the decentralized web, enabling seamless access to websites stored on-chain from any device, anywhere in the world.

Description

DeWeb revolutionizes web accessibility by providing tools to upload, edit, and view websites directly on the blockchain. The project includes two binaries:

Getting Started

Prerequisites

Ensure you have task installed. Follow the instructions here.

Installation

  1. Install required tools:

    task install
  2. Build both binaries:

    task build

    Alternatively, you can build them separately:

    task build:cli
    task build:server
  3. The binaries will be stored in the ./build directory.

DeWeb CLI

DeWeb CLI is a command-line tool designed for deploying, editing, and deleting decentralized websites on the DeWeb platform.

Usage

Once installed, you can use the deweb-cli command to interact with DeWeb. Below is the basic usage syntax:

deweb-cli [global options] command [command options] [arguments...]

Global Options

Commands

upload

Uploads a new website to the DeWeb platform.

deweb-cli upload [global options] <website_zip_file_path>

Arguments

Example

deweb-cli upload -w myWallet -n https://mainnet.massa.net/api/v2 ./website.zip

The zip file should contain an index.html at its root. For example, if you build an app and the output is in a directory (usually build or dist), you can zip it using the following command from the output directory:

zip {name}.zip -r ./*

This should result in a zip file with all the files from the output directory, with the index.html at its root.

Note: Server Side Rendering (SSR) is not supported at this time. Ensure your website is fully client-side rendered.

edit

Edits an existing website on the DeWeb platform.

deweb-cli edit [global options] <website_sc_address> <website_zip_file_path>

Arguments

Example

deweb-cli edit -w myWallet -n http://node-url.com <website_sc_address> ./updated_website.zip

delete

Deletes an existing website from the DeWeb platform.

deweb-cli delete [global options] <website_sc_address>

Arguments

Example

deweb-cli delete -w myWallet -n http://node-url.com <website_sc_address>

Configuration

The CLI can be configured using a YAML file. By default, it looks for deweb_cli_config.yaml in the current directory. You can specify a different configuration file using the --config flag.

Sample Configuration (deweb_cli_config.yaml)

wallet_config:
  wallet_nickname: "alice"

node_url: "https://buildnet.massa.net/api/v2"

sc_config:
  minimal_fees: 0
  max_gas: 0
  max_coins: 0
  expiry: 0

Logging

The CLI logs its output to ./deweb-cli.log. Logging is initialized automatically when the application starts.