Skip to content

Instantly share code, notes, and snippets.

@yemel
yemel / gist:9993627
Created April 5, 2014 15:52
Trustless Prepaid Service
Integrantes: C) Cliente, T) ThirdParty, P) Proveedor
C genera 3 claves privadas y una bitcoin address que para la que se le pueden retirar fondos con 2 de 3 de esas claves (todo esto client-side)
A carga fondos a esa address, entrega una clave privada a T y otra clave privada a P. Los fondos cargados corresponderían al prepago, por ejemplo dinero suficiente para un año de servicio de X.
Cuando C le pasa la clave privada a T también informa las condiciones de pago que exigirá P, como pueden ser: gasto máximo en un periodo y la frecuencia de cobro.
Finalmente el proceso de pago sería el siguiente:
@yemel
yemel / auth.js
Last active August 29, 2015 13:58
"use strict";
var pg = require('pg');
var crypto = require('crypto');
var DATABASE_URL = process.env.DATABASE_URL;
// -------- Cryptographic functions --------
// Passwords are represented as SALT:SHA1_HASH in base64.
var auth = require('./auth.js')
function testAuthentication(username, password) {
auth.authenticateUser(username, password, function onResult(isAuthenticated){
console.log(username + ' can authenticate with '+ password
+ ' --> ' + isAuthenticated);
});
}
function runTest(){

Goal

The main goal of this refactor is to define a proper separation between the frontend and the backend of the application. Although Copay is a 100% client side application, a clean separation of the core functionalities is needed to later offer different endpoints, eg. web interface, npm command line interface or just a library that runs both on server and browser.

Layers of application

Three layers are proposed for the application:

  1. UI Interface: AngularJS | CLI
  2. Wallet Models and Services
  3. Backing Services: P2P Networking | Blockchain | Storage
@yemel
yemel / gist:03f1af168cfa02ea469d
Created June 18, 2014 13:22
Bitcore - Key generation
var bitcore = require('bitcore');
bitcore.buffertools.extend();
var k1 = new bitcore.Key.generateSync();
var pk1 = k1.private.toHex(); // save private key
// Load Key:
var k = new bitcore.Key();
var pkshex = 'b7dafe35d7d1aab78b53982c8ba554584518f86d50af565c98e053613c8f15e0'; // the saved key
@yemel
yemel / gist:449c5552ab386ca1172a
Created July 22, 2014 18:14
Mobile changes for friday
* Show empty addresses of other copayers (all versions)
* Camera: QR scanning and amount
* URI link on Addresses tab for easier loading into the wallet
* URI handling to create spending proposal on Android and browser extensions
* Backup: Email attachment / QR backup generation.
* Android Menu Button
Related Tickets:
https://github.com/bitpay/copay/issues/914
https://github.com/bitpay/copay/issues/916

bitcoin:3CpwZfu42griwnbQ3ZU63Vbcx9hCdVxfiK

@yemel
yemel / gist:543e10fe2105bb519e8b
Created August 21, 2014 20:35
Design - Copay v1.0

Pending issues

  • Testnet details
  • Delete wallet flow
  • Backup flow
  • Payment protocol TRUST icon
@yemel
yemel / copay.md
Last active August 29, 2015 14:05
Copay v1.0

Copay v1.0

The present document describes the proposed changes to Copay.

Design

Be competitive. Win market share. Redesigned with a user-centered approach. Great proof-of-concept, move from the prototype stage to something usable.

Design aspects

@yemel
yemel / SKD.md
Last active August 29, 2015 14:06

Cordova SDK

Please go to http://test.bitpay.com to create an account. After registrarion, depending the kind of application you are building the pairing process you'll need to follow.

Install the SDK plugin

$ cordova plugin add https://github.com/bitpay/cordova-skd.git

Generate Application Key

Use case: Generating and tracking invoices.