@bitgo/utxo-lib 1.10.0-rc.12 → 1.10.0-rc.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,30 +1,8 @@
1
- # BitGo UTXO library (bitgo-utxo-lib)
2
- [![Build Status](https://travis-ci.org/BitGo/bitgo-utxo-lib.png?branch=master)](https://travis-ci.org/BitGo/bitgo-utxo-lib)
3
- [![NPM](https://img.shields.io/npm/v/bitgo-utxo-lib.svg)](https://www.npmjs.org/package/bitgo-utxo-lib)
4
- [![Known Vulnerabilities](https://snyk.io/test/github/BitGo/bitgo-utxo-lib/badge.svg?targetFile=package.json)](https://snyk.io/test/github/BitGo/bitgo-utxo-lib?targetFile=package.json)
1
+ # BitGo UTXO library
5
2
 
6
- [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
7
-
8
- Originally a fork of [bitcoinjs-lib](https://github.com/BitGo/bitcoinjs-lib); we evolved this library to support the transaction building process of different UTXO based coins.
9
-
10
- ## Supported coins
11
- - Bitcoin
12
- - Bitcoin Cash
13
- - Bitcoin Gold
14
- - Bitcoin SV (Satoshi Vision)
15
- - Dash
16
- - Litecoin
17
- - Zcash (Sapling compatible)
3
+ This library is a wrapper around [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib) adding altcoin support.
18
4
 
19
5
  ## Features
20
- - Clean: Pure JavaScript, concise code, easy to read.
21
- - Tested: Coverage > 90%, third-party integration tests.
22
- - Compatible: Works on Node.js and all modern browsers.
23
- - Powerful: Support for advanced features, such as multi-sig, HD Wallets.
24
- - Secure: Strong random number generation, PGP signed releases, trusted developers.
25
- - Principled: No support for browsers with RNG (IE < 11)
26
- - Standardized: Node community coding style, Browserify, Node's stdlib and Buffers.
27
- - Experiment-friendly: Mainnet and Testnet support.
28
6
  - Multicoin support: Configurable behaviour based on [network](https://github.com/BitGo/bitgo-utxo-lib/blob/master/src/networks.js) objects.
29
7
  - Backed by [BitGo](https://www.bitgo.com/info/)
30
8
 
@@ -35,114 +13,30 @@ npm install @bitgo/utxo-lib
35
13
 
36
14
  ## Setup
37
15
  ### Node.js
38
- ``` javascript
39
- var bitGoUTXO = require('@bitgo/utxo-lib')
16
+ ```typescript
17
+ import * as utxolib from '@bitgo/utxo-lib'
40
18
  ```
41
19
 
42
- ### Browser
43
- If you're familiar with how to use browserify, ignore this and proceed normally.
44
- These steps are advisory only, and may not be suitable for your application.
45
-
46
- [Browserify](https://github.com/substack/node-browserify) is assumed to be installed for these steps.
47
-
48
- For your project, create an `index.js` file
49
- ``` javascript
50
- let bitGoUTXO = require('@bitgo/utxo-lib')
51
-
52
- // your code here
53
- function myFunction () {
54
- return bitGoUTXO.ECPair.makeRandom().toWIF()
55
- }
56
20
 
57
- module.exports = {
58
- myFunction
59
- }
60
- ```
61
-
62
- Now, to compile for the browser:
63
- ``` bash
64
- browserify index.js --standalone foo > app.js
65
- ```
21
+ ## Usage
66
22
 
67
- You can now put `<script src="app.js" />` in your web page, using `foo.myFunction` to create a new Bitcoin private key.
23
+ Support for parsing and building altcoin transactions is provided by the following methods
68
24
 
69
- **NOTE**: If you uglify the javascript, you must exclude the following variable names from being mangled: `BigInteger`, `ECPair`, `Point`.
70
- This is because of the function-name-duck-typing used in [typeforce](https://github.com/dcousens/typeforce).
25
+ * `utxolib.bitgo.createTransactionFromBuffer(buffer, network): UtxoTransaction` (similarly `createTransactionFromHex(string, network)`)
26
+ * `utxolib.bitgo.createTransactionBuilderForNetwork(network): UtxoTransactionBuilder`
27
+ * `utxolib.bitgo.createTransactionBuilderFromTransaction(tx): UtxoTransactionBuilder`
71
28
 
72
- Example:
73
- ``` bash
74
- uglifyjs ... --mangle --reserved 'BigInteger,ECPair,Point'
75
- ```
29
+ The `UtxoTransaction(Builder)` classes have the same interface as the `Transaction` type in `bitcoinjs-lib` .
76
30
 
77
- **NOTE**: This library tracks Node LTS features, if you need strict ES5, use [`--transform babelify`](https://github.com/babel/babelify) in conjunction with your `browserify` step (using an [`es2015`](http://babeljs.io/docs/plugins/preset-es2015/) preset).
78
-
79
- **NOTE**: If you expect this library to run on an iOS 10 device, ensure that you are using [buffer@5.0.5](https://github.com/feross/buffer/pull/155) or greater.
80
-
81
- ## Examples
82
- The below examples are implemented as integration tests, they should be very easy to understand.
83
- Otherwise, pull requests are appreciated.
84
- Some examples interact (via HTTPS) with a 3rd Party Blockchain Provider (3PBP).
85
-
86
- ### Bitcoin
87
-
88
- - [Generate a random address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L12)
89
- - [Generate an address from a SHA256 hash](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L19)
90
- - [Import an address via WIF](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L29)
91
- - [Generate a 2-of-3 P2SH multisig address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L36)
92
- - [Generate a SegWit address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L50)
93
- - [Generate a SegWit P2SH address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L60)
94
- - [Generate a SegWit 3-of-4 multisig address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L71)
95
- - [Generate a SegWit 2-of-2 P2SH multisig address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L86)
96
- - [Support the retrieval of transactions for an address (3rd party blockchain)](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L100)
97
- - [Generate a Testnet address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L121)
98
- - [Generate a Litecoin address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/addresses.js#L131)
99
- - [Create a 1-to-1 Transaction](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L14)
100
- - [Create a 2-to-2 Transaction](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L28)
101
- - [Create (and broadcast via 3PBP) a typical Transaction](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L46)
102
- - [Create (and broadcast via 3PBP) a Transaction with an OP\_RETURN output](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L88)
103
- - [Create (and broadcast via 3PBP) a Transaction with a 2-of-4 P2SH(multisig) input](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L115)
104
- - [Create (and broadcast via 3PBP) a Transaction with a SegWit P2SH(P2WPKH) input](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L151)
105
- - [Create (and broadcast via 3PBP) a Transaction with a SegWit 3-of-4 P2SH(P2WSH(multisig)) input](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/transactions.js#L183)
106
- - [Import a BIP32 testnet xpriv and export to WIF](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L8)
107
- - [Export a BIP32 xpriv, then import it](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L15)
108
- - [Export a BIP32 xpub](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L26)
109
- - [Create a BIP32, bitcoin, account 0, external address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L35)
110
- - [Create a BIP44, bitcoin, account 0, external address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L50)
111
- - [Create a BIP49, bitcoin testnet, account 0, external address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L66)
112
- - [Use BIP39 to generate BIP32 addresses](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/bip32.js#L83)
113
- - [Create (and broadcast via 3PBP) a Transaction where Alice can redeem the output after the expiry](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/cltv.js#L37)
114
- - [Create (and broadcast via 3PBP) a Transaction where Alice and Bob can redeem the output at any time](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/cltv.js#L71)
115
- - [Create (but fail to broadcast via 3PBP) a Transaction where Alice attempts to redeem before the expiry](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/cltv.js#L104)
116
- - [Recover a private key from duplicate R values](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/crypto.js#L14)
117
- - [Recover a BIP32 parent private key from the parent public key, and a derived, non-hardened child private key](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/crypto.js#L115)
118
- - [Generate a single-key stealth address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/stealth.js#L70:)
119
- - [Generate a single-key stealth address (randomly)](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/stealth.js#L89:)
120
- - [Recover parent recipient.d, if a derived private key is leaked (and nonce was revealed)](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/stealth.js#L105)
121
- - [Generate a dual-key stealth address](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/stealth.js#L122)
122
- - [Generate a dual-key stealth address (randomly)](https://github.com/BitGo/BitGoJS/tree/master/modules/utxo-lib/test/integration/stealth.js#L145)
123
-
124
- If you have a use case that you feel could be listed here, please [ask for it](https://github.com/BitGo/bitgo-utxo-lib/issues/new)!
125
-
126
- ### Running the test suite
127
-
128
- ``` bash
129
- npm test
130
- npm run-script coverage
131
- ```
132
-
133
- ## Complementing Libraries
134
- - [BIP21](https://github.com/bitcoinjs/bip21) - A BIP21 compatible URL encoding utility library
135
- - [BIP38](https://github.com/bitcoinjs/bip38) - Passphrase-protected private keys
136
- - [BIP39](https://github.com/bitcoinjs/bip39) - Mnemonic generation for deterministic keys
137
- - [BIP32-Utils](https://github.com/bitcoinjs/bip32-utils) - A set of utilities for working with BIP32
138
- - [BIP66](https://github.com/bitcoinjs/bip66) - Strict DER signature decoding
139
- - [BIP69](https://github.com/bitcoinjs/bip69) - Lexicographical Indexing of Transaction Inputs and Outputs
140
- - [Base58](https://github.com/cryptocoinjs/bs58) - Base58 encoding/decoding
141
- - [Base58 Check](https://github.com/bitcoinjs/bs58check) - Base58 check encoding/decoding
142
- - [Bech32](https://github.com/bitcoinjs/bech32) - A BIP173 compliant Bech32 encoding library
143
- - [coinselect](https://github.com/bitcoinjs/coinselect) - A fee-optimizing, transaction input selection module for bitcoinjs-lib.
144
- - [merkle-lib](https://github.com/bitcoinjs/merkle-lib) - A performance conscious library for merkle root and tree calculations.
145
- - [minimaldata](https://github.com/bitcoinjs/minimaldata) - A module to check bitcoin policy: SCRIPT_VERIFY_MINIMALDATA
31
+ ## Supported coins
146
32
 
33
+ |Network|Mainnet|Testnet|
34
+ |---|---|---|
35
+ |Bitcoin|`utxolib.networks.bitcoin`|`utxolib.networks.testnet`|
36
+ |Bitcoin Cash|`utxolib.networks.bitcoincash`|`utxolib.networks.bitcoincashTestnet`|
37
+ |Bitcoin Gold|`utxolib.networks.bitcoingold`|`utxolib.networks.bitcoingoldTestnet`|
38
+ |Bitcoin SV (Satoshi Vision)|`utxolib.networks.bitcoinsv`|`utxolib.networks.bitcoinsvTestnet`|
39
+ |Dash|`utxolib.networks.dash`|`utxolib.networks.dash`|
40
+ |Litecoin|`utxolib.networks.litecoin`|`utxolib.networks.litecoinTest`|
41
+ |Zcash|`utxolib.networks.zcash`|`utxolib.networks.zcashTest`|
147
42
 
148
- ## LICENSE [MIT](LICENSE)
@@ -14,17 +14,12 @@ function padInputScript(input, signatureIndex) {
14
14
  if (![0, 1, 2].includes(signatureIndex)) {
15
15
  throw new Error(`invalid signature index: must be one of [0, 1, 2]`);
16
16
  }
17
- // We only use `txb.build()` on certain legacy v1 SDKs.
18
- // Since native segwit was never enabled in v1 we do not have to worry about p2wsh inputs
19
- // and can focus on p2sh and p2shP2wsh.
20
- if (!input.script) {
21
- throw new Error(`native segwit not supported`);
22
- }
23
- const inputClassification = bscript.classifyInput(input.script, true);
24
- const decompiledSigScript = input.witness.length ? input.witness : bscript.decompile(input.script);
25
- const expectedScriptType = inputClassification === bscript.types.P2SH || inputClassification === bscript.types.P2WSH;
26
- if (!expectedScriptType) {
27
- return;
17
+ let decompiledSigScript;
18
+ if (input.witness && input.witness.length > 0) {
19
+ decompiledSigScript = input.witness;
20
+ }
21
+ else {
22
+ decompiledSigScript = bscript.decompile(input.script);
28
23
  }
29
24
  // The shape of a non-standard half-signed input is
30
25
  // OP_0 <signature> <p2ms>
@@ -33,7 +28,10 @@ function padInputScript(input, signatureIndex) {
33
28
  }
34
29
  const [op0, signatureBuffer, sigScript] = decompiledSigScript;
35
30
  if (op0 !== opcodes.OP_0 && !(Buffer.isBuffer(op0) && op0.length === 0)) {
36
- throw new Error(`unexpected instruction`);
31
+ return;
32
+ }
33
+ if (bscript.classifyOutput(sigScript) !== bscript.types.MULTISIG) {
34
+ return;
37
35
  }
38
36
  const paddedSigScript = [
39
37
  op0,
@@ -49,4 +47,4 @@ function padInputScript(input, signatureIndex) {
49
47
  }
50
48
  }
51
49
  exports.padInputScript = padInputScript;
52
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9uU3RhbmRhcmRIYWxmU2lnbmVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2JpdGdvL25vblN0YW5kYXJkSGFsZlNpZ25lZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQTs7R0FFRztBQUNILHVDQUF1QztBQUN2QyxxQ0FBcUM7QUFJckM7OztHQUdHO0FBQ0g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ANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo/utxo-lib",
3
- "version": "1.10.0-rc.12",
3
+ "version": "1.10.0-rc.13",
4
4
  "description": "Client-side Bitcoin JavaScript library",
5
5
  "main": "./dist/src/index.js",
6
6
  "engines": {
@@ -18,15 +18,21 @@
18
18
  "javascript"
19
19
  ],
20
20
  "scripts": {
21
+ "prepare": "npm run build",
21
22
  "build": "tsc --project tsconfig.build.json",
22
23
  "coverage-report": "nyc report --reporter=lcov",
23
24
  "coverage-html": "nyc report --reporter=html",
24
- "coverage": "npm run build && BITGO_UTXO_LIB_TEST_EXPECTED_COUNT=3594 nyc --check-coverage --branches 88 --functions 90 mocha",
25
- "integration-test": "mocha test/integration/",
26
- "standard": "standard",
27
- "test": "npm run standard && npm run coverage",
25
+ "coverage": "npm run build && nyc --check-coverage mocha",
26
+ "test": "npm run coverage",
28
27
  "unit-test": "mocha"
29
28
  },
29
+ "nyc": {
30
+ "include": [
31
+ "src/**"
32
+ ],
33
+ "branches": 78,
34
+ "functions": 90
35
+ },
30
36
  "repository": {
31
37
  "type": "git",
32
38
  "url": "https://github.com/BitGo/BitGoJS.git",
@@ -37,42 +43,22 @@
37
43
  ],
38
44
  "dependencies": {
39
45
  "@bitgo/blake2b": "^3.0.1",
40
- "bech32": "0.0.3",
41
- "bigi": "^1.4.0",
42
- "bip66": "^1.1.0",
43
46
  "bitcoin-ops": "^1.3.0",
47
+ "bitcoinjs-lib": "git+https://github.com/BitGo/bitcoinjs-lib.git#19fd098772",
44
48
  "bs58check": "^2.0.0",
45
- "create-hash": "^1.1.0",
46
- "create-hmac": "^1.1.3",
47
- "debug": "~3.1.0",
48
- "ecurve": "^1.0.0",
49
- "merkle-lib": "^2.0.10",
50
- "pushdata-bitcoin": "^1.0.1",
51
- "randombytes": "^2.0.1",
52
- "safe-buffer": "^5.0.1",
53
49
  "typeforce": "^1.11.3",
54
- "varuint-bitcoin": "^1.0.4",
55
- "wif": "^2.0.1"
50
+ "varuint-bitcoin": "^1.0.4"
56
51
  },
57
52
  "devDependencies": {
58
53
  "@types/fs-extra": "^9.0.12",
59
54
  "axios": "^0.21.1",
60
- "bip39": "^2.3.0",
61
- "bip65": "^1.0.1",
62
- "bs58": "^4.0.0",
63
- "dhttp": "^2.4.2",
55
+ "debug": "^3.1.0",
64
56
  "fs-extra": "^9.1.0",
65
- "minimaldata": "^1.0.2",
66
57
  "mocha": "^8.4.0",
67
58
  "nyc": "^15.1.0",
68
- "proxyquire": "^1.4.0",
69
- "sinon": "^1.12.2",
70
- "standard": "^9.0.2",
71
- "ts-node": "^9.1.1"
59
+ "ts-node": "^9.1.1",
60
+ "typescript": "^4.4.3"
72
61
  },
73
62
  "license": "MIT",
74
- "optionalDependencies": {
75
- "secp256k1": "^3.5.2"
76
- },
77
- "gitHead": "fce052925597b7ca2e83e233499c8ea2eec06b4b"
63
+ "gitHead": "0d3db112db1495986f23e0e12b56c617f5c0bfd7"
78
64
  }