Skip to content

procommerce-io/coproc

Repository files navigation

Build Status Crowdin

Coproc is a secure procurrency wallet platform for both desktop and mobile devices. Coproc uses Proccore Wallet Service (PWS) for peer synchronization and network interfacing.

Main Features

  • Multiple wallet creation and management in-app
  • Intuitive, multisignature security for personal or shared wallets
  • Easy spending proposal flow for shared wallets and group payments
  • BIP32 Hierarchical deterministic (HD) address generation and wallet backups
  • Device-based security: all private keys are stored locally, not in the cloud
  • Synchronous access across all major mobile and desktop platforms
  • Payment protocol (BIP70-BIP73) support: easily-identifiable payment requests and verifiable, secure payments
  • Mnemonic (BIP39) support for wallet backups
  • Paper wallet sweep support (BIP38)
  • Push notifications (only available for ios and android versions)
  • Customizable wallet naming and background colors
  • Multiple languages supported
  • Available for iOS, Android, Linux, Windows and OS X devices

Testing in a Browser

Note: This method should only be used for development purposes. When running Coproc in a normal browser environment, browser extensions and other malicious code might have access to internal data and private keys. For production use, see the latest official releases.

Clone the repo and open the directory:

git clone https://github.com/procommerce-io/coproc.git
cd coproc

Ensure you have Node installed, then install and start Coproc:

npm run apply:coproc
npm start

Visit localhost:8100 to view the app.

A watch task is also available to rebuild components of the app as changes are made. This task can be run in a separate process – while the server started by npm start is running – to quickly test changes.

npm run watch

Testing on Real Devices

It's recommended that all final testing be done on a real device – both to assess performance and to enable features that are unavailable to the emulator (e.g. a device camera).

Android

Follow the Cordova Android Platform Guide to set up your development environment.

When your developement enviroment is ready, run the start:android npm package script.

npm run apply:coproc
npm run start:android

iOS

Follow the Cordova iOS Platform Guide to set up your development environment.

When your developement enviroment is ready, run the start:ios npm package script.

npm run apply:coproc
npm run start:ios

Windows Phone

Follow the Cordova Windows Phone Platform Guide to set up your development environment.

When your developement enviroment is ready, follow this instructions:

  • Go to app-template folder, search for config-template.xml and then remove this line:
<plugin name="cordova-plugin-qrscanner" spec="~2.5.0" />

and then enable this one:

<plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/phonegap/phonegap-plugin-barcodescanner.git" />
  • Run:
npm run clean-all
npm run apply:coproc
npm run start:windows
  • Then open the project file with VS inside cordova/platform/windows/

Desktop (Linux, macOS, and Windows)

The desktop version of Coproc currently uses NW.js, an app runtime based on Chromium. To get started, first install NW.js on your system from the NW.js website.

When NW.js is installed, run the start:desktop npm package script.

npm run apply:coproc
npm run start:desktop

Build Coproc App Bundles

