REST API for provider of data services
This is part of the Ocean Protocol V3 tools.
This is feature complete and is a BETA version.
Uses the rinkeby network with a remote metadatastore instance running at https://aquarius.marketplace.dev-ocean.com
git clone [email protected]:oceanprotocol/provider.git
cd provider/
python3 -m venv venv
source venv/bin/activate
pip install -r requirements_dev.txt
cp .env.example .env
flask run --port=8030
git clone [email protected]:oceanprotocol/provider.git
cd provider/
Before running it locally we recommend to set up virtual environment:
virtualenv venv -p python3.8
# OR: python -m venv venv
source venv/bin/activate
Install all the requirements:
pip install -r requirements_dev.txt
Metadata store (Aquarius). Do one of the following:
- Run Aquarius locally, see https://github.com/oceanprotocol/aquarius
- Point to a remote instance such as
https://aquarius.marketplace.dev-ocean.com
. In this case replace theaquarius.url
option in theconfig.ini
file with the appropriate URL.
Ethereum network. Do one of the following:
- Run ganache-cli
- Point to rinkeby testnet or any other ethereum network
Make sure that ocean contracts (https://github.com/oceanprotocol/contracts) are deployed to the your network of choice.
Update the network
option in the config.ini
file with the proper network URL. For now it must be a URL, a simple network name (e.g. mainnet) will be supported in the future.
Add the corresponding environment variables in your .env
file. Here is an example:
FLASK_APP=ocean_provider/run.py
PROVIDER_CONFIG_FILE=config.ini
PROVIDER_ADDRESS=your ethereum address goes here
PROVIDER_PRIVATE_KEY=the private key
PROVIDER_FEE_TOKEN = address of ERC20 token used to get fees
You might also want to set FLASK_ENV=development
. Then run flask run --port=8030
Refer to the API.md file for endpoints and payloads.
REQUEST_RETRIES
defines the number of times file downloads are tried, accounting got network glitches and connectivity issues. Defaults to 1 (one trial, meaning no retries).RBAC_SERVER_URL
defines the URL to the RBAC permissions server. Defaults to None (no special permissions).PRIVATE_PROVIDER
if set, adds a "providerAccess": "private" key-value pair to RBAC requestsREDIS_CONNECTION
defines a connection URL to Redis. Defaults to None (no Redis connection, SQLite database is used instead)TEST_PRIVATE_KEY1
andTEST_PRIVATE_KEY2
are private wallet keys for publisher and consumer tests.OPERATOR_SERVICE_URL
defines connection to C2DLOG_CFG
andLOG_LEVEL
define the location of the log file and logging leve, respectivelyIPFS_GATEWAY
defines ipfs gateway for resolving urlsAUTHORIZED_DECRYPTERS
list of authorized addresses that are allowed to decrypt chain data. Use it to restrict access only to certain callers (e.g. custom Aquarius instance). Empty by default, meaning all decrypters are authorized.USE_CHAIN_PROOF
orUSE_HTTP_PROOF
set a mechanism for saving proof-of-download information. For any present true-ish value ofUSE_CHAIN_PROOF
, the proof is sent on-chain. When definingUSE_HTTP_PROOF
the env var must configure a HTTP endpoint that accepts a POST request.
If you are a contributor, make sure you install the pre-commit hooks using the command pre-commit install
. This will make sure your imports are sorted and your code is properly formatted before committing. We use black
, isort
and flake8
to keep code clean.
Licensing your commits is also available: use the command licenseheaders -t .copyright.tmpl -x venv
(or replace "venv" with your local virtual environment path). This option is not available as a precommit since it takes longer.
To release a new version of Provider, please follow the steps decribed in the release process