DFK Community Extended API

Description

Every DFK community developer has a common set of data access needs to build their applications. They need a plethora of on-chain data (heroes, quests, summoning info, dex data, and more) from multiple different blockchains (dfk chain, harmony, and future chains). They often need other external data (e.g. historical JEWEL/CRYSTAL pricing for portfolio management).

Developers can piece this information together with existing tools (Harmony/AVAX API, community Python/JS sdks, and DFKs own GraphQL API). But this approach carries problems for community developers:

  1. The DFK GraphQL API is very helpful, but it does not cover use cases many community members want (e.g. historical information with historical pricing, questing data, dex data, presenting data in a RESTful format instead of GraphQL, etc). The Core API team could theoretically cover these use cases, but they are focused on core features tied to the DFK roadmap (as they should be!).
  2. To cover the gaps, community developers need to limit the UX in their apps by querying blockchains in real time, build their own blockchain indexing infrastructure & sdks, or use an open source SDK in a language they don’t prefer. This work is duplicative and burdensome for people who just want to build great DFK apps.

This proposal covers a solution to the above problems by creating a community built & run API that complements and extends the core team’s GraphQL API. This API would:

  1. Prioritize use cases needed by the DFK developer community that the core API team does not have the bandwidth to address.
  2. Not seek to compete with the core GraphQL API, but would embrace it as a data source and extend its capabilities.
  3. Have easy to follow and up to date documentation.
  4. Be open source so community developers can contribute to it or run an instance of it themselves.
  5. Be a source for API feature ideas to the core DFK API to implement in the official API.
  6. Present results in both GraphQL and REST (using the JSON API specification), giving developers a choice in how to interact with it.
  7. Be built in Typescript as a set of node packages/apps in a monorepo. It will store the data from its various sources in a Postgres database.
  8. Be hosted on fly.io to facilitate easy deployment and scalability.
  9. Be built with the high standards of availability, performance, and technical excellence, including:
  • High automated test coverage
  • Automated CI/CD
  • 24/7 monitoring & incident management

Grant Rationale

This effort needs a grant because developing this API will take a significant amount of time in managing the product (getting feedback/input from the community to prioritize the right features), building the product, and running the product. I also don’t plan to monetize the API directly, and given I plan to open source it, grant funding feels like the best approach.

Grant Amount

I am seeking 50k USD for this project to pay for the development costs of the project and the hosting costs of the API.

Team Information

