#Player Server
##API Endpoints
###GET /catpcha
Get a captcha challenge
###POST /signup
Sign up a user
POST values
- password: password
- alias: optional, will generate a unique alias if not provided
###POST /login
Log in a user
POST values
- password
- alias
Returns
- key: a session key to use for all subsequent requests
###POST /logout
Logout
POST values
- alias
- key: the session key
###PUT /users/sig
Get a challenege string for signed messages
PUT values
- key
Returns
- sig: the challenge string to be signed by the user
###POST /users
List all users
POST values
- key
Returns an array of all users
###POST /users/:alias
Get a single user's info
POST values
- key
Returns a user data object for the provided user alias
###PUT /users/alias
Update the user alias
PUT values
- key
- alias
- password
- sig: a signed message from the user
###PUT /users/email
Update the user email
PUT values
- key
- password
- sig: a signed message from the user
###PUT /users/password
Update the user password
PUT values
- key
- newPass
- password
- sig: a signed message from the user
###PUT /users/addr
add a withdraw address
PUT values
- key
- password
- address: the bitcoin address to add
- currency: currently only 'btc' is supported
- sig: a signed message from the user
###PUT /users/request-affiliate/btc
Request an affiliate account for the user
PUT values
- key
###PUT /users/faucet/btc
Receive BTC in the user account once per hour
PUT values
- key
###PUT /users/withdraw
Withdraw user's balance to their withdraw address
PUT values
- key
- currency: currenly only 'btc'
###GET /txs/btc
Get the transaction history
Body Params
- key
###GET /txs/:alias/btc
Get the transaction history for a player
Body Params
- key
###POST /txs
Add a transaction to the transaction database
This enpoint is currently locked down to a separate server, which only listens
on the 172.17.0.0/16 subnet (which is the default subnet for
docker). If you need to listen on a different subnet, set
the environment variable DOCKER_SUBNET
before running the player server
#!sh
DOCKER_SUBNET=192.168 node app
POST values
- userId: the userId (mongo ObjectId) of the user the transaction is for
- refId: the "id" of the thing that caused this transaction (e.g. a game ID, faucet timestamp)
- type: a string identifying the source of the transaction (e.g. 'deposit', 'withdraw', '')
- amtIn: the amount (in Satoshi) to add to the account (can be ommited or set to 0 for a withdrawal)
- amtOut: the amount (in Satoshi) to be taken from the account (can be omitted or set to 0 for a deposit)
- meta: an object containing any other data that should be stored with the transaction, single level key:value only please