bitcore-wallet-service/README.md

111 lines
4.0 KiB
Markdown
Raw Normal View History

2015-02-17 13:51:15 -08:00
# bitcore-wallet-service
2015-02-17 14:09:28 -08:00
A Multisig HD Wallet Service, with minimun server trust.
2015-02-17 13:51:15 -08:00
# Quick Guide
``` bash
# Start the server
npm ./app.js
2015-02-17 22:55:34 -08:00
# Try the CLI interface
2015-02-17 13:51:15 -08:00
cd bit-wallet
2015-02-17 22:55:34 -08:00
# Create a 2-2 wallet (john.dat is the file were the wallet critical data will be stored, add -t for testnet)
./bit -c john.dat create 2-2 john
2015-02-17 13:51:15 -08:00
* Secret to share:
0a18bed5-5607-4fde-a809-dc6561bc0664:L3WtafRAEHty7h2J7VCHdiyzFboAdVFnNZXMmqDGw4yiu5kW9Tp4:T
./bit -c join.dat status
2015-02-17 22:55:34 -08:00
# User -h or BIT_HOST to setup the base URL for your server.
# Join the wallet from other copayer
2015-02-17 13:51:15 -08:00
./bit -c pete.dat join 0a18bed5-5607-4fde-a809-dc6561bc0664:L3WtafRAEHty7h2J7VCHdiyzFboAdVFnNZXMmqDGw4yiu5kW9Tp4:T
./bit -c pete.dat status
2015-02-17 22:55:34 -08:00
# Sets default file to use
2015-02-17 13:51:15 -08:00
export BIT_FILE=pete.dat
2015-02-17 15:31:03 -08:00
export BIT_HOST=http://pepe.com/bws
2015-02-17 13:51:15 -08:00
./bit address
[1bitcoinaddress]
./bit balance
2015-02-17 22:55:34 -08:00
# Spend coins. Values always in satoshis
2015-02-17 13:51:15 -08:00
./bit send 1xxxxx 100 "100 satoshis to mother"
2015-02-17 22:55:34 -08:00
# List pending TX Proposals
2015-02-17 13:51:15 -08:00
./bit status
2015-02-17 22:55:34 -08:00
# Sign or reject TXs from other copayers
./bit -c pete.data reject <id>
./bit -c pete.data sign <id>
# Export your critical wallet data (you need *quorum* of wallet's copayer to extract coins)
2015-02-17 13:55:37 -08:00
./bit export
# Or export it to a QR
./bit export --qr
2015-02-17 22:55:34 -08:00
# Import it later. It can be safetly used from multiple devices.
2015-02-17 13:55:37 -08:00
./bit import <file>
2015-02-17 22:55:34 -08:00
# In case you use a new server, recreate the wallet from our local information
./bit recreate
2015-02-17 13:51:15 -08:00
# List all commands:
./bit --help
2015-02-17 22:55:34 -08:00
2015-02-17 13:51:15 -08:00
```
2015-02-17 14:09:28 -08:00
# Server API
2015-02-17 14:09:56 -08:00
## create a wallet
2015-02-17 14:09:28 -08:00
POST `/v1/wallets`
2015-02-17 14:09:56 -08:00
## join a wallet
2015-02-17 14:09:28 -08:00
POST `/v1/wallets/:id/copayers`
2015-02-17 14:09:56 -08:00
2015-02-17 14:09:28 -08:00
...
2015-02-17 14:09:56 -08:00
2015-02-17 14:09:28 -08:00
[To be completed, see app.js]
2015-02-17 23:01:34 -08:00
# Local data
Copayers store its extended private key and their copayer's extended public key locally. We call this the ``Wallet Critical Data``.
2015-02-17 14:09:28 -08:00
# Security Considerations
* Private keys are never send to the server. Copayers store them locally.
2015-02-17 22:55:34 -08:00
* Extended public keys are stored on the server. This allow the server to easily check wallet's balances, send offline notifications to copayers, etc.
* During wallet creation a wallet secret is created by the initial copayer containg a private key. Following copayers need to proof the have the secret by signing their information with it to join the wallet. The secret should be shared using secured channels.
## All server responses are verified:
* Addresses, change addresses are derived independently and locally by the copayers from their local data.
2015-02-17 14:09:28 -08:00
* TX Proposals templates are signed by copayers, and verified by others, so the server cannot create / tamper them
2015-02-17 22:55:34 -08:00
## Notes
* A copayer could join the wallet more that one time, and there is not mechanism to prevent it. Copayers should use the command 'confirm' to check others copayer's identity.
## In case the server is compromised
* It could be possible to see past (and future) wallet's transactions.
* It is not possible to spend wallet's funds, since private keys are never send or stored at the server
* It is not possible to tamper tx proposal or wallet addresses since they are computed and verified by copayers
2015-02-17 23:01:34 -08:00
* Copayers could switch to other server using their local data (see `recreate` command). In this case only the wallet extended data will be lost. (Decorated TX History, some copayer metadata, pending transaction proposals, transacion proposal metadata).
2015-02-17 22:55:34 -08:00
2015-02-17 14:09:28 -08:00
# Export Format
Exporting a wallet will expose copayer's extended private key and other's copayers extended public keys. This information is enough to extract funds from the wallet, given the required quorum is meet.
2015-02-17 22:58:06 -08:00
The format is:
2015-02-17 23:01:34 -08:00
``` json
[ "(copayer extender private key)",
"required signatured",
"(array of other copayer's extended public keys, excluding this copayer)"]
2015-02-17 22:58:06 -08:00
```
2015-02-17 23:01:34 -08:00
Example, of a 1-2 wallet:
``` json
[
"tprv8ZgxMBicQKsPds3YbNWdCcsvxhnpjEecCJv1pBPCLEekwhwWNqpRwA283ASepgTnwAXhu4vZPeRAiX1CpPcjcY6izWSC3NVqyk1gWhF8xWy",
1,
["tpubD6NzVbkrYhZ4Y1DE1F6s4NWbLjwQSReggiksexkJ7R7p4tCKH1vmu7G9TafmkGs252PMrs5j6xz7uSiDLbUsE43eHbRa5wCauXqhJnhN9MB"]
]
2015-02-17 22:58:06 -08:00
```
2015-02-17 14:09:28 -08:00