New Project: Teller-JSON
teller-json
- create repo/folder called teller-json
- put documentation in README.md
The teller-json daemon will expose an HTTP API for:
- binding a SKY address to a BTC address
- binding a SKY address to a ETH address
- (possibly binding SKY to other currencies)
- checking the status of a bound SKY address
The two buy methods for binding a SKY address are:
- direct: fixed-price purchase from wallet
- when a deposit event is received, calculate amount based off fixed-price from wallet
- passthrough: variable-price purchase through exchange
- when a deposit event is received, send to external api
The daemon will continually watch bound BTC/ETH addresses and watch for deposits, and then execute purchases and deposit SKY to the user's address.
More requirements for the daemon:
- use JSON storage
- HTTP API respond with JSON
OTC flow/stages with JSON format
Stage 1
skycoin address:
time:
Stage 2 (deposit address)
btc address:
Stage 3 (transaction detected event, but not executed)
time:
btc tx id:
Stage 4
Buying the coins from c2cx
Stage 5
Wait for the BTC TX confirmation
Stage 6
Withdrawal and track withdrawal if its from our OTC wallet and not C2CX
Storage
Teller-json will use a JSON-flatfile database for storage. Here's an overview of the filenames and their contents:
db/bound/[sky address].json
Created: when /api/bind is called for the first time with [sky address].
Appended: successive calls to /api/bind with a [sky address]. Appends to dropoffs field.
{
"address": "...sky address...",
"dropoffs": [
{
address: "...dropoff address...",
type: "...dropoff currency..."
},
{
address: "...dropoff address...",
type: "...dropoff currency..."
}
]
}
db/status/[sky address].json
Created: when /api/bind is called.
Appended: successive calls to /api/bind with a [sky address].
[
{
"seq": ...dropoff sequence number...,
"updated_at": ...unix time...,
"status": ...dropoff status...
}
]
status:
-
waiting_deposit -
waiting_send -
waiting_confirm -
done
From Brandon:
- the otc/teller does not ask how much is to be transferred. It just waits for a transfer to the BTC account, and converts whatever is in there into SKY at the price at that point in time.
- If the amount is less than a configurable amount, set to 0.5 BTC initially, then it does not wait for confirmation before sending the SKY.
- If the amount is over the limit, it must wait for confirmation.
- Admin panel features:
- Secured by user login (config file) or admin network (port/ip)
- There is a configurable flag to switch on and off the "dont wait for confirmation" feature.
- "pause everything" button, and "pause this transaction" feature.
- The admin panel has an option to switch between auto price and fixed price.
- option to change the fixed price.
- option to change the skycoin source address (local mode)
Questions to be answered:
- Is there a timeout waiting for BTC to be deposited?
- Should we build a job which checks to see if additional BTC was deposited after the transfer, or after the deadline (and flat it or send it back)
- What stats are required?