I plan to build, maintain, and operate this API. I am Brian Geihsler (https://www.linkedin.com/in/briangeihsler/), an experienced full stack developer, software entrepreneur, and technology leader. In my developer life, I have built many production-grade APIs across multiple tech stacks. More recently, I co-founded a SaaS startup that exited in 2018 & became a director of development, managing development teams in multiple geographies. I am currently devoting my day-job time to web3 projects like Defi Kingdoms.

Requests from DFK Team

  1. Deliver on the promise of a great developer website that details DFK contracts, APIs, and ways to access DFK data.
  2. Availability in the DFK Dev discord to answer questions as they arise.
  3. Alignment with the core API team’s roadmap so we can align the core team’s roadmap with the community API’s roadmap.

Connection to DFK Game and DFK Blockchain

This is directly connected to the DFK Game and Blockchain, with the intent of making developing DFK applications easier than ever for the DFK developer community.

Deliverables/Payment Schedule/Timeline

I have combined the deliverables, payment schedule, and timeline into one section. Note that these delivery dates & scope are an estimate and subject to change based on community feedback and development schedule realities being different than estimates.

IN PROGRESS - Milestone 1 - delivery by June 27th 2022. Payment: $20,000

Deliver REST & GraphQL endpoints that allow developers to answer historical questions about heroes. Community developers want to answer questions like “What were this hero’s stats at time X?”, “How much did this hero level up cost (in today’s token values and with the token values at the time)?”, and “What quests has this hero been on, and how much did it earn (in today’s values & values at the time)?”

This will include:

  • A deployed & running API with REST and GraphQL endpoints for:

    1. Heroes (includes Serendale/Crystalvale and the ability to query a hero for its stats at a given date/time)
    2. Profession Quests - includes reward item quantities but not pricing
    3. Training Quests - includes reward item quantities but not pricing
    4. Level ups - includes items spent & results but not pricing
    5. Summoning - includes items spent on the summon
    6. Perilous Journey results
  • A public repository published to Github to facilitate collaboration with the broader DFK developer community.

  • A live documentation site based on OpenAPI v3.

This will not (yet) include a promise of availability/scalability - it will be considered a preview API at this stage.

***Milestone 2: delivery by August 17th 2022 - Payment: $10,000 ***

  1. Add current & historical pricing information to Milestone 1 endpoints
  2. Player Inventory & its estimated pricing/value
  3. If available, add Level 10 Profession Quests (rewards + pricing)
  4. Performance testing & right-sizing deployment scale
  5. Monitoring & incident management infrastructure to ensure high availability

After this milestone, the API will be considered “production-ready”

***Milestone 3: delivery by September 17th 2022 - Payment: $10,000 ***

  1. Player Gardens value and estimated APR/earnings schedule
  2. Gardens transactions including LP purchases, rewards claims, and the value of the transactions at the time of the transaction.
  3. Player Bank value and estimated APR/earnings

***Milestone 4: delivery by October 17th 2022 - Payment: $10,000 ***

  1. Player trades in the marketplace & their estimated values at the time of the trade
  2. Player crafted items and their estimated cost/value at the time of crafting
  3. Multi-currency support

Other feature ideas that would require additional grants or prioritizing in place of features above:

  1. Endpoints for aggregated information about heroes, quests, summoning, etc to power charts & dashboards
  2. Estimated hero value based on recently sold similar heroes
  3. Estimated pet value based on recently sold similar pets
  4. Duel results and rewards
  5. Yet-to-be released features from DFK that would impact this API (PVP, PVE, new chains, etc)
  6. Feature ideas solicited from the DFK Developer Community
  7. CLI that communicates with this API
  8. Typescript SDK that communicates with this API

Long Term Plan

$10,000 from the initial payment in Milestone 1 will be set aside in USDC under a publicly known ETH address to pay for hosting costs for this API. Funds will be extracted from this API monthly to pay hosting fees. This should cover 1-2 years of hosting costs & monitoring, depending on demand for the API

After Milestone 3, I will submit another grant to cover development of new features to develop after Milestone 4.

External Links/File Uploads

My LinkedIn: https://www.linkedin.com/in/briangeihsler/

I am actively working on this API. I will post a link to a preview version in the comments when it is available, likely by June 3rd 2022. There’s nothing that speaks better than a working piece of software :slight_smile:

7 Likes

This is a very well thought out proposal.

I’d love to get involved and contribute however I can to this.

Brian if you intend on going through with this, might I suggest you create a new discord server and announce it so we can start having in detail discussions?

I’d also like to raise the point that $50k for this endeavour is just a gesture.

Looking forward to this!

Thanks Thanos.

Re: discord, I’m thinking we could discuss in the dfk dev discord under a new project specific channel - I already have way too many discords to keep track of :slight_smile: . Does that work for you?

Re: $50k - if there’s an option to ask for a bigger grant, I would do so. That would enable me to bring in more developers and accelerate the timeline. I’d be interested in hearing the dfk team’s thoughts on a bigger grant.

I love the idea of having a functioning API to assist developers.

To my best knowledge at the moment they are still working on building a community developer website and “each grant is 50k max” However additional grants requested can be approved after the initial grant proposal.

This was the case with my proposal since it exceeded 50k.

Although that doesn’t mean more than 50k isn’t possible.
The build structure for developers is being working on by the Kingdom Studios Team Currently.

1 Like

Hi folks - I have changed the visibility of my repository on this to public so you can see progress as I develop this API. I currently have an indexer working that is fetching hero data and HeroSummoned events from both Harmony and the DFK chain. I will continue executing on the roadmap and you can see progress in the repo.

1 Like

I think this is a great idea and I had no idea it was an issue. As a proponent of giving users access to all of their heroes information, knowing how well (or not well) my hero is at finding items, leveling, etc. is invaluable. And definitely would help with resale value if you could link your hero to a performance profile or something of that nature. Wouldn’t it be nice to know if your hero is twice as good as the average at finding eggs? Or get accurate info about where you stand on the leaderboard. I think this is something the community would want and it seems like this would greatly help community developers to provide it.

Hi folks - status update on this. I have a basic version of the API up and running that allows you to query a single hero by ID for its static attributes. You can query for the hero via REST or GraphQL. It also automatically ingests/indexes heroes as they are summoned in crystalvale and serendale.

If you notice, the properties that overlap with the existing Community API have the same name as the Community API attributes. For demonstration purposes, I have also added some additional properties that do not yet exist on the Community API (rarityString, mainClassNumber, secondary hp growth stats, etc).

I can share the URL of the endpoint to you on request (ping me in Discord). I don’t yet want to publish an endpoint here given the early nature of the project. Thanks.


2 Likes

Hi folks - FYI the original dates from the proposal will need to be adjusted. My original dates carried an assumption we’d be further through the review process than we currently are (I’m still currently in the backlog for an initial consultation with KS folks).

You can consider the dates on this proposal TBD - I’ll publish a revised set of dates after I’ve had a chance to meet with the team/get initial review.

1 Like