More on Packages

A deeper dive into an example of a package being registered

DAPP Service providers register their package with the dappservices:regpkg command. Examples can be seen on the eosq block explorer.

Below we can see the structure of a new package that is created.

{
   "newpackage": {
      # API endpoint the DSP is reachable at, default PORT 3115
      "api_endpoint": "https://node1.dappfund.io",
      # packages are disabled when created and require the dappservices:enablepkg command
      "enabled": 0,
      # id
      "id": 0,
      # minimum stake required to receive designated QUOTA per package period
      "min_stake_quantity": "10.0000 DAPP",
      # min time in seconds before a stake can be refunded
      "min_unstake_period": 3600,
      # package name, must be 1-12 characters a-z, eosio name format
      "package_id": "fairfund1",
      # url of DSP JSON file, similar to BP JSON
      "package_json_uri": "https://dappfund.io/dsp-package.json",
      # period in seconds where QUOTA refills to 100%, example has 1 day in seconds, each day user will have 1 QUOTA
      "package_period": 86400,
      # DSP account name
      "provider": "thedappfund1",
      # QUOTA to provide per package period, more on QUOTA below
      "quota": "1.0000 QUOTA",
      # service name, more on this and where to find this below
      "service": "stakeservice"
   }
}

The following go into more detail on the settings above.

enabled

To enable you can visit bloks.io's block explorer here to submit the dappservices:enablepkg action, this requires the package id, DSP name, and service name

min_unstake_period

The greater of this and the remaining time in thepackage_period is the total unstake time. For example if you are 12 hours into a 24 hour package period and the min_unstake_period is an hour, you have to wait 12 hours to refund your stake.

package_json_uri

This is the link to the package json information to be standardized and used by DAPP Service Provider portals.

{
    "name": "pricefeed5m",
    "description": "Price feed oracle 5 minute interval",
    "dsp_json_uri": "https://dsp_provider.io/dsp.json",
    "logo":{
      "logo_256":"https://....",
      "logo_1024":"https://....",
      "logo_svg":"https://...."
    },
    "apis" {
      "ipfs":"ipfs.dsp_provider.io",
      "dsp_api":"dsp.dsp_provider.io",
      "state_history":"state.dsp_provider.io",
      "hyperion":"hyperion.dsp_provider.io",
      "dfuse":"dfuse.dsp_provider.io",
      "dfuse_dgraphql":"dfuse.dsp_provider.io",
      "dfuse_fire_hose":"dfuse.dsp_provider.io",
      "dfuse_push_guarantee":"dfuse.dsp_provider.io"
    },
    "contacts" [],
    "locations":[
        {
          "name": "Atlantis",
          "country": "ATL",
          "latitude": 2.082652,
          "longitude": 1.781132
        }
    ]
}
{
  "dsp_account_name": "eosnationftw",
  "org": {
    "candidate_name": "EOS Nation",
    "website": "https://eosnation.io",
    "ownership_disclosure": "https://eosnation.io/ownership-disclosure",
    "code_of_conduct": "https://steemit.com/eos/@eosnation/eos-nation-roadmap-on-values-community-project-timeline-finances-and-transparency",
    "email": "info@eosnation.io",
    "github_user": [
      "deniscarriere",
      "matthewdarwin"
    ],
    "chain_resources": "https://snapshots.eosnation.io",
    "branding": {
      "logo_256": "https://eosnation.keybase.pub/logo_256.png",
      "logo_1024": "https://eosnation.keybase.pub/logo_1024.png",
      "logo_svg": "https://eosnation.keybase.pub/logo.svg"
    },
    "location": {
      "name": "Canada",
      "country": "CA",
      "latitude": 45.425532,
      "longitude": -75.700269
    },
    "social": {
      "medium": "eosnationbp",
      "hive": "eosnation",
      "steemit": "eosnation",
      "twitter": "EOS_Nation",
      "facebook": "groups/EOSNation",
      "github": "EOS-Nation",
      "telegram": "EOSNation",
      "youtube": "channel/UCXgAY9DyooykrubRXw3xK1g",
      "reddit": "EOSNation",
      "keybase": "eosnation",
      "wechat": "Eosnation"
    }
  },
  "nodes": [
    {
      "location": {
        "name": "Canada",
        "country": "CA",
        "latitude": 45.425532,
        "longitude": -75.700269
      },
      "node_type": "query",
      "features": [
        "chain-api",
        "account-query"
      ],
      "api_endpoint": "http://api.eosn.io",
      "ssl_endpoint": "https://api.eosn.io"
    },
    {
      "location": {
        "name": "Canada",
        "country": "CA",
        "latitude": 45.425532,
        "longitude": -75.700269
      },
      "node_type": "seed",
      "p2p_endpoint": "peer.eosn.io:9876"
    },
    {
      "location": {
        "name": "Canada",
        "country": "CA",
        "latitude": 45.425532,
        "longitude": -75.700269
      },
      "node_type": "producer"
    },
    {
      "location": {
        "name": "Canada",
        "country": "CA",
        "latitude": 45.425532,
        "longitude": -75.700269
      },
      "node_type": "query",
      "features": [
        "chain-api",
        "dfuse"
      ],
      "ssl_endpoint": "https://eos.dfuse.eosnation.io"
    },
    {
      "location": {
        "name": "Canada",
        "country": "CA",
        "latitude": 45.425532,
        "longitude": -75.700269
      },
      "node_type": "query",
      "features": [
        "firehose"
      ],
      "ssl_endpoint": "https://eos.firehose.eosnation.io"
    }
  ]
}

quota

Each DSP service action, fetching a vRAM table row, performing an oracle request, scheduling a re-occurring action, each of these are examples where by default 0.0001 QUOTA is used. Let's show

service

The service name can be found in the model file of the service, let's go to the directory of services on Github. If we go into the /models/dapp-services/oracle.json we will see the following:

{
    # this is the short name for the service, used in zeus commands
    "name": "oracle",
    # port service runs on
    "port": 13112,
    # alternative port to run on
    "alt": 26224,
    # this is what needs to be used for the "service" field when registering a package
    # this is also the contract that hosts the service and is included on usage billing
    "contract": "oracleservic",
    # pretty name of the service
    "prettyName": "LiquidHarmony",
    # wip,poc,beta,alpha
    "stage": "Beta",
    "version": "0.9",
    "description": "Web/IBC/XIBC/VCPU/SQL Services",
    # list of commands callable for the service
    "commands": {
        # main oracle calling function, all actions preceded with x (xgeturi)
        "geturi": {
            # if true, blocking will treat the command as a synchronous event
            # if false it will be treated as an asynchonous event
            "blocking": true,
            # broadcast to other DSPs being staked to by the consumer
            # triggers a promise.allSettled which awaits each DSPs response or timeout
            "broadcast": true,
            # specifies requested parameter for action
            "request": {
                "uri": "std::vector<char>"
            },
            # specifies callback response
            "callback": {
                "size": "uint32_t",
                "uri": "std::vector<char>",
                "data": "std::vector<char>"
            },
            # specify what data is required to signal a DSP to responsd to 
            "signal": {
                "size": "uint32_t",
                "uri": "std::vector<char>"
            }
        },
         # action to remove failed oracle rows
         "orcclean": {
             # does not rely on other context, perform async
            "blocking": false,
            "request": {
                "uri": "std::vector<char>"
            },
            "callback": {
                "size": "uint32_t",
                "uri": "std::vector<char>"
            },
            "signal": {
                "size": "uint32_t",
                "uri": "std::vector<char>"
            }
        }
    }
}

Last updated