Skip to content

Instantly share code, notes, and snippets.

Matias Alejo Garcia matiu

  • Bitpay Inc.
  • Tucuman, Argentina
Block or report user

Report or block matiu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3663f71080002321de9b

Normal Operation

bit create myWallet 2-3
bit address
bit send <>

View gist:a7e4531fa567d8e65a29

Client / Sign and extract DER

var clientSign = function(tx, xpriv, n) {
  //Derive proper key to sign, for each input
  var privs = [],
    derived = {};
  var xpriv = new Bitcore.HDPrivateKey(someXPrivKey[0]);

  _.each(tx.inputs, function(i) {
View gist:057cac1e90b8fdd7e5a6
var b = require('bitcore');
var priv = new b.PrivateKey();
var pub = new b.PublicKey(priv);
var inputs =
[ { txid: 'e872a0fda0afd0bce31ddfd9229c9eca2a68e4746615b8a0902b7a657b83676d',
vout: 8,
amount: 100,
scriptPubKey: b.Script.buildPublicKeyHashOut(pub).toBuffer().toString('hex') } ] ;
matiu / gist:ca171251d9940c348058
Last active Aug 29, 2015
Rejoin broken wallet
View gist:ca171251d9940c348058

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':'';
View gist:64730ea6a76053ba609b
  1. Insight commit 70fc47f343417a5bd71241d42bd579c2949b54ef Author: Rainer Koirikivi Date: Mon Nov 3 22:59:38 2014 +0200

    Friendlier error reporting for sendRawTransaction

  2. borro emailstorage db

View gist:754e02c7c3af54535767
  1. fetch insight #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 ( password 123)
  7. close it and open it to test. Create some address and receive some btcs.
View gist:fd16b188fd0fe9025ea0
 $ git clone -b bug/swipe --single-branch
 $ cd copay
 $ bower i
 $ npm i
 $ grunt
 $ util/swipeWallet.js XXX
matiu / gist:07786e0d875b4093accb
Last active Aug 29, 2015
Copay, joining a wallet overview
View gist:07786e0d875b4093accb
Joining a wallet
Creator (C) <-> Joining Peer (J)
<- Hello (secret random, peerPubkey) encrypted with creatorPubkey
(async._addConnectedPeer, emit 'connect', w.sendWalletId)
matiu / gist:cf0a1d65865e544899b6
Last active Aug 29, 2015
Two JS Testing Tips
View gist:cf0a1d65865e544899b6
  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');'name'); // Wrong
  clase.getName().should.equal('name'); //Right
View gist:036e8a3ccfb468c97a64
var opts = {
blockchain: new Blockchain(...),,
storage: localstorage / insight / drive,
networking: new Async(...),
Identity.create(email, password, opts, function(err, iden){
You can’t perform that action at this time.