header source
my icon
esplo.net
ぷるぷるした直方体
Cover Image for Paid API by mining Cryptocurrency

Paid API by mining Cryptocurrency

だいたい4分で読めます

Introduction Video

https://www.youtube.com/watch?v=Z11CF_NQSus

Background

Providing APIs is an important part of expanding the 3rd party ecosystem. A famous example is Jeff Bezos's "The API Mandate" (all services provided by AWS should function as APIs or die) (primary source needed). It can be said that APIs have played a significant role in the development of AWS.

On the other hand, there are various blockers in providing APIs. While security is of course an issue, there are also economic problems.

Basically, it needs to be provided 24 hours a day, costs are incurred during operation, and it's difficult to account for profits from ecosystem expansion, so it's often challenging to give the go-ahead from a business perspective.

A simple solution is to charge a monthly usage fee, but this is inconvenient for users. There's also the management cost of subscriptions. On the other hand, usage-based billing is good for users, but it's a big burden for providers.

Proposed Method

Inspired by Coinhive, I considered a method to provide a paid API that is easy to offer and convenient to use, utilizing the power of cryptocurrency. Specifically, this problem is addressed by preparing a gateway that uses cryptocurrency mining.

API users acquire currency through mining or purchase, and pay the amount set for each API endpoint. This results in a prepaid type of API usage, reducing management costs. Also, by using a currency that is easy to acquire through mining, the entry barrier can be lowered.

Challenges

Latency will increase significantly. As it's necessary to wait for the payment to complete, it will be difficult to return results in a few milliseconds.

Also, it's necessary to consider how to handle payments in case of errors.

Technical Details

Details are described here.

https://qiita.com/esplo/items/65fedba8efbc602f91cb

Usage

The demo site is currently not operational.

It's uploaded to GitHub, so please check there for details.

https://github.com/esplo/crypto-api-gateway

Share