stacksgov / grants-program

Archive of past Stacks Foundation grant applications. Historical record of ecosystem development.
https://stacks.org/grants
141 stars 36 forks source link

Managed Stacks API Nodes #250

Closed rswol closed 2 years ago

rswol commented 2 years ago

Background As more Stacks projects are getting off the ground the pressure on https://stacks-node-api.mainnet.stacks.co increases. Projects in distributed ecosystem cannot rely on centralized service and required to run own API nodes for getting an access to Stacks blockchain information. Unfortunately, running your own API node is not trivial - it requires developers time, resources, and domain knowledge dedicated to the service that is not core focus of the business. stacksdata.info runs a cluster of API nodes already as underlying source of analytics, and it makes a perfect sense to open it up to Stacks community as a managed service.

Project Overview What solution are you providing? Who will it serve? Stacksdata.info already has a runnning cluster stacks API nodes exposed as http://stacks-api.stacksdata.info:3999/extended/v1/status. The solution will be to allow any customer to get access to a dedicated or shared instance of stacks API node on demand. The target audience would be current users of https://stacks-node-api.mainnet.stacks.co who need guaranteed performance and availability of stacks API.

Scope What are the components or technical specs of the project? What will the final deliverable look like? How will you measure success?

The basic service is already up and running. It is a cluster of several API nodes running behind flexible load balancer (http://stacks-api.stacksdata.info:3999). There is a healthcheck which is integrated with load balancer that makes sure underlying nodes are healthy.

The following new components for stacksdata.info needs to be developed:

Budget and Milestones What grant amount are you seeking? How long will the project take in hours? If more than 20, please break down the project into milestones, with a clear output (e.g., low-fi mockup, MVP with two features) and include the estimated work hours for each milestone.

Total Grant Request: $9,000

M1: Frontend website with Hiro wallet authentication. On the website a customer can pick a level of service, generate an endpoint, generate a token which later will be included in all requests to the service. 2 weeks M2: Proxy service. The Proxy accepts Stacks API request, checks the standing by inspecting the provided token and base on the level of service for identified customer (by querying blockchain data through stacksdata.info) passes the request further or rejects the request. 2 weeks M3: Implement operational dashboards for the whole service (load balancer, stacks api nodes, proxy, etc) to identify the service quality for making decision if spinning up new nodes is necessary. 3 days M4: Expand existing scripts to spin up new stacks api nodes. 2 days. M5: provision more bitcoin nodes to provide resiliency (currently running 1 node per VPC). 1 day

Team Who is building this? What relevant experience do you bring to this project? Are there skills sets you are missing that you are seeking from the community? Please share links to previous work.

Risks What dependencies or obstacles do you anticipate? What contingency plans do you have in place? The most challenging part is pretty much done, there are few risks that might derail this project.

Running backbone services is hard and this is just a first step. Another risk for this project would be a single developer not be able to provide a support 24/7 especially during non-USA business hours. This can be mitigated later based on demand with hiring operational developers from other time zones.

Community and Supporting Materials Do you have previous projects, code commits, or experiences that are relevant to this application? What community feedback or input have you received? How do you plan to share your plan to the community over time and as the final deliverable?

stx-grant-bot[bot] commented 2 years ago

Thanks for submitting a grant application! Due to the holiday break, grant reviews are currently on hiatus and will resume on January 5th. In the meantime, we encourage you to continue to share and get feedback on your application from the community.

dcsan commented 2 years ago

hiya -

just to understand a bit better:

just to confirm this is the same team as www.Stacksdata.info ? It's like the infrastructure component for #232 ?

rswol commented 2 years ago

you're proposing to deal with the devops hassle of setting up a node? possibly to provide paid plans for guaranteed access to read-only APIs? (a bit like infura/alchemy ?)

Yes, exactly.

would there be any extended APIs available?

Yes, there is already an extended API provided which customers will have access to: https://stacksdata.info/api.html

Are you running a full node that provides a blockchain instance and will this take load off the core stacks infrastructure?

Yes, in fact, it is a cluster of full nodes behind a load balancer.

would there be any open source code provided by this process?

I can opensource the Proxy component if needed, the rest of infrastructure is closed sourced since it is part of stacksdata.info (which is closed sourced for now)

just to confirm this is the same team as www.Stacksdata.info ? It's like the infrastructure component for #232 ?

Yes, this is the stacksdata.info team. #232 STACKTISTICS might use our API, I am not sure about that - right now the API is fully open to everyone.

will-corcoran commented 2 years ago

Hey @BowTiedArcticWolf -

Thanks for your application. This sounds really cool! I am just waiting for a technical review of your application. Wondering if you might be available to join this Twitter Space tomorrow: https://twitter.com/SyAsteria/status/1477305339745902598?s=20

I also asked @dcsan since you are both exploring API related topics. Figure it would be cool to have a roundtable and touch on your studies in conjunction to what Asteria has been working on. We really want to support as many explorations as possible. It would be great to get a rich dialog going. Sorry for the short notice!

Best, Will

rswol commented 2 years ago

Hi @will-at-stacks, Absolutely, I will try to make it

wileyj commented 2 years ago

An interesting proposal - is the idea around the service model based around subscriptions via smart contract? I'd also like to see the proxy component not be tied to the API backend (particularly if your current API is not open source).

rswol commented 2 years ago

Smart contract is useful but not necessary, we can always get payments info directly from Blockchain - for the first iteration we most likely look at this approach

Proxy will be open source and independent from the stacksdata API, this is for sure - we can get all necessary information from stacks open source API

An interesting proposal - is the idea around the service model based around

subscriptions via smart contract? I'd also like to see the proxy component not be tied to the API backend (particularly if your current API is not open source).

Message ID: @.***>

will-corcoran commented 2 years ago

@BowTiedArcticWolf this is approved! We look forward to reviewing the work this grant yields and can't wait to see it out in the wild!

stx-grant-bot[bot] commented 2 years ago

Congratulations. Your grant is now approved. Please complete the on-boarding link here: https://stacks-grant.netlify.app/onboard?q=f9da26105e1ec016c64d7f53c1905436

rswol commented 2 years ago

The proxy is ready: https://github.com/BowTiedArcticWolf/stacks-api-proxy It can monitor underlying Stacks API Nodes and include/exclude them automatically based on latest block their are processing. It has a support for authentication, so the service can be gated if needed

will-corcoran commented 2 years ago

@BowTiedArcticWolf thanks for the update. Can you please give us an update on M3-M5?

rswol commented 2 years ago

@will-at-stacks

M3: Implement operational dashboards for the whole service (load balancer, stacks api nodes, proxy, etc) to identify the service quality for making decision if spinning up new nodes is necessary. 3 days

This is will take little bit more time since I am not a frontend developer, going to offload this job to someone soon

M4: Expand existing scripts to spin up new stacks api nodes. 2 days.

in progress, need to polish and publish

M5: provision more bitcoin nodes to provide resiliency (currently running 1 node per VPC). 1 day

in progress, will be part of M4 script for API node bootstrap

will-corcoran commented 2 years ago

Hello and thank you for participating in the Stacks Foundation Grants Program!

We are in the process of migrating from GitHub to the new Grants Dashboard. In order to complete your grant, you will need to submit any remaining Progress Review and/or Final Review requests through the Dashboard in order to receive your remaining payments.

Lastly, please note we are marking this grant 'closed' on GitHub for organizational purposes, but it is still 'open' on the Grants Dashboard.

Thanks and we hope to continue to support your efforts with additional grants!

Best, Will