├── node_modules ├── .bin │ ├── sha.js │ └── sha.js.cmd ├── base-x │ ├── LICENSE.md │ ├── README.md │ ├── index.js │ └── package.json ├── bech32 │ ├── README.md │ ├── index.js │ └── package.json ├── bigi │ ├── .npmignore │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── lib │ │ ├── bigi.js │ │ ├── convert.js │ │ └── index.js │ └── package.json ├── bip66 │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── bitcoin-ops │ ├── LICENSE │ ├── README.md │ ├── index.json │ ├── map.js │ └── package.json ├── bitcoinjs-lib │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ └── src │ │ ├── address.js │ │ ├── block.js │ │ ├── bufferutils.js │ │ ├── crypto.js │ │ ├── ecdsa.js │ │ ├── ecpair.js │ │ ├── ecsignature.js │ │ ├── hdnode.js │ │ ├── index.js │ │ ├── networks.js │ │ ├── script.js │ │ ├── script_number.js │ │ ├── templates │ │ ├── index.js │ │ ├── multisig │ │ │ ├── index.js │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── nulldata.js │ │ ├── pubkey │ │ │ ├── index.js │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── pubkeyhash │ │ │ ├── index.js │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── scripthash │ │ │ ├── index.js │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── witnesscommitment │ │ │ ├── index.js │ │ │ └── output.js │ │ ├── witnesspubkeyhash │ │ │ ├── index.js │ │ │ ├── input.js │ │ │ └── output.js │ │ └── witnessscripthash │ │ │ ├── index.js │ │ │ ├── input.js │ │ │ └── output.js │ │ ├── transaction.js │ │ ├── transaction_builder.js │ │ └── types.js ├── bs58 │ ├── CHANGELOG.md │ ├── README.md │ ├── index.js │ └── package.json ├── bs58check │ ├── LICENSE │ ├── README.md │ ├── base.js │ ├── index.js │ └── package.json ├── cipher-base │ ├── .eslintrc │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test.js ├── create-hash │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── index.js │ ├── md5.js │ ├── package.json │ └── test.js ├── create-hmac │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── index.js │ ├── legacy.js │ └── package.json ├── ecurve │ ├── .min-wd │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── README.md │ ├── lib │ │ ├── curve.js │ │ ├── curves.json │ │ ├── index.js │ │ ├── names.js │ │ └── point.js │ └── package.json ├── hash-base │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── inherits │ ├── LICENSE │ ├── README.md │ ├── inherits.js │ ├── inherits_browser.js │ └── package.json ├── md5.js │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── merkle-lib │ ├── LICENSE │ ├── README.md │ ├── fastRoot.js │ ├── index.js │ ├── package.json │ └── proof.js ├── pushdata-bitcoin │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── randombytes │ ├── .travis.yml │ ├── .zuul.yml │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── index.js │ ├── package.json │ └── test.js ├── ripemd160 │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── safe-buffer │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json ├── sha.js │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── bin.js │ ├── hash.js │ ├── index.js │ ├── package.json │ ├── sha.js │ ├── sha1.js │ ├── sha224.js │ ├── sha256.js │ ├── sha384.js │ ├── sha512.js │ └── test │ │ ├── hash.js │ │ ├── test.js │ │ └── vectors.js ├── typeforce │ ├── LICENSE │ ├── README.md │ ├── errors.js │ ├── extra.js │ ├── index.js │ ├── native.js │ └── package.json ├── varuint-bitcoin │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json └── wif │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ ├── fixtures.json │ └── index.js ├── p2pkh.js ├── p2sh-p2wpkh.js ├── p2wpkh.js ├── package-lock.json └── package.json /node_modules/.bin/sha.js: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | 4 | case `uname` in 5 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 6 | esac 7 | 8 | if [ -x "$basedir/node" ]; then 9 | "$basedir/node" "$basedir/../sha.js/bin.js" "$@" 10 | ret=$? 11 | else 12 | node "$basedir/../sha.js/bin.js" "$@" 13 | ret=$? 14 | fi 15 | exit $ret 16 | -------------------------------------------------------------------------------- /node_modules/.bin/sha.js.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe" "%~dp0\..\sha.js\bin.js" %* 3 | ) ELSE ( 4 | @SETLOCAL 5 | @SET PATHEXT=%PATHEXT:;.JS;=;% 6 | node "%~dp0\..\sha.js\bin.js" %* 7 | ) -------------------------------------------------------------------------------- /node_modules/base-x/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright base-x contributors (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/base-x/index.js: -------------------------------------------------------------------------------- 1 | // base-x encoding 2 | // Forked from https://github.com/cryptocoinjs/bs58 3 | // Originally written by Mike Hearn for BitcoinJ 4 | // Copyright (c) 2011 Google Inc 5 | // Ported to JavaScript by Stefan Thomas 6 | // Merged Buffer refactorings from base58-native by Stephen Pair 7 | // Copyright (c) 2013 BitPay Inc 8 | 9 | var Buffer = require('safe-buffer').Buffer 10 | 11 | module.exports = function base (ALPHABET) { 12 | var ALPHABET_MAP = {} 13 | var BASE = ALPHABET.length 14 | var LEADER = ALPHABET.charAt(0) 15 | 16 | // pre-compute lookup table 17 | for (var z = 0; z < ALPHABET.length; z++) { 18 | var x = ALPHABET.charAt(z) 19 | 20 | if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous') 21 | ALPHABET_MAP[x] = z 22 | } 23 | 24 | function encode (source) { 25 | if (source.length === 0) return '' 26 | 27 | var digits = [0] 28 | for (var i = 0; i < source.length; ++i) { 29 | for (var j = 0, carry = source[i]; j < digits.length; ++j) { 30 | carry += digits[j] << 8 31 | digits[j] = carry % BASE 32 | carry = (carry / BASE) | 0 33 | } 34 | 35 | while (carry > 0) { 36 | digits.push(carry % BASE) 37 | carry = (carry / BASE) | 0 38 | } 39 | } 40 | 41 | var string = '' 42 | 43 | // deal with leading zeros 44 | for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) string += LEADER 45 | // convert digits to a string 46 | for (var q = digits.length - 1; q >= 0; --q) string += ALPHABET[digits[q]] 47 | 48 | return string 49 | } 50 | 51 | function decodeUnsafe (string) { 52 | if (typeof string !== 'string') throw new TypeError('Expected String') 53 | if (string.length === 0) return Buffer.allocUnsafe(0) 54 | 55 | var bytes = [0] 56 | for (var i = 0; i < string.length; i++) { 57 | var value = ALPHABET_MAP[string[i]] 58 | if (value === undefined) return 59 | 60 | for (var j = 0, carry = value; j < bytes.length; ++j) { 61 | carry += bytes[j] * BASE 62 | bytes[j] = carry & 0xff 63 | carry >>= 8 64 | } 65 | 66 | while (carry > 0) { 67 | bytes.push(carry & 0xff) 68 | carry >>= 8 69 | } 70 | } 71 | 72 | // deal with leading zeros 73 | for (var k = 0; string[k] === LEADER && k < string.length - 1; ++k) { 74 | bytes.push(0) 75 | } 76 | 77 | return Buffer.from(bytes.reverse()) 78 | } 79 | 80 | function decode (string) { 81 | var buffer = decodeUnsafe(string) 82 | if (buffer) return buffer 83 | 84 | throw new Error('Non-base' + BASE + ' character') 85 | } 86 | 87 | return { 88 | encode: encode, 89 | decodeUnsafe: decodeUnsafe, 90 | decode: decode 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /node_modules/base-x/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "base-x@^3.0.2", 3 | "_id": "base-x@3.0.4", 4 | "_inBundle": false, 5 | "_integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==", 6 | "_location": "/base-x", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "base-x@^3.0.2", 12 | "name": "base-x", 13 | "escapedName": "base-x", 14 | "rawSpec": "^3.0.2", 15 | "saveSpec": null, 16 | "fetchSpec": "^3.0.2" 17 | }, 18 | "_requiredBy": [ 19 | "/bs58" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz", 22 | "_shasum": "94c1788736da065edb1d68808869e357c977fa77", 23 | "_spec": "base-x@^3.0.2", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bs58", 25 | "author": { 26 | "name": "Daniel Cousens" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/cryptocoinjs/base-x/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "dependencies": { 33 | "safe-buffer": "^5.0.1" 34 | }, 35 | "deprecated": false, 36 | "description": "Fast base encoding / decoding of any given alphabet", 37 | "devDependencies": { 38 | "standard": "^10.0.3", 39 | "tape": "^4.5.1" 40 | }, 41 | "files": [ 42 | "index.js" 43 | ], 44 | "homepage": "https://github.com/cryptocoinjs/base-x", 45 | "keywords": [ 46 | "base-x", 47 | "base58", 48 | "base62", 49 | "base64", 50 | "crypto", 51 | "crytography", 52 | "decode", 53 | "decoding", 54 | "encode", 55 | "encoding" 56 | ], 57 | "license": "MIT", 58 | "main": "index.js", 59 | "name": "base-x", 60 | "repository": { 61 | "type": "git", 62 | "url": "git+https://github.com/cryptocoinjs/base-x.git" 63 | }, 64 | "scripts": { 65 | "standard": "standard", 66 | "test": "npm run unit && npm run standard", 67 | "unit": "tape test/*.js" 68 | }, 69 | "version": "3.0.4" 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/bech32/README.md: -------------------------------------------------------------------------------- 1 | # bech32 2 | [![build status](https://secure.travis-ci.org/bitcoinjs/bech32.png)](http://travis-ci.org/bitcoinjs/bech32) 3 | [![Version](http://img.shields.io/npm/v/bech32.svg)](https://www.npmjs.org/package/bech32) 4 | 5 | A [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) compatible Bech32 encoding/decoding library. 6 | 7 | 8 | ## Example 9 | ``` javascript 10 | let bech32 = require('bech32') 11 | 12 | bech32.decode('abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw') 13 | // => { 14 | // prefix: 'abcdef', 15 | // words: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31] 16 | // } 17 | 18 | let words = bech32.toWords(Buffer.from('foobar', 'utf8')) 19 | bech32.encode('foo', words) 20 | // => 'foo1vehk7cnpwgry9h96' 21 | ``` 22 | 23 | 24 | ### Advanced 25 | BIP173 enforces a limitation of 90 characters, if extend the `LIMIT` parameter beyond this, be aware that the [effectiveness of checksum decreases as the length increases](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#checksum-design). 26 | 27 | It is highly recommended **NOT** exceed 1023 characters, as the module could only guarantee detecting 1 error. 28 | 29 | 30 | ## Credits 31 | - [Peter Wuille](https://github.com/sipa/bech32) for the reference JavaScript implementation, and for authoring the Bech32 [BIP173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki). 32 | 33 | 34 | ## License [MIT](LICENSE) 35 | -------------------------------------------------------------------------------- /node_modules/bech32/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bech32@^1.1.2", 3 | "_id": "bech32@1.1.3", 4 | "_inBundle": false, 5 | "_integrity": "sha512-yuVFUvrNcoJi0sv5phmqc6P+Fl1HjRDRNOOkHY2X/3LBy2bIGNSFx4fZ95HMaXHupuS7cZR15AsvtmCIF4UEyg==", 6 | "_location": "/bech32", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "bech32@^1.1.2", 12 | "name": "bech32", 13 | "escapedName": "bech32", 14 | "rawSpec": "^1.1.2", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.2" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.3.tgz", 22 | "_shasum": "bd47a8986bbb3eec34a56a097a84b8d3e9a2dfcd", 23 | "_spec": "bech32@^1.1.2", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "bugs": { 26 | "url": "https://github.com/bitcoinjs/bech32/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "dependencies": {}, 30 | "deprecated": false, 31 | "description": "Bech32 encoding / decoding", 32 | "devDependencies": { 33 | "nyc": "^10.2.0", 34 | "standard": "*", 35 | "tap-dot": "*", 36 | "tape": "^4.6.3" 37 | }, 38 | "files": [ 39 | "index.js" 40 | ], 41 | "homepage": "https://github.com/bitcoinjs/bech32#readme", 42 | "keywords": [ 43 | "base32", 44 | "bech32", 45 | "bitcoin", 46 | "crypto", 47 | "crytography", 48 | "decode", 49 | "decoding", 50 | "encode", 51 | "encoding" 52 | ], 53 | "license": "MIT", 54 | "main": "index.js", 55 | "name": "bech32", 56 | "repository": { 57 | "url": "git+ssh://git@github.com/bitcoinjs/bech32.git", 58 | "type": "git" 59 | }, 60 | "scripts": { 61 | "coverage": "nyc --check-coverage --branches 90 --functions 90 tape test/*.js", 62 | "standard": "standard", 63 | "test": "tape test/*.js | tap-dot" 64 | }, 65 | "version": "1.1.3" 66 | } 67 | -------------------------------------------------------------------------------- /node_modules/bigi/.npmignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | test/ 3 | .DS_Store 4 | .travis.yml 5 | benchmark/ 6 | jshint.json 7 | -------------------------------------------------------------------------------- /node_modules/bigi/LICENSE.md: -------------------------------------------------------------------------------- 1 | This software is covered under the following copyright: 2 | 3 | > Copyright (c) 2003-2005 Tom Wu 4 | > All Rights Reserved. 5 | 6 | > Permission is hereby granted, free of charge, to any person obtaining 7 | > a copy of this software and associated documentation files (the 8 | > "Software"), to deal in the Software without restriction, including 9 | > without limitation the rights to use, copy, modify, merge, publish, 10 | > distribute, sublicense, and/or sell copies of the Software, and to 11 | > permit persons to whom the Software is furnished to do so, subject to 12 | > the following conditions: 13 | > 14 | > The above copyright notice and this permission notice shall be 15 | > included in all copies or substantial portions of the Software. 16 | > 17 | > THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 18 | > EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 19 | > WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 20 | > 21 | > IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, 22 | > INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER 23 | > RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF 24 | > THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT 25 | > OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | > 27 | > In addition, the following condition applies: 28 | > 29 | > All redistributions must retain an intact copy of this copyright notice 30 | > and disclaimer. 31 | -------------------------------------------------------------------------------- /node_modules/bigi/README.md: -------------------------------------------------------------------------------- 1 | bigi 2 | ====== 3 | 4 | [![build status](https://secure.travis-ci.org/cryptocoinjs/bigi.png)](http://travis-ci.org/cryptocoinjs/bigi) 5 | [![Coverage Status](https://img.shields.io/coveralls/cryptocoinjs/bigi.svg)](https://coveralls.io/r/cryptocoinjs/bigi) 6 | [![Version](http://img.shields.io/npm/v/bigi.svg)](https://www.npmjs.org/package/bigi) 7 | 8 | [![browser support](https://ci.testling.com/cryptocoinjs/bigi.png)](https://ci.testling.com/cryptocoinjs/bigi) 9 | 10 | JavaScript library to manipulate big integers. Based on `jsbn` made by [Tom Wu](http://www-cs-students.stanford.edu/~tjw/jsbn/) 11 | 12 | Official documentation: 13 | 14 | http://cryptocoinjs.com/modules/misc/bigi/ -------------------------------------------------------------------------------- /node_modules/bigi/lib/convert.js: -------------------------------------------------------------------------------- 1 | // FIXME: Kind of a weird way to throw exceptions, consider removing 2 | var assert = require('assert') 3 | var BigInteger = require('./bigi') 4 | 5 | /** 6 | * Turns a byte array into a big integer. 7 | * 8 | * This function will interpret a byte array as a big integer in big 9 | * endian notation. 10 | */ 11 | BigInteger.fromByteArrayUnsigned = function(byteArray) { 12 | // BigInteger expects a DER integer conformant byte array 13 | if (byteArray[0] & 0x80) { 14 | return new BigInteger([0].concat(byteArray)) 15 | } 16 | 17 | return new BigInteger(byteArray) 18 | } 19 | 20 | /** 21 | * Returns a byte array representation of the big integer. 22 | * 23 | * This returns the absolute of the contained value in big endian 24 | * form. A value of zero results in an empty array. 25 | */ 26 | BigInteger.prototype.toByteArrayUnsigned = function() { 27 | var byteArray = this.toByteArray() 28 | return byteArray[0] === 0 ? byteArray.slice(1) : byteArray 29 | } 30 | 31 | BigInteger.fromDERInteger = function(byteArray) { 32 | return new BigInteger(byteArray) 33 | } 34 | 35 | /* 36 | * Converts BigInteger to a DER integer representation. 37 | * 38 | * The format for this value uses the most significant bit as a sign 39 | * bit. If the most significant bit is already set and the integer is 40 | * positive, a 0x00 is prepended. 41 | * 42 | * Examples: 43 | * 44 | * 0 => 0x00 45 | * 1 => 0x01 46 | * -1 => 0xff 47 | * 127 => 0x7f 48 | * -127 => 0x81 49 | * 128 => 0x0080 50 | * -128 => 0x80 51 | * 255 => 0x00ff 52 | * -255 => 0xff01 53 | * 16300 => 0x3fac 54 | * -16300 => 0xc054 55 | * 62300 => 0x00f35c 56 | * -62300 => 0xff0ca4 57 | */ 58 | BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray 59 | 60 | BigInteger.fromBuffer = function(buffer) { 61 | // BigInteger expects a DER integer conformant byte array 62 | if (buffer[0] & 0x80) { 63 | var byteArray = Array.prototype.slice.call(buffer) 64 | 65 | return new BigInteger([0].concat(byteArray)) 66 | } 67 | 68 | return new BigInteger(buffer) 69 | } 70 | 71 | BigInteger.fromHex = function(hex) { 72 | if (hex === '') return BigInteger.ZERO 73 | 74 | assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string') 75 | assert.equal(hex.length % 2, 0, 'Incomplete hex') 76 | return new BigInteger(hex, 16) 77 | } 78 | 79 | BigInteger.prototype.toBuffer = function(size) { 80 | var byteArray = this.toByteArrayUnsigned() 81 | var zeros = [] 82 | 83 | var padding = size - byteArray.length 84 | while (zeros.length < padding) zeros.push(0) 85 | 86 | return new Buffer(zeros.concat(byteArray)) 87 | } 88 | 89 | BigInteger.prototype.toHex = function(size) { 90 | return this.toBuffer(size).toString('hex') 91 | } 92 | -------------------------------------------------------------------------------- /node_modules/bigi/lib/index.js: -------------------------------------------------------------------------------- 1 | var BigInteger = require('./bigi') 2 | 3 | //addons 4 | require('./convert') 5 | 6 | module.exports = BigInteger -------------------------------------------------------------------------------- /node_modules/bigi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bigi@^1.4.0", 3 | "_id": "bigi@1.4.2", 4 | "_inBundle": false, 5 | "_integrity": "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU=", 6 | "_location": "/bigi", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "bigi@^1.4.0", 12 | "name": "bigi", 13 | "escapedName": "bigi", 14 | "rawSpec": "^1.4.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.4.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib", 20 | "/ecurve" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz", 23 | "_shasum": "9c665a95f88b8b08fc05cfd731f561859d725825", 24 | "_spec": "bigi@^1.4.0", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 26 | "bugs": { 27 | "url": "https://github.com/cryptocoinjs/bigi/issues" 28 | }, 29 | "bundleDependencies": false, 30 | "dependencies": {}, 31 | "deprecated": false, 32 | "description": "Big integers.", 33 | "devDependencies": { 34 | "coveralls": "^2.11.2", 35 | "istanbul": "^0.3.5", 36 | "jshint": "^2.5.1", 37 | "mocha": "^2.1.0", 38 | "mochify": "^2.1.0" 39 | }, 40 | "homepage": "https://github.com/cryptocoinjs/bigi#readme", 41 | "keywords": [ 42 | "cryptography", 43 | "math", 44 | "bitcoin", 45 | "arbitrary", 46 | "precision", 47 | "arithmetic", 48 | "big", 49 | "integer", 50 | "int", 51 | "number", 52 | "biginteger", 53 | "bigint", 54 | "bignumber", 55 | "decimal", 56 | "float" 57 | ], 58 | "main": "./lib/index.js", 59 | "name": "bigi", 60 | "repository": { 61 | "url": "git+https://github.com/cryptocoinjs/bigi.git", 62 | "type": "git" 63 | }, 64 | "scripts": { 65 | "browser-test": "mochify --wd -R spec", 66 | "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js", 67 | "coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info", 68 | "jshint": "jshint --config jshint.json lib/*.js ; true", 69 | "test": "_mocha -- test/*.js", 70 | "unit": "mocha" 71 | }, 72 | "testling": { 73 | "files": "test/*.js", 74 | "harness": "mocha", 75 | "browsers": [ 76 | "ie/9..latest", 77 | "firefox/latest", 78 | "chrome/latest", 79 | "safari/6.0..latest", 80 | "iphone/6.0..latest", 81 | "android-browser/4.2..latest" 82 | ] 83 | }, 84 | "version": "1.4.2" 85 | } 86 | -------------------------------------------------------------------------------- /node_modules/bip66/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Daniel Cousens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/bip66/README.md: -------------------------------------------------------------------------------- 1 | # bip66 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/bip66.svg?style=flat-square)](https://www.npmjs.org/package/bip66) 4 | [![Build Status](https://img.shields.io/travis/bitcoinjs/bip66.svg?branch=master&style=flat-square)](https://travis-ci.org/bitcoinjs/bip66) 5 | 6 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 7 | 8 | Strict DER signature encoding/decoding. 9 | 10 | See [bip66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki). 11 | 12 | - This module **works only with [two's complement](https://en.wikipedia.org/wiki/Two's_complement) numbers**. 13 | - BIP66 doesn't check that `r` or `s` are fully valid. 14 | - `check`/`decode` doesn't check that `r` or `s` great than 33 bytes or that this number represent valid point on elliptic curve. 15 | - `encode` doesn't check that `r`/`s` represent valid point on elliptic curve. 16 | 17 | ## Example 18 | 19 | ``` javascript 20 | var bip66 = require('bip66') 21 | var r = new Buffer('1ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777', 'hex') 22 | var s = new Buffer('29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex') 23 | 24 | bip66.encode(r, s) 25 | // Buffer <30 43 02 20 1e a1 fd ff 81 b3 a2 71 65 9d f4 aa d1 9b c4 ef 83 de f3 89 13 1a 36 35 8f e6 4b 24 56 32 e7 77 02 1f 29 e1 64 65 8b e9 ce 81 09 21 bf 81 d6 b8 66 94 78 5a 79 ea 1e 52 db fa 51 05 14 8d 1f 0b c1> 26 | 27 | var signature = new Buffer('304302201ea1fdff81b3a271659df4aad19bc4ef83def389131a36358fe64b245632e777021f29e164658be9ce810921bf81d6b86694785a79ea1e52dbfa5105148d1f0bc1', 'hex') 28 | bip66.decode(signature) 29 | // => { 30 | // r: Buffer <1e a1 fd ff 81 b3 a2 71 65 9d f4 aa d1 9b c4 ef 83 de f3 89 13 1a 36 35 8f e6 4b 24 56 32 e7 77>, 31 | // s: Buffer <29 e1 64 65 8b e9 ce 81 09 21 bf 81 d6 b8 66 94 78 5a 79 ea 1e 52 db fa 51 05 14 8d 1f 0b c1> 32 | // } 33 | ``` 34 | 35 | A catch-all exception regex: 36 | ``` javascript 37 | /Expected DER (integer|sequence)|(R|S) value (excessively padded|is negative)|(R|S|DER sequence) length is (zero|too short|too long|invalid)/ 38 | ``` 39 | 40 | ## LICENSE [MIT](LICENSE) 41 | -------------------------------------------------------------------------------- /node_modules/bip66/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bip66@^1.1.0", 3 | "_id": "bip66@1.1.5", 4 | "_inBundle": false, 5 | "_integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", 6 | "_location": "/bip66", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "bip66@^1.1.0", 12 | "name": "bip66", 13 | "escapedName": "bip66", 14 | "rawSpec": "^1.1.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", 22 | "_shasum": "01fa8748785ca70955d5011217d1b3139969ca22", 23 | "_spec": "bip66@^1.1.0", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": { 26 | "name": "Daniel Cousens" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/bitcoinjs/bip66/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "dependencies": { 33 | "safe-buffer": "^5.0.1" 34 | }, 35 | "deprecated": false, 36 | "description": "Strict DER signature encoding/decoding.", 37 | "devDependencies": { 38 | "nyc": "^6.4.0", 39 | "standard": "^10.0.2", 40 | "tape": "^4.5.1" 41 | }, 42 | "files": [ 43 | "index.js" 44 | ], 45 | "homepage": "https://github.com/bitcoinjs/bip66", 46 | "keywords": [ 47 | "bip66", 48 | "bitcoin" 49 | ], 50 | "license": "MIT", 51 | "main": "index.js", 52 | "name": "bip66", 53 | "repository": { 54 | "type": "git", 55 | "url": "git+https://github.com/bitcoinjs/bip66.git" 56 | }, 57 | "scripts": { 58 | "coverage": "nyc --check-coverage --branches 100 --functions 100 tape test/*.js", 59 | "lint": "standard", 60 | "test": "npm run lint && npm run unit", 61 | "unit": "tape test/*.js" 62 | }, 63 | "version": "1.1.5" 64 | } 65 | -------------------------------------------------------------------------------- /node_modules/bitcoin-ops/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Daniel Cousens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/bitcoin-ops/README.md: -------------------------------------------------------------------------------- 1 | # bitcoin-ops 2 | 3 | [![build status](https://secure.travis-ci.org/bitcoinjs/bitcoinjs-ops.png)](http://travis-ci.org/bitcoinjs/bitcoin-ops) 4 | [![Version](http://img.shields.io/npm/v/bitcoinjs-ops.svg)](https://www.npmjs.org/package/bitcoin-ops) 5 | 6 | 7 | ## License [MIT](LICENSE) 8 | -------------------------------------------------------------------------------- /node_modules/bitcoin-ops/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "OP_FALSE": 0, 3 | "OP_0": 0, 4 | "OP_PUSHDATA1": 76, 5 | "OP_PUSHDATA2": 77, 6 | "OP_PUSHDATA4": 78, 7 | "OP_1NEGATE": 79, 8 | "OP_RESERVED": 80, 9 | "OP_TRUE": 81, 10 | "OP_1": 81, 11 | "OP_2": 82, 12 | "OP_3": 83, 13 | "OP_4": 84, 14 | "OP_5": 85, 15 | "OP_6": 86, 16 | "OP_7": 87, 17 | "OP_8": 88, 18 | "OP_9": 89, 19 | "OP_10": 90, 20 | "OP_11": 91, 21 | "OP_12": 92, 22 | "OP_13": 93, 23 | "OP_14": 94, 24 | "OP_15": 95, 25 | "OP_16": 96, 26 | 27 | "OP_NOP": 97, 28 | "OP_VER": 98, 29 | "OP_IF": 99, 30 | "OP_NOTIF": 100, 31 | "OP_VERIF": 101, 32 | "OP_VERNOTIF": 102, 33 | "OP_ELSE": 103, 34 | "OP_ENDIF": 104, 35 | "OP_VERIFY": 105, 36 | "OP_RETURN": 106, 37 | 38 | "OP_TOALTSTACK": 107, 39 | "OP_FROMALTSTACK": 108, 40 | "OP_2DROP": 109, 41 | "OP_2DUP": 110, 42 | "OP_3DUP": 111, 43 | "OP_2OVER": 112, 44 | "OP_2ROT": 113, 45 | "OP_2SWAP": 114, 46 | "OP_IFDUP": 115, 47 | "OP_DEPTH": 116, 48 | "OP_DROP": 117, 49 | "OP_DUP": 118, 50 | "OP_NIP": 119, 51 | "OP_OVER": 120, 52 | "OP_PICK": 121, 53 | "OP_ROLL": 122, 54 | "OP_ROT": 123, 55 | "OP_SWAP": 124, 56 | "OP_TUCK": 125, 57 | 58 | "OP_CAT": 126, 59 | "OP_SUBSTR": 127, 60 | "OP_LEFT": 128, 61 | "OP_RIGHT": 129, 62 | "OP_SIZE": 130, 63 | 64 | "OP_INVERT": 131, 65 | "OP_AND": 132, 66 | "OP_OR": 133, 67 | "OP_XOR": 134, 68 | "OP_EQUAL": 135, 69 | "OP_EQUALVERIFY": 136, 70 | "OP_RESERVED1": 137, 71 | "OP_RESERVED2": 138, 72 | 73 | "OP_1ADD": 139, 74 | "OP_1SUB": 140, 75 | "OP_2MUL": 141, 76 | "OP_2DIV": 142, 77 | "OP_NEGATE": 143, 78 | "OP_ABS": 144, 79 | "OP_NOT": 145, 80 | "OP_0NOTEQUAL": 146, 81 | "OP_ADD": 147, 82 | "OP_SUB": 148, 83 | "OP_MUL": 149, 84 | "OP_DIV": 150, 85 | "OP_MOD": 151, 86 | "OP_LSHIFT": 152, 87 | "OP_RSHIFT": 153, 88 | 89 | "OP_BOOLAND": 154, 90 | "OP_BOOLOR": 155, 91 | "OP_NUMEQUAL": 156, 92 | "OP_NUMEQUALVERIFY": 157, 93 | "OP_NUMNOTEQUAL": 158, 94 | "OP_LESSTHAN": 159, 95 | "OP_GREATERTHAN": 160, 96 | "OP_LESSTHANOREQUAL": 161, 97 | "OP_GREATERTHANOREQUAL": 162, 98 | "OP_MIN": 163, 99 | "OP_MAX": 164, 100 | 101 | "OP_WITHIN": 165, 102 | 103 | "OP_RIPEMD160": 166, 104 | "OP_SHA1": 167, 105 | "OP_SHA256": 168, 106 | "OP_HASH160": 169, 107 | "OP_HASH256": 170, 108 | "OP_CODESEPARATOR": 171, 109 | "OP_CHECKSIG": 172, 110 | "OP_CHECKSIGVERIFY": 173, 111 | "OP_CHECKMULTISIG": 174, 112 | "OP_CHECKMULTISIGVERIFY": 175, 113 | 114 | "OP_NOP1": 176, 115 | 116 | "OP_NOP2": 177, 117 | "OP_CHECKLOCKTIMEVERIFY": 177, 118 | 119 | "OP_NOP3": 178, 120 | "OP_CHECKSEQUENCEVERIFY": 178, 121 | 122 | "OP_NOP4": 179, 123 | "OP_NOP5": 180, 124 | "OP_NOP6": 181, 125 | "OP_NOP7": 182, 126 | "OP_NOP8": 183, 127 | "OP_NOP9": 184, 128 | "OP_NOP10": 185, 129 | 130 | "OP_PUBKEYHASH": 253, 131 | "OP_PUBKEY": 254, 132 | "OP_INVALIDOPCODE": 255 133 | } 134 | -------------------------------------------------------------------------------- /node_modules/bitcoin-ops/map.js: -------------------------------------------------------------------------------- 1 | var OPS = require('./index.json') 2 | 3 | var map = {} 4 | for (var op in OPS) { 5 | var code = OPS[op] 6 | map[code] = op 7 | } 8 | 9 | module.exports = map 10 | -------------------------------------------------------------------------------- /node_modules/bitcoin-ops/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bitcoin-ops@^1.3.0", 3 | "_id": "bitcoin-ops@1.4.1", 4 | "_inBundle": false, 5 | "_integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow==", 6 | "_location": "/bitcoin-ops", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "bitcoin-ops@^1.3.0", 12 | "name": "bitcoin-ops", 13 | "escapedName": "bitcoin-ops", 14 | "rawSpec": "^1.3.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.3.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib", 20 | "/pushdata-bitcoin" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz", 23 | "_shasum": "e45de620398e22fd4ca6023de43974ff42240278", 24 | "_spec": "bitcoin-ops@^1.3.0", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 26 | "author": { 27 | "name": "Daniel Cousens" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/bitcoinjs/bitcoin-ops/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "deprecated": false, 34 | "description": "bitcoin OP codes", 35 | "devDependencies": { 36 | "standard": "*" 37 | }, 38 | "files": [ 39 | "index.json", 40 | "map.js" 41 | ], 42 | "homepage": "https://github.com/bitcoinjs/bitcoin-ops", 43 | "keywords": [ 44 | "opcodes", 45 | "ops", 46 | "bitcoin-ops", 47 | "bitcoin" 48 | ], 49 | "license": "MIT", 50 | "main": "./index.json", 51 | "name": "bitcoin-ops", 52 | "repository": { 53 | "type": "git", 54 | "url": "git+https://github.com/bitcoinjs/bitcoin-ops.git" 55 | }, 56 | "scripts": {}, 57 | "version": "1.4.1" 58 | } 59 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2017 bitcoinjs-lib contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bitcoinjs-lib", 3 | "_id": "bitcoinjs-lib@3.3.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-l5qqvbaK8wwtANPf6oEffykycg4383XgEYdia1rI7/JpGf1jfRWlOUCvx5TiTZS7kyIvY4j/UhIQ2urLsvGkzw==", 6 | "_location": "/bitcoinjs-lib", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "bitcoinjs-lib", 12 | "name": "bitcoinjs-lib", 13 | "escapedName": "bitcoinjs-lib", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-3.3.2.tgz", 23 | "_shasum": "780c9c53ecb1222adb463b58bef26386067b609a", 24 | "_spec": "bitcoinjs-lib", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples", 26 | "bugs": { 27 | "url": "https://github.com/bitcoinjs/bitcoinjs-lib/issues" 28 | }, 29 | "bundleDependencies": false, 30 | "dependencies": { 31 | "bech32": "^1.1.2", 32 | "bigi": "^1.4.0", 33 | "bip66": "^1.1.0", 34 | "bitcoin-ops": "^1.3.0", 35 | "bs58check": "^2.0.0", 36 | "create-hash": "^1.1.0", 37 | "create-hmac": "^1.1.3", 38 | "ecurve": "^1.0.0", 39 | "merkle-lib": "^2.0.10", 40 | "pushdata-bitcoin": "^1.0.1", 41 | "randombytes": "^2.0.1", 42 | "safe-buffer": "^5.0.1", 43 | "typeforce": "^1.11.3", 44 | "varuint-bitcoin": "^1.0.4", 45 | "wif": "^2.0.1" 46 | }, 47 | "deprecated": false, 48 | "description": "Client-side Bitcoin JavaScript library", 49 | "devDependencies": { 50 | "async": "^2.0.1", 51 | "bip39": "^2.3.0", 52 | "bs58": "^4.0.0", 53 | "cb-http-client": "^0.2.0", 54 | "coinselect": "^3.1.1", 55 | "dhttp": "^2.3.5", 56 | "minimaldata": "^1.0.2", 57 | "mocha": "^3.1.0", 58 | "nyc": "^10.2.0", 59 | "proxyquire": "^1.4.0", 60 | "sinon": "^1.12.2", 61 | "standard": "^9.0.2" 62 | }, 63 | "engines": { 64 | "node": ">=4.0.0" 65 | }, 66 | "files": [ 67 | "src" 68 | ], 69 | "homepage": "https://github.com/bitcoinjs/bitcoinjs-lib#readme", 70 | "keywords": [ 71 | "bitcoinjs", 72 | "bitcoin", 73 | "browserify", 74 | "javascript", 75 | "bitcoinjs" 76 | ], 77 | "license": "MIT", 78 | "main": "./src/index.js", 79 | "name": "bitcoinjs-lib", 80 | "repository": { 81 | "type": "git", 82 | "url": "git+https://github.com/bitcoinjs/bitcoinjs-lib.git" 83 | }, 84 | "scripts": { 85 | "coverage": "nyc --check-coverage --branches 90 --functions 90 mocha", 86 | "coverage-html": "nyc report --reporter=html", 87 | "coverage-report": "nyc report --reporter=lcov", 88 | "integration": "mocha test/integration/", 89 | "standard": "standard", 90 | "test": "npm run standard && npm run coverage", 91 | "unit": "mocha" 92 | }, 93 | "version": "3.3.2" 94 | } 95 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/bufferutils.js: -------------------------------------------------------------------------------- 1 | var pushdata = require('pushdata-bitcoin') 2 | var varuint = require('varuint-bitcoin') 3 | 4 | // https://github.com/feross/buffer/blob/master/index.js#L1127 5 | function verifuint (value, max) { 6 | if (typeof value !== 'number') throw new Error('cannot write a non-number as a number') 7 | if (value < 0) throw new Error('specified a negative value for writing an unsigned value') 8 | if (value > max) throw new Error('RangeError: value out of range') 9 | if (Math.floor(value) !== value) throw new Error('value has a fractional component') 10 | } 11 | 12 | function readUInt64LE (buffer, offset) { 13 | var a = buffer.readUInt32LE(offset) 14 | var b = buffer.readUInt32LE(offset + 4) 15 | b *= 0x100000000 16 | 17 | verifuint(b + a, 0x001fffffffffffff) 18 | 19 | return b + a 20 | } 21 | 22 | function writeUInt64LE (buffer, value, offset) { 23 | verifuint(value, 0x001fffffffffffff) 24 | 25 | buffer.writeInt32LE(value & -1, offset) 26 | buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4) 27 | return offset + 8 28 | } 29 | 30 | // TODO: remove in 4.0.0? 31 | function readVarInt (buffer, offset) { 32 | var result = varuint.decode(buffer, offset) 33 | 34 | return { 35 | number: result, 36 | size: varuint.decode.bytes 37 | } 38 | } 39 | 40 | // TODO: remove in 4.0.0? 41 | function writeVarInt (buffer, number, offset) { 42 | varuint.encode(number, buffer, offset) 43 | return varuint.encode.bytes 44 | } 45 | 46 | module.exports = { 47 | pushDataSize: pushdata.encodingLength, 48 | readPushDataInt: pushdata.decode, 49 | readUInt64LE: readUInt64LE, 50 | readVarInt: readVarInt, 51 | varIntBuffer: varuint.encode, 52 | varIntSize: varuint.encodingLength, 53 | writePushDataInt: pushdata.encode, 54 | writeUInt64LE: writeUInt64LE, 55 | writeVarInt: writeVarInt 56 | } 57 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/crypto.js: -------------------------------------------------------------------------------- 1 | var createHash = require('create-hash') 2 | 3 | function ripemd160 (buffer) { 4 | return createHash('rmd160').update(buffer).digest() 5 | } 6 | 7 | function sha1 (buffer) { 8 | return createHash('sha1').update(buffer).digest() 9 | } 10 | 11 | function sha256 (buffer) { 12 | return createHash('sha256').update(buffer).digest() 13 | } 14 | 15 | function hash160 (buffer) { 16 | return ripemd160(sha256(buffer)) 17 | } 18 | 19 | function hash256 (buffer) { 20 | return sha256(sha256(buffer)) 21 | } 22 | 23 | module.exports = { 24 | hash160: hash160, 25 | hash256: hash256, 26 | ripemd160: ripemd160, 27 | sha1: sha1, 28 | sha256: sha256 29 | } 30 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/ecsignature.js: -------------------------------------------------------------------------------- 1 | var bip66 = require('bip66') 2 | var typeforce = require('typeforce') 3 | var types = require('./types') 4 | 5 | var BigInteger = require('bigi') 6 | 7 | function ECSignature (r, s) { 8 | typeforce(types.tuple(types.BigInt, types.BigInt), arguments) 9 | 10 | this.r = r 11 | this.s = s 12 | } 13 | 14 | ECSignature.parseCompact = function (buffer) { 15 | typeforce(types.BufferN(65), buffer) 16 | 17 | var flagByte = buffer.readUInt8(0) - 27 18 | if (flagByte !== (flagByte & 7)) throw new Error('Invalid signature parameter') 19 | 20 | var compressed = !!(flagByte & 4) 21 | var recoveryParam = flagByte & 3 22 | var signature = ECSignature.fromRSBuffer(buffer.slice(1)) 23 | 24 | return { 25 | compressed: compressed, 26 | i: recoveryParam, 27 | signature: signature 28 | } 29 | } 30 | 31 | ECSignature.fromRSBuffer = function (buffer) { 32 | typeforce(types.BufferN(64), buffer) 33 | 34 | var r = BigInteger.fromBuffer(buffer.slice(0, 32)) 35 | var s = BigInteger.fromBuffer(buffer.slice(32, 64)) 36 | return new ECSignature(r, s) 37 | } 38 | 39 | ECSignature.fromDER = function (buffer) { 40 | var decode = bip66.decode(buffer) 41 | var r = BigInteger.fromDERInteger(decode.r) 42 | var s = BigInteger.fromDERInteger(decode.s) 43 | 44 | return new ECSignature(r, s) 45 | } 46 | 47 | // BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed) 48 | ECSignature.parseScriptSignature = function (buffer) { 49 | var hashType = buffer.readUInt8(buffer.length - 1) 50 | var hashTypeMod = hashType & ~0x80 51 | 52 | if (hashTypeMod <= 0x00 || hashTypeMod >= 0x04) throw new Error('Invalid hashType ' + hashType) 53 | 54 | return { 55 | signature: ECSignature.fromDER(buffer.slice(0, -1)), 56 | hashType: hashType 57 | } 58 | } 59 | 60 | ECSignature.prototype.toCompact = function (i, compressed) { 61 | if (compressed) { 62 | i += 4 63 | } 64 | 65 | i += 27 66 | 67 | var buffer = Buffer.alloc(65) 68 | buffer.writeUInt8(i, 0) 69 | this.toRSBuffer(buffer, 1) 70 | return buffer 71 | } 72 | 73 | ECSignature.prototype.toDER = function () { 74 | var r = Buffer.from(this.r.toDERInteger()) 75 | var s = Buffer.from(this.s.toDERInteger()) 76 | 77 | return bip66.encode(r, s) 78 | } 79 | 80 | ECSignature.prototype.toRSBuffer = function (buffer, offset) { 81 | buffer = buffer || Buffer.alloc(64) 82 | this.r.toBuffer(32).copy(buffer, offset) 83 | this.s.toBuffer(32).copy(buffer, offset + 32) 84 | return buffer 85 | } 86 | 87 | ECSignature.prototype.toScriptSignature = function (hashType) { 88 | var hashTypeMod = hashType & ~0x80 89 | if (hashTypeMod <= 0 || hashTypeMod >= 4) throw new Error('Invalid hashType ' + hashType) 90 | 91 | var hashTypeBuffer = Buffer.alloc(1) 92 | hashTypeBuffer.writeUInt8(hashType, 0) 93 | 94 | return Buffer.concat([this.toDER(), hashTypeBuffer]) 95 | } 96 | 97 | module.exports = ECSignature 98 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/index.js: -------------------------------------------------------------------------------- 1 | var script = require('./script') 2 | 3 | var templates = require('./templates') 4 | for (var key in templates) { 5 | script[key] = templates[key] 6 | } 7 | 8 | module.exports = { 9 | bufferutils: require('./bufferutils'), // TODO: remove in 4.0.0 10 | 11 | Block: require('./block'), 12 | ECPair: require('./ecpair'), 13 | ECSignature: require('./ecsignature'), 14 | HDNode: require('./hdnode'), 15 | Transaction: require('./transaction'), 16 | TransactionBuilder: require('./transaction_builder'), 17 | 18 | address: require('./address'), 19 | crypto: require('./crypto'), 20 | networks: require('./networks'), 21 | opcodes: require('bitcoin-ops'), 22 | script: script 23 | } 24 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/networks.js: -------------------------------------------------------------------------------- 1 | // https://en.bitcoin.it/wiki/List_of_address_prefixes 2 | // Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731 3 | 4 | module.exports = { 5 | bitcoin: { 6 | messagePrefix: '\x18Bitcoin Signed Message:\n', 7 | bech32: 'bc', 8 | bip32: { 9 | public: 0x0488b21e, 10 | private: 0x0488ade4 11 | }, 12 | pubKeyHash: 0x00, 13 | scriptHash: 0x05, 14 | wif: 0x80 15 | }, 16 | testnet: { 17 | messagePrefix: '\x18Bitcoin Signed Message:\n', 18 | bech32: 'tb', 19 | bip32: { 20 | public: 0x043587cf, 21 | private: 0x04358394 22 | }, 23 | pubKeyHash: 0x6f, 24 | scriptHash: 0xc4, 25 | wif: 0xef 26 | }, 27 | litecoin: { 28 | messagePrefix: '\x19Litecoin Signed Message:\n', 29 | bip32: { 30 | public: 0x019da462, 31 | private: 0x019d9cfe 32 | }, 33 | pubKeyHash: 0x30, 34 | scriptHash: 0x32, 35 | wif: 0xb0 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/script_number.js: -------------------------------------------------------------------------------- 1 | var Buffer = require('safe-buffer').Buffer 2 | 3 | function decode (buffer, maxLength, minimal) { 4 | maxLength = maxLength || 4 5 | minimal = minimal === undefined ? true : minimal 6 | 7 | var length = buffer.length 8 | if (length === 0) return 0 9 | if (length > maxLength) throw new TypeError('Script number overflow') 10 | if (minimal) { 11 | if ((buffer[length - 1] & 0x7f) === 0) { 12 | if (length <= 1 || (buffer[length - 2] & 0x80) === 0) throw new Error('Non-minimally encoded script number') 13 | } 14 | } 15 | 16 | // 40-bit 17 | if (length === 5) { 18 | var a = buffer.readUInt32LE(0) 19 | var b = buffer.readUInt8(4) 20 | 21 | if (b & 0x80) return -(((b & ~0x80) * 0x100000000) + a) 22 | return (b * 0x100000000) + a 23 | } 24 | 25 | var result = 0 26 | 27 | // 32-bit / 24-bit / 16-bit / 8-bit 28 | for (var i = 0; i < length; ++i) { 29 | result |= buffer[i] << (8 * i) 30 | } 31 | 32 | if (buffer[length - 1] & 0x80) return -(result & ~(0x80 << (8 * (length - 1)))) 33 | return result 34 | } 35 | 36 | function scriptNumSize (i) { 37 | return i > 0x7fffffff ? 5 38 | : i > 0x7fffff ? 4 39 | : i > 0x7fff ? 3 40 | : i > 0x7f ? 2 41 | : i > 0x00 ? 1 42 | : 0 43 | } 44 | 45 | function encode (number) { 46 | var value = Math.abs(number) 47 | var size = scriptNumSize(value) 48 | var buffer = Buffer.allocUnsafe(size) 49 | var negative = number < 0 50 | 51 | for (var i = 0; i < size; ++i) { 52 | buffer.writeUInt8(value & 0xff, i) 53 | value >>= 8 54 | } 55 | 56 | if (buffer[size - 1] & 0x80) { 57 | buffer.writeUInt8(negative ? 0x80 : 0x00, size - 1) 58 | } else if (negative) { 59 | buffer[size - 1] |= 0x80 60 | } 61 | 62 | return buffer 63 | } 64 | 65 | module.exports = { 66 | decode: decode, 67 | encode: encode 68 | } 69 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/index.js: -------------------------------------------------------------------------------- 1 | var decompile = require('../script').decompile 2 | var multisig = require('./multisig') 3 | var nullData = require('./nulldata') 4 | var pubKey = require('./pubkey') 5 | var pubKeyHash = require('./pubkeyhash') 6 | var scriptHash = require('./scripthash') 7 | var witnessPubKeyHash = require('./witnesspubkeyhash') 8 | var witnessScriptHash = require('./witnessscripthash') 9 | var witnessCommitment = require('./witnesscommitment') 10 | 11 | var types = { 12 | MULTISIG: 'multisig', 13 | NONSTANDARD: 'nonstandard', 14 | NULLDATA: 'nulldata', 15 | P2PK: 'pubkey', 16 | P2PKH: 'pubkeyhash', 17 | P2SH: 'scripthash', 18 | P2WPKH: 'witnesspubkeyhash', 19 | P2WSH: 'witnessscripthash', 20 | WITNESS_COMMITMENT: 'witnesscommitment' 21 | } 22 | 23 | function classifyOutput (script) { 24 | if (witnessPubKeyHash.output.check(script)) return types.P2WPKH 25 | if (witnessScriptHash.output.check(script)) return types.P2WSH 26 | if (pubKeyHash.output.check(script)) return types.P2PKH 27 | if (scriptHash.output.check(script)) return types.P2SH 28 | 29 | // XXX: optimization, below functions .decompile before use 30 | var chunks = decompile(script) 31 | if (multisig.output.check(chunks)) return types.MULTISIG 32 | if (pubKey.output.check(chunks)) return types.P2PK 33 | if (witnessCommitment.output.check(chunks)) return types.WITNESS_COMMITMENT 34 | if (nullData.output.check(chunks)) return types.NULLDATA 35 | 36 | return types.NONSTANDARD 37 | } 38 | 39 | function classifyInput (script, allowIncomplete) { 40 | // XXX: optimization, below functions .decompile before use 41 | var chunks = decompile(script) 42 | 43 | if (pubKeyHash.input.check(chunks)) return types.P2PKH 44 | if (scriptHash.input.check(chunks, allowIncomplete)) return types.P2SH 45 | if (multisig.input.check(chunks, allowIncomplete)) return types.MULTISIG 46 | if (pubKey.input.check(chunks)) return types.P2PK 47 | 48 | return types.NONSTANDARD 49 | } 50 | 51 | function classifyWitness (script, allowIncomplete) { 52 | // XXX: optimization, below functions .decompile before use 53 | var chunks = decompile(script) 54 | 55 | if (witnessPubKeyHash.input.check(chunks)) return types.P2WPKH 56 | if (witnessScriptHash.input.check(chunks, allowIncomplete)) return types.P2WSH 57 | 58 | return types.NONSTANDARD 59 | } 60 | 61 | module.exports = { 62 | classifyInput: classifyInput, 63 | classifyOutput: classifyOutput, 64 | classifyWitness: classifyWitness, 65 | multisig: multisig, 66 | nullData: nullData, 67 | pubKey: pubKey, 68 | pubKeyHash: pubKeyHash, 69 | scriptHash: scriptHash, 70 | witnessPubKeyHash: witnessPubKeyHash, 71 | witnessScriptHash: witnessScriptHash, 72 | witnessCommitment: witnessCommitment, 73 | types: types 74 | } 75 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/multisig/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | input: require('./input'), 3 | output: require('./output') 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/multisig/input.js: -------------------------------------------------------------------------------- 1 | // OP_0 [signatures ...] 2 | 3 | var Buffer = require('safe-buffer').Buffer 4 | var bscript = require('../../script') 5 | var p2mso = require('./output') 6 | var typeforce = require('typeforce') 7 | var OPS = require('bitcoin-ops') 8 | 9 | function partialSignature (value) { 10 | return value === OPS.OP_0 || bscript.isCanonicalSignature(value) 11 | } 12 | 13 | function check (script, allowIncomplete) { 14 | var chunks = bscript.decompile(script) 15 | if (chunks.length < 2) return false 16 | if (chunks[0] !== OPS.OP_0) return false 17 | 18 | if (allowIncomplete) { 19 | return chunks.slice(1).every(partialSignature) 20 | } 21 | 22 | return chunks.slice(1).every(bscript.isCanonicalSignature) 23 | } 24 | check.toJSON = function () { return 'multisig input' } 25 | 26 | var EMPTY_BUFFER = Buffer.allocUnsafe(0) 27 | 28 | function encodeStack (signatures, scriptPubKey) { 29 | typeforce([partialSignature], signatures) 30 | 31 | if (scriptPubKey) { 32 | var scriptData = p2mso.decode(scriptPubKey) 33 | 34 | if (signatures.length < scriptData.m) { 35 | throw new TypeError('Not enough signatures provided') 36 | } 37 | 38 | if (signatures.length > scriptData.pubKeys.length) { 39 | throw new TypeError('Too many signatures provided') 40 | } 41 | } 42 | 43 | return [].concat(EMPTY_BUFFER, signatures.map(function (sig) { 44 | if (sig === OPS.OP_0) { 45 | return EMPTY_BUFFER 46 | } 47 | return sig 48 | })) 49 | } 50 | 51 | function encode (signatures, scriptPubKey) { 52 | return bscript.compile(encodeStack(signatures, scriptPubKey)) 53 | } 54 | 55 | function decodeStack (stack, allowIncomplete) { 56 | typeforce(typeforce.Array, stack) 57 | typeforce(check, stack, allowIncomplete) 58 | return stack.slice(1) 59 | } 60 | 61 | function decode (buffer, allowIncomplete) { 62 | var stack = bscript.decompile(buffer) 63 | return decodeStack(stack, allowIncomplete) 64 | } 65 | 66 | module.exports = { 67 | check: check, 68 | decode: decode, 69 | decodeStack: decodeStack, 70 | encode: encode, 71 | encodeStack: encodeStack 72 | } 73 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/multisig/output.js: -------------------------------------------------------------------------------- 1 | // m [pubKeys ...] n OP_CHECKMULTISIG 2 | 3 | var bscript = require('../../script') 4 | var types = require('../../types') 5 | var typeforce = require('typeforce') 6 | var OPS = require('bitcoin-ops') 7 | var OP_INT_BASE = OPS.OP_RESERVED // OP_1 - 1 8 | 9 | function check (script, allowIncomplete) { 10 | var chunks = bscript.decompile(script) 11 | 12 | if (chunks.length < 4) return false 13 | if (chunks[chunks.length - 1] !== OPS.OP_CHECKMULTISIG) return false 14 | if (!types.Number(chunks[0])) return false 15 | if (!types.Number(chunks[chunks.length - 2])) return false 16 | var m = chunks[0] - OP_INT_BASE 17 | var n = chunks[chunks.length - 2] - OP_INT_BASE 18 | 19 | if (m <= 0) return false 20 | if (n > 16) return false 21 | if (m > n) return false 22 | if (n !== chunks.length - 3) return false 23 | if (allowIncomplete) return true 24 | 25 | var keys = chunks.slice(1, -2) 26 | return keys.every(bscript.isCanonicalPubKey) 27 | } 28 | check.toJSON = function () { return 'multi-sig output' } 29 | 30 | function encode (m, pubKeys) { 31 | typeforce({ 32 | m: types.Number, 33 | pubKeys: [bscript.isCanonicalPubKey] 34 | }, { 35 | m: m, 36 | pubKeys: pubKeys 37 | }) 38 | 39 | var n = pubKeys.length 40 | if (n < m) throw new TypeError('Not enough pubKeys provided') 41 | 42 | return bscript.compile([].concat( 43 | OP_INT_BASE + m, 44 | pubKeys, 45 | OP_INT_BASE + n, 46 | OPS.OP_CHECKMULTISIG 47 | )) 48 | } 49 | 50 | function decode (buffer, allowIncomplete) { 51 | var chunks = bscript.decompile(buffer) 52 | typeforce(check, chunks, allowIncomplete) 53 | 54 | return { 55 | m: chunks[0] - OP_INT_BASE, 56 | pubKeys: chunks.slice(1, -2) 57 | } 58 | } 59 | 60 | module.exports = { 61 | check: check, 62 | decode: decode, 63 | encode: encode 64 | } 65 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/nulldata.js: -------------------------------------------------------------------------------- 1 | // OP_RETURN {data} 2 | 3 | var bscript = require('../script') 4 | var types = require('../types') 5 | var typeforce = require('typeforce') 6 | var OPS = require('bitcoin-ops') 7 | 8 | function check (script) { 9 | var buffer = bscript.compile(script) 10 | 11 | return buffer.length > 1 && 12 | buffer[0] === OPS.OP_RETURN 13 | } 14 | check.toJSON = function () { return 'null data output' } 15 | 16 | function encode (data) { 17 | typeforce(types.Buffer, data) 18 | 19 | return bscript.compile([OPS.OP_RETURN, data]) 20 | } 21 | 22 | function decode (buffer) { 23 | typeforce(check, buffer) 24 | 25 | return buffer.slice(2) 26 | } 27 | 28 | module.exports = { 29 | output: { 30 | check: check, 31 | decode: decode, 32 | encode: encode 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/pubkey/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | input: require('./input'), 3 | output: require('./output') 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/pubkey/input.js: -------------------------------------------------------------------------------- 1 | // {signature} 2 | 3 | var bscript = require('../../script') 4 | var typeforce = require('typeforce') 5 | 6 | function check (script) { 7 | var chunks = bscript.decompile(script) 8 | 9 | return chunks.length === 1 && 10 | bscript.isCanonicalSignature(chunks[0]) 11 | } 12 | check.toJSON = function () { return 'pubKey input' } 13 | 14 | function encodeStack (signature) { 15 | typeforce(bscript.isCanonicalSignature, signature) 16 | return [signature] 17 | } 18 | 19 | function encode (signature) { 20 | return bscript.compile(encodeStack(signature)) 21 | } 22 | 23 | function decodeStack (stack) { 24 | typeforce(typeforce.Array, stack) 25 | typeforce(check, stack) 26 | return stack[0] 27 | } 28 | 29 | function decode (buffer) { 30 | var stack = bscript.decompile(buffer) 31 | return decodeStack(stack) 32 | } 33 | 34 | module.exports = { 35 | check: check, 36 | decode: decode, 37 | decodeStack: decodeStack, 38 | encode: encode, 39 | encodeStack: encodeStack 40 | } 41 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/pubkey/output.js: -------------------------------------------------------------------------------- 1 | // {pubKey} OP_CHECKSIG 2 | 3 | var bscript = require('../../script') 4 | var typeforce = require('typeforce') 5 | var OPS = require('bitcoin-ops') 6 | 7 | function check (script) { 8 | var chunks = bscript.decompile(script) 9 | 10 | return chunks.length === 2 && 11 | bscript.isCanonicalPubKey(chunks[0]) && 12 | chunks[1] === OPS.OP_CHECKSIG 13 | } 14 | check.toJSON = function () { return 'pubKey output' } 15 | 16 | function encode (pubKey) { 17 | typeforce(bscript.isCanonicalPubKey, pubKey) 18 | 19 | return bscript.compile([pubKey, OPS.OP_CHECKSIG]) 20 | } 21 | 22 | function decode (buffer) { 23 | var chunks = bscript.decompile(buffer) 24 | typeforce(check, chunks) 25 | 26 | return chunks[0] 27 | } 28 | 29 | module.exports = { 30 | check: check, 31 | decode: decode, 32 | encode: encode 33 | } 34 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/pubkeyhash/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | input: require('./input'), 3 | output: require('./output') 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/pubkeyhash/input.js: -------------------------------------------------------------------------------- 1 | // {signature} {pubKey} 2 | 3 | var bscript = require('../../script') 4 | var typeforce = require('typeforce') 5 | 6 | function check (script) { 7 | var chunks = bscript.decompile(script) 8 | 9 | return chunks.length === 2 && 10 | bscript.isCanonicalSignature(chunks[0]) && 11 | bscript.isCanonicalPubKey(chunks[1]) 12 | } 13 | check.toJSON = function () { return 'pubKeyHash input' } 14 | 15 | function encodeStack (signature, pubKey) { 16 | typeforce({ 17 | signature: bscript.isCanonicalSignature, 18 | pubKey: bscript.isCanonicalPubKey 19 | }, { 20 | signature: signature, 21 | pubKey: pubKey 22 | }) 23 | 24 | return [signature, pubKey] 25 | } 26 | 27 | function encode (signature, pubKey) { 28 | return bscript.compile(encodeStack(signature, pubKey)) 29 | } 30 | 31 | function decodeStack (stack) { 32 | typeforce(typeforce.Array, stack) 33 | typeforce(check, stack) 34 | 35 | return { 36 | signature: stack[0], 37 | pubKey: stack[1] 38 | } 39 | } 40 | 41 | function decode (buffer) { 42 | var stack = bscript.decompile(buffer) 43 | return decodeStack(stack) 44 | } 45 | 46 | module.exports = { 47 | check: check, 48 | decode: decode, 49 | decodeStack: decodeStack, 50 | encode: encode, 51 | encodeStack: encodeStack 52 | } 53 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/pubkeyhash/output.js: -------------------------------------------------------------------------------- 1 | // OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG 2 | 3 | var bscript = require('../../script') 4 | var types = require('../../types') 5 | var typeforce = require('typeforce') 6 | var OPS = require('bitcoin-ops') 7 | 8 | function check (script) { 9 | var buffer = bscript.compile(script) 10 | 11 | return buffer.length === 25 && 12 | buffer[0] === OPS.OP_DUP && 13 | buffer[1] === OPS.OP_HASH160 && 14 | buffer[2] === 0x14 && 15 | buffer[23] === OPS.OP_EQUALVERIFY && 16 | buffer[24] === OPS.OP_CHECKSIG 17 | } 18 | check.toJSON = function () { return 'pubKeyHash output' } 19 | 20 | function encode (pubKeyHash) { 21 | typeforce(types.Hash160bit, pubKeyHash) 22 | 23 | return bscript.compile([ 24 | OPS.OP_DUP, 25 | OPS.OP_HASH160, 26 | pubKeyHash, 27 | OPS.OP_EQUALVERIFY, 28 | OPS.OP_CHECKSIG 29 | ]) 30 | } 31 | 32 | function decode (buffer) { 33 | typeforce(check, buffer) 34 | 35 | return buffer.slice(3, 23) 36 | } 37 | 38 | module.exports = { 39 | check: check, 40 | decode: decode, 41 | encode: encode 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/scripthash/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | input: require('./input'), 3 | output: require('./output') 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/scripthash/input.js: -------------------------------------------------------------------------------- 1 | // {serialized scriptPubKey script} 2 | 3 | var Buffer = require('safe-buffer').Buffer 4 | var bscript = require('../../script') 5 | var typeforce = require('typeforce') 6 | 7 | var p2ms = require('../multisig/') 8 | var p2pk = require('../pubkey/') 9 | var p2pkh = require('../pubkeyhash/') 10 | var p2wpkho = require('../witnesspubkeyhash/output') 11 | var p2wsho = require('../witnessscripthash/output') 12 | 13 | function check (script, allowIncomplete) { 14 | var chunks = bscript.decompile(script) 15 | if (chunks.length < 1) return false 16 | 17 | var lastChunk = chunks[chunks.length - 1] 18 | if (!Buffer.isBuffer(lastChunk)) return false 19 | 20 | var scriptSigChunks = bscript.decompile(bscript.compile(chunks.slice(0, -1))) 21 | var redeemScriptChunks = bscript.decompile(lastChunk) 22 | 23 | // is redeemScript a valid script? 24 | if (redeemScriptChunks.length === 0) return false 25 | 26 | // is redeemScriptSig push only? 27 | if (!bscript.isPushOnly(scriptSigChunks)) return false 28 | 29 | // is witness? 30 | if (chunks.length === 1) { 31 | return p2wsho.check(redeemScriptChunks) || 32 | p2wpkho.check(redeemScriptChunks) 33 | } 34 | 35 | // match types 36 | if (p2pkh.input.check(scriptSigChunks) && 37 | p2pkh.output.check(redeemScriptChunks)) return true 38 | 39 | if (p2ms.input.check(scriptSigChunks, allowIncomplete) && 40 | p2ms.output.check(redeemScriptChunks)) return true 41 | 42 | if (p2pk.input.check(scriptSigChunks) && 43 | p2pk.output.check(redeemScriptChunks)) return true 44 | 45 | return false 46 | } 47 | check.toJSON = function () { return 'scriptHash input' } 48 | 49 | function encodeStack (redeemScriptStack, redeemScript) { 50 | var serializedScriptPubKey = bscript.compile(redeemScript) 51 | 52 | return [].concat(redeemScriptStack, serializedScriptPubKey) 53 | } 54 | 55 | function encode (redeemScriptSig, redeemScript) { 56 | var redeemScriptStack = bscript.decompile(redeemScriptSig) 57 | 58 | return bscript.compile(encodeStack(redeemScriptStack, redeemScript)) 59 | } 60 | 61 | function decodeStack (stack) { 62 | typeforce(typeforce.Array, stack) 63 | typeforce(check, stack) 64 | 65 | return { 66 | redeemScriptStack: stack.slice(0, -1), 67 | redeemScript: stack[stack.length - 1] 68 | } 69 | } 70 | 71 | function decode (buffer) { 72 | var stack = bscript.decompile(buffer) 73 | var result = decodeStack(stack) 74 | result.redeemScriptSig = bscript.compile(result.redeemScriptStack) 75 | delete result.redeemScriptStack 76 | return result 77 | } 78 | 79 | module.exports = { 80 | check: check, 81 | decode: decode, 82 | decodeStack: decodeStack, 83 | encode: encode, 84 | encodeStack: encodeStack 85 | } 86 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/scripthash/output.js: -------------------------------------------------------------------------------- 1 | // OP_HASH160 {scriptHash} OP_EQUAL 2 | 3 | var bscript = require('../../script') 4 | var types = require('../../types') 5 | var typeforce = require('typeforce') 6 | var OPS = require('bitcoin-ops') 7 | 8 | function check (script) { 9 | var buffer = bscript.compile(script) 10 | 11 | return buffer.length === 23 && 12 | buffer[0] === OPS.OP_HASH160 && 13 | buffer[1] === 0x14 && 14 | buffer[22] === OPS.OP_EQUAL 15 | } 16 | check.toJSON = function () { return 'scriptHash output' } 17 | 18 | function encode (scriptHash) { 19 | typeforce(types.Hash160bit, scriptHash) 20 | 21 | return bscript.compile([OPS.OP_HASH160, scriptHash, OPS.OP_EQUAL]) 22 | } 23 | 24 | function decode (buffer) { 25 | typeforce(check, buffer) 26 | 27 | return buffer.slice(2, 22) 28 | } 29 | 30 | module.exports = { 31 | check: check, 32 | decode: decode, 33 | encode: encode 34 | } 35 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnesscommitment/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | output: require('./output') 3 | } 4 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnesscommitment/output.js: -------------------------------------------------------------------------------- 1 | // OP_RETURN {aa21a9ed} {commitment} 2 | 3 | var Buffer = require('safe-buffer').Buffer 4 | var bscript = require('../../script') 5 | var types = require('../../types') 6 | var typeforce = require('typeforce') 7 | var OPS = require('bitcoin-ops') 8 | 9 | var HEADER = Buffer.from('aa21a9ed', 'hex') 10 | 11 | function check (script) { 12 | var buffer = bscript.compile(script) 13 | 14 | return buffer.length > 37 && 15 | buffer[0] === OPS.OP_RETURN && 16 | buffer[1] === 0x24 && 17 | buffer.slice(2, 6).equals(HEADER) 18 | } 19 | 20 | check.toJSON = function () { return 'Witness commitment output' } 21 | 22 | function encode (commitment) { 23 | typeforce(types.Hash256bit, commitment) 24 | 25 | var buffer = Buffer.allocUnsafe(36) 26 | HEADER.copy(buffer, 0) 27 | commitment.copy(buffer, 4) 28 | 29 | return bscript.compile([OPS.OP_RETURN, buffer]) 30 | } 31 | 32 | function decode (buffer) { 33 | typeforce(check, buffer) 34 | 35 | return bscript.decompile(buffer)[1].slice(4, 36) 36 | } 37 | 38 | module.exports = { 39 | check: check, 40 | decode: decode, 41 | encode: encode 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnesspubkeyhash/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | input: require('./input'), 3 | output: require('./output') 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnesspubkeyhash/input.js: -------------------------------------------------------------------------------- 1 | // {signature} {pubKey} 2 | 3 | var bscript = require('../../script') 4 | var typeforce = require('typeforce') 5 | 6 | function isCompressedCanonicalPubKey (pubKey) { 7 | return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33 8 | } 9 | 10 | function check (script) { 11 | var chunks = bscript.decompile(script) 12 | 13 | return chunks.length === 2 && 14 | bscript.isCanonicalSignature(chunks[0]) && 15 | isCompressedCanonicalPubKey(chunks[1]) 16 | } 17 | check.toJSON = function () { return 'witnessPubKeyHash input' } 18 | 19 | function encodeStack (signature, pubKey) { 20 | typeforce({ 21 | signature: bscript.isCanonicalSignature, 22 | pubKey: isCompressedCanonicalPubKey 23 | }, { 24 | signature: signature, 25 | pubKey: pubKey 26 | }) 27 | 28 | return [signature, pubKey] 29 | } 30 | 31 | function decodeStack (stack) { 32 | typeforce(typeforce.Array, stack) 33 | typeforce(check, stack) 34 | 35 | return { 36 | signature: stack[0], 37 | pubKey: stack[1] 38 | } 39 | } 40 | 41 | module.exports = { 42 | check: check, 43 | decodeStack: decodeStack, 44 | encodeStack: encodeStack 45 | } 46 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnesspubkeyhash/output.js: -------------------------------------------------------------------------------- 1 | // OP_0 {pubKeyHash} 2 | 3 | var bscript = require('../../script') 4 | var types = require('../../types') 5 | var typeforce = require('typeforce') 6 | var OPS = require('bitcoin-ops') 7 | 8 | function check (script) { 9 | var buffer = bscript.compile(script) 10 | 11 | return buffer.length === 22 && 12 | buffer[0] === OPS.OP_0 && 13 | buffer[1] === 0x14 14 | } 15 | check.toJSON = function () { return 'Witness pubKeyHash output' } 16 | 17 | function encode (pubKeyHash) { 18 | typeforce(types.Hash160bit, pubKeyHash) 19 | 20 | return bscript.compile([OPS.OP_0, pubKeyHash]) 21 | } 22 | 23 | function decode (buffer) { 24 | typeforce(check, buffer) 25 | 26 | return buffer.slice(2) 27 | } 28 | 29 | module.exports = { 30 | check: check, 31 | decode: decode, 32 | encode: encode 33 | } 34 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnessscripthash/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | input: require('./input'), 3 | output: require('./output') 4 | } 5 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnessscripthash/input.js: -------------------------------------------------------------------------------- 1 | // {serialized scriptPubKey script} 2 | 3 | var bscript = require('../../script') 4 | var types = require('../../types') 5 | var typeforce = require('typeforce') 6 | 7 | var p2ms = require('../multisig/') 8 | var p2pk = require('../pubkey/') 9 | var p2pkh = require('../pubkeyhash/') 10 | 11 | function check (chunks, allowIncomplete) { 12 | typeforce(types.Array, chunks) 13 | if (chunks.length < 1) return false 14 | 15 | var witnessScript = chunks[chunks.length - 1] 16 | if (!Buffer.isBuffer(witnessScript)) return false 17 | 18 | var witnessScriptChunks = bscript.decompile(witnessScript) 19 | 20 | // is witnessScript a valid script? 21 | if (witnessScriptChunks.length === 0) return false 22 | 23 | var witnessRawScriptSig = bscript.compile(chunks.slice(0, -1)) 24 | 25 | // match types 26 | if (p2pkh.input.check(witnessRawScriptSig) && 27 | p2pkh.output.check(witnessScriptChunks)) return true 28 | 29 | if (p2ms.input.check(witnessRawScriptSig, allowIncomplete) && 30 | p2ms.output.check(witnessScriptChunks)) return true 31 | 32 | if (p2pk.input.check(witnessRawScriptSig) && 33 | p2pk.output.check(witnessScriptChunks)) return true 34 | 35 | return false 36 | } 37 | check.toJSON = function () { return 'witnessScriptHash input' } 38 | 39 | function encodeStack (witnessData, witnessScript) { 40 | typeforce({ 41 | witnessData: [types.Buffer], 42 | witnessScript: types.Buffer 43 | }, { 44 | witnessData: witnessData, 45 | witnessScript: witnessScript 46 | }) 47 | 48 | return [].concat(witnessData, witnessScript) 49 | } 50 | 51 | function decodeStack (stack) { 52 | typeforce(typeforce.Array, stack) 53 | typeforce(check, stack) 54 | return { 55 | witnessData: stack.slice(0, -1), 56 | witnessScript: stack[stack.length - 1] 57 | } 58 | } 59 | 60 | module.exports = { 61 | check: check, 62 | decodeStack: decodeStack, 63 | encodeStack: encodeStack 64 | } 65 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/templates/witnessscripthash/output.js: -------------------------------------------------------------------------------- 1 | // OP_0 {scriptHash} 2 | 3 | var bscript = require('../../script') 4 | var types = require('../../types') 5 | var typeforce = require('typeforce') 6 | var OPS = require('bitcoin-ops') 7 | 8 | function check (script) { 9 | var buffer = bscript.compile(script) 10 | 11 | return buffer.length === 34 && 12 | buffer[0] === OPS.OP_0 && 13 | buffer[1] === 0x20 14 | } 15 | check.toJSON = function () { return 'Witness scriptHash output' } 16 | 17 | function encode (scriptHash) { 18 | typeforce(types.Hash256bit, scriptHash) 19 | 20 | return bscript.compile([OPS.OP_0, scriptHash]) 21 | } 22 | 23 | function decode (buffer) { 24 | typeforce(check, buffer) 25 | 26 | return buffer.slice(2) 27 | } 28 | 29 | module.exports = { 30 | check: check, 31 | decode: decode, 32 | encode: encode 33 | } 34 | -------------------------------------------------------------------------------- /node_modules/bitcoinjs-lib/src/types.js: -------------------------------------------------------------------------------- 1 | var typeforce = require('typeforce') 2 | 3 | var UINT31_MAX = Math.pow(2, 31) - 1 4 | function UInt31 (value) { 5 | return typeforce.UInt32(value) && value <= UINT31_MAX 6 | } 7 | 8 | function BIP32Path (value) { 9 | return typeforce.String(value) && value.match(/^(m\/)?(\d+'?\/)*\d+'?$/) 10 | } 11 | BIP32Path.toJSON = function () { return 'BIP32 derivation path' } 12 | 13 | var SATOSHI_MAX = 21 * 1e14 14 | function Satoshi (value) { 15 | return typeforce.UInt53(value) && value <= SATOSHI_MAX 16 | } 17 | 18 | // external dependent types 19 | var BigInt = typeforce.quacksLike('BigInteger') 20 | var ECPoint = typeforce.quacksLike('Point') 21 | 22 | // exposed, external API 23 | var ECSignature = typeforce.compile({ r: BigInt, s: BigInt }) 24 | var Network = typeforce.compile({ 25 | messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String), 26 | bip32: { 27 | public: typeforce.UInt32, 28 | private: typeforce.UInt32 29 | }, 30 | pubKeyHash: typeforce.UInt8, 31 | scriptHash: typeforce.UInt8, 32 | wif: typeforce.UInt8 33 | }) 34 | 35 | // extend typeforce types with ours 36 | var types = { 37 | BigInt: BigInt, 38 | BIP32Path: BIP32Path, 39 | Buffer256bit: typeforce.BufferN(32), 40 | ECPoint: ECPoint, 41 | ECSignature: ECSignature, 42 | Hash160bit: typeforce.BufferN(20), 43 | Hash256bit: typeforce.BufferN(32), 44 | Network: Network, 45 | Satoshi: Satoshi, 46 | UInt31: UInt31 47 | } 48 | 49 | for (var typeName in typeforce) { 50 | types[typeName] = typeforce[typeName] 51 | } 52 | 53 | module.exports = types 54 | -------------------------------------------------------------------------------- /node_modules/bs58/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 4.0.0 / 2016-12-3 2 | ------------------ 3 | - `decode` now returns a `Buffer` again, to avoid potential cryptographic errors. [Daniel Cousens / #21](https://github.com/cryptocoinjs/bs58/pull/21) 4 | 5 | 3.0.0 / 2015-08-18 6 | ------------------ 7 | - refactored module into generic [`base-x`](https://github.com/cryptocoinjs/base-x). 8 | 9 | 2.0.1 / 2014-12-23 10 | ------------------ 11 | - performance boost in `encode()` [#10](https://github.com/cryptocoinjs/bs58/pull/10) 12 | 13 | 2.0.0 / 2014-10-03 14 | ------------------ 15 | - `decode` now returns an `Array` instead of `Buffer` to keep things simple. [Daniel Cousens / #9](https://github.com/cryptocoinjs/bs58/pull/9) 16 | 17 | 1.2.1 / 2014-07-24 18 | ------------------ 19 | * speed optimizations [Daniel Cousens / #8](https://github.com/cryptocoinjs/bs58/pull/8) 20 | 21 | 1.2.0 / 2014-06-29 22 | ------------------ 23 | * removed `bigi` dep, implemented direct byte conversion [Jared Deckard / #6](https://github.com/cryptocoinjs/bs58/pull/6) 24 | 25 | 1.1.0 / 2014-06-26 26 | ------------------ 27 | * user `Buffer` internally for calculations, providing cleaner code and a performance increase. [Daniel Cousens](https://github.com/cryptocoinjs/bs58/commit/129c71de8bc1e36f113bce06da0616066f41c5ca) 28 | 29 | 1.0.0 / 2014-05-27 30 | ------------------ 31 | * removed `binstring` dep, `Buffer` now only input to `encode()` and output of `decode()` 32 | * update `bigi` from `~0.3.0` to `^1.1.0` 33 | * added travis-ci support 34 | * added coveralls support 35 | * modified tests and library to handle fixture style testing (thanks to bitcoinjs-lib devs and [Daniel Cousens](https://github.com/dcousens)) 36 | 37 | 38 | 0.3.0 / 2014-02-24 39 | ------------------ 40 | * duck type input to `encode` and change output of `decode` to `Buffer`. 41 | 42 | 43 | 0.2.1 / 2014-02-24 44 | ------------------ 45 | * removed bower and component support. Closes #1 46 | * convert from 4 spaces to 2 47 | 48 | 49 | 0.2.0 / 2013-12-07 50 | ------------------ 51 | * renamed from `cryptocoin-base58` to `bs58` 52 | 53 | 54 | 0.1.0 / 2013-11-20 55 | ------------------ 56 | * removed AMD support 57 | 58 | 59 | 0.0.1 / 2013-11-04 60 | ------------------ 61 | * initial release 62 | -------------------------------------------------------------------------------- /node_modules/bs58/README.md: -------------------------------------------------------------------------------- 1 | bs58 2 | ==== 3 | 4 | [![build status](https://travis-ci.org/cryptocoinjs/bs58.svg)](https://travis-ci.org/cryptocoinjs/bs58) 5 | 6 | JavaScript component to compute base 58 encoding. This encoding is typically used for crypto currencies such as Bitcoin. 7 | 8 | **Note:** If you're looking for **base 58 check** encoding, see: [https://github.com/bitcoinjs/bs58check](https://github.com/bitcoinjs/bs58check), which depends upon this library. 9 | 10 | 11 | Install 12 | ------- 13 | 14 | npm i --save bs58 15 | 16 | 17 | API 18 | --- 19 | 20 | ### encode(input) 21 | 22 | `input` must be a [Buffer](https://nodejs.org/api/buffer.html) or an `Array`. It returns a `string`. 23 | 24 | **example**: 25 | 26 | ```js 27 | const bs58 = require('bs58') 28 | 29 | const bytes = Buffer.from('003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187', 'hex') 30 | const address = bs58.encode(bytes) 31 | console.log(address) 32 | // => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS 33 | ``` 34 | 35 | 36 | ### decode(input) 37 | 38 | `input` must be a base 58 encoded string. Returns a [Buffer](https://nodejs.org/api/buffer.html). 39 | 40 | **example**: 41 | 42 | ```js 43 | const bs58 = require('bs58') 44 | 45 | const address = '16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS' 46 | const bytes = bs58.decode(address) 47 | console.log(out.toString('hex')) 48 | // => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187 49 | ``` 50 | 51 | Hack / Test 52 | ----------- 53 | 54 | Uses JavaScript standard style. Read more: 55 | 56 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 57 | 58 | 59 | Credits 60 | ------- 61 | - [Mike Hearn](https://github.com/mikehearn) for original Java implementation 62 | - [Stefan Thomas](https://github.com/justmoon) for porting to JavaScript 63 | - [Stephan Pair](https://github.com/gasteve) for buffer improvements 64 | - [Daniel Cousens](https://github.com/dcousens) for cleanup and merging improvements from bitcoinjs-lib 65 | - [Jared Deckard](https://github.com/deckar01) for killing `bigi` as a dependency 66 | 67 | 68 | License 69 | ------- 70 | 71 | MIT 72 | -------------------------------------------------------------------------------- /node_modules/bs58/index.js: -------------------------------------------------------------------------------- 1 | var basex = require('base-x') 2 | var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' 3 | 4 | module.exports = basex(ALPHABET) 5 | -------------------------------------------------------------------------------- /node_modules/bs58/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bs58@^4.0.0", 3 | "_id": "bs58@4.0.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", 6 | "_location": "/bs58", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "bs58@^4.0.0", 12 | "name": "bs58", 13 | "escapedName": "bs58", 14 | "rawSpec": "^4.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^4.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bs58check" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", 22 | "_shasum": "be161e76c354f6f788ae4071f63f34e8c4f0a42a", 23 | "_spec": "bs58@^4.0.0", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bs58check", 25 | "bugs": { 26 | "url": "https://github.com/cryptocoinjs/bs58/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "dependencies": { 30 | "base-x": "^3.0.2" 31 | }, 32 | "deprecated": false, 33 | "description": "Base 58 encoding / decoding", 34 | "devDependencies": { 35 | "standard": "*", 36 | "tape": "^4.6.3" 37 | }, 38 | "files": [ 39 | "./index.js" 40 | ], 41 | "homepage": "https://github.com/cryptocoinjs/bs58#readme", 42 | "keywords": [ 43 | "base58", 44 | "bitcoin", 45 | "crypto", 46 | "crytography", 47 | "decode", 48 | "decoding", 49 | "encode", 50 | "encoding", 51 | "litecoin" 52 | ], 53 | "license": "MIT", 54 | "main": "./index.js", 55 | "name": "bs58", 56 | "repository": { 57 | "url": "git+https://github.com/cryptocoinjs/bs58.git", 58 | "type": "git" 59 | }, 60 | "scripts": { 61 | "standard": "standard", 62 | "test": "npm run standard && npm run unit", 63 | "unit": "tape test/index.js" 64 | }, 65 | "version": "4.0.1" 66 | } 67 | -------------------------------------------------------------------------------- /node_modules/bs58check/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Daniel Cousens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/bs58check/README.md: -------------------------------------------------------------------------------- 1 | # bs58check 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/bs58check.svg?style=flat-square)](https://www.npmjs.org/package/bs58check) 4 | [![Build Status](https://img.shields.io/travis/bitcoinjs/bs58check.svg?branch=master&style=flat-square)](https://travis-ci.org/bitcoinjs/bs58check) 5 | [![Dependency status](https://img.shields.io/david/bitcoinjs/bs58check.svg?style=flat-square)](https://david-dm.org/bitcoinjs/bs58check#info=dependencies) 6 | 7 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 8 | 9 | A straight forward implementation of base58check extending upon bs58. 10 | 11 | 12 | ## Example 13 | 14 | ```javascript 15 | var bs58check = require('bs58check') 16 | 17 | var decoded = bs58check.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr') 18 | 19 | console.log(decoded) 20 | // => 21 | 22 | console.log(bs58check.encode(decoded)) 23 | // => 5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr 24 | ``` 25 | 26 | 27 | ## LICSENSE [MIT](LICENSE) 28 | -------------------------------------------------------------------------------- /node_modules/bs58check/base.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var base58 = require('bs58') 4 | var Buffer = require('safe-buffer').Buffer 5 | 6 | module.exports = function (checksumFn) { 7 | // Encode a buffer as a base58-check encoded string 8 | function encode (payload) { 9 | var checksum = checksumFn(payload) 10 | 11 | return base58.encode(Buffer.concat([ 12 | payload, 13 | checksum 14 | ], payload.length + 4)) 15 | } 16 | 17 | function decodeRaw (buffer) { 18 | var payload = buffer.slice(0, -4) 19 | var checksum = buffer.slice(-4) 20 | var newChecksum = checksumFn(payload) 21 | 22 | if (checksum[0] ^ newChecksum[0] | 23 | checksum[1] ^ newChecksum[1] | 24 | checksum[2] ^ newChecksum[2] | 25 | checksum[3] ^ newChecksum[3]) return 26 | 27 | return payload 28 | } 29 | 30 | // Decode a base58-check encoded string to a buffer, no result if checksum is wrong 31 | function decodeUnsafe (string) { 32 | var buffer = base58.decodeUnsafe(string) 33 | if (!buffer) return 34 | 35 | return decodeRaw(buffer) 36 | } 37 | 38 | function decode (string) { 39 | var buffer = base58.decode(string) 40 | var payload = decodeRaw(buffer, checksumFn) 41 | if (!payload) throw new Error('Invalid checksum') 42 | return payload 43 | } 44 | 45 | return { 46 | encode: encode, 47 | decode: decode, 48 | decodeUnsafe: decodeUnsafe 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /node_modules/bs58check/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var createHash = require('create-hash') 4 | var bs58checkBase = require('./base') 5 | 6 | // SHA256(SHA256(buffer)) 7 | function sha256x2 (buffer) { 8 | var tmp = createHash('sha256').update(buffer).digest() 9 | return createHash('sha256').update(tmp).digest() 10 | } 11 | 12 | module.exports = bs58checkBase(sha256x2) 13 | -------------------------------------------------------------------------------- /node_modules/bs58check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bs58check@^2.0.0", 3 | "_id": "bs58check@2.1.1", 4 | "_inBundle": false, 5 | "_integrity": "sha512-okRQiWc5FJuA2VOwQ1hB7Sf0MyEFg/EwRN12h4b8HrJoGkZ3xq1CGjkaAfYloLcZyqixQnO5mhPpN6IcHSplVg==", 6 | "_location": "/bs58check", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "bs58check@^2.0.0", 12 | "name": "bs58check", 13 | "escapedName": "bs58check", 14 | "rawSpec": "^2.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib", 20 | "/wif" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.1.tgz", 23 | "_shasum": "8a5d0e587af97b784bf9cbf1b29f454d82bc0222", 24 | "_spec": "bs58check@^2.0.0", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 26 | "author": { 27 | "name": "Daniel Cousens" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/bitcoinjs/bs58check/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "dependencies": { 34 | "bs58": "^4.0.0", 35 | "create-hash": "^1.1.0" 36 | }, 37 | "deprecated": false, 38 | "description": "A straightforward implementation of base58-check encoding", 39 | "devDependencies": { 40 | "blake-hash": "^1.0.0", 41 | "nyc": "^11.3.0", 42 | "safe-buffer": "^5.1.1", 43 | "standard": "^10.0.3", 44 | "tape": "^4.6.2" 45 | }, 46 | "files": [ 47 | "index.js", 48 | "base.js" 49 | ], 50 | "homepage": "https://github.com/bitcoinjs/bs58check", 51 | "keywords": [ 52 | "base", 53 | "base58", 54 | "base58check", 55 | "bitcoin", 56 | "bs58", 57 | "check", 58 | "checksum", 59 | "decode", 60 | "decoding", 61 | "encode", 62 | "encoding", 63 | "litecoin" 64 | ], 65 | "license": "MIT", 66 | "main": "index.js", 67 | "name": "bs58check", 68 | "repository": { 69 | "type": "git", 70 | "url": "git+https://github.com/bitcoinjs/bs58check.git" 71 | }, 72 | "scripts": { 73 | "coverage": "nyc --check-coverage --branches 90 --functions 90 npm run unit", 74 | "coverage-report": "nyc report --reporter=lcov", 75 | "standard": "standard", 76 | "test": "npm run standard && npm run coverage", 77 | "unit": "tape test/*.js" 78 | }, 79 | "version": "2.1.1" 80 | } 81 | -------------------------------------------------------------------------------- /node_modules/cipher-base/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["standard"] 3 | } 4 | -------------------------------------------------------------------------------- /node_modules/cipher-base/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /node_modules/cipher-base/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.11" 4 | - "0.10" 5 | - "0.12" 6 | - "iojs" 7 | -------------------------------------------------------------------------------- /node_modules/cipher-base/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 crypto-browserify contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/cipher-base/README.md: -------------------------------------------------------------------------------- 1 | cipher-base 2 | === 3 | 4 | [![Build Status](https://travis-ci.org/crypto-browserify/cipher-base.svg)](https://travis-ci.org/crypto-browserify/cipher-base) 5 | 6 | Abstract base class to inherit from if you want to create streams implementing 7 | the same api as node crypto streams. 8 | 9 | Requires you to implement 2 methods `_final` and `_update`. `_update` takes a 10 | buffer and should return a buffer, `_final` takes no arguments and should return 11 | a buffer. 12 | 13 | 14 | The constructor takes one argument and that is a string which if present switches 15 | it into hash mode, i.e. the object you get from crypto.createHash or 16 | crypto.createSign, this switches the name of the final method to be the string 17 | you passed instead of `final` and returns `this` from update. 18 | -------------------------------------------------------------------------------- /node_modules/cipher-base/index.js: -------------------------------------------------------------------------------- 1 | var Buffer = require('safe-buffer').Buffer 2 | var Transform = require('stream').Transform 3 | var StringDecoder = require('string_decoder').StringDecoder 4 | var inherits = require('inherits') 5 | 6 | function CipherBase (hashMode) { 7 | Transform.call(this) 8 | this.hashMode = typeof hashMode === 'string' 9 | if (this.hashMode) { 10 | this[hashMode] = this._finalOrDigest 11 | } else { 12 | this.final = this._finalOrDigest 13 | } 14 | if (this._final) { 15 | this.__final = this._final 16 | this._final = null 17 | } 18 | this._decoder = null 19 | this._encoding = null 20 | } 21 | inherits(CipherBase, Transform) 22 | 23 | CipherBase.prototype.update = function (data, inputEnc, outputEnc) { 24 | if (typeof data === 'string') { 25 | data = Buffer.from(data, inputEnc) 26 | } 27 | 28 | var outData = this._update(data) 29 | if (this.hashMode) return this 30 | 31 | if (outputEnc) { 32 | outData = this._toString(outData, outputEnc) 33 | } 34 | 35 | return outData 36 | } 37 | 38 | CipherBase.prototype.setAutoPadding = function () {} 39 | CipherBase.prototype.getAuthTag = function () { 40 | throw new Error('trying to get auth tag in unsupported state') 41 | } 42 | 43 | CipherBase.prototype.setAuthTag = function () { 44 | throw new Error('trying to set auth tag in unsupported state') 45 | } 46 | 47 | CipherBase.prototype.setAAD = function () { 48 | throw new Error('trying to set aad in unsupported state') 49 | } 50 | 51 | CipherBase.prototype._transform = function (data, _, next) { 52 | var err 53 | try { 54 | if (this.hashMode) { 55 | this._update(data) 56 | } else { 57 | this.push(this._update(data)) 58 | } 59 | } catch (e) { 60 | err = e 61 | } finally { 62 | next(err) 63 | } 64 | } 65 | CipherBase.prototype._flush = function (done) { 66 | var err 67 | try { 68 | this.push(this.__final()) 69 | } catch (e) { 70 | err = e 71 | } 72 | 73 | done(err) 74 | } 75 | CipherBase.prototype._finalOrDigest = function (outputEnc) { 76 | var outData = this.__final() || Buffer.alloc(0) 77 | if (outputEnc) { 78 | outData = this._toString(outData, outputEnc, true) 79 | } 80 | return outData 81 | } 82 | 83 | CipherBase.prototype._toString = function (value, enc, fin) { 84 | if (!this._decoder) { 85 | this._decoder = new StringDecoder(enc) 86 | this._encoding = enc 87 | } 88 | 89 | if (this._encoding !== enc) throw new Error('can\'t switch encodings') 90 | 91 | var out = this._decoder.write(value) 92 | if (fin) { 93 | out += this._decoder.end() 94 | } 95 | 96 | return out 97 | } 98 | 99 | module.exports = CipherBase 100 | -------------------------------------------------------------------------------- /node_modules/cipher-base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "cipher-base@^1.0.1", 3 | "_id": "cipher-base@1.0.4", 4 | "_inBundle": false, 5 | "_integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", 6 | "_location": "/cipher-base", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "cipher-base@^1.0.1", 12 | "name": "cipher-base", 13 | "escapedName": "cipher-base", 14 | "rawSpec": "^1.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/create-hash", 20 | "/create-hmac" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", 23 | "_shasum": "8760e4ecc272f4c363532f926d874aae2c1397de", 24 | "_spec": "cipher-base@^1.0.1", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\create-hash", 26 | "author": { 27 | "name": "Calvin Metcalf", 28 | "email": "calvin.metcalf@gmail.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/crypto-browserify/cipher-base/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "inherits": "^2.0.1", 36 | "safe-buffer": "^5.0.1" 37 | }, 38 | "deprecated": false, 39 | "description": "abstract base class for crypto-streams", 40 | "devDependencies": { 41 | "standard": "^10.0.2", 42 | "tap-spec": "^4.1.0", 43 | "tape": "^4.2.0" 44 | }, 45 | "homepage": "https://github.com/crypto-browserify/cipher-base#readme", 46 | "keywords": [ 47 | "cipher", 48 | "stream" 49 | ], 50 | "license": "MIT", 51 | "main": "index.js", 52 | "name": "cipher-base", 53 | "repository": { 54 | "type": "git", 55 | "url": "git+https://github.com/crypto-browserify/cipher-base.git" 56 | }, 57 | "scripts": { 58 | "test": "node test.js | tspec" 59 | }, 60 | "version": "1.0.4" 61 | } 62 | -------------------------------------------------------------------------------- /node_modules/create-hash/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | before_install: 4 | - "npm install npm -g" 5 | node_js: 6 | - "4" 7 | - "5" 8 | - "6" 9 | - "7" 10 | env: 11 | matrix: 12 | - TEST_SUITE=unit 13 | matrix: 14 | include: 15 | - node_js: "7" 16 | env: TEST_SUITE=standard 17 | script: npm run $TEST_SUITE 18 | -------------------------------------------------------------------------------- /node_modules/create-hash/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 crypto-browserify contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/create-hash/README.md: -------------------------------------------------------------------------------- 1 | # create-hash 2 | 3 | [![Build Status](https://travis-ci.org/crypto-browserify/createHash.svg)](https://travis-ci.org/crypto-browserify/createHash) 4 | 5 | Node style hashes for use in the browser, with native hash functions in node. 6 | 7 | API is the same as hashes in node: 8 | ```js 9 | var createHash = require('create-hash') 10 | var hash = createHash('sha224') 11 | hash.update('synchronous write') // optional encoding parameter 12 | hash.digest() // synchronously get result with optional encoding parameter 13 | 14 | hash.write('write to it as a stream') 15 | hash.end() // remember it's a stream 16 | hash.read() // only if you ended it as a stream though 17 | ``` 18 | 19 | To get the JavaScript version even in node do `require('create-hash/browser')` 20 | -------------------------------------------------------------------------------- /node_modules/create-hash/browser.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var inherits = require('inherits') 3 | var MD5 = require('md5.js') 4 | var RIPEMD160 = require('ripemd160') 5 | var sha = require('sha.js') 6 | var Base = require('cipher-base') 7 | 8 | function Hash (hash) { 9 | Base.call(this, 'digest') 10 | 11 | this._hash = hash 12 | } 13 | 14 | inherits(Hash, Base) 15 | 16 | Hash.prototype._update = function (data) { 17 | this._hash.update(data) 18 | } 19 | 20 | Hash.prototype._final = function () { 21 | return this._hash.digest() 22 | } 23 | 24 | module.exports = function createHash (alg) { 25 | alg = alg.toLowerCase() 26 | if (alg === 'md5') return new MD5() 27 | if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160() 28 | 29 | return new Hash(sha(alg)) 30 | } 31 | -------------------------------------------------------------------------------- /node_modules/create-hash/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('crypto').createHash 2 | -------------------------------------------------------------------------------- /node_modules/create-hash/md5.js: -------------------------------------------------------------------------------- 1 | var MD5 = require('md5.js') 2 | 3 | module.exports = function (buffer) { 4 | return new MD5().update(buffer).digest() 5 | } 6 | -------------------------------------------------------------------------------- /node_modules/create-hash/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "create-hash@^1.1.0", 3 | "_id": "create-hash@1.2.0", 4 | "_inBundle": false, 5 | "_integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", 6 | "_location": "/create-hash", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "create-hash@^1.1.0", 12 | "name": "create-hash", 13 | "escapedName": "create-hash", 14 | "rawSpec": "^1.1.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib", 20 | "/bs58check", 21 | "/create-hmac" 22 | ], 23 | "_resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", 24 | "_shasum": "889078af11a63756bcfb59bd221996be3a9ef196", 25 | "_spec": "create-hash@^1.1.0", 26 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 27 | "author": "", 28 | "browser": "browser.js", 29 | "bugs": { 30 | "url": "https://github.com/crypto-browserify/createHash/issues" 31 | }, 32 | "bundleDependencies": false, 33 | "dependencies": { 34 | "cipher-base": "^1.0.1", 35 | "inherits": "^2.0.1", 36 | "md5.js": "^1.3.4", 37 | "ripemd160": "^2.0.1", 38 | "sha.js": "^2.4.0" 39 | }, 40 | "deprecated": false, 41 | "description": "create hashes for browserify", 42 | "devDependencies": { 43 | "hash-test-vectors": "^1.3.2", 44 | "safe-buffer": "^5.0.1", 45 | "standard": "^10.0.2", 46 | "tap-spec": "^2.1.2", 47 | "tape": "^4.6.3" 48 | }, 49 | "homepage": "https://github.com/crypto-browserify/createHash", 50 | "keywords": [ 51 | "crypto" 52 | ], 53 | "license": "MIT", 54 | "main": "index.js", 55 | "name": "create-hash", 56 | "repository": { 57 | "type": "git", 58 | "url": "git+ssh://git@github.com/crypto-browserify/createHash.git" 59 | }, 60 | "scripts": { 61 | "standard": "standard", 62 | "test": "npm run-script standard && npm run-script unit", 63 | "unit": "node test.js | tspec" 64 | }, 65 | "version": "1.2.0" 66 | } 67 | -------------------------------------------------------------------------------- /node_modules/create-hash/test.js: -------------------------------------------------------------------------------- 1 | var test = require('tape') 2 | 3 | var Buffer = require('safe-buffer').Buffer 4 | var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160', 'ripemd160'] 5 | var encodings = ['hex', 'base64'] // ignore binary 6 | var vectors = require('hash-test-vectors') 7 | vectors.forEach(function (vector) { 8 | vector.ripemd160 = vector.rmd160 9 | }) 10 | var createHash = require('./browser') 11 | 12 | algorithms.forEach(function (algorithm) { 13 | test('test ' + algorithm + ' against test vectors', function (t) { 14 | vectors.forEach(function (obj, i) { 15 | var input = Buffer.from(obj.input, 'base64') 16 | var node = obj[algorithm] 17 | var js = createHash(algorithm).update(input).digest('hex') 18 | t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node) 19 | }) 20 | 21 | encodings.forEach(function (encoding) { 22 | vectors.forEach(function (obj, i) { 23 | var input = Buffer.from(obj.input, 'base64').toString(encoding) 24 | var node = obj[algorithm] 25 | var js = createHash(algorithm).update(input, encoding).digest('hex') 26 | t.equal(js, node, algorithm + '(testVector[' + i + '], ' + encoding + ') == ' + node) 27 | }) 28 | }) 29 | 30 | vectors.forEach(function (obj, i) { 31 | var input = Buffer.from(obj.input, 'base64') 32 | var node = obj[algorithm] 33 | var hash = createHash(algorithm) 34 | hash.end(input) 35 | var js = hash.read().toString('hex') 36 | t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node) 37 | }) 38 | 39 | t.end() 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /node_modules/create-hmac/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 crypto-browserify contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/create-hmac/README.md: -------------------------------------------------------------------------------- 1 | # create-hmac 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/create-hmac.svg?style=flat-square)](https://www.npmjs.org/package/create-hmac) 4 | [![Build Status](https://img.shields.io/travis/crypto-browserify/createHmac.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/createHmac) 5 | [![Dependency status](https://img.shields.io/david/crypto-browserify/createHmac.svg?style=flat-square)](https://david-dm.org/crypto-browserify/createHmac#info=dependencies) 6 | 7 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 8 | 9 | Node style HMACs for use in the browser, with native HMAC functions in node. API is the same as HMACs in node: 10 | 11 | ```js 12 | var createHmac = require('create-hmac') 13 | var hmac = createHmac('sha224', Buffer.from('secret key')) 14 | hmac.update('synchronous write') //optional encoding parameter 15 | hmac.digest() // synchronously get result with optional encoding parameter 16 | 17 | hmac.write('write to it as a stream') 18 | hmac.end() //remember it's a stream 19 | hmac.read() //only if you ended it as a stream though 20 | ``` 21 | -------------------------------------------------------------------------------- /node_modules/create-hmac/browser.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var inherits = require('inherits') 3 | var Legacy = require('./legacy') 4 | var Base = require('cipher-base') 5 | var Buffer = require('safe-buffer').Buffer 6 | var md5 = require('create-hash/md5') 7 | var RIPEMD160 = require('ripemd160') 8 | 9 | var sha = require('sha.js') 10 | 11 | var ZEROS = Buffer.alloc(128) 12 | 13 | function Hmac (alg, key) { 14 | Base.call(this, 'digest') 15 | if (typeof key === 'string') { 16 | key = Buffer.from(key) 17 | } 18 | 19 | var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 20 | 21 | this._alg = alg 22 | this._key = key 23 | if (key.length > blocksize) { 24 | var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) 25 | key = hash.update(key).digest() 26 | } else if (key.length < blocksize) { 27 | key = Buffer.concat([key, ZEROS], blocksize) 28 | } 29 | 30 | var ipad = this._ipad = Buffer.allocUnsafe(blocksize) 31 | var opad = this._opad = Buffer.allocUnsafe(blocksize) 32 | 33 | for (var i = 0; i < blocksize; i++) { 34 | ipad[i] = key[i] ^ 0x36 35 | opad[i] = key[i] ^ 0x5C 36 | } 37 | this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) 38 | this._hash.update(ipad) 39 | } 40 | 41 | inherits(Hmac, Base) 42 | 43 | Hmac.prototype._update = function (data) { 44 | this._hash.update(data) 45 | } 46 | 47 | Hmac.prototype._final = function () { 48 | var h = this._hash.digest() 49 | var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg) 50 | return hash.update(this._opad).update(h).digest() 51 | } 52 | 53 | module.exports = function createHmac (alg, key) { 54 | alg = alg.toLowerCase() 55 | if (alg === 'rmd160' || alg === 'ripemd160') { 56 | return new Hmac('rmd160', key) 57 | } 58 | if (alg === 'md5') { 59 | return new Legacy(md5, key) 60 | } 61 | return new Hmac(alg, key) 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/create-hmac/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('crypto').createHmac 2 | -------------------------------------------------------------------------------- /node_modules/create-hmac/legacy.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var inherits = require('inherits') 3 | var Buffer = require('safe-buffer').Buffer 4 | 5 | var Base = require('cipher-base') 6 | 7 | var ZEROS = Buffer.alloc(128) 8 | var blocksize = 64 9 | 10 | function Hmac (alg, key) { 11 | Base.call(this, 'digest') 12 | if (typeof key === 'string') { 13 | key = Buffer.from(key) 14 | } 15 | 16 | this._alg = alg 17 | this._key = key 18 | 19 | if (key.length > blocksize) { 20 | key = alg(key) 21 | } else if (key.length < blocksize) { 22 | key = Buffer.concat([key, ZEROS], blocksize) 23 | } 24 | 25 | var ipad = this._ipad = Buffer.allocUnsafe(blocksize) 26 | var opad = this._opad = Buffer.allocUnsafe(blocksize) 27 | 28 | for (var i = 0; i < blocksize; i++) { 29 | ipad[i] = key[i] ^ 0x36 30 | opad[i] = key[i] ^ 0x5C 31 | } 32 | 33 | this._hash = [ipad] 34 | } 35 | 36 | inherits(Hmac, Base) 37 | 38 | Hmac.prototype._update = function (data) { 39 | this._hash.push(data) 40 | } 41 | 42 | Hmac.prototype._final = function () { 43 | var h = this._alg(Buffer.concat(this._hash)) 44 | return this._alg(Buffer.concat([this._opad, h])) 45 | } 46 | module.exports = Hmac 47 | -------------------------------------------------------------------------------- /node_modules/create-hmac/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "create-hmac@^1.1.3", 3 | "_id": "create-hmac@1.1.7", 4 | "_inBundle": false, 5 | "_integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", 6 | "_location": "/create-hmac", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "create-hmac@^1.1.3", 12 | "name": "create-hmac", 13 | "escapedName": "create-hmac", 14 | "rawSpec": "^1.1.3", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.1.3" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", 22 | "_shasum": "69170c78b3ab957147b2b8b04572e47ead2243ff", 23 | "_spec": "create-hmac@^1.1.3", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": "", 26 | "browser": "./browser.js", 27 | "bugs": { 28 | "url": "https://github.com/crypto-browserify/createHmac/issues" 29 | }, 30 | "bundleDependencies": false, 31 | "dependencies": { 32 | "cipher-base": "^1.0.3", 33 | "create-hash": "^1.1.0", 34 | "inherits": "^2.0.1", 35 | "ripemd160": "^2.0.0", 36 | "safe-buffer": "^5.0.1", 37 | "sha.js": "^2.4.8" 38 | }, 39 | "deprecated": false, 40 | "description": "node style hmacs in the browser", 41 | "devDependencies": { 42 | "hash-test-vectors": "^1.3.2", 43 | "standard": "^5.3.1", 44 | "tap-spec": "^2.1.2", 45 | "tape": "^3.0.3" 46 | }, 47 | "files": [ 48 | "browser.js", 49 | "index.js", 50 | "legacy.js" 51 | ], 52 | "homepage": "https://github.com/crypto-browserify/createHmac", 53 | "keywords": [ 54 | "crypto", 55 | "hmac" 56 | ], 57 | "license": "MIT", 58 | "main": "index.js", 59 | "name": "create-hmac", 60 | "repository": { 61 | "type": "git", 62 | "url": "git+https://github.com/crypto-browserify/createHmac.git" 63 | }, 64 | "scripts": { 65 | "standard": "standard", 66 | "test": "npm run-script standard && npm run-script unit", 67 | "unit": "node test.js | tspec" 68 | }, 69 | "version": "1.1.7" 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/ecurve/.min-wd: -------------------------------------------------------------------------------- 1 | { 2 | "hostname" : "localhost", 3 | "port" : 4444, 4 | "browsers" : [{ 5 | "name" : "chrome" 6 | }] 7 | } -------------------------------------------------------------------------------- /node_modules/ecurve/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "4" 5 | - "5" 6 | - "6" 7 | - "7" 8 | matrix: 9 | include: 10 | - node_js: "7" 11 | env: TEST_SUITE=lint 12 | env: 13 | - TEST_SUITE=unit 14 | script: npm run-script $TEST_SUITE 15 | -------------------------------------------------------------------------------- /node_modules/ecurve/README.md: -------------------------------------------------------------------------------- 1 | ecurve 2 | ======= 3 | 4 | [![build status](https://secure.travis-ci.org/cryptocoinjs/ecurve.svg)](http://travis-ci.org/cryptocoinjs/ecurve) 5 | 6 | 7 | JavaScript component for [Elliptic Curve Cryptography](http://en.wikipedia.org/wiki/Elliptic_curve_cryptography). Works in both Node.js and the browser. 8 | 9 | Official documentation: 10 | 11 | http://cryptocoinjs.com/modules/crypto/ecurve/ 12 | -------------------------------------------------------------------------------- /node_modules/ecurve/lib/curve.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert') 2 | var BigInteger = require('bigi') 3 | 4 | var Point = require('./point') 5 | 6 | function Curve (p, a, b, Gx, Gy, n, h) { 7 | this.p = p 8 | this.a = a 9 | this.b = b 10 | this.G = Point.fromAffine(this, Gx, Gy) 11 | this.n = n 12 | this.h = h 13 | 14 | this.infinity = new Point(this, null, null, BigInteger.ZERO) 15 | 16 | // result caching 17 | this.pOverFour = p.add(BigInteger.ONE).shiftRight(2) 18 | 19 | // determine size of p in bytes 20 | this.pLength = Math.floor((this.p.bitLength() + 7) / 8) 21 | } 22 | 23 | Curve.prototype.pointFromX = function (isOdd, x) { 24 | var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p) 25 | var beta = alpha.modPow(this.pOverFour, this.p) // XXX: not compatible with all curves 26 | 27 | var y = beta 28 | if (beta.isEven() ^ !isOdd) { 29 | y = this.p.subtract(y) // -y % p 30 | } 31 | 32 | return Point.fromAffine(this, x, y) 33 | } 34 | 35 | Curve.prototype.isInfinity = function (Q) { 36 | if (Q === this.infinity) return true 37 | 38 | return Q.z.signum() === 0 && Q.y.signum() !== 0 39 | } 40 | 41 | Curve.prototype.isOnCurve = function (Q) { 42 | if (this.isInfinity(Q)) return true 43 | 44 | var x = Q.affineX 45 | var y = Q.affineY 46 | var a = this.a 47 | var b = this.b 48 | var p = this.p 49 | 50 | // Check that xQ and yQ are integers in the interval [0, p - 1] 51 | if (x.signum() < 0 || x.compareTo(p) >= 0) return false 52 | if (y.signum() < 0 || y.compareTo(p) >= 0) return false 53 | 54 | // and check that y^2 = x^3 + ax + b (mod p) 55 | var lhs = y.square().mod(p) 56 | var rhs = x.pow(3).add(a.multiply(x)).add(b).mod(p) 57 | return lhs.equals(rhs) 58 | } 59 | 60 | /** 61 | * Validate an elliptic curve point. 62 | * 63 | * See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive 64 | */ 65 | Curve.prototype.validate = function (Q) { 66 | // Check Q != O 67 | assert(!this.isInfinity(Q), 'Point is at infinity') 68 | assert(this.isOnCurve(Q), 'Point is not on the curve') 69 | 70 | // Check nQ = O (where Q is a scalar multiple of G) 71 | var nQ = Q.multiply(this.n) 72 | assert(this.isInfinity(nQ), 'Point is not a scalar multiple of G') 73 | 74 | return true 75 | } 76 | 77 | module.exports = Curve 78 | -------------------------------------------------------------------------------- /node_modules/ecurve/lib/curves.json: -------------------------------------------------------------------------------- 1 | { 2 | "secp128r1": { 3 | "p": "fffffffdffffffffffffffffffffffff", 4 | "a": "fffffffdfffffffffffffffffffffffc", 5 | "b": "e87579c11079f43dd824993c2cee5ed3", 6 | "n": "fffffffe0000000075a30d1b9038a115", 7 | "h": "01", 8 | "Gx": "161ff7528b899b2d0c28607ca52c5b86", 9 | "Gy": "cf5ac8395bafeb13c02da292dded7a83" 10 | }, 11 | "secp160k1": { 12 | "p": "fffffffffffffffffffffffffffffffeffffac73", 13 | "a": "00", 14 | "b": "07", 15 | "n": "0100000000000000000001b8fa16dfab9aca16b6b3", 16 | "h": "01", 17 | "Gx": "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb", 18 | "Gy": "938cf935318fdced6bc28286531733c3f03c4fee" 19 | }, 20 | "secp160r1": { 21 | "p": "ffffffffffffffffffffffffffffffff7fffffff", 22 | "a": "ffffffffffffffffffffffffffffffff7ffffffc", 23 | "b": "1c97befc54bd7a8b65acf89f81d4d4adc565fa45", 24 | "n": "0100000000000000000001f4c8f927aed3ca752257", 25 | "h": "01", 26 | "Gx": "4a96b5688ef573284664698968c38bb913cbfc82", 27 | "Gy": "23a628553168947d59dcc912042351377ac5fb32" 28 | }, 29 | "secp192k1": { 30 | "p": "fffffffffffffffffffffffffffffffffffffffeffffee37", 31 | "a": "00", 32 | "b": "03", 33 | "n": "fffffffffffffffffffffffe26f2fc170f69466a74defd8d", 34 | "h": "01", 35 | "Gx": "db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d", 36 | "Gy": "9b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d" 37 | }, 38 | "secp192r1": { 39 | "p": "fffffffffffffffffffffffffffffffeffffffffffffffff", 40 | "a": "fffffffffffffffffffffffffffffffefffffffffffffffc", 41 | "b": "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 42 | "n": "ffffffffffffffffffffffff99def836146bc9b1b4d22831", 43 | "h": "01", 44 | "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 45 | "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811" 46 | }, 47 | "secp256k1": { 48 | "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", 49 | "a": "00", 50 | "b": "07", 51 | "n": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 52 | "h": "01", 53 | "Gx": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", 54 | "Gy": "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8" 55 | }, 56 | "secp256r1": { 57 | "p": "ffffffff00000001000000000000000000000000ffffffffffffffffffffffff", 58 | "a": "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", 59 | "b": "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 60 | "n": "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", 61 | "h": "01", 62 | "Gx": "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", 63 | "Gy": "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /node_modules/ecurve/lib/index.js: -------------------------------------------------------------------------------- 1 | var Point = require('./point') 2 | var Curve = require('./curve') 3 | 4 | var getCurveByName = require('./names') 5 | 6 | module.exports = { 7 | Curve: Curve, 8 | Point: Point, 9 | getCurveByName: getCurveByName 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/ecurve/lib/names.js: -------------------------------------------------------------------------------- 1 | var BigInteger = require('bigi') 2 | 3 | var curves = require('./curves.json') 4 | var Curve = require('./curve') 5 | 6 | function getCurveByName (name) { 7 | var curve = curves[name] 8 | if (!curve) return null 9 | 10 | var p = new BigInteger(curve.p, 16) 11 | var a = new BigInteger(curve.a, 16) 12 | var b = new BigInteger(curve.b, 16) 13 | var n = new BigInteger(curve.n, 16) 14 | var h = new BigInteger(curve.h, 16) 15 | var Gx = new BigInteger(curve.Gx, 16) 16 | var Gy = new BigInteger(curve.Gy, 16) 17 | 18 | return new Curve(p, a, b, Gx, Gy, n, h) 19 | } 20 | 21 | module.exports = getCurveByName 22 | -------------------------------------------------------------------------------- /node_modules/ecurve/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "ecurve@^1.0.0", 3 | "_id": "ecurve@1.0.6", 4 | "_inBundle": false, 5 | "_integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==", 6 | "_location": "/ecurve", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "ecurve@^1.0.0", 12 | "name": "ecurve", 13 | "escapedName": "ecurve", 14 | "rawSpec": "^1.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", 22 | "_shasum": "dfdabbb7149f8d8b78816be5a7d5b83fcf6de797", 23 | "_spec": "ecurve@^1.0.0", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "bugs": { 26 | "url": "https://github.com/cryptocoinjs/ecurve/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "dependencies": { 30 | "bigi": "^1.1.0", 31 | "safe-buffer": "^5.0.1" 32 | }, 33 | "deprecated": false, 34 | "description": "Elliptic curve cryptography", 35 | "devDependencies": { 36 | "mocha": "^2.5.3", 37 | "standard": "^7.1.2" 38 | }, 39 | "homepage": "https://github.com/cryptocoinjs/ecurve#readme", 40 | "keywords": [ 41 | "cryptography", 42 | "crypto", 43 | "bitcoin", 44 | "litecoin", 45 | "elliptic", 46 | "curve" 47 | ], 48 | "license": "MIT", 49 | "main": "./lib/index.js", 50 | "name": "ecurve", 51 | "repository": { 52 | "url": "git+https://github.com/cryptocoinjs/ecurve.git", 53 | "type": "git" 54 | }, 55 | "scripts": { 56 | "lint": "standard", 57 | "test": "npm run lint && npm run unit", 58 | "unit": "mocha --ui bdd" 59 | }, 60 | "version": "1.0.6" 61 | } 62 | -------------------------------------------------------------------------------- /node_modules/hash-base/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kirill Fomichev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/hash-base/README.md: -------------------------------------------------------------------------------- 1 | # hash-base 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base) 4 | [![Build Status](https://img.shields.io/travis/crypto-browserify/hash-base.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/hash-base) 5 | [![Dependency status](https://img.shields.io/david/crypto-browserify/hash-base.svg?style=flat-square)](https://david-dm.org/crypto-browserify/hash-base#info=dependencies) 6 | 7 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 8 | 9 | Abstract base class to inherit from if you want to create streams implementing the same API as node crypto [Hash][1] (for [Cipher][2] / [Decipher][3] check [crypto-browserify/cipher-base][4]). 10 | 11 | ## Example 12 | 13 | ```js 14 | const HashBase = require('hash-base') 15 | const inherits = require('inherits') 16 | 17 | // our hash function is XOR sum of all bytes 18 | function MyHash () { 19 | HashBase.call(this, 1) // in bytes 20 | 21 | this._sum = 0x00 22 | } 23 | 24 | inherits(MyHash, HashBase) 25 | 26 | MyHash.prototype._update = function () { 27 | for (let i = 0; i < this._block.length; ++i) this._sum ^= this._block[i] 28 | } 29 | 30 | MyHash.prototype._digest = function () { 31 | return this._sum 32 | } 33 | 34 | const data = Buffer.from([ 0x00, 0x42, 0x01 ]) 35 | const hash = new MyHash().update(data).digest() 36 | console.log(hash) // => 67 37 | ``` 38 | You also can check [source code](index.js) or [crypto-browserify/md5.js][5] 39 | 40 | ## LICENSE 41 | 42 | MIT 43 | 44 | [1]: https://nodejs.org/api/crypto.html#crypto_class_hash 45 | [2]: https://nodejs.org/api/crypto.html#crypto_class_cipher 46 | [3]: https://nodejs.org/api/crypto.html#crypto_class_decipher 47 | [4]: https://github.com/crypto-browserify/cipher-base 48 | [5]: https://github.com/crypto-browserify/md5.js 49 | -------------------------------------------------------------------------------- /node_modules/hash-base/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var Buffer = require('safe-buffer').Buffer 3 | var Transform = require('stream').Transform 4 | var inherits = require('inherits') 5 | 6 | function throwIfNotStringOrBuffer (val, prefix) { 7 | if (!Buffer.isBuffer(val) && typeof val !== 'string') { 8 | throw new TypeError(prefix + ' must be a string or a buffer') 9 | } 10 | } 11 | 12 | function HashBase (blockSize) { 13 | Transform.call(this) 14 | 15 | this._block = Buffer.allocUnsafe(blockSize) 16 | this._blockSize = blockSize 17 | this._blockOffset = 0 18 | this._length = [0, 0, 0, 0] 19 | 20 | this._finalized = false 21 | } 22 | 23 | inherits(HashBase, Transform) 24 | 25 | HashBase.prototype._transform = function (chunk, encoding, callback) { 26 | var error = null 27 | try { 28 | this.update(chunk, encoding) 29 | } catch (err) { 30 | error = err 31 | } 32 | 33 | callback(error) 34 | } 35 | 36 | HashBase.prototype._flush = function (callback) { 37 | var error = null 38 | try { 39 | this.push(this.digest()) 40 | } catch (err) { 41 | error = err 42 | } 43 | 44 | callback(error) 45 | } 46 | 47 | HashBase.prototype.update = function (data, encoding) { 48 | throwIfNotStringOrBuffer(data, 'Data') 49 | if (this._finalized) throw new Error('Digest already called') 50 | if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding) 51 | 52 | // consume data 53 | var block = this._block 54 | var offset = 0 55 | while (this._blockOffset + data.length - offset >= this._blockSize) { 56 | for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] 57 | this._update() 58 | this._blockOffset = 0 59 | } 60 | while (offset < data.length) block[this._blockOffset++] = data[offset++] 61 | 62 | // update length 63 | for (var j = 0, carry = data.length * 8; carry > 0; ++j) { 64 | this._length[j] += carry 65 | carry = (this._length[j] / 0x0100000000) | 0 66 | if (carry > 0) this._length[j] -= 0x0100000000 * carry 67 | } 68 | 69 | return this 70 | } 71 | 72 | HashBase.prototype._update = function () { 73 | throw new Error('_update is not implemented') 74 | } 75 | 76 | HashBase.prototype.digest = function (encoding) { 77 | if (this._finalized) throw new Error('Digest already called') 78 | this._finalized = true 79 | 80 | var digest = this._digest() 81 | if (encoding !== undefined) digest = digest.toString(encoding) 82 | 83 | // reset state 84 | this._block.fill(0) 85 | this._blockOffset = 0 86 | for (var i = 0; i < 4; ++i) this._length[i] = 0 87 | 88 | return digest 89 | } 90 | 91 | HashBase.prototype._digest = function () { 92 | throw new Error('_digest is not implemented') 93 | } 94 | 95 | module.exports = HashBase 96 | -------------------------------------------------------------------------------- /node_modules/hash-base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "hash-base@^3.0.0", 3 | "_id": "hash-base@3.0.4", 4 | "_inBundle": false, 5 | "_integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", 6 | "_location": "/hash-base", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "hash-base@^3.0.0", 12 | "name": "hash-base", 13 | "escapedName": "hash-base", 14 | "rawSpec": "^3.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^3.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/md5.js", 20 | "/ripemd160" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", 23 | "_shasum": "5fc8686847ecd73499403319a6b0a3f3f6ae4918", 24 | "_spec": "hash-base@^3.0.0", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\md5.js", 26 | "author": { 27 | "name": "Kirill Fomichev", 28 | "email": "fanatid@ya.ru", 29 | "url": "https://github.com/fanatid" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/crypto-browserify/hash-base/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "dependencies": { 36 | "inherits": "^2.0.1", 37 | "safe-buffer": "^5.0.1" 38 | }, 39 | "deprecated": false, 40 | "description": "abstract base class for hash-streams", 41 | "devDependencies": { 42 | "nyc": "^8.3.2", 43 | "standard": "*", 44 | "tape": "^4.2.0" 45 | }, 46 | "engines": { 47 | "node": ">=4" 48 | }, 49 | "files": [ 50 | "index.js" 51 | ], 52 | "homepage": "https://github.com/crypto-browserify/hash-base", 53 | "keywords": [ 54 | "hash", 55 | "stream" 56 | ], 57 | "license": "MIT", 58 | "main": "index.js", 59 | "name": "hash-base", 60 | "repository": { 61 | "type": "git", 62 | "url": "git+https://github.com/crypto-browserify/hash-base.git" 63 | }, 64 | "scripts": { 65 | "coverage": "nyc node test/*.js", 66 | "lint": "standard", 67 | "test": "npm run lint && npm run unit", 68 | "unit": "node test/*.js" 69 | }, 70 | "version": "3.0.4" 71 | } 72 | -------------------------------------------------------------------------------- /node_modules/inherits/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | 17 | -------------------------------------------------------------------------------- /node_modules/inherits/README.md: -------------------------------------------------------------------------------- 1 | Browser-friendly inheritance fully compatible with standard node.js 2 | [inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). 3 | 4 | This package exports standard `inherits` from node.js `util` module in 5 | node environment, but also provides alternative browser-friendly 6 | implementation through [browser 7 | field](https://gist.github.com/shtylman/4339901). Alternative 8 | implementation is a literal copy of standard one located in standalone 9 | module to avoid requiring of `util`. It also has a shim for old 10 | browsers with no `Object.create` support. 11 | 12 | While keeping you sure you are using standard `inherits` 13 | implementation in node.js environment, it allows bundlers such as 14 | [browserify](https://github.com/substack/node-browserify) to not 15 | include full `util` package to your client code if all you need is 16 | just `inherits` function. It worth, because browser shim for `util` 17 | package is large and `inherits` is often the single function you need 18 | from it. 19 | 20 | It's recommended to use this package instead of 21 | `require('util').inherits` for any code that has chances to be used 22 | not only in node.js but in browser too. 23 | 24 | ## usage 25 | 26 | ```js 27 | var inherits = require('inherits'); 28 | // then use exactly as the standard one 29 | ``` 30 | 31 | ## note on version ~1.0 32 | 33 | Version ~1.0 had completely different motivation and is not compatible 34 | neither with 2.0 nor with standard node.js `inherits`. 35 | 36 | If you are using version ~1.0 and planning to switch to ~2.0, be 37 | careful: 38 | 39 | * new version uses `super_` instead of `super` for referencing 40 | superclass 41 | * new version overwrites current prototype while old one preserves any 42 | existing fields on it 43 | -------------------------------------------------------------------------------- /node_modules/inherits/inherits.js: -------------------------------------------------------------------------------- 1 | try { 2 | var util = require('util'); 3 | if (typeof util.inherits !== 'function') throw ''; 4 | module.exports = util.inherits; 5 | } catch (e) { 6 | module.exports = require('./inherits_browser.js'); 7 | } 8 | -------------------------------------------------------------------------------- /node_modules/inherits/inherits_browser.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.create === 'function') { 2 | // implementation from standard node.js 'util' module 3 | module.exports = function inherits(ctor, superCtor) { 4 | ctor.super_ = superCtor 5 | ctor.prototype = Object.create(superCtor.prototype, { 6 | constructor: { 7 | value: ctor, 8 | enumerable: false, 9 | writable: true, 10 | configurable: true 11 | } 12 | }); 13 | }; 14 | } else { 15 | // old school shim for old browsers 16 | module.exports = function inherits(ctor, superCtor) { 17 | ctor.super_ = superCtor 18 | var TempCtor = function () {} 19 | TempCtor.prototype = superCtor.prototype 20 | ctor.prototype = new TempCtor() 21 | ctor.prototype.constructor = ctor 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /node_modules/inherits/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "inherits@^2.0.1", 3 | "_id": "inherits@2.0.3", 4 | "_inBundle": false, 5 | "_integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", 6 | "_location": "/inherits", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "inherits@^2.0.1", 12 | "name": "inherits", 13 | "escapedName": "inherits", 14 | "rawSpec": "^2.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/cipher-base", 20 | "/create-hash", 21 | "/create-hmac", 22 | "/hash-base", 23 | "/md5.js", 24 | "/ripemd160", 25 | "/sha.js" 26 | ], 27 | "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 28 | "_shasum": "633c2c83e3da42a502f52466022480f4208261de", 29 | "_spec": "inherits@^2.0.1", 30 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\create-hash", 31 | "browser": "./inherits_browser.js", 32 | "bugs": { 33 | "url": "https://github.com/isaacs/inherits/issues" 34 | }, 35 | "bundleDependencies": false, 36 | "deprecated": false, 37 | "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", 38 | "devDependencies": { 39 | "tap": "^7.1.0" 40 | }, 41 | "files": [ 42 | "inherits.js", 43 | "inherits_browser.js" 44 | ], 45 | "homepage": "https://github.com/isaacs/inherits#readme", 46 | "keywords": [ 47 | "inheritance", 48 | "class", 49 | "klass", 50 | "oop", 51 | "object-oriented", 52 | "inherits", 53 | "browser", 54 | "browserify" 55 | ], 56 | "license": "ISC", 57 | "main": "./inherits.js", 58 | "name": "inherits", 59 | "repository": { 60 | "type": "git", 61 | "url": "git://github.com/isaacs/inherits.git" 62 | }, 63 | "scripts": { 64 | "test": "node test" 65 | }, 66 | "version": "2.0.3" 67 | } 68 | -------------------------------------------------------------------------------- /node_modules/md5.js/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kirill Fomichev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/md5.js/README.md: -------------------------------------------------------------------------------- 1 | # md5.js 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/md5.js.svg?style=flat-square)](https://www.npmjs.org/package/md5.js) 4 | [![Build Status](https://img.shields.io/travis/crypto-browserify/md5.js.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/md5.js) 5 | [![Dependency status](https://img.shields.io/david/crypto-browserify/md5.js.svg?style=flat-square)](https://david-dm.org/crypto-browserify/md5.js#info=dependencies) 6 | 7 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 8 | 9 | Node style `md5` on pure JavaScript. 10 | 11 | From [NIST SP 800-131A][1]: *md5 is no longer acceptable where collision resistance is required such as digital signatures.* 12 | 13 | ## Example 14 | 15 | ```js 16 | var MD5 = require('md5.js') 17 | 18 | console.log(new MD5().update('42').digest('hex')) 19 | // => a1d0c6e83f027327d8461063f4ac58a6 20 | 21 | var md5stream = new MD5() 22 | md5stream.end('42') 23 | console.log(md5stream.read().toString('hex')) 24 | // => a1d0c6e83f027327d8461063f4ac58a6 25 | ``` 26 | 27 | ## LICENSE 28 | 29 | MIT 30 | 31 | [1]: http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf 32 | -------------------------------------------------------------------------------- /node_modules/md5.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "md5.js@^1.3.4", 3 | "_id": "md5.js@1.3.4", 4 | "_inBundle": false, 5 | "_integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", 6 | "_location": "/md5.js", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "md5.js@^1.3.4", 12 | "name": "md5.js", 13 | "escapedName": "md5.js", 14 | "rawSpec": "^1.3.4", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.3.4" 17 | }, 18 | "_requiredBy": [ 19 | "/create-hash" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", 22 | "_shasum": "e9bdbde94a20a5ac18b04340fc5764d5b09d901d", 23 | "_spec": "md5.js@^1.3.4", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\create-hash", 25 | "author": { 26 | "name": "Kirill Fomichev", 27 | "email": "fanatid@ya.ru", 28 | "url": "https://github.com/fanatid" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/crypto-browserify/md5.js/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "hash-base": "^3.0.0", 36 | "inherits": "^2.0.1" 37 | }, 38 | "deprecated": false, 39 | "description": "node style md5 on pure JavaScript", 40 | "devDependencies": { 41 | "hash-test-vectors": "^1.3.2", 42 | "standard": "^7.0.0", 43 | "tape": "^4.2.0" 44 | }, 45 | "files": [ 46 | "index.js" 47 | ], 48 | "homepage": "https://github.com/crypto-browserify/md5.js", 49 | "keywords": [ 50 | "crypto", 51 | "md5" 52 | ], 53 | "license": "MIT", 54 | "main": "index.js", 55 | "name": "md5.js", 56 | "repository": { 57 | "type": "git", 58 | "url": "git+https://github.com/crypto-browserify/md5.js.git" 59 | }, 60 | "scripts": { 61 | "lint": "standard", 62 | "test": "npm run lint && npm run unit", 63 | "unit": "node test/*.js" 64 | }, 65 | "version": "1.3.4" 66 | } 67 | -------------------------------------------------------------------------------- /node_modules/merkle-lib/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 BitcoinJS 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/merkle-lib/fastRoot.js: -------------------------------------------------------------------------------- 1 | // constant-space merkle root calculation algorithm 2 | module.exports = function fastRoot (values, digestFn) { 3 | if (!Array.isArray(values)) throw TypeError('Expected values Array') 4 | if (typeof digestFn !== 'function') throw TypeError('Expected digest Function') 5 | 6 | var length = values.length 7 | var results = values.concat() 8 | 9 | while (length > 1) { 10 | var j = 0 11 | 12 | for (var i = 0; i < length; i += 2, ++j) { 13 | var left = results[i] 14 | var right = i + 1 === length ? left : results[i + 1] 15 | var data = Buffer.concat([left, right]) 16 | 17 | results[j] = digestFn(data) 18 | } 19 | 20 | length = j 21 | } 22 | 23 | return results[0] 24 | } 25 | -------------------------------------------------------------------------------- /node_modules/merkle-lib/index.js: -------------------------------------------------------------------------------- 1 | // returns an array of hashes of length: values.length / 2 + (values.length % 2) 2 | function _derive (values, digestFn) { 3 | var length = values.length 4 | var results = [] 5 | 6 | for (var i = 0; i < length; i += 2) { 7 | var left = values[i] 8 | var right = i + 1 === length ? left : values[i + 1] 9 | var data = Buffer.concat([left, right]) 10 | 11 | results.push(digestFn(data)) 12 | } 13 | 14 | return results 15 | } 16 | 17 | // returns the merkle tree 18 | function merkle (values, digestFn) { 19 | if (!Array.isArray(values)) throw TypeError('Expected values Array') 20 | if (typeof digestFn !== 'function') throw TypeError('Expected digest Function') 21 | if (values.length === 1) return values.concat() 22 | 23 | var levels = [values] 24 | var level = values 25 | 26 | do { 27 | level = _derive(level, digestFn) 28 | levels.push(level) 29 | } while (level.length > 1) 30 | 31 | return [].concat.apply([], levels) 32 | } 33 | 34 | module.exports = merkle 35 | -------------------------------------------------------------------------------- /node_modules/merkle-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "merkle-lib@^2.0.10", 3 | "_id": "merkle-lib@2.0.10", 4 | "_inBundle": false, 5 | "_integrity": "sha1-grjbrnXieneFOItz+ddyXQ9vMyY=", 6 | "_location": "/merkle-lib", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "merkle-lib@^2.0.10", 12 | "name": "merkle-lib", 13 | "escapedName": "merkle-lib", 14 | "rawSpec": "^2.0.10", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.0.10" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/merkle-lib/-/merkle-lib-2.0.10.tgz", 22 | "_shasum": "82b8dbae75e27a7785388b73f9d7725d0f6f3326", 23 | "_spec": "merkle-lib@^2.0.10", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": { 26 | "name": "Daniel Cousens" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/bitcoinjs/merkle-lib/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "deprecated": false, 33 | "description": "A performance conscious library for merkle root and tree calculations.", 34 | "devDependencies": { 35 | "nyc": "^6.4.0", 36 | "standard": "*", 37 | "tape": "^4.5.1" 38 | }, 39 | "files": [ 40 | "index.js", 41 | "fastRoot.js", 42 | "proof.js" 43 | ], 44 | "homepage": "https://github.com/bitcoinjs/merkle-lib", 45 | "keywords": [ 46 | "bitcoin", 47 | "bitcoinjs-lib", 48 | "leaf", 49 | "merkle tree", 50 | "merkle", 51 | "root", 52 | "hash", 53 | "chain", 54 | "tree" 55 | ], 56 | "license": "MIT", 57 | "main": "index.js", 58 | "name": "merkle-lib", 59 | "repository": { 60 | "type": "git", 61 | "url": "git+https://github.com/bitcoinjs/merkle-lib.git" 62 | }, 63 | "scripts": { 64 | "coverage": "nyc --check-coverage --branches 90 --functions 90 tape test/*.js", 65 | "lint": "standard", 66 | "test": "npm run lint && npm run unit", 67 | "unit": "tape test/*.js" 68 | }, 69 | "version": "2.0.10" 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/merkle-lib/proof.js: -------------------------------------------------------------------------------- 1 | // https://bitcointalk.org/index.php?topic=403231.msg9054025#msg9054025 2 | function treeNodeCount (leafCount) { 3 | var count = 1 4 | for (var i = leafCount; i > 1; i = (i + 1) >> 1) count += i 5 | return count 6 | } 7 | 8 | function treeWidth (n, h) { 9 | return (n + (1 << h) - 1) >> h 10 | } 11 | 12 | function makeProof (tree, leaf) { 13 | var index = tree.indexOf(leaf) 14 | 15 | // does the leaf node even exist [in the tree]? 16 | if (index === -1) return null 17 | 18 | var n = tree.length 19 | var nodes = [] 20 | 21 | // does the far right leaf bypass a layer? 22 | // determine hashable node count... 23 | var z = treeWidth(n, 1) 24 | while (z > 0) { 25 | if (treeNodeCount(z) === n) break 26 | --z 27 | } 28 | 29 | // XXX: not reach-able (AFAIK) but handled anyway 30 | if (z === 0) throw new Error('Unknown solution') 31 | 32 | var height = 0 33 | var i = 0 34 | while (i < n - 1) { 35 | var layerWidth = treeWidth(z, height) 36 | ++height 37 | 38 | var odd = index % 2 39 | if (odd) --index 40 | 41 | var offset = i + index 42 | var left = tree[offset] 43 | var right = index === (layerWidth - 1) ? left : tree[offset + 1] 44 | 45 | if (i > 0) { 46 | nodes.push(odd ? left : null) 47 | nodes.push(odd ? null : right) 48 | } else { 49 | nodes.push(left) 50 | nodes.push(right) 51 | } 52 | 53 | index = (index / 2) | 0 54 | i += layerWidth 55 | } 56 | 57 | nodes.push(tree[n - 1]) 58 | return nodes 59 | } 60 | 61 | function verify (proof, digestFn) { 62 | var root = proof[proof.length - 1] 63 | var hash = root 64 | 65 | for (var i = 0; i < proof.length - 1; i += 2) { 66 | var left = proof[i] || hash 67 | var right = proof[i + 1] || hash 68 | var data = Buffer.concat([left, right]) 69 | hash = digestFn(data) 70 | } 71 | 72 | return hash.equals(root) 73 | } 74 | 75 | module.exports = makeProof 76 | module.exports.verify = verify 77 | -------------------------------------------------------------------------------- /node_modules/pushdata-bitcoin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Daniel Cousens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/pushdata-bitcoin/README.md: -------------------------------------------------------------------------------- 1 | # pushdata-bitcoin 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/pushdata-bitcoin.svg?style=flat-square)](https://www.npmjs.org/package/pushdata-bitcoin) 4 | [![Build Status](https://img.shields.io/travis/bitcoinjs/pushdata-bitcoin.svg?branch=master&style=flat-square)](https://travis-ci.org/bitcoinjs/pushdata-bitcoin) 5 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 6 | 7 | Encode/decode value as bitcoin OP_PUSHDATA integer 8 | 9 | 10 | ## Example 11 | 12 | ``` javascript 13 | ``` 14 | 15 | ## LICENSE [MIT](LICENSE) 16 | -------------------------------------------------------------------------------- /node_modules/pushdata-bitcoin/index.js: -------------------------------------------------------------------------------- 1 | var OPS = require('bitcoin-ops') 2 | 3 | function encodingLength (i) { 4 | return i < OPS.OP_PUSHDATA1 ? 1 5 | : i <= 0xff ? 2 6 | : i <= 0xffff ? 3 7 | : 5 8 | } 9 | 10 | function encode (buffer, number, offset) { 11 | var size = encodingLength(number) 12 | 13 | // ~6 bit 14 | if (size === 1) { 15 | buffer.writeUInt8(number, offset) 16 | 17 | // 8 bit 18 | } else if (size === 2) { 19 | buffer.writeUInt8(OPS.OP_PUSHDATA1, offset) 20 | buffer.writeUInt8(number, offset + 1) 21 | 22 | // 16 bit 23 | } else if (size === 3) { 24 | buffer.writeUInt8(OPS.OP_PUSHDATA2, offset) 25 | buffer.writeUInt16LE(number, offset + 1) 26 | 27 | // 32 bit 28 | } else { 29 | buffer.writeUInt8(OPS.OP_PUSHDATA4, offset) 30 | buffer.writeUInt32LE(number, offset + 1) 31 | } 32 | 33 | return size 34 | } 35 | 36 | function decode (buffer, offset) { 37 | var opcode = buffer.readUInt8(offset) 38 | var number, size 39 | 40 | // ~6 bit 41 | if (opcode < OPS.OP_PUSHDATA1) { 42 | number = opcode 43 | size = 1 44 | 45 | // 8 bit 46 | } else if (opcode === OPS.OP_PUSHDATA1) { 47 | if (offset + 2 > buffer.length) return null 48 | number = buffer.readUInt8(offset + 1) 49 | size = 2 50 | 51 | // 16 bit 52 | } else if (opcode === OPS.OP_PUSHDATA2) { 53 | if (offset + 3 > buffer.length) return null 54 | number = buffer.readUInt16LE(offset + 1) 55 | size = 3 56 | 57 | // 32 bit 58 | } else { 59 | if (offset + 5 > buffer.length) return null 60 | if (opcode !== OPS.OP_PUSHDATA4) throw new Error('Unexpected opcode') 61 | 62 | number = buffer.readUInt32LE(offset + 1) 63 | size = 5 64 | } 65 | 66 | return { 67 | opcode: opcode, 68 | number: number, 69 | size: size 70 | } 71 | } 72 | 73 | module.exports = { 74 | encodingLength: encodingLength, 75 | encode: encode, 76 | decode: decode 77 | } 78 | -------------------------------------------------------------------------------- /node_modules/pushdata-bitcoin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "pushdata-bitcoin@^1.0.1", 3 | "_id": "pushdata-bitcoin@1.0.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-FZMdPNlnreUiBvUjqnMxrvfUOvc=", 6 | "_location": "/pushdata-bitcoin", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "pushdata-bitcoin@^1.0.1", 12 | "name": "pushdata-bitcoin", 13 | "escapedName": "pushdata-bitcoin", 14 | "rawSpec": "^1.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz", 22 | "_shasum": "15931d3cd967ade52206f523aa7331aef7d43af7", 23 | "_spec": "pushdata-bitcoin@^1.0.1", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": { 26 | "name": "Daniel Cousens" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/bitcoinjs/pushdata-bitcoin/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "dependencies": { 33 | "bitcoin-ops": "^1.3.0" 34 | }, 35 | "deprecated": false, 36 | "description": "encode/decode value as bitcoin OP_PUSHDATA integer", 37 | "devDependencies": { 38 | "nyc": "^6.4.0", 39 | "standard": "*", 40 | "tape": "^4.5.1" 41 | }, 42 | "files": [ 43 | "index.js" 44 | ], 45 | "homepage": "https://github.com/bitcoinjs/pushdata-bitcoin", 46 | "keywords": [ 47 | "push", 48 | "encode", 49 | "decode", 50 | "abstract-encoding", 51 | "OP_0", 52 | "OP_1", 53 | "OP_PUSHDATA1", 54 | "OP_PUSHDATA2", 55 | "OP_PUSHDATA4", 56 | "pushdata-bitcoin", 57 | "bitcoinjs-lib", 58 | "bitcoin" 59 | ], 60 | "license": "MIT", 61 | "main": "index.js", 62 | "name": "pushdata-bitcoin", 63 | "repository": { 64 | "type": "git", 65 | "url": "git+https://github.com/bitcoinjs/pushdata-bitcoin.git" 66 | }, 67 | "scripts": { 68 | "coverage": "nyc --check-coverage --branches 100 --functions 100 tape test/*.js", 69 | "lint": "standard", 70 | "prepublish": "npm run test", 71 | "test": "npm run lint && npm run unit", 72 | "unit": "tape test/*.js" 73 | }, 74 | "version": "1.0.1" 75 | } 76 | -------------------------------------------------------------------------------- /node_modules/randombytes/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | matrix: 4 | include: 5 | - node_js: '7' 6 | env: TEST_SUITE=test 7 | - node_js: '6' 8 | env: TEST_SUITE=test 9 | - node_js: '5' 10 | env: TEST_SUITE=test 11 | - node_js: '4' 12 | env: TEST_SUITE=test 13 | - node_js: '4' 14 | env: TEST_SUITE=phantom 15 | script: "npm run-script $TEST_SUITE" 16 | -------------------------------------------------------------------------------- /node_modules/randombytes/.zuul.yml: -------------------------------------------------------------------------------- 1 | ui: tape 2 | -------------------------------------------------------------------------------- /node_modules/randombytes/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 crypto-browserify 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/randombytes/README.md: -------------------------------------------------------------------------------- 1 | randombytes 2 | === 3 | 4 | [![Version](http://img.shields.io/npm/v/randombytes.svg)](https://www.npmjs.org/package/randombytes) [![Build Status](https://travis-ci.org/crypto-browserify/randombytes.svg?branch=master)](https://travis-ci.org/crypto-browserify/randombytes) 5 | 6 | randombytes from node that works in the browser. In node you just get crypto.randomBytes, but in the browser it uses .crypto/msCrypto.getRandomValues 7 | 8 | ```js 9 | var randomBytes = require('randombytes'); 10 | randomBytes(16);//get 16 random bytes 11 | randomBytes(16, function (err, resp) { 12 | // resp is 16 random bytes 13 | }); 14 | ``` 15 | -------------------------------------------------------------------------------- /node_modules/randombytes/browser.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | function oldBrowser () { 4 | throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11') 5 | } 6 | 7 | var Buffer = require('safe-buffer').Buffer 8 | var crypto = global.crypto || global.msCrypto 9 | 10 | if (crypto && crypto.getRandomValues) { 11 | module.exports = randomBytes 12 | } else { 13 | module.exports = oldBrowser 14 | } 15 | 16 | function randomBytes (size, cb) { 17 | // phantomjs needs to throw 18 | if (size > 65536) throw new Error('requested too many random bytes') 19 | // in case browserify isn't using the Uint8Array version 20 | var rawBytes = new global.Uint8Array(size) 21 | 22 | // This will not work in older browsers. 23 | // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues 24 | if (size > 0) { // getRandomValues fails on IE if size == 0 25 | crypto.getRandomValues(rawBytes) 26 | } 27 | 28 | // XXX: phantomjs doesn't like a buffer being passed here 29 | var bytes = Buffer.from(rawBytes.buffer) 30 | 31 | if (typeof cb === 'function') { 32 | return process.nextTick(function () { 33 | cb(null, bytes) 34 | }) 35 | } 36 | 37 | return bytes 38 | } 39 | -------------------------------------------------------------------------------- /node_modules/randombytes/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('crypto').randomBytes 2 | -------------------------------------------------------------------------------- /node_modules/randombytes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "randombytes@^2.0.1", 3 | "_id": "randombytes@2.0.6", 4 | "_inBundle": false, 5 | "_integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", 6 | "_location": "/randombytes", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "randombytes@^2.0.1", 12 | "name": "randombytes", 13 | "escapedName": "randombytes", 14 | "rawSpec": "^2.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", 22 | "_shasum": "d302c522948588848a8d300c932b44c24231da80", 23 | "_spec": "randombytes@^2.0.1", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": "", 26 | "browser": "browser.js", 27 | "bugs": { 28 | "url": "https://github.com/crypto-browserify/randombytes/issues" 29 | }, 30 | "bundleDependencies": false, 31 | "dependencies": { 32 | "safe-buffer": "^5.1.0" 33 | }, 34 | "deprecated": false, 35 | "description": "random bytes from browserify stand alone", 36 | "devDependencies": { 37 | "phantomjs": "^1.9.9", 38 | "standard": "^10.0.2", 39 | "tap-spec": "^2.1.2", 40 | "tape": "^4.6.3", 41 | "zuul": "^3.7.2" 42 | }, 43 | "homepage": "https://github.com/crypto-browserify/randombytes", 44 | "keywords": [ 45 | "crypto", 46 | "random" 47 | ], 48 | "license": "MIT", 49 | "main": "index.js", 50 | "name": "randombytes", 51 | "repository": { 52 | "type": "git", 53 | "url": "git+ssh://git@github.com/crypto-browserify/randombytes.git" 54 | }, 55 | "scripts": { 56 | "local": "zuul --local --no-coverage -- test.js", 57 | "phantom": "zuul --phantom -- test.js", 58 | "test": "standard && node test.js | tspec" 59 | }, 60 | "version": "2.0.6" 61 | } 62 | -------------------------------------------------------------------------------- /node_modules/randombytes/test.js: -------------------------------------------------------------------------------- 1 | var test = require('tape') 2 | var randomBytes = require('./') 3 | 4 | test('sync', function (t) { 5 | t.plan(4) 6 | t.equals(randomBytes(0).length, 0, 'len: ' + 0) 7 | t.equals(randomBytes(3).length, 3, 'len: ' + 3) 8 | t.equals(randomBytes(30).length, 30, 'len: ' + 30) 9 | t.equals(randomBytes(300).length, 300, 'len: ' + 300) 10 | }) 11 | 12 | test('async', function (t) { 13 | t.plan(4) 14 | 15 | randomBytes(0, function (err, resp) { 16 | if (err) throw err 17 | 18 | t.equals(resp.length, 0, 'len: ' + 0) 19 | }) 20 | 21 | randomBytes(3, function (err, resp) { 22 | if (err) throw err 23 | 24 | t.equals(resp.length, 3, 'len: ' + 3) 25 | }) 26 | 27 | randomBytes(30, function (err, resp) { 28 | if (err) throw err 29 | 30 | t.equals(resp.length, 30, 'len: ' + 30) 31 | }) 32 | 33 | randomBytes(300, function (err, resp) { 34 | if (err) throw err 35 | 36 | t.equals(resp.length, 300, 'len: ' + 300) 37 | }) 38 | }) 39 | 40 | if (process.browser) { 41 | test('requesting to much throws', function (t) { 42 | t.plan(1) 43 | t.throws(function () { 44 | randomBytes(65537) 45 | }) 46 | }) 47 | 48 | test('requesting to much throws async', function (t) { 49 | t.plan(1) 50 | t.throws(function () { 51 | randomBytes(65537, function () { 52 | t.ok(false, 'should not get here') 53 | }) 54 | }) 55 | }) 56 | } 57 | -------------------------------------------------------------------------------- /node_modules/ripemd160/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2.0.1 / 2016-06-22 2 | ------------------ 3 | - added LICENSE file. 4 | 5 | 2.0.0 / 2016-04-11 6 | ------------------ 7 | - rewritten, license change BSD-3 to MIT. [#13][#13] 8 | - stream support [#13][#13] 9 | 10 | 1.0.1 / 2015-05-05 11 | ------------------ 12 | - standard formatting 13 | 14 | 1.0.0 / 2015-01-14 15 | ------------------ 16 | - updated dev deps 17 | - added more test fixtures 18 | - updated readme with usage, testing, etc 19 | - moved from https://github.com/cryptocoinjs/ripemd160 to https://github.com/crypto-browserify/ripemd160 20 | 21 | 0.2.1 / 2014-12-31 22 | ------------------ 23 | - made license clear in `package.json` 24 | - deleted `Makefile`, moved targets to `package.json` 25 | - removed `terst` for `assert` 26 | 27 | 0.2.0 / 2014-03-09 28 | ------------------ 29 | * removed bower.json and component.json 30 | * changed 4 spacing to 2 31 | * returns `Buffer` type now, input must be Array, Uint8Array, Buffer, or string 32 | * remove deps: `convert-hex` and `convert-string` 33 | 34 | 0.1.0 / 2013-11-20 35 | ------------------ 36 | * changed package name 37 | * removed AMD support 38 | 39 | 0.0.2 / 2013-11-06 40 | ------------------ 41 | * fixed component.json file 42 | 43 | 0.0.1 / 2013-11-03 44 | ------------------ 45 | * initial release 46 | 47 | 48 | [#13]: https://github.com/crypto-browserify/ripemd160/pull/13 49 | 50 | [#12]: https://github.com/crypto-browserify/ripemd160/pull/12 51 | 52 | [#11]: https://github.com/crypto-browserify/ripemd160/pull/11 53 | 54 | [#10]: https://github.com/crypto-browserify/ripemd160/pull/10 55 | 56 | [#9]: https://github.com/crypto-browserify/ripemd160/pull/9 57 | 58 | [#8]: https://github.com/crypto-browserify/ripemd160/issues/8 59 | 60 | [#7]: https://github.com/crypto-browserify/ripemd160/pull/7 61 | 62 | [#6]: https://github.com/crypto-browserify/ripemd160/pull/6 63 | 64 | [#5]: https://github.com/crypto-browserify/ripemd160/issues/5 65 | 66 | [#4]: https://github.com/crypto-browserify/ripemd160/pull/4 67 | 68 | [#3]: https://github.com/crypto-browserify/ripemd160/pull/3 69 | 70 | [#2]: https://github.com/crypto-browserify/ripemd160/pull/2 71 | 72 | [#1]: https://github.com/crypto-browserify/ripemd160/pull/1 73 | -------------------------------------------------------------------------------- /node_modules/ripemd160/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 crypto-browserify 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/ripemd160/README.md: -------------------------------------------------------------------------------- 1 | # ripemd160 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/ripemd160.svg?style=flat-square)](https://www.npmjs.org/package/ripemd160) 4 | [![Build Status](https://img.shields.io/travis/crypto-browserify/ripemd160.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/ripemd160) 5 | [![Dependency status](https://img.shields.io/david/crypto-browserify/ripemd160.svg?style=flat-square)](https://david-dm.org/crypto-browserify/ripemd160#info=dependencies) 6 | 7 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 8 | 9 | Node style `ripemd160` on pure JavaScript. 10 | 11 | ## Example 12 | 13 | ```js 14 | var RIPEMD160 = require('ripemd160') 15 | 16 | console.log(new RIPEMD160().update('42').digest('hex')) 17 | // => 0df020ba32aa9b8b904471ff582ce6b579bf8bc8 18 | 19 | var ripemd160stream = new RIPEMD160() 20 | ripemd160stream.end('42') 21 | console.log(ripemd160stream.read().toString('hex')) 22 | // => 0df020ba32aa9b8b904471ff582ce6b579bf8bc8 23 | ``` 24 | 25 | ## LICENSE 26 | 27 | MIT 28 | -------------------------------------------------------------------------------- /node_modules/ripemd160/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "ripemd160@^2.0.1", 3 | "_id": "ripemd160@2.0.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", 6 | "_location": "/ripemd160", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "ripemd160@^2.0.1", 12 | "name": "ripemd160", 13 | "escapedName": "ripemd160", 14 | "rawSpec": "^2.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/create-hash", 20 | "/create-hmac" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", 23 | "_shasum": "a1c1a6f624751577ba5d07914cbc92850585890c", 24 | "_spec": "ripemd160@^2.0.1", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\create-hash", 26 | "bugs": { 27 | "url": "https://github.com/crypto-browserify/ripemd160/issues" 28 | }, 29 | "bundleDependencies": false, 30 | "dependencies": { 31 | "hash-base": "^3.0.0", 32 | "inherits": "^2.0.1" 33 | }, 34 | "deprecated": false, 35 | "description": "Compute ripemd160 of bytes or strings.", 36 | "devDependencies": { 37 | "hash-test-vectors": "^1.3.2", 38 | "standard": "^6.0.7", 39 | "tape": "^4.5.1" 40 | }, 41 | "files": [ 42 | "index.js" 43 | ], 44 | "homepage": "https://github.com/crypto-browserify/ripemd160#readme", 45 | "keywords": [ 46 | "string", 47 | "strings", 48 | "ripemd160", 49 | "ripe160", 50 | "bitcoin", 51 | "bytes", 52 | "cryptography" 53 | ], 54 | "license": "MIT", 55 | "main": "./index", 56 | "name": "ripemd160", 57 | "repository": { 58 | "url": "git+https://github.com/crypto-browserify/ripemd160.git", 59 | "type": "git" 60 | }, 61 | "scripts": { 62 | "lint": "standard", 63 | "test": "npm run lint && npm run unit", 64 | "unit": "node test/*.js" 65 | }, 66 | "version": "2.0.2" 67 | } 68 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable node/no-deprecated-api */ 2 | var buffer = require('buffer') 3 | var Buffer = buffer.Buffer 4 | 5 | // alternative to using Object.keys for old browsers 6 | function copyProps (src, dst) { 7 | for (var key in src) { 8 | dst[key] = src[key] 9 | } 10 | } 11 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { 12 | module.exports = buffer 13 | } else { 14 | // Copy properties from require('buffer') 15 | copyProps(buffer, exports) 16 | exports.Buffer = SafeBuffer 17 | } 18 | 19 | function SafeBuffer (arg, encodingOrOffset, length) { 20 | return Buffer(arg, encodingOrOffset, length) 21 | } 22 | 23 | // Copy static methods from Buffer 24 | copyProps(Buffer, SafeBuffer) 25 | 26 | SafeBuffer.from = function (arg, encodingOrOffset, length) { 27 | if (typeof arg === 'number') { 28 | throw new TypeError('Argument must not be a number') 29 | } 30 | return Buffer(arg, encodingOrOffset, length) 31 | } 32 | 33 | SafeBuffer.alloc = function (size, fill, encoding) { 34 | if (typeof size !== 'number') { 35 | throw new TypeError('Argument must be a number') 36 | } 37 | var buf = Buffer(size) 38 | if (fill !== undefined) { 39 | if (typeof encoding === 'string') { 40 | buf.fill(fill, encoding) 41 | } else { 42 | buf.fill(fill) 43 | } 44 | } else { 45 | buf.fill(0) 46 | } 47 | return buf 48 | } 49 | 50 | SafeBuffer.allocUnsafe = function (size) { 51 | if (typeof size !== 'number') { 52 | throw new TypeError('Argument must be a number') 53 | } 54 | return Buffer(size) 55 | } 56 | 57 | SafeBuffer.allocUnsafeSlow = function (size) { 58 | if (typeof size !== 'number') { 59 | throw new TypeError('Argument must be a number') 60 | } 61 | return buffer.SlowBuffer(size) 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "safe-buffer@^5.0.1", 3 | "_id": "safe-buffer@5.1.2", 4 | "_inBundle": false, 5 | "_integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 6 | "_location": "/safe-buffer", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "safe-buffer@^5.0.1", 12 | "name": "safe-buffer", 13 | "escapedName": "safe-buffer", 14 | "rawSpec": "^5.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^5.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/base-x", 20 | "/bip66", 21 | "/bitcoinjs-lib", 22 | "/cipher-base", 23 | "/create-hmac", 24 | "/ecurve", 25 | "/hash-base", 26 | "/randombytes", 27 | "/sha.js", 28 | "/varuint-bitcoin" 29 | ], 30 | "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 31 | "_shasum": "991ec69d296e0313747d59bdfd2b745c35f8828d", 32 | "_spec": "safe-buffer@^5.0.1", 33 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 34 | "author": { 35 | "name": "Feross Aboukhadijeh", 36 | "email": "feross@feross.org", 37 | "url": "http://feross.org" 38 | }, 39 | "bugs": { 40 | "url": "https://github.com/feross/safe-buffer/issues" 41 | }, 42 | "bundleDependencies": false, 43 | "deprecated": false, 44 | "description": "Safer Node.js Buffer API", 45 | "devDependencies": { 46 | "standard": "*", 47 | "tape": "^4.0.0" 48 | }, 49 | "homepage": "https://github.com/feross/safe-buffer", 50 | "keywords": [ 51 | "buffer", 52 | "buffer allocate", 53 | "node security", 54 | "safe", 55 | "safe-buffer", 56 | "security", 57 | "uninitialized" 58 | ], 59 | "license": "MIT", 60 | "main": "index.js", 61 | "name": "safe-buffer", 62 | "repository": { 63 | "type": "git", 64 | "url": "git://github.com/feross/safe-buffer.git" 65 | }, 66 | "scripts": { 67 | "test": "standard && tape test/*.js" 68 | }, 69 | "types": "index.d.ts", 70 | "version": "5.1.2" 71 | } 72 | -------------------------------------------------------------------------------- /node_modules/sha.js/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: 3 | - linux 4 | language: node_js 5 | node_js: 6 | - "4" 7 | - "5" 8 | - "6" 9 | - "7" 10 | env: 11 | matrix: 12 | - TEST_SUITE=unit 13 | matrix: 14 | include: 15 | - node_js: "7" 16 | env: TEST_SUITE=lint 17 | script: npm run $TEST_SUITE 18 | -------------------------------------------------------------------------------- /node_modules/sha.js/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2018 sha.js contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | 21 | 22 | Copyright (c) 1998 - 2009, Paul Johnston & Contributors 23 | All rights reserved. 24 | 25 | Redistribution and use in source and binary forms, with or without 26 | modification, are permitted provided that the following conditions are met: 27 | 28 | Redistributions of source code must retain the above copyright notice, this 29 | list of conditions and the following disclaimer. 30 | 31 | Redistributions in binary form must reproduce the above copyright notice, this 32 | list of conditions and the following disclaimer in the documentation and/or 33 | other materials provided with the distribution. 34 | 35 | Neither the name of the author nor the names of its contributors may be used to 36 | endorse or promote products derived from this software without specific prior 37 | written permission. 38 | 39 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 40 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 41 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 42 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 43 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 44 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 46 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 47 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 48 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 49 | 50 | -------------------------------------------------------------------------------- /node_modules/sha.js/README.md: -------------------------------------------------------------------------------- 1 | # sha.js 2 | [![NPM Package](https://img.shields.io/npm/v/sha.js.svg?style=flat-square)](https://www.npmjs.org/package/sha.js) 3 | [![Build Status](https://img.shields.io/travis/crypto-browserify/sha.js.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/sha.js) 4 | [![Dependency status](https://img.shields.io/david/crypto-browserify/sha.js.svg?style=flat-square)](https://david-dm.org/crypto-browserify/sha.js#info=dependencies) 5 | 6 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 7 | 8 | Node style `SHA` on pure JavaScript. 9 | 10 | ```js 11 | var shajs = require('sha.js') 12 | 13 | console.log(shajs('sha256').update('42').digest('hex')) 14 | // => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049 15 | console.log(new shajs.sha256().update('42').digest('hex')) 16 | // => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049 17 | 18 | var sha256stream = shajs('sha256') 19 | sha256stream.end('42') 20 | console.log(sha256stream.read().toString('hex')) 21 | // => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049 22 | ``` 23 | 24 | ## supported hashes 25 | `sha.js` currently implements: 26 | 27 | - SHA (SHA-0) -- **legacy, do not use in new systems** 28 | - SHA-1 -- **legacy, do not use in new systems** 29 | - SHA-224 30 | - SHA-256 31 | - SHA-384 32 | - SHA-512 33 | 34 | 35 | ## Not an actual stream 36 | Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial. 37 | It does update incrementally, so you can hash things larger than RAM, as it uses a constant amount of memory (except when using base64 or utf8 encoding, see code comments). 38 | 39 | 40 | ## Acknowledgements 41 | This work is derived from Paul Johnston's [A JavaScript implementation of the Secure Hash Algorithm](http://pajhome.org.uk/crypt/md5/sha1.html). 42 | 43 | 44 | ## LICENSE [MIT](LICENSE) 45 | -------------------------------------------------------------------------------- /node_modules/sha.js/bin.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 3 | var createHash = require('./browserify') 4 | var argv = process.argv.slice(2) 5 | 6 | function pipe (algorithm, s) { 7 | var start = Date.now() 8 | var hash = createHash(algorithm || 'sha1') 9 | 10 | s.on('data', function (data) { 11 | hash.update(data) 12 | }) 13 | 14 | s.on('end', function () { 15 | if (process.env.DEBUG) { 16 | return console.log(hash.digest('hex'), Date.now() - start) 17 | } 18 | 19 | console.log(hash.digest('hex')) 20 | }) 21 | } 22 | 23 | function usage () { 24 | console.error('sha.js [algorithm=sha1] [filename] # hash filename with algorithm') 25 | console.error('input | sha.js [algorithm=sha1] # hash stdin with algorithm') 26 | console.error('sha.js --help # display this message') 27 | } 28 | 29 | if (!process.stdin.isTTY) { 30 | pipe(argv[0], process.stdin) 31 | } else if (argv.length) { 32 | if (/--help|-h/.test(argv[0])) { 33 | usage() 34 | } else { 35 | var filename = argv.pop() 36 | var algorithm = argv.pop() 37 | pipe(algorithm, require('fs').createReadStream(filename)) 38 | } 39 | } else { 40 | usage() 41 | } 42 | -------------------------------------------------------------------------------- /node_modules/sha.js/hash.js: -------------------------------------------------------------------------------- 1 | var Buffer = require('safe-buffer').Buffer 2 | 3 | // prototype class for hash functions 4 | function Hash (blockSize, finalSize) { 5 | this._block = Buffer.alloc(blockSize) 6 | this._finalSize = finalSize 7 | this._blockSize = blockSize 8 | this._len = 0 9 | } 10 | 11 | Hash.prototype.update = function (data, enc) { 12 | if (typeof data === 'string') { 13 | enc = enc || 'utf8' 14 | data = Buffer.from(data, enc) 15 | } 16 | 17 | var block = this._block 18 | var blockSize = this._blockSize 19 | var length = data.length 20 | var accum = this._len 21 | 22 | for (var offset = 0; offset < length;) { 23 | var assigned = accum % blockSize 24 | var remainder = Math.min(length - offset, blockSize - assigned) 25 | 26 | for (var i = 0; i < remainder; i++) { 27 | block[assigned + i] = data[offset + i] 28 | } 29 | 30 | accum += remainder 31 | offset += remainder 32 | 33 | if ((accum % blockSize) === 0) { 34 | this._update(block) 35 | } 36 | } 37 | 38 | this._len += length 39 | return this 40 | } 41 | 42 | Hash.prototype.digest = function (enc) { 43 | var rem = this._len % this._blockSize 44 | 45 | this._block[rem] = 0x80 46 | 47 | // zero (rem + 1) trailing bits, where (rem + 1) is the smallest 48 | // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize 49 | this._block.fill(0, rem + 1) 50 | 51 | if (rem >= this._finalSize) { 52 | this._update(this._block) 53 | this._block.fill(0) 54 | } 55 | 56 | var bits = this._len * 8 57 | 58 | // uint32 59 | if (bits <= 0xffffffff) { 60 | this._block.writeUInt32BE(bits, this._blockSize - 4) 61 | 62 | // uint64 63 | } else { 64 | var lowBits = (bits & 0xffffffff) >>> 0 65 | var highBits = (bits - lowBits) / 0x100000000 66 | 67 | this._block.writeUInt32BE(highBits, this._blockSize - 8) 68 | this._block.writeUInt32BE(lowBits, this._blockSize - 4) 69 | } 70 | 71 | this._update(this._block) 72 | var hash = this._hash() 73 | 74 | return enc ? hash.toString(enc) : hash 75 | } 76 | 77 | Hash.prototype._update = function () { 78 | throw new Error('_update must be implemented by subclass') 79 | } 80 | 81 | module.exports = Hash 82 | -------------------------------------------------------------------------------- /node_modules/sha.js/index.js: -------------------------------------------------------------------------------- 1 | var exports = module.exports = function SHA (algorithm) { 2 | algorithm = algorithm.toLowerCase() 3 | 4 | var Algorithm = exports[algorithm] 5 | if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)') 6 | 7 | return new Algorithm() 8 | } 9 | 10 | exports.sha = require('./sha') 11 | exports.sha1 = require('./sha1') 12 | exports.sha224 = require('./sha224') 13 | exports.sha256 = require('./sha256') 14 | exports.sha384 = require('./sha384') 15 | exports.sha512 = require('./sha512') 16 | -------------------------------------------------------------------------------- /node_modules/sha.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "sha.js@^2.4.0", 3 | "_id": "sha.js@2.4.11", 4 | "_inBundle": false, 5 | "_integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", 6 | "_location": "/sha.js", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "sha.js@^2.4.0", 12 | "name": "sha.js", 13 | "escapedName": "sha.js", 14 | "rawSpec": "^2.4.0", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.4.0" 17 | }, 18 | "_requiredBy": [ 19 | "/create-hash", 20 | "/create-hmac" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", 23 | "_shasum": "37a5cf0b81ecbc6943de109ba2960d1b26584ae7", 24 | "_spec": "sha.js@^2.4.0", 25 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\create-hash", 26 | "author": { 27 | "name": "Dominic Tarr", 28 | "email": "dominic.tarr@gmail.com", 29 | "url": "dominictarr.com" 30 | }, 31 | "bin": { 32 | "sha.js": "./bin.js" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/crypto-browserify/sha.js/issues" 36 | }, 37 | "bundleDependencies": false, 38 | "dependencies": { 39 | "inherits": "^2.0.1", 40 | "safe-buffer": "^5.0.1" 41 | }, 42 | "deprecated": false, 43 | "description": "Streamable SHA hashes in pure javascript", 44 | "devDependencies": { 45 | "buffer": "~2.3.2", 46 | "hash-test-vectors": "^1.3.1", 47 | "standard": "^10.0.2", 48 | "tape": "~2.3.2", 49 | "typedarray": "0.0.6" 50 | }, 51 | "homepage": "https://github.com/crypto-browserify/sha.js", 52 | "license": "(MIT AND BSD-3-Clause)", 53 | "name": "sha.js", 54 | "repository": { 55 | "type": "git", 56 | "url": "git://github.com/crypto-browserify/sha.js.git" 57 | }, 58 | "scripts": { 59 | "lint": "standard", 60 | "prepublish": "npm ls && npm run unit", 61 | "test": "npm run lint && npm run unit", 62 | "unit": "set -e; for t in test/*.js; do node $t; done;" 63 | }, 64 | "version": "2.4.11" 65 | } 66 | -------------------------------------------------------------------------------- /node_modules/sha.js/sha.js: -------------------------------------------------------------------------------- 1 | /* 2 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined 3 | * in FIPS PUB 180-1 4 | * This source code is derived from sha1.js of the same repository. 5 | * The difference between SHA-0 and SHA-1 is just a bitwise rotate left 6 | * operation was added. 7 | */ 8 | 9 | var inherits = require('inherits') 10 | var Hash = require('./hash') 11 | var Buffer = require('safe-buffer').Buffer 12 | 13 | var K = [ 14 | 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 15 | ] 16 | 17 | var W = new Array(80) 18 | 19 | function Sha () { 20 | this.init() 21 | this._w = W 22 | 23 | Hash.call(this, 64, 56) 24 | } 25 | 26 | inherits(Sha, Hash) 27 | 28 | Sha.prototype.init = function () { 29 | this._a = 0x67452301 30 | this._b = 0xefcdab89 31 | this._c = 0x98badcfe 32 | this._d = 0x10325476 33 | this._e = 0xc3d2e1f0 34 | 35 | return this 36 | } 37 | 38 | function rotl5 (num) { 39 | return (num << 5) | (num >>> 27) 40 | } 41 | 42 | function rotl30 (num) { 43 | return (num << 30) | (num >>> 2) 44 | } 45 | 46 | function ft (s, b, c, d) { 47 | if (s === 0) return (b & c) | ((~b) & d) 48 | if (s === 2) return (b & c) | (b & d) | (c & d) 49 | return b ^ c ^ d 50 | } 51 | 52 | Sha.prototype._update = function (M) { 53 | var W = this._w 54 | 55 | var a = this._a | 0 56 | var b = this._b | 0 57 | var c = this._c | 0 58 | var d = this._d | 0 59 | var e = this._e | 0 60 | 61 | for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) 62 | for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16] 63 | 64 | for (var j = 0; j < 80; ++j) { 65 | var s = ~~(j / 20) 66 | var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 67 | 68 | e = d 69 | d = c 70 | c = rotl30(b) 71 | b = a 72 | a = t 73 | } 74 | 75 | this._a = (a + this._a) | 0 76 | this._b = (b + this._b) | 0 77 | this._c = (c + this._c) | 0 78 | this._d = (d + this._d) | 0 79 | this._e = (e + this._e) | 0 80 | } 81 | 82 | Sha.prototype._hash = function () { 83 | var H = Buffer.allocUnsafe(20) 84 | 85 | H.writeInt32BE(this._a | 0, 0) 86 | H.writeInt32BE(this._b | 0, 4) 87 | H.writeInt32BE(this._c | 0, 8) 88 | H.writeInt32BE(this._d | 0, 12) 89 | H.writeInt32BE(this._e | 0, 16) 90 | 91 | return H 92 | } 93 | 94 | module.exports = Sha 95 | -------------------------------------------------------------------------------- /node_modules/sha.js/sha1.js: -------------------------------------------------------------------------------- 1 | /* 2 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined 3 | * in FIPS PUB 180-1 4 | * Version 2.1a Copyright Paul Johnston 2000 - 2002. 5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 6 | * Distributed under the BSD License 7 | * See http://pajhome.org.uk/crypt/md5 for details. 8 | */ 9 | 10 | var inherits = require('inherits') 11 | var Hash = require('./hash') 12 | var Buffer = require('safe-buffer').Buffer 13 | 14 | var K = [ 15 | 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 16 | ] 17 | 18 | var W = new Array(80) 19 | 20 | function Sha1 () { 21 | this.init() 22 | this._w = W 23 | 24 | Hash.call(this, 64, 56) 25 | } 26 | 27 | inherits(Sha1, Hash) 28 | 29 | Sha1.prototype.init = function () { 30 | this._a = 0x67452301 31 | this._b = 0xefcdab89 32 | this._c = 0x98badcfe 33 | this._d = 0x10325476 34 | this._e = 0xc3d2e1f0 35 | 36 | return this 37 | } 38 | 39 | function rotl1 (num) { 40 | return (num << 1) | (num >>> 31) 41 | } 42 | 43 | function rotl5 (num) { 44 | return (num << 5) | (num >>> 27) 45 | } 46 | 47 | function rotl30 (num) { 48 | return (num << 30) | (num >>> 2) 49 | } 50 | 51 | function ft (s, b, c, d) { 52 | if (s === 0) return (b & c) | ((~b) & d) 53 | if (s === 2) return (b & c) | (b & d) | (c & d) 54 | return b ^ c ^ d 55 | } 56 | 57 | Sha1.prototype._update = function (M) { 58 | var W = this._w 59 | 60 | var a = this._a | 0 61 | var b = this._b | 0 62 | var c = this._c | 0 63 | var d = this._d | 0 64 | var e = this._e | 0 65 | 66 | for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) 67 | for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) 68 | 69 | for (var j = 0; j < 80; ++j) { 70 | var s = ~~(j / 20) 71 | var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 72 | 73 | e = d 74 | d = c 75 | c = rotl30(b) 76 | b = a 77 | a = t 78 | } 79 | 80 | this._a = (a + this._a) | 0 81 | this._b = (b + this._b) | 0 82 | this._c = (c + this._c) | 0 83 | this._d = (d + this._d) | 0 84 | this._e = (e + this._e) | 0 85 | } 86 | 87 | Sha1.prototype._hash = function () { 88 | var H = Buffer.allocUnsafe(20) 89 | 90 | H.writeInt32BE(this._a | 0, 0) 91 | H.writeInt32BE(this._b | 0, 4) 92 | H.writeInt32BE(this._c | 0, 8) 93 | H.writeInt32BE(this._d | 0, 12) 94 | H.writeInt32BE(this._e | 0, 16) 95 | 96 | return H 97 | } 98 | 99 | module.exports = Sha1 100 | -------------------------------------------------------------------------------- /node_modules/sha.js/sha224.js: -------------------------------------------------------------------------------- 1 | /** 2 | * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined 3 | * in FIPS 180-2 4 | * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. 5 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 6 | * 7 | */ 8 | 9 | var inherits = require('inherits') 10 | var Sha256 = require('./sha256') 11 | var Hash = require('./hash') 12 | var Buffer = require('safe-buffer').Buffer 13 | 14 | var W = new Array(64) 15 | 16 | function Sha224 () { 17 | this.init() 18 | 19 | this._w = W // new Array(64) 20 | 21 | Hash.call(this, 64, 56) 22 | } 23 | 24 | inherits(Sha224, Sha256) 25 | 26 | Sha224.prototype.init = function () { 27 | this._a = 0xc1059ed8 28 | this._b = 0x367cd507 29 | this._c = 0x3070dd17 30 | this._d = 0xf70e5939 31 | this._e = 0xffc00b31 32 | this._f = 0x68581511 33 | this._g = 0x64f98fa7 34 | this._h = 0xbefa4fa4 35 | 36 | return this 37 | } 38 | 39 | Sha224.prototype._hash = function () { 40 | var H = Buffer.allocUnsafe(28) 41 | 42 | H.writeInt32BE(this._a, 0) 43 | H.writeInt32BE(this._b, 4) 44 | H.writeInt32BE(this._c, 8) 45 | H.writeInt32BE(this._d, 12) 46 | H.writeInt32BE(this._e, 16) 47 | H.writeInt32BE(this._f, 20) 48 | H.writeInt32BE(this._g, 24) 49 | 50 | return H 51 | } 52 | 53 | module.exports = Sha224 54 | -------------------------------------------------------------------------------- /node_modules/sha.js/sha384.js: -------------------------------------------------------------------------------- 1 | var inherits = require('inherits') 2 | var SHA512 = require('./sha512') 3 | var Hash = require('./hash') 4 | var Buffer = require('safe-buffer').Buffer 5 | 6 | var W = new Array(160) 7 | 8 | function Sha384 () { 9 | this.init() 10 | this._w = W 11 | 12 | Hash.call(this, 128, 112) 13 | } 14 | 15 | inherits(Sha384, SHA512) 16 | 17 | Sha384.prototype.init = function () { 18 | this._ah = 0xcbbb9d5d 19 | this._bh = 0x629a292a 20 | this._ch = 0x9159015a 21 | this._dh = 0x152fecd8 22 | this._eh = 0x67332667 23 | this._fh = 0x8eb44a87 24 | this._gh = 0xdb0c2e0d 25 | this._hh = 0x47b5481d 26 | 27 | this._al = 0xc1059ed8 28 | this._bl = 0x367cd507 29 | this._cl = 0x3070dd17 30 | this._dl = 0xf70e5939 31 | this._el = 0xffc00b31 32 | this._fl = 0x68581511 33 | this._gl = 0x64f98fa7 34 | this._hl = 0xbefa4fa4 35 | 36 | return this 37 | } 38 | 39 | Sha384.prototype._hash = function () { 40 | var H = Buffer.allocUnsafe(48) 41 | 42 | function writeInt64BE (h, l, offset) { 43 | H.writeInt32BE(h, offset) 44 | H.writeInt32BE(l, offset + 4) 45 | } 46 | 47 | writeInt64BE(this._ah, this._al, 0) 48 | writeInt64BE(this._bh, this._bl, 8) 49 | writeInt64BE(this._ch, this._cl, 16) 50 | writeInt64BE(this._dh, this._dl, 24) 51 | writeInt64BE(this._eh, this._el, 32) 52 | writeInt64BE(this._fh, this._fl, 40) 53 | 54 | return H 55 | } 56 | 57 | module.exports = Sha384 58 | -------------------------------------------------------------------------------- /node_modules/sha.js/test/hash.js: -------------------------------------------------------------------------------- 1 | var tape = require('tape') 2 | var Hash = require('../hash') 3 | var hex = '0A1B2C3D4E5F6G7H' 4 | 5 | function equal (t, a, b) { 6 | t.equal(a.length, b.length) 7 | t.equal(a.toString('hex'), b.toString('hex')) 8 | } 9 | 10 | var hexBuf = Buffer.from('0A1B2C3D4E5F6G7H', 'utf8') 11 | var count16 = { 12 | strings: ['0A1B2C3D4E5F6G7H'], 13 | buffers: [ 14 | hexBuf, 15 | Buffer.from('80000000000000000000000000000080', 'hex') 16 | ] 17 | } 18 | 19 | var empty = { 20 | strings: [''], 21 | buffers: [ 22 | Buffer.from('80000000000000000000000000000000', 'hex') 23 | ] 24 | } 25 | 26 | var multi = { 27 | strings: ['abcd', 'efhijk', 'lmnopq'], 28 | buffers: [ 29 | Buffer.from('abcdefhijklmnopq', 'ascii'), 30 | Buffer.from('80000000000000000000000000000080', 'hex') 31 | ] 32 | } 33 | 34 | var long = { 35 | strings: [hex + hex], 36 | buffers: [ 37 | hexBuf, 38 | hexBuf, 39 | Buffer.from('80000000000000000000000000000100', 'hex') 40 | ] 41 | } 42 | 43 | function makeTest (name, data) { 44 | tape(name, function (t) { 45 | var h = new Hash(16, 8) 46 | var hash = Buffer.alloc(20) 47 | var n = 2 48 | var expected = data.buffers.slice() 49 | // t.plan(expected.length + 1) 50 | 51 | h._update = function (block) { 52 | var e = expected.shift() 53 | equal(t, block, e) 54 | 55 | if (n < 0) { 56 | throw new Error('expecting only 2 calls to _update') 57 | } 58 | } 59 | h._hash = function () { 60 | return hash 61 | } 62 | 63 | data.strings.forEach(function (string) { 64 | h.update(string, 'ascii') 65 | }) 66 | 67 | equal(t, h.digest(), hash) 68 | t.end() 69 | }) 70 | } 71 | 72 | makeTest('Hash#update 1 in 1', count16) 73 | makeTest('empty Hash#update', empty) 74 | makeTest('Hash#update 1 in 3', multi) 75 | makeTest('Hash#update 2 in 1', long) 76 | -------------------------------------------------------------------------------- /node_modules/sha.js/test/test.js: -------------------------------------------------------------------------------- 1 | var crypto = require('crypto') 2 | var tape = require('tape') 3 | var Sha1 = require('../').sha1 4 | 5 | var inputs = [ 6 | ['', 'ascii'], 7 | ['abc', 'ascii'], 8 | ['123', 'ascii'], 9 | ['123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 'ascii'], 10 | ['123456789abcdef123456789abcdef123456789abcdef123456789abc', 'ascii'], 11 | ['123456789abcdef123456789abcdef123456789abcdef123456789ab', 'ascii'], 12 | ['0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde', 'ascii'], 13 | ['0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', 'ascii'], 14 | ['foobarbaz', 'ascii'] 15 | ] 16 | 17 | tape("hash is the same as node's crypto", function (t) { 18 | inputs.forEach(function (v) { 19 | var a = new Sha1().update(v[0], v[1]).digest('hex') 20 | var e = crypto.createHash('sha1').update(v[0], v[1]).digest('hex') 21 | console.log(a, '==', e) 22 | t.equal(a, e) 23 | }) 24 | 25 | t.end() 26 | }) 27 | 28 | tape('call update multiple times', function (t) { 29 | inputs.forEach(function (v) { 30 | var hash = new Sha1() 31 | var _hash = crypto.createHash('sha1') 32 | 33 | for (var i = 0; i < v[0].length; i = (i + 1) * 2) { 34 | var s = v[0].substring(i, (i + 1) * 2) 35 | hash.update(s, v[1]) 36 | _hash.update(s, v[1]) 37 | } 38 | 39 | var a = hash.digest('hex') 40 | var e = _hash.digest('hex') 41 | console.log(a, '==', e) 42 | t.equal(a, e) 43 | }) 44 | t.end() 45 | }) 46 | 47 | tape('call update twice', function (t) { 48 | var _hash = crypto.createHash('sha1') 49 | var hash = new Sha1() 50 | 51 | _hash.update('foo', 'ascii') 52 | hash.update('foo', 'ascii') 53 | 54 | _hash.update('bar', 'ascii') 55 | hash.update('bar', 'ascii') 56 | 57 | _hash.update('baz', 'ascii') 58 | hash.update('baz', 'ascii') 59 | 60 | var a = hash.digest('hex') 61 | var e = _hash.digest('hex') 62 | 63 | t.equal(a, e) 64 | t.end() 65 | }) 66 | 67 | tape('hex encoding', function (t) { 68 | inputs.forEach(function (v) { 69 | var hash = new Sha1() 70 | var _hash = crypto.createHash('sha1') 71 | 72 | for (var i = 0; i < v[0].length; i = (i + 1) * 2) { 73 | var s = v[0].substring(i, (i + 1) * 2) 74 | hash.update(Buffer.from(s, 'ascii').toString('hex'), 'hex') 75 | _hash.update(Buffer.from(s, 'ascii').toString('hex'), 'hex') 76 | } 77 | var a = hash.digest('hex') 78 | var e = _hash.digest('hex') 79 | 80 | console.log(a, '==', e) 81 | t.equal(a, e) 82 | }) 83 | 84 | t.end() 85 | }) 86 | 87 | tape('call digest for more than MAX_UINT32 bits of data', function (t) { 88 | var _hash = crypto.createHash('sha1') 89 | var hash = new Sha1() 90 | var bigData = Buffer.alloc(0x1ffffffff / 8) 91 | 92 | hash.update(bigData) 93 | _hash.update(bigData) 94 | 95 | var a = hash.digest('hex') 96 | var e = _hash.digest('hex') 97 | 98 | t.equal(a, e) 99 | t.end() 100 | }) 101 | -------------------------------------------------------------------------------- /node_modules/sha.js/test/vectors.js: -------------------------------------------------------------------------------- 1 | var tape = require('tape') 2 | var vectors = require('hash-test-vectors') 3 | // var from = require('bops/typedarray/from') 4 | var Buffer = require('safe-buffer').Buffer 5 | 6 | var createHash = require('../') 7 | 8 | function makeTest (alg, i, verbose) { 9 | var v = vectors[i] 10 | 11 | tape(alg + ': NIST vector ' + i, function (t) { 12 | if (verbose) { 13 | console.log(v) 14 | console.log('VECTOR', i) 15 | console.log('INPUT', v.input) 16 | console.log(Buffer.from(v.input, 'base64').toString('hex')) 17 | } 18 | 19 | var buf = Buffer.from(v.input, 'base64') 20 | t.equal(createHash(alg).update(buf).digest('hex'), v[alg]) 21 | 22 | i = ~~(buf.length / 2) 23 | var buf1 = buf.slice(0, i) 24 | var buf2 = buf.slice(i, buf.length) 25 | 26 | console.log(buf1.length, buf2.length, buf.length) 27 | console.log(createHash(alg)._block.length) 28 | 29 | t.equal( 30 | createHash(alg) 31 | .update(buf1) 32 | .update(buf2) 33 | .digest('hex'), 34 | v[alg] 35 | ) 36 | 37 | var j, buf3 38 | 39 | i = ~~(buf.length / 3) 40 | j = ~~(buf.length * 2 / 3) 41 | buf1 = buf.slice(0, i) 42 | buf2 = buf.slice(i, j) 43 | buf3 = buf.slice(j, buf.length) 44 | 45 | t.equal( 46 | createHash(alg) 47 | .update(buf1) 48 | .update(buf2) 49 | .update(buf3) 50 | .digest('hex'), 51 | v[alg] 52 | ) 53 | 54 | setTimeout(function () { 55 | // avoid "too much recursion" errors in tape in firefox 56 | t.end() 57 | }) 58 | }) 59 | } 60 | 61 | if (process.argv[2]) { 62 | makeTest(process.argv[2], parseInt(process.argv[3], 10), true) 63 | } else { 64 | vectors.forEach(function (v, i) { 65 | makeTest('sha', i) 66 | makeTest('sha1', i) 67 | makeTest('sha224', i) 68 | makeTest('sha256', i) 69 | makeTest('sha384', i) 70 | makeTest('sha512', i) 71 | }) 72 | } 73 | -------------------------------------------------------------------------------- /node_modules/typeforce/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Daniel Cousens 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /node_modules/typeforce/extra.js: -------------------------------------------------------------------------------- 1 | var NATIVE = require('./native') 2 | var ERRORS = require('./errors') 3 | 4 | function _Buffer (value) { 5 | return Buffer.isBuffer(value) 6 | } 7 | 8 | function Hex (value) { 9 | return typeof value === 'string' && /^([0-9a-f]{2})+$/i.test(value) 10 | } 11 | 12 | function _LengthN (type, length) { 13 | var name = type.toJSON() 14 | 15 | function Length (value) { 16 | if (!type(value)) return false 17 | if (value.length === length) return true 18 | 19 | throw ERRORS.tfCustomError(name + '(Length: ' + length + ')', name + '(Length: ' + value.length + ')') 20 | } 21 | Length.toJSON = function () { return name } 22 | 23 | return Length 24 | } 25 | 26 | var _ArrayN = _LengthN.bind(null, NATIVE.Array) 27 | var _BufferN = _LengthN.bind(null, _Buffer) 28 | var _HexN = _LengthN.bind(null, Hex) 29 | var _StringN = _LengthN.bind(null, NATIVE.String) 30 | 31 | var UINT53_MAX = Math.pow(2, 53) - 1 32 | 33 | function Finite (value) { 34 | return typeof value === 'number' && isFinite(value) 35 | } 36 | function Int8 (value) { return ((value << 24) >> 24) === value } 37 | function Int16 (value) { return ((value << 16) >> 16) === value } 38 | function Int32 (value) { return (value | 0) === value } 39 | function UInt8 (value) { return (value & 0xff) === value } 40 | function UInt16 (value) { return (value & 0xffff) === value } 41 | function UInt32 (value) { return (value >>> 0) === value } 42 | function UInt53 (value) { 43 | return typeof value === 'number' && 44 | value >= 0 && 45 | value <= UINT53_MAX && 46 | Math.floor(value) === value 47 | } 48 | 49 | var types = { 50 | ArrayN: _ArrayN, 51 | Buffer: _Buffer, 52 | BufferN: _BufferN, 53 | Finite: Finite, 54 | Hex: Hex, 55 | HexN: _HexN, 56 | Int8: Int8, 57 | Int16: Int16, 58 | Int32: Int32, 59 | StringN: _StringN, 60 | UInt8: UInt8, 61 | UInt16: UInt16, 62 | UInt32: UInt32, 63 | UInt53: UInt53 64 | } 65 | 66 | for (var typeName in types) { 67 | types[typeName].toJSON = function (t) { 68 | return t 69 | }.bind(null, typeName) 70 | } 71 | 72 | module.exports = types 73 | -------------------------------------------------------------------------------- /node_modules/typeforce/native.js: -------------------------------------------------------------------------------- 1 | var types = { 2 | Array: function (value) { return value !== null && value !== undefined && value.constructor === Array }, 3 | Boolean: function (value) { return typeof value === 'boolean' }, 4 | Function: function (value) { return typeof value === 'function' }, 5 | Nil: function (value) { return value === undefined || value === null }, 6 | Number: function (value) { return typeof value === 'number' }, 7 | Object: function (value) { return typeof value === 'object' }, 8 | String: function (value) { return typeof value === 'string' }, 9 | '': function () { return true } 10 | } 11 | 12 | // TODO: deprecate 13 | types.Null = types.Nil 14 | 15 | for (var typeName in types) { 16 | types[typeName].toJSON = function (t) { 17 | return t 18 | }.bind(null, typeName) 19 | } 20 | 21 | module.exports = types 22 | -------------------------------------------------------------------------------- /node_modules/typeforce/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "typeforce@^1.11.3", 3 | "_id": "typeforce@1.12.0", 4 | "_inBundle": false, 5 | "_integrity": "sha512-fvnkvueAOFLhtAqDgIA/wMP21SMwS/NQESFKZuwVrj5m/Ew6eK2S0z0iB++cwtROPWDOhaT6OUfla8UwMw4Adg==", 6 | "_location": "/typeforce", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "typeforce@^1.11.3", 12 | "name": "typeforce", 13 | "escapedName": "typeforce", 14 | "rawSpec": "^1.11.3", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.11.3" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.12.0.tgz", 22 | "_shasum": "ca40899919f1466d7819e37be039406beb912a2e", 23 | "_spec": "typeforce@^1.11.3", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": { 26 | "name": "Daniel Cousens" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/dcousens/typeforce/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "dependencies": {}, 33 | "deprecated": false, 34 | "description": "Another biased type checking solution for Javascript", 35 | "devDependencies": { 36 | "nyc": "^6.4.0", 37 | "standard": "^9.0.0", 38 | "tap-dot": "^1.0.5", 39 | "tape": "^4.6.1" 40 | }, 41 | "files": [ 42 | "errors.js", 43 | "extra.js", 44 | "index.js", 45 | "native.js" 46 | ], 47 | "homepage": "https://github.com/dcousens/typeforce", 48 | "keywords": [ 49 | "typeforce", 50 | "types", 51 | "typechecking", 52 | "type", 53 | "exceptions", 54 | "force" 55 | ], 56 | "license": "ISC", 57 | "main": "index.js", 58 | "name": "typeforce", 59 | "repository": { 60 | "type": "git", 61 | "url": "git+https://github.com/dcousens/typeforce.git" 62 | }, 63 | "scripts": { 64 | "coverage": "nyc --check-coverage --branches 100 --functions 100 node test/*.js", 65 | "standard": "standard", 66 | "test": "npm run standard && npm run unit", 67 | "unit": "node test/*.js | tap-dot" 68 | }, 69 | "version": "1.12.0" 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/varuint-bitcoin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Kirill Fomichev 4 | 5 | Parts of this software are based on https://github.com/mappum/bitcoin-protocol 6 | Copyright (c) 2016 Matt Bell 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /node_modules/varuint-bitcoin/README.md: -------------------------------------------------------------------------------- 1 | # varuint-bitcoin 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/varuint-bitcoin.svg?style=flat-square)](https://www.npmjs.org/package/varuint-bitcoin) 4 | [![Build Status](https://img.shields.io/travis/bitcoinjs/varuint-bitcoin.svg?branch=master&style=flat-square)](https://travis-ci.org/bitcoinjs/varuint-bitcoin) 5 | 6 | [![abstract-encoding](https://img.shields.io/badge/abstract--encoding-compliant-brightgreen.svg?style=flat-square)](https://github.com/mafintosh/abstract-encoding) 7 | 8 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 9 | 10 | encode/decode number as [bitcoin variable length integer](https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer) 11 | 12 | | value | storage length (bytes) | 13 | |:------:|:--------------:| 14 | | [0, 0xfd) | 1 | 15 | | [0xfd, 0xffff] | 3 | 16 | | [0x010000, 0xffffffff] | 5 | 17 | | [0x0100000000, 0x1fffffffffffff] | 9 | 18 | 19 | ## License 20 | 21 | MIT 22 | -------------------------------------------------------------------------------- /node_modules/varuint-bitcoin/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var Buffer = require('safe-buffer').Buffer 3 | 4 | // Number.MAX_SAFE_INTEGER 5 | var MAX_SAFE_INTEGER = 9007199254740991 6 | 7 | function checkUInt53 (n) { 8 | if (n < 0 || n > MAX_SAFE_INTEGER || n % 1 !== 0) throw new RangeError('value out of range') 9 | } 10 | 11 | function encode (number, buffer, offset) { 12 | checkUInt53(number) 13 | 14 | if (!buffer) buffer = Buffer.allocUnsafe(encodingLength(number)) 15 | if (!Buffer.isBuffer(buffer)) throw new TypeError('buffer must be a Buffer instance') 16 | if (!offset) offset = 0 17 | 18 | // 8 bit 19 | if (number < 0xfd) { 20 | buffer.writeUInt8(number, offset) 21 | encode.bytes = 1 22 | 23 | // 16 bit 24 | } else if (number <= 0xffff) { 25 | buffer.writeUInt8(0xfd, offset) 26 | buffer.writeUInt16LE(number, offset + 1) 27 | encode.bytes = 3 28 | 29 | // 32 bit 30 | } else if (number <= 0xffffffff) { 31 | buffer.writeUInt8(0xfe, offset) 32 | buffer.writeUInt32LE(number, offset + 1) 33 | encode.bytes = 5 34 | 35 | // 64 bit 36 | } else { 37 | buffer.writeUInt8(0xff, offset) 38 | buffer.writeUInt32LE(number >>> 0, offset + 1) 39 | buffer.writeUInt32LE((number / 0x100000000) | 0, offset + 5) 40 | encode.bytes = 9 41 | } 42 | 43 | return buffer 44 | } 45 | 46 | function decode (buffer, offset) { 47 | if (!Buffer.isBuffer(buffer)) throw new TypeError('buffer must be a Buffer instance') 48 | if (!offset) offset = 0 49 | 50 | var first = buffer.readUInt8(offset) 51 | 52 | // 8 bit 53 | if (first < 0xfd) { 54 | decode.bytes = 1 55 | return first 56 | 57 | // 16 bit 58 | } else if (first === 0xfd) { 59 | decode.bytes = 3 60 | return buffer.readUInt16LE(offset + 1) 61 | 62 | // 32 bit 63 | } else if (first === 0xfe) { 64 | decode.bytes = 5 65 | return buffer.readUInt32LE(offset + 1) 66 | 67 | // 64 bit 68 | } else { 69 | decode.bytes = 9 70 | var lo = buffer.readUInt32LE(offset + 1) 71 | var hi = buffer.readUInt32LE(offset + 5) 72 | var number = hi * 0x0100000000 + lo 73 | checkUInt53(number) 74 | 75 | return number 76 | } 77 | } 78 | 79 | function encodingLength (number) { 80 | checkUInt53(number) 81 | 82 | return ( 83 | number < 0xfd ? 1 84 | : number <= 0xffff ? 3 85 | : number <= 0xffffffff ? 5 86 | : 9 87 | ) 88 | } 89 | 90 | module.exports = { encode: encode, decode: decode, encodingLength: encodingLength } 91 | -------------------------------------------------------------------------------- /node_modules/varuint-bitcoin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "varuint-bitcoin@^1.0.4", 3 | "_id": "varuint-bitcoin@1.1.0", 4 | "_inBundle": false, 5 | "_integrity": "sha512-jCEPG+COU/1Rp84neKTyDJQr478/hAfVp5xxYn09QEH0yBjbmPeMfuuQIrp+BUD83hybtYZKhr5elV3bvdV1bA==", 6 | "_location": "/varuint-bitcoin", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "varuint-bitcoin@^1.0.4", 12 | "name": "varuint-bitcoin", 13 | "escapedName": "varuint-bitcoin", 14 | "rawSpec": "^1.0.4", 15 | "saveSpec": null, 16 | "fetchSpec": "^1.0.4" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/varuint-bitcoin/-/varuint-bitcoin-1.1.0.tgz", 22 | "_shasum": "7a343f50537607af6a3059312b9782a170894540", 23 | "_spec": "varuint-bitcoin@^1.0.4", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": { 26 | "name": "Kirill Fomichev", 27 | "email": "fanatid@ya.ru", 28 | "url": "http://github.com/fanatid" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/bitcoinjs/varuint-bitcoin/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "safe-buffer": "^5.1.1" 36 | }, 37 | "deprecated": false, 38 | "description": "encode/decode number as bitcoin variable length integer", 39 | "devDependencies": { 40 | "nyc": "^11.4.1", 41 | "standard": "*", 42 | "tape": "^4.5.1" 43 | }, 44 | "files": [ 45 | "index.js" 46 | ], 47 | "homepage": "https://github.com/bitcoinjs/varuint-bitcoin", 48 | "license": "MIT", 49 | "main": "./index.js", 50 | "name": "varuint-bitcoin", 51 | "repository": { 52 | "type": "git", 53 | "url": "git+https://github.com/bitcoinjs/varuint-bitcoin.git" 54 | }, 55 | "scripts": { 56 | "coverage": "nyc --check-coverage --branches 100 --functions 100 tape test/*.js", 57 | "lint": "standard", 58 | "test": "npm run lint && npm run unit", 59 | "unit": "tape test/*.js" 60 | }, 61 | "version": "1.1.0" 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/wif/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .nyc_output 3 | -------------------------------------------------------------------------------- /node_modules/wif/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "4" 5 | - "5" 6 | - "7" 7 | matrix: 8 | include: 9 | - node_js: "7" 10 | env: TEST_SUITE=standard 11 | - node_js: "7" 12 | env: TEST_SUITE=coverage 13 | env: 14 | - TEST_SUITE=unit 15 | script: npm run-script $TEST_SUITE 16 | -------------------------------------------------------------------------------- /node_modules/wif/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Daniel Cousens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/wif/README.md: -------------------------------------------------------------------------------- 1 | # WIF 2 | 3 | [![TRAVIS](https://secure.travis-ci.org/bitcoinjs/wif.png)](http://travis-ci.org/bitcoinjs/wif) 4 | [![NPM](http://img.shields.io/npm/v/wif.svg)](https://www.npmjs.org/package/wif) 5 | 6 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 7 | 8 | Bitcoin Wallet Import Format encoding/decoding module. 9 | 10 | 11 | ## Example 12 | 13 | ``` javascript 14 | var wif = require('wif') 15 | 16 | var privateKey = new Buffer('0000000000000000000000000000000000000000000000000000000000000001', 'hex') 17 | 18 | var key = wif.encode(128, privateKey, true) 19 | // => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn 20 | 21 | var obj = wif.decode(key) 22 | // => { 23 | // version: 128, 24 | // privateKey: , 25 | // compressed: true 26 | //} 27 | 28 | wif.encode(obj) 29 | // => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn 30 | ``` 31 | 32 | ## LICENSE [MIT](LICENSE) 33 | -------------------------------------------------------------------------------- /node_modules/wif/index.js: -------------------------------------------------------------------------------- 1 | var bs58check = require('bs58check') 2 | 3 | function decodeRaw (buffer, version) { 4 | // check version only if defined 5 | if (version !== undefined && buffer[0] !== version) throw new Error('Invalid network version') 6 | 7 | // uncompressed 8 | if (buffer.length === 33) { 9 | return { 10 | version: buffer[0], 11 | privateKey: buffer.slice(1, 33), 12 | compressed: false 13 | } 14 | } 15 | 16 | // invalid length 17 | if (buffer.length !== 34) throw new Error('Invalid WIF length') 18 | 19 | // invalid compression flag 20 | if (buffer[33] !== 0x01) throw new Error('Invalid compression flag') 21 | 22 | return { 23 | version: buffer[0], 24 | privateKey: buffer.slice(1, 33), 25 | compressed: true 26 | } 27 | } 28 | 29 | function encodeRaw (version, privateKey, compressed) { 30 | var result = new Buffer(compressed ? 34 : 33) 31 | 32 | result.writeUInt8(version, 0) 33 | privateKey.copy(result, 1) 34 | 35 | if (compressed) { 36 | result[33] = 0x01 37 | } 38 | 39 | return result 40 | } 41 | 42 | function decode (string, version) { 43 | return decodeRaw(bs58check.decode(string), version) 44 | } 45 | 46 | function encode (version, privateKey, compressed) { 47 | if (typeof version === 'number') return bs58check.encode(encodeRaw(version, privateKey, compressed)) 48 | 49 | return bs58check.encode( 50 | encodeRaw( 51 | version.version, 52 | version.privateKey, 53 | version.compressed 54 | ) 55 | ) 56 | } 57 | 58 | module.exports = { 59 | decode: decode, 60 | decodeRaw: decodeRaw, 61 | encode: encode, 62 | encodeRaw: encodeRaw 63 | } 64 | -------------------------------------------------------------------------------- /node_modules/wif/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "wif@^2.0.1", 3 | "_id": "wif@2.0.6", 4 | "_inBundle": false, 5 | "_integrity": "sha1-CNP1IFbGZnkplyb63g1DKudLRwQ=", 6 | "_location": "/wif", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "wif@^2.0.1", 12 | "name": "wif", 13 | "escapedName": "wif", 14 | "rawSpec": "^2.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^2.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/bitcoinjs-lib" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/wif/-/wif-2.0.6.tgz", 22 | "_shasum": "08d3f52056c66679299726fade0d432ae74b4704", 23 | "_spec": "wif@^2.0.1", 24 | "_where": "C:\\Users\\Kyle\\Documents\\GitHub\\bitcoinjs-lib-Examples\\node_modules\\bitcoinjs-lib", 25 | "author": { 26 | "name": "Daniel Cousens" 27 | }, 28 | "bugs": { 29 | "url": "https://github.com/bitcoinjs/wif/issues" 30 | }, 31 | "bundleDependencies": false, 32 | "dependencies": { 33 | "bs58check": "<3.0.0" 34 | }, 35 | "deprecated": false, 36 | "description": "Bitcoin Wallet Import Format (WIF) decoding/encoding module", 37 | "devDependencies": { 38 | "nyc": "^6.4.0", 39 | "standard": "*", 40 | "tape": "^4.6.2" 41 | }, 42 | "homepage": "https://github.com/bitcoinjs/wif", 43 | "keywords": [ 44 | "bitcoin", 45 | "base58", 46 | "base58check", 47 | "decode", 48 | "decoding", 49 | "encoding", 50 | "encode", 51 | "key", 52 | "private", 53 | "wif" 54 | ], 55 | "license": "MIT", 56 | "main": "index.js", 57 | "name": "wif", 58 | "repository": { 59 | "type": "git", 60 | "url": "git+https://github.com/bitcoinjs/wif.git" 61 | }, 62 | "scripts": { 63 | "coverage": "nyc --check-coverage --branches 90 --functions 90 npm run unit", 64 | "coverage-report": "nyc report --reporter=lcov", 65 | "standard": "standard", 66 | "test": "npm run standard && npm run coverage", 67 | "unit": "tape test/*.js" 68 | }, 69 | "version": "2.0.6" 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/wif/test/fixtures.json: -------------------------------------------------------------------------------- 1 | { 2 | "valid": [ 3 | { 4 | "WIF": "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn", 5 | "compressed": true, 6 | "privateKeyHex": "0000000000000000000000000000000000000000000000000000000000000001", 7 | "version": 128 8 | }, 9 | { 10 | "WIF": "5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf", 11 | "compressed": false, 12 | "privateKeyHex": "0000000000000000000000000000000000000000000000000000000000000001", 13 | "version": 128 14 | }, 15 | { 16 | "WIF": "KxhEDBQyyEFymvfJD96q8stMbJMbZUb6D1PmXqBWZDU2WvbvVs9o", 17 | "compressed": true, 18 | "privateKeyHex": "2bfe58ab6d9fd575bdc3a624e4825dd2b375d64ac033fbc46ea79dbab4f69a3e", 19 | "version": 128 20 | }, 21 | { 22 | "WIF": "KzrA86mCVMGWnLGBQu9yzQa32qbxb5dvSK4XhyjjGAWSBKYX4rHx", 23 | "compressed": true, 24 | "privateKeyHex": "6c4313b03f2e7324d75e642f0ab81b734b724e13fec930f309e222470236d66b", 25 | "version": 128 26 | }, 27 | { 28 | "WIF": "5JdxzLtFPHNe7CAL8EBC6krdFv9pwPoRo4e3syMZEQT9srmK8hh", 29 | "compressed": false, 30 | "privateKeyHex": "6c4313b03f2e7324d75e642f0ab81b734b724e13fec930f309e222470236d66b", 31 | "version": 128 32 | }, 33 | { 34 | "WIF": "cRD9b1m3vQxmwmjSoJy7Mj56f4uNFXjcWMCzpQCEmHASS4edEwXv", 35 | "compressed": true, 36 | "privateKeyHex": "6c4313b03f2e7324d75e642f0ab81b734b724e13fec930f309e222470236d66b", 37 | "version": 239 38 | }, 39 | { 40 | "WIF": "92Qba5hnyWSn5Ffcka56yMQauaWY6ZLd91Vzxbi4a9CCetaHtYj", 41 | "compressed": false, 42 | "privateKeyHex": "6c4313b03f2e7324d75e642f0ab81b734b724e13fec930f309e222470236d66b", 43 | "version": 239 44 | }, 45 | { 46 | "WIF": "L5oLkpV3aqBjhki6LmvChTCV6odsp4SXM6FfU2Gppt5kFLaHLuZ9", 47 | "compressed": true, 48 | "privateKeyHex": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140", 49 | "version": 128 50 | } 51 | ], 52 | "invalid": { 53 | "decode": [ 54 | { 55 | "exception": "Invalid network version", 56 | "version": 128, 57 | "WIF": "92Qba5hnyWSn5Ffcka56yMQauaWY6ZLd91Vzxbi4a9CCetaHtYj" 58 | }, 59 | { 60 | "exception": "Invalid compression flag", 61 | "version": 128, 62 | "WIF": "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sfZr2ym" 63 | }, 64 | { 65 | "exception": "Invalid WIF length", 66 | "version": 128, 67 | "WIF": "3tq8Vmhh9SN5XhjTGSWgx8iKk59XbKG6UH4oqpejRuJhfYD" 68 | }, 69 | { 70 | "exception": "Invalid WIF length", 71 | "version": 128, 72 | "WIF": "38uMpGARR2BJy5p4dNFKYg9UsWNoBtkpbdrXDjmfvz8krCtw3T1W92ZDSR" 73 | } 74 | ] 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /node_modules/wif/test/index.js: -------------------------------------------------------------------------------- 1 | var wif = require('../') 2 | var fixtures = require('./fixtures') 3 | var tape = require('tape') 4 | 5 | fixtures.valid.forEach(function (f) { 6 | tape('encode/encodeRaw returns ' + f.WIF + ' for ' + f.privateKeyHex.slice(0, 20) + '... (' + f.version + ')', function (t) { 7 | t.plan(1) 8 | 9 | var privateKey = new Buffer(f.privateKeyHex, 'hex') 10 | var actual = wif.encode(f.version, privateKey, f.compressed) 11 | t.equal(actual, f.WIF) 12 | }) 13 | }) 14 | 15 | fixtures.valid.forEach(function (f) { 16 | tape('decode/decodeRaw returns ' + f.privateKeyHex.slice(0, 20) + '... (' + f.version + ')' + ' for ' + f.WIF, function (t) { 17 | t.plan(3) 18 | 19 | var actual = wif.decode(f.WIF, f.version) 20 | t.equal(actual.version, f.version) 21 | t.equal(actual.privateKey.toString('hex'), f.privateKeyHex) 22 | t.equal(actual.compressed, f.compressed) 23 | }) 24 | }) 25 | 26 | fixtures.invalid.decode.forEach(function (f) { 27 | tape('throws ' + f.exception + ' for ' + f.WIF, function (t) { 28 | t.plan(1) 29 | t.throws(function () { 30 | wif.decode(f.WIF, f.version) 31 | }, new RegExp(f.exception)) 32 | }) 33 | }) 34 | 35 | fixtures.valid.forEach(function (f) { 36 | tape('decode/encode for ' + f.WIF, function (t) { 37 | t.plan(1) 38 | 39 | var actual = wif.encode(wif.decode(f.WIF, f.version)) 40 | t.equal(actual, f.WIF) 41 | }) 42 | }) 43 | -------------------------------------------------------------------------------- /p2pkh.js: -------------------------------------------------------------------------------- 1 | const bitcoin = require("bitcoinjs-lib"); 2 | 3 | //creating and signing a standard p2pkh transaction 4 | 5 | let NETWORK = bitcoin.networks.bitcoin; 6 | let txb = new bitcoin.TransactionBuilder(NETWORK); 7 | 8 | //get unspent output details 9 | let txid = ""; //transaction id 10 | let outn = 0; // n out 11 | 12 | //add input 13 | txb.addInput(txid, outn); 14 | 15 | //add output 16 | txb.addOutput("bc1qmwzvnazs8263g6v9ctscwheu329dvsax6jl369",35000); //first argument is address that will receive the funds, the second is the value to send in satoshis after deducting the mining fees. In this example there are 5000 satoshis in mining fees (40000-35000=5000) 17 | 18 | //signing 19 | let WIF = ""; //private key of the address associated with this unspent output 20 | let keypair = bitcoin.ECPair.fromWIF(WIF, NETWORK); 21 | txb.sign(0, keypair); 22 | let tx = txb.build(); 23 | let txhex = tx.toHex(); 24 | 25 | console.log (txhex); 26 | 27 | //using buildIncomplete lets you build your transaction before its signed or complete, good for debugging or multi signings 28 | //let txhex = txb.buildIncomplete().toHex(); 29 | //console.log(txhex); 30 | -------------------------------------------------------------------------------- /p2sh-p2wpkh.js: -------------------------------------------------------------------------------- 1 | const bitcoin = require("bitcoinjs-lib"); 2 | 3 | //creating and signing a p2sh segwit 4 | //p2sh(p2wpkh): addInput('00000....', 0) 5 | //sign(0, keyPair, redeemScript, ,value) 6 | 7 | let NETWORK = bitcoin.networks.bitcoin; 8 | let txb = new bitcoin.TransactionBuilder(NETWORK); 9 | 10 | //get unspent output details 11 | let txid = ""; //transaction id of the output you want to spend 12 | let outn = 0; // n out 13 | 14 | //need scriptPubKey for adding input 15 | let WIF = ""; //private key of p2sh-p2wpkh output 16 | let keypair = bitcoin.ECPair.fromWIF(WIF, NETWORK); 17 | let pubKey = keypair.getPublicKeyBuffer(); 18 | let pubKeyHash = bitcoin.crypto.hash160(pubKey); 19 | let redeemScript = bitcoin.script.witnessPubKeyHash.output.encode(pubKeyHash); 20 | let redeemScriptHash = bitcoin.crypto.hash160(redeemScript); 21 | let scriptPubkey = bitcoin.script.scriptHash.output.encode(redeemScriptHash); 22 | 23 | //add input 24 | txb.addInput(txid, outn, null, scriptPubkey); 25 | 26 | //add output 27 | txb.addOutput("17v9bcxrrKF4V2uyRtZR9QHRRcMFvG7pdq",30000); //first argument is receiving address, the second is the amount we are sending after deducting a mining fee 28 | 29 | //signing 30 | txb.sign(0, keypair, redeemScript, null, 35000); //NOTE the amount is the FULL amount of the unspent output, NOT the amount we are sending 31 | let tx = txb.build(); 32 | let txhex = tx.toHex(); 33 | 34 | console.log(txhex); 35 | 36 | //using buildIncomplete lets you build your transaction before its signed or complete, good for debugging or multi signings 37 | //let txhex = txb.buildIncomplete().toHex(); 38 | //console.log(txhex); 39 | -------------------------------------------------------------------------------- /p2wpkh.js: -------------------------------------------------------------------------------- 1 | const bitcoin = require("bitcoinjs-lib"); 2 | 3 | //creating and signing a native p2wpkh 4 | //p2wpk: addInput('00000....', 0, prevOutScript) 5 | //sign(0, keyPair,,,value) 6 | 7 | let NETWORK = bitcoin.networks.bitcoin; 8 | let txb = new bitcoin.TransactionBuilder(NETWORK); 9 | 10 | //get unspent output details 11 | let txid = ""; //transaction id of the output you want to spend 12 | let outn = 0; // n out 13 | 14 | //need scriptPubKey for adding input 15 | let WIF = ""; //private key of bech32 output 16 | let keypair = bitcoin.ECPair.fromWIF(WIF, NETWORK); 17 | let scriptPubkey = bitcoin.script.witnessPubKeyHash.output.encode( 18 | bitcoin.crypto.hash160( 19 | keypair.getPublicKeyBuffer() 20 | ) 21 | ); 22 | 23 | //add input 24 | txb.addInput(txid, outn, null, scriptPubkey); 25 | 26 | //add output 27 | txb.addOutput("17v9bcxrrKF4V2uyRtZR9QHRRcMFvG7pdq",30000); //first argument is receiving address, the second is the amount we are sending after deducting a mining fee 28 | 29 | //signing 30 | txb.sign(0, keypair, null, null, 35000); //NOTE the amount is the FULL amount of the unspent output, NOT the amount we are sending 31 | let tx = txb.build(); 32 | let txhex = tx.toHex(); 33 | 34 | console.log(txhex); 35 | 36 | //using buildIncomplete lets you build your transaction before its signed or complete, good for debugging or multi signings 37 | //let txhex = txb.buildIncomplete().toHex(); 38 | //console.log(txhex); 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bitcoinjs-lib-examples", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "bitcoinjs-lib": "^3.3.2" 13 | } 14 | } 15 | --------------------------------------------------------------------------------