bitcore-wallet-service/README.md

93 lines
4.2 KiB
Markdown
Raw Normal View History

2015-02-17 13:51:15 -08:00
# bitcore-wallet-service
2015-02-20 10:15:08 -08:00
2015-02-20 10:14:00 -08:00
[![Build Status](https://img.shields.io/travis/bitpay/bitcore-wallet-service.svg?branch=master&style=flat-square)](https://travis-ci.org/bitpay/bitcore-wallet-service)
2015-02-21 14:22:21 -08:00
[![Coverage Status](https://coveralls.io/repos/bitpay/bitcore-wallet-service/badge.svg?branch=master)](https://coveralls.io/r/bitpay/bitcore-wallet-service?branch=master)
2015-02-20 10:12:37 -08:00
2015-03-02 21:17:21 -08:00
A Multisig HD Wallet Service, with minimum trust.
2015-02-17 13:51:15 -08:00
2015-03-03 21:03:56 -08:00
# Description
2015-02-17 13:51:15 -08:00
2015-03-03 21:03:56 -08:00
Bitcore Wallet Service facilitates multisig HD wallets creation and operation thru a (hopefully) simple and intuitive REST API.
2015-02-24 07:51:14 -08:00
2015-03-03 21:03:56 -08:00
BWS can usually be installed within minutes and acommodates all the needed infrastruture for peers in a multisig wallet to communicate, and operate with minimun server trust.
2015-02-23 19:19:40 -08:00
2015-03-03 21:03:56 -08:00
See [Bitcore-wallet-client] (https://github.com/bitpay/bitcore-wallet-client) for the *official* client library that communicates to BWS, and verifies its responsed. Also check [Bitcore-wallet] (https://github.com/bitpay/bitcore-wallet) for a simple CLI wallet implementation that relays on BWS.
2015-02-23 19:19:40 -08:00
2015-03-03 21:03:56 -08:00
# Peer's Local data
Peer need to store their *extended private key* and other participant peers' extended public key locally. We call this the ``Credentials``. *Extended private keys* are **never** sent to BWS.
2015-02-21 19:11:59 -08:00
## Mobility
2015-03-03 21:03:56 -08:00
Peers can safely access a wallet from different devices at the same time by copying their credentials.
2015-02-21 19:11:59 -08:00
2015-03-03 21:03:56 -08:00
## Agent support
2015-02-21 18:45:34 -08:00
2015-03-04 09:31:52 -08:00
BWS supports signing and non signing agents.
Agents can be given a wallet secret, and join the wallet during creation, and act as with the same status of a regular peer. Agents can also be created by *cloning* one peer's data (and optionally removing its private key). By removing the private key, the resulting agent wont be able to sign transactions.
Agent support is [planned to be extended](https://github.com/bitpay/bitcore-wallet-service/issues/114) in following releases.
2015-03-03 21:03:56 -08:00
## Airgapped Operation
2015-03-04 09:31:52 -08:00
[TODO be documented]
2015-02-21 18:45:34 -08:00
2015-03-03 21:03:56 -08:00
## Security Considerations
2015-03-02 21:17:21 -08:00
* Private keys are never sent to BWS. Copayers store them locally.
* Extended public keys are stored on BWS. This allows BWS to easily check wallet balance, send offline notifications to copayers, etc.
2015-02-27 21:45:47 -08:00
* During wallet creation, the initial copayer creates a wallet secret that contains a private key. All copayers need to prove they have the secret by signing their information with this private key when joining the wallet. The secret should be shared using secured channels.
2015-02-17 22:55:34 -08:00
2015-03-02 21:17:21 -08:00
## All BWS responses are verified:
2015-02-27 21:45:47 -08:00
* Addresses and change addresses are derived independently and locally by the copayers from their local data.
2015-03-02 21:17:21 -08:00
* TX Proposals templates are signed by copayers and verified by others, so the BWS cannot create or tamper with them.
2015-02-17 14:09:28 -08:00
2015-02-17 22:55:34 -08:00
## Notes
2015-03-04 09:31:52 -08:00
* A copayer could join the wallet more than once, and there is no mechanism to prevent this. See [wallet]((https://github.com/bitpay/bitcore-wallet)'s confirm command, for a method for confirming copayers.
2015-02-21 09:49:16 -08:00
2015-03-04 09:31:52 -08:00
# REST API
2015-02-17 22:55:34 -08:00
2015-03-04 09:31:52 -08:00
## Authentication
2015-02-21 18:45:34 -08:00
2015-03-04 09:31:52 -08:00
In order to access a wallet, clients are required to send the headers:
```
x-identity
x-signature
```
Identity is the Peer-ID, this will identify the peer and its wallet. Signature is the current request signature, using `requestSigningKey`, the `m/1/1` derivative of the Extended Private Key.
2015-02-21 19:11:59 -08:00
2015-03-04 09:31:52 -08:00
See [Bitcore Wallet Client](https://github.com/bitpay/bitcore-wallet-client/blob/master/lib/api.js#L73) for implementation details.
2015-02-21 19:11:59 -08:00
2015-03-04 09:31:52 -08:00
## GET Endpoinds
`/v1/wallets/`: Get wallet information
`/v1/txhistory/`: Get Wallet's transaction history
`/v1/txproposals/`: Get Wallet's pending transaction proposals and their status
`/v1/addresses/`: Get Wallet's main addresses (does not include change addresses)
2015-02-21 19:11:59 -08:00
2015-03-04 09:31:52 -08:00
`/v1/balance/`: Get Wallet's balance
## POST Endpoinds
`/v1/wallets/`: Create a new Wallet
`/v1/wallets/:id/copayers/`: Join a Wallet in creation
`/v1/txproposals/`: Add a new transactionproposal
`/v1/addresses/`: Request a new main address from wallet
`/v1/txproposals/:id/signatures/`: Sign a transaction proposal
`/v1/txproposals/:id/broadcast/`: Broadcast a transaction proposal
`/v1/txproposals/:id/rejections`: Reject a transaction proposal
## DELETE Endpoinds
`/v1/txproposals/:id/`: Deletes a transaction proposal. Only the creator can delete a TX Proposal, and only if it has no other signatures or rejections
2015-02-17 14:09:28 -08:00
2015-03-03 21:03:56 -08:00