Getting Started

Overview

SP Recommendation Engine has three sort rules:

  • Price first: price from low to high

Some users are price-sensitive when it comes to SPs, and they prefer to spend as little as possible while ensuring availability.In this rule, we will increase the weightage of price indicators for both reading and writing.

  • Speed first: latency from low to high

Some users are more concerned about the upload and download speed of files, and we will prioritize recommending SPs with fast speeds for them.

  • Brand first: brand reputation from high to low.

Some users place a greater emphasis on the security of their files and assets. They prefer that the stored files remain intact. Therefore, they would prioritize selecting SPs with a long service history and a good reputation.

Getting Started

SP Recommendation Engine is designed to be easy to use. Developers can send a POST request to get the recommendation result.

Here is an example:

curl --location --request POST 'sp-testnet-recommendation-engine.nodereal.io/recommendations' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_by":[
        "read_price",
        "latency",
        "store_price",
        "free_read_quota"
    ],
    "region":"us"
}'

SP Recommendation Engine will return an Array List of SP info. Here is an example:

[
    {
        "SPAddress": "0x8b4581442D06F8Ff5c09629f4a51399D00760b3E",
        "Description": "",
        "StakedBnb": "1000000000000000000000",
        "Status": "STATUS_IN_SERVICE",
        "Endpoint": "https://gnfd-testnet-sp-1.blockvision.org",
        "ReadPrice": "0.060000000000000000",
        "FreeReadQuota": 10000,
        "StorePrice": "0.019000000000000000",
        "Latency": 885,
        "Tags": null
    },
    {
        "SPAddress": "0xa3ac8c0999b73f028122CE609e318c7da09cb752",
        "Description": "",
        "StakedBnb": "1000000000000000000000",
        "Status": "STATUS_IN_SERVICE",
        "Endpoint": "https://gnfd-testnet-sp-1.nodereal.io",
        "ReadPrice": "0.087000000000000000",
        "FreeReadQuota": 10000000000,
        "StorePrice": "0.004800000000000000",
        "Latency": 1937,
        "Tags": null
    }
]

Here are meaning of the parameters:

ParametorsTypeDescription
SPAddressstringprimary address of SP
DescriptionstringSP's self description
StakedBnbstringtoken amount the SP has staked, it reflect the reputation of the SP
StatusstringSP current status, normally it should be "STATUS_IN_SERVICE", otherwise SP may not be functioning well
EndpointstringSP endpoint
ReadPricestringSP read price, unit is wei bnb
FreeReadQuotastringSP free read quota, unit is wei bnb
StorePricestringSP store pricey, unit is wei bnb
LatencystringSP latency, unit is ms