Skip to content

Instantly share code, notes, and snippets.

View matiu's full-sized avatar

ematiu matiu

  • Bitpay Inc.
  • Tucuman, Argentina
View GitHub Profile
@matiu
matiu / gist:0a1d7217c99350936d92
Created July 21, 2014 17:58
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.
@matiu
matiu / gist:3305c42b341916fb7afc
Last active August 29, 2015 14:05
Copay: Remove transaction proposals

Remove TxProposals

@matiu
matiu / gist:0d5201b89c2f9ed8e23e
Last active August 29, 2015 14:05
Copay Recovery Process

This procedure is for reseting a Copay Wallet status, reseting its transactions proposals, addresses and peer metainfo. It should be used as a last resource to recover wallet's funds, in case there is an error on the wallet or a corrupted backup.

A. Gathering the information

  1. You need to have access of the ALL peers of the wallet (*)
  2. If you will run the procedure on the same computer, BE SURE not to use the same browser, since localStorage is shared. You can use: 1 Chrome window, and 1 Chrome incognito window, 1 Firefox window, 1 Firefox incognito window.
  3. Start by creating backups of all the peers.
  4. Go to 'More' in the peers wallet, and add the &advanced=1 at the end of the URL. This should show some advanced options
  5. Take note of the Master Private Key of ALL the peers.
@matiu
matiu / gist:036e8a3ccfb468c97a64
Last active August 29, 2015 14:06
Identity API
var opts = {
blockchain: new Blockchain(...),,
storage: localstorage / insight / drive,
networking: new Async(...),
};
Identity.create(email, password, opts, function(err, iden){
//
})
@matiu
matiu / gist:cf0a1d65865e544899b6
Last active August 29, 2015 14:07
Two JS Testing Tips
  1. Test only one class at time. Use sinon.stub (.returns & .yields) to create on the fly mockups for dependencies.
  2. Test the API Only. Never access class internals for checking / setting values. Use the API, this prevents to brake test in the future. E.g.:
  class.setName('name');
  class.name.should.equal('name'); // Wrong
  clase.getName().should.equal('name'); //Right
@matiu
matiu / gist:07786e0d875b4093accb
Last active August 29, 2015 14:07
Copay, joining a wallet overview
Joining a wallet
================
Creator (C) <-> Joining Peer (J)
(J)
<- Hello (secret random, peerPubkey) encrypted with creatorPubkey
(C)
(async._addConnectedPeer, emit 'connect', w.sendWalletId)
@matiu
matiu / gist:fd16b188fd0fe9025ea0
Last active August 29, 2015 14:08
swipe Tool
 $ git clone -b bug/swipe --single-branch https://github.com/matiu/copay.git
 $ cd copay
 $ bower i
 $ npm i
 $ grunt
 $ util/swipeWallet.js XXX
@matiu
matiu / gist:754e02c7c3af54535767
Last active August 29, 2015 14:09
Falcon tests
  1. fetch insight #f2e33fcad34f76bed1e8a60a30751793f9a721cb https://github.com/bitpay/insight-api/commit/f2e33fcad34f76bed1e8a60a30751793f9a721cb
  2. fetch Copay master #9e695863edd31cce9979250f2b625258b787c073
  3. modify config.js to point to localhost
  4. run insight: ENABLE_MAILBOX="true" ENABLE_EMAILSTORE="true" ./insight.js
  5. check that creating a user with password with "!" does not work.
  6. create a profile ([email protected] password 123)
  7. close it and open it to test. Create some address and receive some btcs.
  1. Insight commit 70fc47f343417a5bd71241d42bd579c2949b54ef Author: Rainer Koirikivi [email protected] Date: Mon Nov 3 22:59:38 2014 +0200

    Friendlier error reporting for sendRawTransaction

  2. borro emailstorage db

@matiu
matiu / gist:ca171251d9940c348058
Last active August 29, 2015 14:12
Rejoin broken wallet

The following is a procedure to grab the extended priv key, for copayers that are

  • Open the wallet in Chrome
  • Open the javascript console
  • Inspect an element on the html (could be any element), inspect by using the magnifing glass.

After selecting an item, go back to the javascript console and type:

 var w= angular.element($0).scope().wallet; w?'OK':'';