Skip to content

Instantly share code, notes, and snippets.

View matiu's full-sized avatar

ematiu matiu

  • Bitpay Inc.
  • Tucuman, Argentina
View GitHub Profile
Cosign.prototype.cmd_raw_sign_scripthash = function(anypay, tx, i, scriptPubKey, txSigHash)
{
var scriptHash = scriptPubKey.capture()[0];
var addr = new Address(this.network.addressScript, scriptHash);
var addrStr = addr.as('base58');
if (!(addrStr in this.wallet.datastore.scripts))
return;
var scriptHex = this.wallet.datastore.scripts[addrStr];
//...
@matiu
matiu / gist:9833812
Last active August 29, 2015 13:57
Proposed TransactionBuilder Interfase.
/* create and sign */
var tx = TransactionBuilder.init(opts)
.addUtxos(utxos)
.addOutputs(outs)
.addKeys(keys)
.build();
broadcast(tx.serialize());
'use strict';
var imports = require('soop').imports();
var bitcore = require('bitcore');
var Storage = imports.Storage || require('./Storage');
function Wallet(opts) {
opts = opts || {};
this.network = opts.network === 'livenet' ?
bitcore.networks.livenet : bitcore.networks.testnet;