File Storage Web3 Server

SKALE Chain nodes run a special NGINX Webserver that provides read-only access to each file uploaded using SKALE Chain Filestorage.

To access the file, use the following URL conventions depending on the endpoint you are using:

If using the reverse proxy load balancer:

http(s)://REVERSE_PROXY_ENDPOINT/fs/SKALE_CHAIN_NAME/FILESTORAGE_FULL_PATH

If connecting directly to a single node: http(s)://NODE_DOMAIN_NAME/SKALE_CHAIN_NAME/FILESTORAGE_FULL_PATH

The uploader address in the URLs MUST omit the 0x prefix AND be in lowercase. For example: 0x77333Da3492C4BBB9CCF3EA5BB63D6202F86CDA8 must be entered as 77333da3492c4BBB9ccf3Ea5bb63d6202f86cda8

Example:

https://network.skalenodes.com/fs/chubby-sadr/77333da3492c4BBB9ccf3Ea5bb63d6202f86cda8/directoryA/random_text.txt # reverse-proxy
https://node1.validator.com/fluffy-marsupial/77333da3492c4BBB9ccf3Ea5bb63d6202f86cda8/directoryA/random_text.txt # node

The NGINX config is as follows:

limit_req_zone $binary_remote_addr zone=one:10m rate=7r/s;

server {
    listen 3009;

    {% if ssl %}
    listen 311 ssl;
    ssl_certificate     /ssl/ssl_cert;
    ssl_certificate_key /ssl/ssl_key;
    {% endif %}

    proxy_read_timeout 500;
    proxy_connect_timeout 500;
    proxy_send_timeout 500;

    error_log /var/log/nginx/error.log warn;
    client_max_body_size 20m;

    server_name localhost;
    limit_req zone=one burst=10;

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3010;
    }
}

server {
    listen 80;

    {% if ssl %}
    listen 443 ssl;
    ssl_certificate     /ssl/ssl_cert;
    ssl_certificate_key /ssl/ssl_key;
    {% endif %}

    error_log /var/log/nginx/error.log warn;
    client_max_body_size 20m;
    server_name localhost;
    limit_req zone=one burst=50;

    location / {
        root /filestorage;
    }
}