This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SORTS ELEMENTS OF AN ARRAY | |
// http://jsbin.com/rutumeh/edit?js,console | |
var sortBy = (function () { | |
var _toString = Object.prototype.toString, | |
//the default parser function | |
_parser = function (x) { return x; }, | |
//gets the item to be sorted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Require the libraries we need to make this magic happen | |
var bitcoin = require(‘bitcoinjs-lib’); | |
var request = require(‘request’); | |
var blockchain = require(‘blockchain.info’); | |
var blockexplorer = require(‘blockchain.info/blockexplorer’); | |
// Export this module so you can easily call it from your main application | |
exports.opReturn = function (message, fromKey, toAddress) { | |
// Create a new promise that can only resolve or reject | |
return new Promise(function(resolve, reject) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitcoin = require('bitcoinjs-lib'); | |
var request = require('request'); | |
function getUnspent(address) { | |
var url ='https://bitcoin.toshi.io/api/v0/addresses/'+address+'/unspent_outputs'; | |
request(url, function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
var body = JSON.parse(body); | |
var total = 0; | |
var transactions = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitcoin = require('bitcoinjs-lib') | |
var fs = require("fs") | |
function randomString(length, chars) { | |
var result = ''; | |
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; | |
return result; | |
} | |
function makePair(params) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitcoin = require('bitcoinjs-lib') | |
var fs = require("fs") | |
function randomString(length, chars) { | |
var result = ''; | |
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)]; | |
return result; | |
} |
NewerOlder