Skip to content

File Sharing

Apex File Server

The Apex File Server serves as the dApp server and the backend for the STRATO Management Dashboard. It uses web sockets to push real-time statistics and management data to the dashboard.

http://localhost/apex-api

Upload a dApp

Users can upload dApps to Apex with a dedicated endpoint.

dApp Directory Structure Format

  • dApps are packaged as a collection of smart contracts and front end code.
  • The front end interacts directly with the smart contracts using the STRATO REST APIs.
  • The app should use index.html as an entry point to the application, which in turn loads all other static resources (js and css). You can look at charity-raffle or this example.
  • Since the UI maybe shipped to different nodes, index.html should use only relative paths instead of absolute paths for local static resources.

Packaging

Your dApp should be packaged as a Zip file.

File structure of the Zip archive is strictly defined:

STRATO dApp should be packaged as a zip archive which contains the smart contracts and the UI, with the following format.

app directory
├─ contracts/
│   └─ ...all solidity contract files (*.sol)
│
├─ metadata.json
│
└─ index.html
You may name the Zip file whatever you like.

metadata.json

Your application should have a text file in the root folder called metadata.json. metadata.json defines the application (1) name, (2) version, (3)## and (4) maintainer of the dApp.

Example:

{
"name": "my dApp",
"version": "0.0.1",
"## ": "simple blockchain application",
"maintainer": "Alice, [email protected]"
}
curl -X POST http://localhost/apex-api/dapps
     -F "username=test"
     -F "address=c2fe4cd7afff347bedee9f7dd6e02403bca9710d"
     -F "password=1234"
     -F '[email protected]/path/to/archive.zip'

Which returns an object with information about our app:

{
  "metadata":{
    "name": "my dApp",
    "version": "0.0.1",
    "## ": "simple blockchain application",
    "maintainer": "Alice, [email protected]",
  },
  "url":"http://localhost/apps/e80b681c42f831ea3c4b8db531f5e165"
}