-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Create a folder called coin-api
This is a command line application.
- it will launch a web-server on local host and expose a JSON HTTP interface
- will have two executables, a server and a command line RPC
- will have a simple minimal web front end or dash board
https://godoc.org/github.com/skycoin/skycoin/src/cip
We will define an interface that implements 5 functions for each coin
- generate address, private keys, pubkeys from deterministic seed
- check the balance (and get unspent outputs) for an address
- sign a transaction
- inject transaction into network
- check the status of a transaction (tracks transactions by transaction hash)
For generating addreses, see
- https://godoc.org/github.com/skycoin/skycoin/src/cip
- GenerateDeterministicKeyPair(seed []byte) (PubKey, SecKey)
- BitcoinAddressFromPubkey(pubkey PubKey) string
For Bitcoin
Only implement
- generating addresses, private keys, secret keys
- checking balance
The can come back and focus on
- creating transactions
- injecting transactions
- monitoring the status of transactions later
For Skycoin, implement all of the above, using the golang CLI command.
Later we may want to implement "Watch Address" functionality, which allows us to add an address as a "watch address" and get events (deposits) to that address.
Each coin will have one or more implementations of the interface
- Bitcoin will have an implementation that uses https://godoc.org/github.com/skycoin/skycoin/src/cipher for address generation and which gets outputs from blockchain.info
- Bitcoin will have an interface that uses https://godoc.org/github.com/skycoin/skycoin/src/cip for address generation and which gets outputs and address balances from the bitcoin scanning wallet in the services repo (in this repo)
- Bitcoin may have another implementation that connects to a BCTD node directly (like the scanning wallet does)
- Skycoin will have one interface implementation that connects to a Skycoin node over the CLI
There will be a CLI with a command for
- listing the coins supported by the wallet API
- listing the coins and implementations supported by the API
- instantiating an instance of a coin interface (an instance of BTC, scanning wallet) on the multi-coin API server
There will be a JSON HTTP api that includes
- a ping command (just responds to ping, used for checking server status and returning stats)
- a url that returns a list of the interfaces (coin and type) instantiated on the multi-coin server instance (and the status of the interface, etc whether it is connected to the server and working).
- a url for checking the balance of an address for a given coin, against a given interface
- a url for injecting a transaction for a particular coin and interface (with transactions encoded in hex)
- a url for checking the status of a transaction
- a url for checking the validity of a transaction for a given coin and interface (optional, may not be needed)
-
applications will be able to use the multi-coin server from an HTTP JSON API
-
we may have a command line interface (CLI) for doing operations against the coin api server (will jus call the JSON HTTP API)
-
The coin API server will have a golang api, that can be imported and allow applications in golang to generate public keys, private keys and addresses for each supported coin, from a deterministic seed (supported for Bitcoin and Skycoin in the cipher library).
There will be a web-interface, showing which scanning wallet implementations have be instantiated.
The web-interface will also show the connection status of instantiated interfaces (is the coin-api server connected to the skycoin node? is the coin api-server successfully connected to a BCTD node, etc).
Note:
- for reference code for BTC transaction signing, see the teller repo https://github.com/skycoin/teller
- for reference code for SKY api usage, see teller repo https://github.com/skycoin/teller
Architecture Choices
- we can have one server that supports multiple coins (BTC, SKY, etc) with one server and multiple interface instantiations (one for BTC, one for SKY)
- OR we can create a server that exposes the coin-api, but which requires the coin/interface type specified at startup and only allows one instantiation