The service metadata is the off-chain description of a SingularityNET service and is, by default, hosted on the SingularityNET IPFS cluster. In order to use a service, the client needs to know:
Fortunately the latter is included in the metadata. The daemon allowing access to the service also needs to know this metadata, in order to configure the necessary payment systems.
There are three ways of providing this metadata to the clients and the daemons:
getMetadataIPFSHash
method.As a security concern the client shoudn’t use mpe_address
from the metadata as a sole source of the MPE contract address. The client should check that this address corresponds to the mpe_address
it was expecting. The defaults MPE addresses for various networks are:
0x9c9252ec9fa844e2c7bd2e6f54bec2901938479f
0x7e6366fbe3bdfce3c906667911fc5237cc96bd08
0x39f31ac7b393fe2c6660b95b878feb16ea8f3156
A suspicious client should also check that hash of the metadata corresponds to the IPFS hash, otherwise the client can be attacked if the IPFS client is compromised.
Fortunately, the snet-cli
does this by default.
{
"version": 2,
"display_name": "Entity Disambiguation",
"encoding": "proto",
"service_type": "grpc",
"model_ipfs_hash": "Qmdxxxhggjkkgk6wAB4GmGBekQfLoiLtXYv",
"mpe_address": "0x34E2EeE197EfAAbEcC495FdF3B1781a3b894eB5f",
"groups": [
{
"group_name": "default_group",
"pricing": [
{
"price_model": "fixed_price",
"price_in_cogs": 1,
"default": true
}
],
"endpoints": [
"https://tz-services-1.snet.sh:8005"
],
"group_id": "EoFmN3nvaXpf6ew8jJbIPVghE5NXfYupFF7PkRmVyGQ="
}
],
"assets": {
"hero_image": "QmbaewdfafrpZdpug4WhhcmVVCEwUxjLQafq1/hero_named-entity-disambiguation.png"
},
"service_description": {
"url": "https://dummy.io/sadds/users_guide/named-entity-disambiguation-service.html",
"description": "Provide further clearity regaridng entities named within a piece of text. For example, \"Paris is the capital of France\", we would want to link \"Paris\" to Paris the city not Paris Hilton in this case."
}
}
This metadata file can be directly edited before publishing to IPFS, or manipulated by snet-cli
through service subcommands that have the metadata-*
prefix.
The python module for manipulating this metadata directly can be found here.
Last modified on : 11-May-20