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