The BROCA Markets

Words
549
Reading
3 min
Listen
Play
3y

That's the Name of the Game

craiyon : a kinetic marble machine

SPK Network has a resource credit called BROCA. It charges up to a max value and can be used to purchase services on the network, namely decentralized storage. There is no way to trade or accumulate BROCA directly due to it's individual cap per account. However, the nature of the system begs for it's use as the biggest way to distribute HIVE and SPK inside the network is by redeeming BROCA through validations.

Storage contracts allow multiple accounts to claim to be storing a file but only the top few can get full rewards for storing this data to encourage a broader decentralization. When a contract is built the upload service provider is chosen by the account who pays for the contract. Meaning if you pay for the contract, you can be sure to be the first account on the contract to get the full rewards for keeping that data. This makes sense for anybody who was using their own infrastructure initially, like 3Speak or DLUX. We still store our dApps data, incentivize it's decentralization, and pull 1/3rd of the cost of it's storage back in token rewards. No amount of software will replace the need for the underlying hardware after all, but sharing it's cost and operation makes the entire system more robust.

SPK Network is open enough to allow people to purchase storage at will much like they could with amazon s3 or many other providers... but they can do it exclusively through the use of ecosystem tokens. Near direct from HIVE... or as you will see, possibly directly from HIVE.

Code Sprint

Let's briefly discuss the options available. Below is some code from Trole which is the management layer of the IPFS storage. It receives uploads from users, inserts those uploads into IPFS, matches the IPFS content IDs with the user signed claculated Content IDs... and finalizes the storage contract with the SPK Network.

This particular snippet is an API request for an upload based on a username.

exports.contract = (req, res) => {
  const user = req.query.user;
  fetch(`${config.SPK_API}/@${user}`).then(rz => rz.json()).then(json => {
    if (!json.channels[config.account] && json.pubKey != 'NA') { //no contract
      var grant = 1000, multiplier = 1

First it checks the spk api to see if a channel is already open, and if the user has registered their public key.

      const powder = parseInt(live_stats.broca.split(',')[0])
      const cap = live_stats.spk_power * 1000
      if (powder / cap > 0.8) {
        multiplier = 8
      } else if (powder / cap > 0.6) {
        multiplier = 4
      } else if (powder / cap > 0.4) {
        multiplier = 2
      }
      if (live_stats.granted[user]) {
        grant = parseInt((live_stats.granted[user] / live_stats.granted.t) * multiplier * (.2 * cap))
      }
      live_stats.broca = `${powder - grant},${live_stats.broca.split(',')[1]}`

Next checks it's accounts live_stats (updated elsewhere) so that it manages it's broca to roughly 20% perday, in alignment with it's recharge rate.

Let's finish the process before twe talk about the Broca grant...

      const operations = [
        [
          'custom_json',
          {
            "required_auths": [
              config.account
            ],
            "required_posting_auths": [],
            "id": "spkcc_channel_open",
            "json": `{\"broca\":${grant},\"broker\":\"${config.account}\",\"to\":\"${user}\",\"contract\":\"1\",\"slots\":\"dlux-io,1000\"}`
          }
        ]
      ]
      const tx = new hiveTx.Transaction()
      tx.create(operations).then(() => {
        const privateKey = hiveTx.PrivateKey.from(config.active_key)
        tx.sign(privateKey)
        tx.broadcast().then(r => {
          console.log({ r })
          res.status(200)
            .json({
              message: 'Contract Sent',
              tx: r
            });
        })
      })
        .catch(e => {
          console.log(e)
          res.status(400)
            .json({
              message: 'File Contract Build Failed'
            });
        })
    } else {
      res.status(400)
        .json({
          message: 'Contract Exists or User PubKey Not Found'
        });
    }
  })
}

And finally, opens a channel with the account to it's own IPFS upload account.

The most interesting part here, is that you can pull any other data source to calculate a Broca grant. Does this user delegate to a hive account? Do they delegate LARYNX to your account? Are they on a blacklist? Have they purchased a subscription to your twitter through their posh associated account? This calculation is 100% up to you.

All together this means you can provide up to a free service just to mine BROCA on SPK network, or provide a better service(larger uploads, automatic extention...) to further the benefits to your users and yourself.

Next Steps

Here is one place we are still working on features. We want your suggestions and ideas so when this system is released it's as useful to you as possible. What can we do better?


Don't forget to consider voting for my witness.

The BROCA Markets | Ecency