/ILDeathmatch-Server

Web Monetization implementation for ILDeathmatch

Primary LanguageJavaScript

ILDeathmatch-Server

An API for monetizing ILDeathmatch

Overview

ILDeathmatch-Server is a server that implements the dm-web-monetization middleware for payments over the Interledger. It is meant to be used with ILDeathmatch, which is a Quake III Arena server that makes API calls to this server as certain events occur in that Quake session.

Running the Server

Prerequisites:

To start, make sure an instance of moneyd is running on the machine you wish to host the server on. This daemon will allow the server to send and receive payments.

Now run npm install.

Then, create a file in the root directory called config.json and insert the following data:

{
  "JWT_SECRET": "YOUR_OWN_SECRET"
}

JWT_SECRET is a string that is used to verify the signatures of JSON Web Tokens sent to the Web Monetization Module at ILDeathmatch-Server from the Quake server at ILDeathmatch. This prevents any third parties from calling your monetized APIs. Make sure your secret here is the same as the secret you define in config.json at ILDeathmatch!

Now you can start your server with node index.js.

The server will now be listening on http://localhost:8080. To start using it for Quake, follow the instructions at ILDeathmatch to launch a Quake server instance that uses this API.

Connecting as a Client

Prerequisites

In order for a client to connect to your server and start earning/losing money on ILDeathmatch, they'll first need to install the Minute extenstion, which allows the streaming of payment to the server for spawning, and set up an ILP-SPSP receiver, which will allow the receiving of payment for kills. The section "Receiving an SPSP Payment" is the most relevant section for connecting to ILDeathmatch.

How it works

Upon loading to the ILDeathmatch-Server homepage, a client will begin streaming payments to the server through Minute. This payment stream adds to a balance associated with the client that is spent when the client connects to the game, and each time they die. The site will ask for the client's SPSP receiver, and upon receiving it will first ping it to make sure it's live, then send the client into the game. ILDeathmatch-Server will send payments to this receiver each time the client kills other players on the Quake server.