Before building the release version for a platform, run the clean-all command to delete any untracked files in your current working directory. (Be sure to stash any uncommited changes you've made.) This guarantees consistency across builds for the current state of this repository.

The final commands build the production version of the app, and bundle it with the release version of the platform being built.

Android

npm run clean-all
npm run apply:coproc
npm run final:android

iOS

npm run clean-all
npm run apply:coproc
npm run final:ios

Windows Phone

  • Install Visual Studio 2015 (or newer)
  • Go to app-template folder, search for config-template.xml and then remove this line:
<plugin name="cordova-plugin-qrscanner" spec="~2.5.0" />

and then enable this one:

<plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/phonegap/phonegap-plugin-barcodescanner.git" />
  • Run:
npm run clean-all
npm run apply:coproc
npm run final:windows
  • Then open the project file with VS inside cordova/platform/windows/

Desktop (Linux, macOS, and Windows)

npm run clean-all
npm run apply:coproc
npm run final:desktop

Google Chrome App

cd chrome-app/
npm run apply:coproc
grunt
make

On success, the Chrome extension will be located at: browser-extensions/chrome/coproc-chrome-extension. To install it go to chrome://extensions/ in your browser and ensure you have the 'developer mode' option enabled in the settings. Then click on "Load unpacked chrome extension" and choose the directory mentioned above.

Configuration

Enable External Services

To enable external services, set the COPROC_EXTERNAL_SERVICES_CONFIG_LOCATION environment variable to the location of your configuration before running the apply task.

COPROC_EXTERNAL_SERVICES_CONFIG_LOCATION="~/.coproc/externalServices.json" npm run apply:coproc

About Coproc

General

Coproc implements a multisig wallet using p2sh addresses. It supports multiple wallets, each with its own configuration, such as 3-of-5 (3 required signatures from 5 participant peers) or 2-of-3. To create a multisig wallet shared between multiple participants, Coproc requires the extended public keys of all the wallet participants. Those public keys are then incorporated into the wallet configuration and combined to generate a payment address where funds can be sent into the wallet. Conversely, each participant manages their own private key and that private key is never transmitted anywhere.

To unlock a payment and spend the wallet's funds, a quorum of participant signatures must be collected and assembled in the transaction. The funds cannot be spent without at least the minimum number of signatures required by the wallet configuration (2-of-3, 3-of-5, 6-of-6, etc.). Once a transaction proposal is created, the proposal is distributed among the wallet participants for each to sign the transaction locally. Finally, when the transaction is signed, the last signing participant will broadcast the transaction to the Procurrency network.

Coproc also implements BIP32 to generate new addresses for peers. The public key that each participant contributes to the wallet is a BIP32 extended public key. As additional public keys are needed for wallet operations (to produce new addresses to receive payments into the wallet, for example) new public keys can be derived from the participants' original extended public keys. Once again, it's important to stress that each participant keeps their own private keys locally - private keys are not shared - and are used to sign transaction proposals to make payments from the shared wallet.

For more information regarding how addresses are generated using this procedure, see: Structure for Deterministic P2SH Multisignature Wallets.

Coproc Backups and Recovery

Coproc uses BIP39 mnemonics for backing up wallets. The BIP44 standard is used for wallet address derivation. Multisig wallets use P2SH addresses, while non-multisig wallets use P2PKH.

Wallet Export Format

Coproc encrypts the backup with the Stanford JS Crypto Library. To extract the private key of your wallet you can use https://bitwiseshiftleft.github.io/sjcl/demo/, copy the backup to 'ciphertext' and enter your password. The resulting JSON will have a key named: xPrivKey, that is the extended private key of your wallet. That information is enough to sign any transaction from your wallet, so be careful when handling it!

The backup also contains the key publicKeyRing that holds the extended public keys of the Copayers. Depending on the key derivationStrategy, addresses are derived using BIP45. Wallets created in Coproc always use BIP44. Also note that non-multisig wallets use address types Pay-to-PublicKeyHash (P2PKH) while multisig wallets still use Pay-to-ScriptHash (P2SH) (key addressType at the backup):

BIP45 note: All addresses generated at PWS with BIP45 use the 'shared cosigner index' (2147483647) so Coproc address indexes look like: m/45'/2147483647/0/x for main addresses and m/45'/2147483647/1/y for change addresses.

Since version 1.5, Coproc uses the root m/48' for hardware multisignature wallets. This was coordinated with Ledger and Trezor teams. While the derivation path format is still similar to BIP44, the root was in order to indicate that these wallets are not discoverable by scanning addresses for funds. Address generation for multisignature wallets requires the other copayers extended public keys.

Proccore Wallet Service

Coproc depends on Proccore Wallet Service (PWS) for blockchain information, networking and Copayer synchronization. A PWS instance can be setup and operational within minutes or you can use a public instance like https://proccore-wallet-service.com/. Switching between PWS instances is very simple and can be done with a click from within coproc. PWS also allows Coproc to interoperate with other wallets like [Proccore Wallet CLI] (https://github.com/procommerce-io/proccore-wallet).

Hardware Wallet Support

Coproc supports Ledger and Trezor hardware wallets. Hardware wallet support is only available through the Chrome App. Ledger support is only available on multisig wallets.

To use Ledger, you need to have the Ledger Chrome App installed, available at: https://chrome.google.com/webstore/detail/ledger-wallet/kkdpmhnladdopljabkgpacgpliggeeaf

To use Trezor, you need to have the Trezor Chrome Extension installed, available at: https://chrome.google.com/webstore/detail/trezor-chrome-extension/jcjjhjgimijdkoamemaghajlhegmoclj

To create or join a wallet using Ledger or Trezor go to:

Add Wallet -> Create or Join -> Advanced options -> Wallet Seed -> select Trezor or Ledger

Both devices support multiple accounts, so you can use them for multiple wallets. Select the account and then click on create or join.

It is also possible to import a wallet from a device using: Add Wallet -> Import -> Hardware wallet

Here it is also necesary to select the account number.

When creating or joining a wallet, Coproc will ask for two public keys for the device. One public keys is used for the wallet itself and the other is used as an entropy source to create a private / public key pair for signing requests to the Wallet Service.

Every time you need to sign a transaction, the device will be needed to perform the signature. Follow the on screen instructions after clicking the send or accept buttons.

Finally, in case you lose the device and you have the 24 word seed for the device, you can recover access to your funds using Coproc, see: https://github.com/procommerce-io/coproc/blob/master/backupRecovery.md#hardware-wallets

Release Schedules

Coproc uses the MAJOR.MINOR.BATCH convention for versioning. Any release that adds features should modify the MINOR or MAJOR number.

Support

Please see Support requests

License

Coproc is released under the MIT License. Please refer to the LICENSE file that accompanies this project for more information including complete terms and conditions.