# Grant Proposal: Mina Berkeley Testnet Public Infrastructure
This grant supports the public infrastructure costs of providing services for the [Berkeley testnet](https://minaprotocol.com/blog/berkeley-testnet-alpha-participation-guide) to zkApp developers.
Currently, this infrastructure greatly supports zkApp development, removing friction for developers getting up and running developing zkApps. The grant is for a 6-month period, likely to include an incentivized testnet with wider adoption. While this infrastructure is already operational, this grant will enable a more robust implementation, offset some of the costs incurred, and provide some support for redeployments and other issues.
**Services enabled by this grant:**
* A load-balanced, highly available proxy service used by zkApp developers to deploy and fetch current account information at [https://proxy.berkeley.minaexplorer.com](https://proxy.berkeley.minaexplorer.com/graphql).
* Powering the faucet at https://faucet.minaprotocol.com/ that uses the API at [api.berkeley.minaexplorer.com/broadcast](https://berkeley.api.minaexplorer.com) to avoid running infrastructure.
* Wallet services - full transaction history via GraphQL, and broadcasting of transactions by the proxy service (used by [Auro Wallet](https://www.aurowallet.com/)).
* A [GraphQL archive API](https://berkeley.graphql.minaexplorer.com/) to retrieve historical data (including exposing events and sequence events).
The proxy service is a load-balanced service that sits behind a [Stellate](https://stellate.co/) proxy cache to minimize load on the backend services and improve the performance of the daemon GraphQL API. This is further protected by proxying requests through [AWS API Gateway](https://aws.amazon.com/api-gateway/) to add some additional protections regarding throttling and potential IP restrictions in the case of abuse (as seen on mainnet). This setup is a replica of the services offered at scale on mainnet.
The [GraphQL API](https://berkeley.graphql.minaexplorer.com/) provides a familiar interface to retrieve chain history past the 290 blocks offered by the proxy service. Currently, the only alternative for developers and wallet operators is to run an archive node and query that directly. The GraphQL API also exposes [sequence events and events](https://docs.minaprotocol.com/zkapps/advanced-snarkyjs/events) such that they may be integrated into existing zkApps with little effort or used to provide oracle services, e.g. [a delegation program example](https://github.com/garethtdavies/zkAppPool#delegation-program-oracle-example). Auro wallet has implemented the GraphQL API to display historical transaction data and the proxy service to broadcast transactions.
The services offered are well tested and have already scaled on mainnet, serving over 20 million requests monthly to the REST API, 10 million to the GraphQL API (peak at 25 million), and over 1 million requests to the proxy service.
The below cost breakdown assumes 5 million API requests per month, as it is anticipated an incentivized testnet will experience heavier usage [^1]. However, this variable isn't a major factor in the grant and is a reasonable estimate as a fraction of current mainnet usage.
While normally, some level of service level would be guaranteed for such a grant, given the potential instability of a testnet, this is unfeasible, so support and uptime will be provided on a (very) best-effort basis.
## Cost Breakdown
| Item | Notes | Monthly Cost | Total |
| ----------------------------- | ------------------------------- | ------------ | ------- |
| Proxy Servers | m5zn.3xlarge x 3 | $723.40 | $13,021 |
| Cloudflare DDOS Protection | | $20 | $120 |
| MongoDB Atlas | M20 replica set | $144 | $864 |
| Stellate Proxy Cache | 5 million | $50 | $300 |
| AWS Application Load Balancer | | $18.25 | $110 |
| AWS Data Transfer | 1000 @ $0.090 per GB | $90 | $540 |
| Monitoring & Logging | Grafana + Loki | $50 | $300 |
| Atlas Data Transfer | 10,000 @ $0.01 / GB | $100 | $600 |
| AWS API Gateway Requests | 10 million | $10 | $60 |
| MongoDB Realm | (requests, compute) @ 5 million | $10 | $60 |
| Maintainence and Support | 10 hours/month @$150/hr | $1,500 | $9000 |
| Total | | $4,162 | $24,975 |
[^1]: Historically, Mina's initial incentivized testnet was still by far the highest usage seen. This was likely a result of the design of the program, and while higher than current traffic to Berkeley is assumed, it isn't anticipated to be at these levels.