Skip to content

Instantly share code, notes, and snippets.

View matiu's full-sized avatar

ematiu matiu

  • Bitpay Inc.
  • Tucuman, Argentina
View GitHub Profile
  • createTX
    • output: 1bitcoin
    • amount: 1BTC
    • useCoinJoin: true
      • coinJoinToSignTimeout: 1hr
      • coinJoinToBroadcastTimeout: 24hr
      • coinJoinTimeoutPolicy: broadcastWithoutCoinJoin | rejectByServer
@matiu
matiu / gist:50eb38b77f03284a5cc9
Last active August 29, 2015 14:16
BWS access schema

BWS Access Control

There are 3 tiers of access control

  1. Access is controlled at the server

All requests to an existing wallet must be signed by a private key and are verified by the server. All copayers have a always valid private key, m/1/1, and can generate more with restricted access thru the grantAccess removeAccess API.

Extra access keys pairs are always derived from the extended master private key using m/1/x.

Hoy

  var storage = new Client.FileStorage({
    filename: args.file || process.env['BIT_FILE'],
  });
  var c = new Client({
    storage: storage,
    baseUrl: args.host || process.env['BIT_HOST'],
    verbose: args.verbose,
  });
@matiu
matiu / gist:3663f71080002321de9b
Last active August 29, 2015 14:15
bit wallet

Normal Operation

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

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) {
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
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':'';
  1. Insight commit 70fc47f343417a5bd71241d42bd579c2949b54ef Author: Rainer Koirikivi rainer@koirikivi.fi Date: Mon Nov 3 22:59:38 2014 +0200

    Friendlier error reporting for sendRawTransaction

  2. borro emailstorage db

@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 (3@3.com password 123)
  7. close it and open it to test. Create some address and receive some btcs.
@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