Dynamically On-boarding New Assets — Factomize

  1. Find at least two APIs that provide free and reliable* data for the market price
  2. Create a polling adapter that is able to read the API endpoint and transform the data to use in pegnetd
  3. Add a new OPR version that indicates the addition of a new asset, updating the OPR and Grading package
  4. Determine an activation height for this change
  5. Implement the activation height change in both pegnetd and the reference miner
  6. Deploy the new code and work with exchanges, mining pools, and discord to coordinate the hard fork

The Two Components

  1. Dynamic API: The ability for a miner to mine a new asset and submit it
  2. Dynamic OPR: Deciding when an asset is active and required for submissions to be valid

First System: Dynamic API

Descriptor Files

  • Protocol: The method of connecting, which likely will be just HTTP(S)
  • URL / Endpoint: The address to contact in a format specific to the protocol
  • Authentication Scheme: Can be “none” or a variety of pre-configured methods like www-authentication or OAuth
  • Response format: JSON, XML, CSV, etc.
  • API-DF: The entry hash of an API-DF
  • Assets: A list of assets that this API can read, i.e. PEG & EUR
  • Paths: Each asset would have its own path for both price and the time it was updated, which depends on the format. For CSV this could be expressed as a (row, column) tuple, whereas JSON could be a list of nested keys
  • Data type: How the asset price is encoded, i.e. float vs integer

Descriptor File Examples

{ "version": 1, "protocol": "HTTP", "endpoint": "https://pegnetmarketcap.com/api/asset/all?columns=ticker_symbol,exchange_price,exchange_price_dateline", "authentication": "none", "response": "json" }
{ "api-df": "abcdef...", "assets": ["PEG"], "path": { "PEG": { "price": "root/10/exchange_price", "price_type": "float64", "time": "root/10/exchange_price_dateline", "time_format": "unix_integer" } } }
{ "version": 1, "protocol": "HTTP", "protocol_options": { "header": { "X-CMC_PRO_API_KEY":"%s", "Accepts": "application/json" }, "GET": [ {"type": "commalist", "key": "id", "value": "ids"}, {"type": "raw", "key": "convert", "value": "USD"} ] }, "endpoint": "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest", "authentication": "header:X-CMC_PRO_API_KEY", "response": "json" }
{ "api-df": "abcdef...", "assets": ["XBT", "FCT"], "protocol_options": {"ids": ["1","1807"]}, "path": { "XBT": { "price": "root/data/1/quote/USD/price", "price_type": "float64", "time": "root/data/1/quote/USD/last_updated", "time_format": "ISO-8601" }, "FCT": { "price": "root/data/1807/quote/USD/price", "price_type": "float64", "time": "root/data/1807/quote/USD/last_updated", "time_format": "ISO-8601" } } }
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?id=1,1807&convert=USD
{ "api-df": "abcdef...", "assets": ["ETH"], "protocol_options": {"ids": ["1027"]}, "path": { "ETH": { "price": "root/data/1027/quote/USD/price", "price_type": "float64", "time": "root/data/1027/quote/USD/last_updated", "time_format": "ISO-8601" } } }
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?id=1,1807,1027&convert=USD

Using a Descriptor File

Marketplace

Centralized Marketplace

Decentralized Marketplace

Second System: Dynamic OPR

Consensus

Data Structure

syntax = "proto3"; package opr; message DynamicAssetOPR { string Address = 1; string ID = 2; int32 Height = 3; repeated bytes Winners = 4; repeated uint64 Assets = 5; repeated Vote Votes = 6; } message Vote { string Asset = 1; enum Action { ADD = 0; REMOVE = 1; } }

API Requirements

Removing Assets (Optional)

Final Thoughts

--

--

--

Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

On talent and 300x programmers.

A Super-Fast Way to Loop in Python

Considerations for programming language design: a rebuttal

Business Engineering — an alternative approach to architecting and executing complex businesses…

Hack the Box: LameWrite-up

6 Reasons You Should Try Liquibase for Your Next Project

Golang image search api

New Razor Pages Project Backed with an API

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Who

Who

Developer

More from Medium

Buy Verified Cash App Account with BTC Enable

The CRYPTO Divergence

Welcome to Loopring

How to Stake & Farm on the Musk Gold TerraFarm