Skip to content

Instantly share code, notes, and snippets.

@matiu
Created July 21, 2014 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matiu/0a1d7217c99350936d92 to your computer and use it in GitHub Desktop.
Save matiu/0a1d7217c99350936d92 to your computer and use it in GitHub Desktop.
Copay / updated.

Copay

Copay is an open-source multisig wallet. Each peer is has control of her private keys, that never leave their system. Copay has two components: a client and a p2p network of servers. The servers form a p2p global network that exchange messages between clients and provide Bitcoin blockchain API services using insight-API.

Copay-client is implemented in JS client-side. It can work as a:

  • web app,
  • a webview based mobile app,
  • or a node-kit based desktop app.

In all cases, Copay source code is mostly the same, and it works out of the box in all modern browers. Copay-Client only open one single network connection to one node on the Copay server network, to exchange messages and query the blockchain.

Copay Server

Copay client relies on the Copay server p2p network to operate. Copay Server software is open-source, and many open instances are expected to exists. Copay server tasks are: 1)- relay messages between wallet participants 2)- interact with the Bitcoin Network

Servers can not decrypt or forge peer messages given the current authentication-encryption schema. Each message is stored and retrived from the server using the recipent's SIN as only parameter. Messages have a TTL defined by the uploading client, with a limit defined by the server. Each node make the messages available to the client using STOMP destionations (like /dsub/<SIN>)

Copay-server should be fairly easy to setup, and Linux installation should be as easy as installing a web server. We should expect multiple open copay servers to exists, as today multiple Insight installations are available.

Copay servers are a true p2p network, in which relayed messages are distributed between all the p2p network participants, with a defined TTL. Clients could connect, upload and download messages to any Copay server p2p network participant, and those messages would be copied in all installations.

In order to provide some DOS protection, Copay server limit the rate of messages received per IP, and the queue size per SINs.

When configuring a Copay server, the main options are:

  • date to start syncing (default: now). Insight-api, the module that implements 2), does not need to sync from the beginning of the blockchain, only from the block since the served wallets were created.
  • spawn a new full node bitcoind server or use a existing installation (*)
  • Maximun TTL for message relaying

(*) could eventually be replaced by a bitcore-based full node or SPV.

Copay Client

The main configuration of Copay Client is the location of a Copay server of trust. The only network connection going out from a Copay client in usage is the Copay server. The client uses STOMP to communicate to the server, could use a different HTTP connection to the same server to query the blockchain, or query the blockchain using a STOMP special queue, with will be processed by the server an return the results to the client using it's SIN destionation.

@yemel
Copy link

yemel commented Jul 21, 2014

The Insight-api needs to be fully synced with the blockchain, because any copay client could start using that P2P node at any time, with wallets created before the setup of the server.

A Copay client should be able to create a wallet being connected to a Copay Server and later change it to other server and continue working properly.

@matiu
Copy link
Author

matiu commented Jul 21, 2014

@yemel agree. But we can start syncing from the day the copay network is established (ie 2014, and not 2009, right?)

@cmgustavo
Copy link

I like you could use an existing insight installation. This will be useful for insight's community that already installed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment