Ocean uses these off-chain services:
- Ocean Provider is for data services. Specifically, it's a REST API serving requests for two types of data services: static urls (for downloading data) and compute services. It's run by the marketplace or the data publisher.
- Ocean Aquarius is metadata cache REST API. This helps to aid search in marketplaces.
We now describe how to use these.
Here we use a file to set config values.
In your working directory, create a file config.ini
and fill it with the following. It will use pre-existing services running for rinkeby testnet.
[eth-network]
network = https://rinkeby.infura.io/v3/<your Infura project id>
[resources]
metadata_cache_uri = https://aquarius.oceanprotocol.com
provider.url = https://provider.rinkeby.oceanprotocol.com
Ensure that envvars don't override the config file values:
unset OCEAN_NETWORK_URL METADATA_CACHE_URI AQUARIUS_URL PROVIDER_URL
Create an envvar to point to the new config file. In the console:
export OCEAN_CONFIG_FILE=config.ini
In Python, import and configure the components / services:
import os
from ocean_lib.config import Config
#configure the components
config = Config(os.getenv('OCEAN_CONFIG_FILE'))
Now you're ready to use the services! 🐳 The marketplace tutorial will use them in more detail.
Above, we described a specific flow to go through configuring services. Here are some variants of that flow.
The service urls above are for rinkeby. Ocean's docs have urls for Ethereum mainnet and other supported networks.
Above, we pointed to existing services. Alternatively, you can run your own. Here's how.
Open a new console, and get provider running:
docker run oceanprotocol/provider:latest
Open another new console, and get aquarius running:
docker run oceanprotocol/aquarius:latest
Here are the urls for the local services, for use in config.ini
etc.
- Provider url:
http://127.0.0.1:8030
- Aquarius url:
http://127.0.0.1:5000
Above, we ran all services separately. You can also run Ocean Barge to conveniently run them all at once.