@btc-vision/bitcoin 6.3.1 → 6.3.2

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.
Files changed (259) hide show
  1. package/.babelrc +4 -0
  2. package/.gitattributes +2 -0
  3. package/.nyc_output/6368a5b2-daa5-4821-8ed0-b742d6fc7eab.json +1 -0
  4. package/.nyc_output/processinfo/6368a5b2-daa5-4821-8ed0-b742d6fc7eab.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -0
  6. package/.prettierrc.json +12 -0
  7. package/CHANGELOG.md +403 -0
  8. package/CONTRIBUTING.md +83 -0
  9. package/browser/address.d.ts +16 -0
  10. package/{src → browser}/bip66.d.ts +6 -7
  11. package/{src → browser}/block.d.ts +29 -30
  12. package/{src → browser}/bufferutils.d.ts +34 -54
  13. package/browser/crypto/crypto.d.ts +1 -0
  14. package/{src → browser}/crypto.d.ts +13 -18
  15. package/browser/ecc_lib.d.ts +3 -0
  16. package/browser/hooks/AdvancedSignatureManager.d.ts +16 -0
  17. package/{src → browser}/hooks/HookedSigner.d.ts +4 -4
  18. package/browser/hooks/SignatureManager.d.ts +13 -0
  19. package/browser/index.d.ts +58 -0
  20. package/browser/index.js +2 -0
  21. package/browser/index.js.LICENSE.txt +14 -0
  22. package/browser/merkle.d.ts +1 -0
  23. package/browser/networks.d.ts +23 -0
  24. package/{src → browser}/ops.d.ts +126 -126
  25. package/browser/payments/bip341.d.ts +23 -0
  26. package/browser/payments/embed.d.ts +2 -0
  27. package/browser/payments/index.d.ts +41 -0
  28. package/{src → browser}/payments/lazy.d.ts +2 -2
  29. package/browser/payments/p2ms.d.ts +2 -0
  30. package/browser/payments/p2pk.d.ts +2 -0
  31. package/browser/payments/p2pkh.d.ts +2 -0
  32. package/browser/payments/p2sh.d.ts +2 -0
  33. package/browser/payments/p2tr.d.ts +2 -0
  34. package/browser/payments/p2wpkh.d.ts +2 -0
  35. package/browser/payments/p2wsh.d.ts +2 -0
  36. package/browser/psbt/bip371.d.ts +16 -0
  37. package/browser/psbt/psbtutils.d.ts +26 -0
  38. package/{src → browser}/psbt.d.ts +167 -238
  39. package/browser/push_data.d.ts +7 -0
  40. package/browser/script.d.ts +17 -0
  41. package/browser/script_number.d.ts +2 -0
  42. package/browser/script_signature.d.ts +7 -0
  43. package/{src → browser}/transaction.d.ts +48 -60
  44. package/{src → browser}/types.d.ts +37 -54
  45. package/build/address.d.ts +16 -0
  46. package/build/address.js +148 -0
  47. package/build/bip66.d.ts +6 -0
  48. package/build/bip66.js +99 -0
  49. package/build/block.d.ts +29 -0
  50. package/build/block.js +181 -0
  51. package/build/bufferutils.d.ts +34 -0
  52. package/build/bufferutils.js +141 -0
  53. package/build/crypto/crypto.d.ts +1 -0
  54. package/build/crypto/crypto.js +1 -0
  55. package/build/crypto.d.ts +13 -0
  56. package/build/crypto.js +87 -0
  57. package/build/ecc_lib.d.ts +3 -0
  58. package/build/ecc_lib.js +61 -0
  59. package/build/hooks/AdvancedSignatureManager.d.ts +16 -0
  60. package/build/hooks/AdvancedSignatureManager.js +52 -0
  61. package/build/hooks/HookedSigner.d.ts +4 -0
  62. package/build/hooks/HookedSigner.js +64 -0
  63. package/build/hooks/SignatureManager.d.ts +13 -0
  64. package/build/hooks/SignatureManager.js +45 -0
  65. package/build/index.d.ts +58 -0
  66. package/build/index.js +32 -0
  67. package/build/merkle.d.ts +1 -0
  68. package/build/merkle.js +19 -0
  69. package/build/networks.d.ts +23 -0
  70. package/build/networks.js +121 -0
  71. package/build/ops.d.ts +126 -0
  72. package/{src → build}/ops.js +127 -131
  73. package/build/payments/bip341.d.ts +23 -0
  74. package/build/payments/bip341.js +82 -0
  75. package/build/payments/embed.d.ts +2 -0
  76. package/build/payments/embed.js +39 -0
  77. package/build/payments/index.d.ts +41 -0
  78. package/build/payments/index.js +10 -0
  79. package/build/payments/lazy.d.ts +2 -0
  80. package/{src → build}/payments/lazy.js +28 -32
  81. package/build/payments/p2ms.d.ts +2 -0
  82. package/{src → build}/payments/p2ms.js +128 -158
  83. package/build/payments/p2pk.d.ts +2 -0
  84. package/build/payments/p2pk.js +68 -0
  85. package/build/payments/p2pkh.d.ts +2 -0
  86. package/build/payments/p2pkh.js +135 -0
  87. package/build/payments/p2sh.d.ts +2 -0
  88. package/build/payments/p2sh.js +175 -0
  89. package/build/payments/p2tr.d.ts +2 -0
  90. package/build/payments/p2tr.js +254 -0
  91. package/build/payments/p2wpkh.d.ts +2 -0
  92. package/build/payments/p2wpkh.js +130 -0
  93. package/build/payments/p2wsh.d.ts +2 -0
  94. package/build/payments/p2wsh.js +180 -0
  95. package/build/psbt/bip371.d.ts +16 -0
  96. package/build/psbt/bip371.js +246 -0
  97. package/build/psbt/psbtutils.d.ts +26 -0
  98. package/build/psbt/psbtutils.js +170 -0
  99. package/build/psbt.d.ts +167 -0
  100. package/build/psbt.js +1305 -0
  101. package/build/push_data.d.ts +7 -0
  102. package/build/push_data.js +57 -0
  103. package/build/script.d.ts +17 -0
  104. package/build/script.js +167 -0
  105. package/build/script_number.d.ts +2 -0
  106. package/build/script_number.js +49 -0
  107. package/build/script_signature.d.ts +7 -0
  108. package/build/script_signature.js +49 -0
  109. package/build/transaction.d.ts +48 -0
  110. package/build/transaction.js +445 -0
  111. package/build/types.d.ts +37 -0
  112. package/build/types.js +73 -0
  113. package/cjs/package.json +3 -0
  114. package/eslint.config.js +56 -0
  115. package/gulpfile.js +42 -0
  116. package/package.json +105 -50
  117. package/src/{address.js → address.ts} +93 -73
  118. package/src/{bip66.js → bip66.ts} +23 -19
  119. package/src/{block.js → block.ts} +114 -105
  120. package/src/{bufferutils.js → bufferutils.ts} +65 -67
  121. package/src/crypto/crypto-browser.js +75 -0
  122. package/src/crypto/crypto.ts +1 -0
  123. package/src/crypto.ts +108 -0
  124. package/src/{ecc_lib.js → ecc_lib.ts} +25 -53
  125. package/src/hooks/{AdvancedSignatureManager.js → AdvancedSignatureManager.ts} +34 -18
  126. package/src/hooks/HookedSigner.ts +108 -0
  127. package/src/hooks/{SignatureManager.js → SignatureManager.ts} +26 -14
  128. package/src/index.ts +86 -0
  129. package/src/{merkle.js → merkle.ts} +8 -7
  130. package/src/{networks.js → networks.ts} +44 -29
  131. package/src/ops.ts +282 -0
  132. package/src/payments/bip341.ts +140 -0
  133. package/src/payments/embed.ts +55 -0
  134. package/src/payments/{index.d.ts → index.ts} +20 -10
  135. package/src/payments/lazy.ts +28 -0
  136. package/src/payments/p2ms.ts +150 -0
  137. package/src/payments/{p2pk.js → p2pk.ts} +32 -29
  138. package/src/payments/{p2pkh.js → p2pkh.ts} +53 -47
  139. package/src/payments/{p2sh.js → p2sh.ts} +72 -71
  140. package/src/payments/{p2tr.js → p2tr.ts} +114 -125
  141. package/src/payments/{p2wpkh.js → p2wpkh.ts} +51 -56
  142. package/src/payments/{p2wsh.js → p2wsh.ts} +69 -81
  143. package/src/psbt/{bip371.js → bip371.ts} +191 -174
  144. package/src/psbt/psbtutils.ts +299 -0
  145. package/src/{psbt.js → psbt.ts} +1025 -679
  146. package/src/{push_data.js → push_data.ts} +35 -21
  147. package/src/{script.js → script.ts} +93 -77
  148. package/src/{script_number.js → script_number.ts} +15 -21
  149. package/src/{script_signature.js → script_signature.ts} +26 -14
  150. package/src/{transaction.js → transaction.ts} +247 -167
  151. package/src/types.ts +122 -0
  152. package/test/address.spec.js +124 -0
  153. package/test/address.spec.ts +177 -0
  154. package/test/bitcoin.core.spec.js +170 -0
  155. package/test/bitcoin.core.spec.ts +234 -0
  156. package/test/block.spec.js +141 -0
  157. package/test/block.spec.ts +194 -0
  158. package/test/bufferutils.spec.js +427 -0
  159. package/test/bufferutils.spec.ts +513 -0
  160. package/test/crypto.spec.js +41 -0
  161. package/test/crypto.spec.ts +55 -0
  162. package/test/fixtures/address.json +329 -0
  163. package/test/fixtures/block.json +148 -0
  164. package/test/fixtures/bufferutils.json +102 -0
  165. package/test/fixtures/core/README.md +26 -0
  166. package/test/fixtures/core/base58_encode_decode.json +50 -0
  167. package/test/fixtures/core/base58_keys_invalid.json +152 -0
  168. package/test/fixtures/core/base58_keys_valid.json +452 -0
  169. package/test/fixtures/core/blocks.json +27 -0
  170. package/test/fixtures/core/sig_canonical.json +7 -0
  171. package/test/fixtures/core/sig_noncanonical.json +33 -0
  172. package/test/fixtures/core/sighash.json +3505 -0
  173. package/test/fixtures/core/tx_valid.json +2023 -0
  174. package/test/fixtures/crypto.json +43 -0
  175. package/test/fixtures/ecdsa.json +217 -0
  176. package/test/fixtures/ecpair.json +141 -0
  177. package/test/fixtures/embed.json +108 -0
  178. package/test/fixtures/p2ms.json +434 -0
  179. package/test/fixtures/p2pk.json +179 -0
  180. package/test/fixtures/p2pkh.json +276 -0
  181. package/test/fixtures/p2sh.json +508 -0
  182. package/test/fixtures/p2tr.json +1198 -0
  183. package/test/fixtures/p2wpkh.json +290 -0
  184. package/test/fixtures/p2wsh.json +489 -0
  185. package/test/fixtures/psbt.json +924 -0
  186. package/test/fixtures/script.json +465 -0
  187. package/test/fixtures/script_number.json +225 -0
  188. package/test/fixtures/signature.json +140 -0
  189. package/test/fixtures/transaction.json +916 -0
  190. package/test/integration/_regtest.js +7 -0
  191. package/test/integration/_regtest.ts +6 -0
  192. package/test/integration/addresses.spec.js +116 -0
  193. package/test/integration/addresses.spec.ts +154 -0
  194. package/test/integration/bip32.spec.js +85 -0
  195. package/test/integration/bip32.spec.ts +151 -0
  196. package/test/integration/blocks.spec.js +26 -0
  197. package/test/integration/blocks.spec.ts +28 -0
  198. package/test/integration/cltv.spec.js +199 -0
  199. package/test/integration/cltv.spec.ts +283 -0
  200. package/test/integration/csv.spec.js +362 -0
  201. package/test/integration/csv.spec.ts +527 -0
  202. package/test/integration/payments.spec.js +98 -0
  203. package/test/integration/payments.spec.ts +135 -0
  204. package/test/integration/taproot.spec.js +532 -0
  205. package/test/integration/taproot.spec.ts +707 -0
  206. package/test/integration/transactions.spec.js +561 -0
  207. package/test/integration/transactions.spec.ts +769 -0
  208. package/test/payments.spec.js +97 -0
  209. package/test/payments.spec.ts +125 -0
  210. package/test/payments.utils.js +190 -0
  211. package/test/payments.utils.ts +208 -0
  212. package/test/psbt.spec.js +1044 -0
  213. package/test/psbt.spec.ts +1414 -0
  214. package/test/script.spec.js +151 -0
  215. package/test/script.spec.ts +210 -0
  216. package/test/script_number.spec.js +24 -0
  217. package/test/script_number.spec.ts +29 -0
  218. package/test/script_signature.spec.js +52 -0
  219. package/test/script_signature.spec.ts +66 -0
  220. package/test/transaction.spec.js +269 -0
  221. package/test/transaction.spec.ts +387 -0
  222. package/test/ts-node-register.js +5 -0
  223. package/test/tsconfig.json +45 -0
  224. package/test/types.spec.js +46 -0
  225. package/test/types.spec.ts +58 -0
  226. package/tsconfig.base.json +27 -0
  227. package/tsconfig.json +19 -0
  228. package/tsconfig.webpack.json +18 -0
  229. package/webpack.config.js +79 -0
  230. package/src/address.d.ts +0 -42
  231. package/src/crypto.js +0 -128
  232. package/src/ecc_lib.d.ts +0 -17
  233. package/src/hooks/AdvancedSignatureManager.d.ts +0 -44
  234. package/src/hooks/HookedSigner.js +0 -90
  235. package/src/hooks/SignatureManager.d.ts +0 -35
  236. package/src/index.d.ts +0 -42
  237. package/src/index.js +0 -87
  238. package/src/merkle.d.ts +0 -10
  239. package/src/networks.d.ts +0 -83
  240. package/src/payments/bip341.d.ts +0 -49
  241. package/src/payments/bip341.js +0 -124
  242. package/src/payments/embed.d.ts +0 -9
  243. package/src/payments/embed.js +0 -54
  244. package/src/payments/index.js +0 -69
  245. package/src/payments/p2ms.d.ts +0 -9
  246. package/src/payments/p2pk.d.ts +0 -10
  247. package/src/payments/p2pkh.d.ts +0 -10
  248. package/src/payments/p2sh.d.ts +0 -10
  249. package/src/payments/p2tr.d.ts +0 -10
  250. package/src/payments/p2wpkh.d.ts +0 -10
  251. package/src/payments/p2wsh.d.ts +0 -10
  252. package/src/psbt/bip371.d.ts +0 -42
  253. package/src/psbt/psbtutils.d.ts +0 -64
  254. package/src/psbt/psbtutils.js +0 -191
  255. package/src/push_data.d.ts +0 -29
  256. package/src/script.d.ts +0 -42
  257. package/src/script_number.d.ts +0 -19
  258. package/src/script_signature.d.ts +0 -21
  259. package/src/types.js +0 -106
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":78344,"argv":["C:\\Program Files\\nodejs\\node.exe","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\node_modules\\mocha\\bin\\mocha.js"],"execArgv":[],"cwd":"C:\\Users\\felix\\Desktop\\moto\\bitcoin","time":1735543317036,"ppid":66896,"coverageFilename":"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\.nyc_output\\6368a5b2-daa5-4821-8ed0-b742d6fc7eab.json","externalId":"","uuid":"6368a5b2-daa5-4821-8ed0-b742d6fc7eab","files":["C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\address.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\networks.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\index.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\embed.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\script.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\bip66.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\ops.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\push_data.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\script_number.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\script_signature.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\types.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\lazy.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2ms.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2pk.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2pkh.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\crypto.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2sh.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2wpkh.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2wsh.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2tr.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\ecc_lib.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\bip341.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\bufferutils.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\index.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\block.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\merkle.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\transaction.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\psbt.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\psbt\\bip371.js","C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\psbt\\psbtutils.js"]}
@@ -0,0 +1 @@
1
+ {"processes":{"6368a5b2-daa5-4821-8ed0-b742d6fc7eab":{"parent":null,"children":[]}},"files":{"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\address.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\networks.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\index.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\embed.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\script.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\bip66.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\ops.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\push_data.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\script_number.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\script_signature.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\types.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\lazy.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2ms.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2pk.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2pkh.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\crypto.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2sh.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2wpkh.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2wsh.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\p2tr.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\ecc_lib.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\payments\\bip341.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\bufferutils.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\index.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\block.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\merkle.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\transaction.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\psbt.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\psbt\\bip371.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"],"C:\\Users\\felix\\Desktop\\moto\\bitcoin\\src\\psbt\\psbtutils.js":["6368a5b2-daa5-4821-8ed0-b742d6fc7eab"]},"externalIds":{}}
@@ -0,0 +1,12 @@
1
+ {
2
+ "printWidth": 100,
3
+ "trailingComma": "all",
4
+ "tabWidth": 4,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "quoteProps": "as-needed",
8
+ "bracketSpacing": true,
9
+ "bracketSameLine": true,
10
+ "arrowParens": "always",
11
+ "singleAttributePerLine": true
12
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,403 @@
1
+ # 6.1.6
2
+ __fixed__
3
+ - Fix sighash treatment when signing taproot script sign scripts using Psbt (#2104)
4
+ - Fix error for invalid scripts in toASM (#2097)
5
+ - Fix mutation of input to addOutput method on Psbt (#2091)
6
+
7
+ # 6.1.5
8
+ __fixed__
9
+ - Updated bip174 dependency to fix issue with unknownKeyVals. (#1979)
10
+
11
+ # 6.1.4
12
+ __changed__
13
+ - Changed internal usage of the Buffer API to match with newer broken bundlers that don't follow spec. The new usage is still compatible with older versions of Buffer, so there shouldn't be any breakage. The public API interface was not changed. (#1975)
14
+
15
+ # 6.1.3
16
+ __fixed__
17
+ - validateSignaturesOfInput for taproot inputs returned false for valid signatures in specific cases. (#1934)
18
+
19
+ # 6.1.2
20
+ __fixed__
21
+ - validateSignaturesOfInput for taproot inputs returned true for invalid signatures in specific cases. (#1932)
22
+
23
+ # 6.1.1
24
+ __added__
25
+ - add example using BIP86 vector to verify the sending to and from a BIP86 generated taproot address
26
+
27
+ __fixed__
28
+ - support for 65 byte taproot signature
29
+ - prevent the creation of unspendable scripts in bitcoinjs-lib by implementing checks for resource limitations
30
+ - use `Buffer.from()` instead of `Buffer.of()`
31
+
32
+ __changed__
33
+ - performance: precompute the taproot hashes
34
+ - performance: switch from `create-hash` and `ripemd160` to noble-hashes
35
+
36
+ __removed__
37
+ - types: removed unused methods `privateAdd` and `privateNegate` from `TinySecp256k1Interface`
38
+
39
+ # 6.1.0
40
+ __added__
41
+ - taproot support for payments (p2tr) and PSBT. See taproot.spec.ts integration test for examples. (#1742)
42
+
43
+ # 6.0.2
44
+ __fixed__
45
+ - p2sh payment now uses empty Buffer for redeem.output when redeemScript is OP_FALSE (#1802)
46
+ - Fix ripemd160 hashing fallback issue (#1812)
47
+
48
+ # 6.0.1
49
+ - No changes to public API
50
+
51
+ # 6.0.0
52
+ __removed__
53
+ - bip32: Removed the re-export. Please add as dependency to your app instead.
54
+ - ECPair: Please use bip32 moving forward. ecpair package was created for those who need it.
55
+ - TransactionBuilder: Any internal files used only in TB (classify, templates, etc.) were also removed.
56
+
57
+ __added__
58
+ - taproot segwit v1 address support (bech32m) via address module (#1676)
59
+ - hashForWitnessV1 method on Transaction class (#1745)
60
+
61
+ __fixed__
62
+ - Transaction version read/write differed. (#1717)
63
+
64
+ # 5.2.0
65
+ __changed__
66
+ - Updated PSBT to allow for witnessUtxo and nonWitnessUtxo simultaneously (Re: segwit psbt bug) (#1563)
67
+
68
+ __added__
69
+ - PSBT methods `getInputType`, `inputHasPubkey`, `inputHasHDKey`, `outputHasPubkey`, `outputHasHDKey` (#1563)
70
+
71
+ # 5.1.10
72
+ __fixed__
73
+ - Fixed psbt.signInputAsync (and consequentially all Async signing methods) not handling rejection of keypair.sign properly (#1582)
74
+
75
+ # 5.1.9
76
+ __fixed__
77
+ - Fixed errors for psbt.txOutputs getter (#1578)
78
+
79
+ # 5.1.8
80
+ __fixed__
81
+ - Throw errors when p2wsh or p2wpkh contain uncompressed pubkeys (#1573)
82
+
83
+ __added__
84
+ - Add txInputs and txOutputs for Psbt (#1561)
85
+
86
+ __changed__
87
+ - (Not exposed) Added BufferWriter to help ease maintenance of certain forks of this library (#1533)
88
+
89
+ # 5.1.7
90
+ __fixed__
91
+ - Fixed Transaction class Output interface typing for TypeScript (#1506)
92
+ - Add `weight()` to Block class, add optional includeWitness arg to Transaction byteLength method (#1515)
93
+ - Match the old TransactionBuilder behavior of allowing for multiple instances of the same pubkey to be in a p2ms script for PSBT (#1519)
94
+
95
+ __added__
96
+ - Allow the API consumer to pass in the finalizer functions to allow for any type of transaction to be finalized. It places the most crucial part of transaction construction on the consumer, and should be used with caution. (#1491)
97
+
98
+ # 5.1.6
99
+ __fixed__
100
+ - `PsbtOutputExtended` did not support using the address attribute properly. It is now fixed.
101
+
102
+ # 5.1.5
103
+ __added__
104
+ - `Psbt` now has `getFee(): number` for use when all inputs are finalized. It returns the satoshi fee of the transaction. Calling getFee, getFeeRate, or extractTransaction will cache these values so if you call one after the other, the second call will return immediately.
105
+
106
+ # 5.1.4
107
+ __changed__
108
+ - `Psbt` inputs using segwit scripts can now work with nonWitnessUtxo as well as the original witnessUtxo. The reasoning for this is that nonWitnessUtxo has all the information contained in the witnessUtxo, so rejecting signing even though we have all the info we need is unnecessary. Trying to sign a non-segwit script with a witnessUtxo will still throw an Error as it should.
109
+
110
+ # 5.1.3
111
+ __changed__
112
+ - TypeScript types: Made Signer and SignerAsync use any for network since we only check for equivalence. (#1448)
113
+ - TypeScript types: Made the args for addInput and addOutput for Psbt actually accept updateInput and updateOutput parameters. (#1449)
114
+
115
+ # 5.1.2
116
+ __added__
117
+ - `ECPair` and `bip32` objects now have a lowR boolean attribute defaulted to false. You may set it to true to ensure that the sign method uses low R values (#1442) (This is to enable low R usage in Psbt, since we decided not to give the low R flag to the Psbt class, since it makes more sense to be an attribute of the Signer interface)
118
+
119
+ # 5.1.1
120
+ __changed__
121
+ - Name inconsistencies for Psbt class. (Quick fix)
122
+
123
+ # 5.1.0
124
+ __added__
125
+ - A new `Psbt` class for creating, distributing, combining, signing, and compiling Transactions (#1425)
126
+ - A `name` attribute to the Payment interface. P2SH and P2WSH are nested with `'-'` as separator, and p2ms is in the format of `'p2ms(m of n)''` all others are just hard coded. (#1433)
127
+
128
+ __changed__
129
+ - `TransactionBuilder`: Migrate to stricter type checks during sign by switching to a single object parameter (#1416)
130
+ - `tests`: Use regtest-client as separate library (#1421)
131
+
132
+ # 5.0.5
133
+ __added__
134
+ - Added `ECPairInterface` `Stack` and `StackElement` interfaces to the main index.ts export (TypeScript only affected)
135
+
136
+ # 5.0.4
137
+ __added__
138
+ - low R value support for ECPair, bip32, and TransactionBuilder (default off) via `txb.setLowR()` (#1385)
139
+
140
+ __fixed__
141
+ - Fixed Various TypeScript types that have been pushed out since v5.0.0 (#1388)
142
+
143
+ # 5.0.0
144
+ __added__
145
+ - TypeScript support (#1319)
146
+ - `Block.prototype.checkTxRoots` will check the merkleRoot and witnessCommit if it exists against the transactions array. (e52abec) (0426c66)
147
+
148
+ __changed__
149
+ - `Transaction.prototype.getHash` now has `forWitness?: boolean` which when true returns the hash for wtxid (a652d04)
150
+ - `Block.calculateMerkleRoot` now has `forWitness?: boolean` which when true returns the witness commit (a652d04)
151
+
152
+ __removed__
153
+ - `Block.prototype.checkMerkleRoot` was removed, please use `checkTxRoots` (0426c66)
154
+
155
+ # 4.0.5
156
+ __fixed__
157
+ - Fixed bug where Angular apps break due to lack of crypto at build time. Reverted #1373 and added (6bead5d).
158
+
159
+ # 4.0.4
160
+ __fixed__
161
+ - Fixed bug where Electron v4 breaks due to lack of `'rmd160'` alias for ripemd160 hash. (#1373)
162
+
163
+ # 4.0.3
164
+ __fixed__
165
+ - Fixed `TransactionBuilder` to require that the Transaction has outputs before signing (#1151)
166
+ - Fixed `payments.p2sh`, which now takes the network from the redeem attribute if one is not given in the object argument (#1232)
167
+ - Fixed `Block.calculateTarget` to allow for exponents up to 29 (#1285)
168
+ - Fixed some low priority rarely occurring bugs with multisig payments and `TransactionBuilder` multisig processing (#1307)
169
+
170
+ __added__
171
+ - Regtest network object to `networks` (#1261)
172
+
173
+ # 4.0.2
174
+ __fixed__
175
+ - Fixed `TransactionBuilder` not throwing when payment type validation should fail (#1195)
176
+
177
+ __removed__
178
+ - Removed rogue `package.json` from `src/payments` (#1216)
179
+
180
+ # 4.0.1
181
+ __fixed__
182
+ - Fixed `tiny-secp256k1` dependency version (used `ecurve`) (#1139)
183
+ - Fixed `TransactionBuilder` throwing when trying to sign `P2WSH(P2WPKH)` (#1135)
184
+
185
+ # 4.0.0
186
+ __added__
187
+ - Added [`bip32`](https://github.com/bitcoinjs/bip32) dependency as a primary export (#1073)
188
+ - Added `ECPair.fromPrivateKey` (#1070)
189
+ - Added `payments` export, with support for `p2pkh`, `p2pk`, `p2ms`, `p2sh`, `p2wpkh`, `p2wsh` and `embed` payment types (#1096, #1119)
190
+ - Added `script.signature.encode/decode` for script signatures (#459)
191
+
192
+ __changed__
193
+ - `ECPair.prototype.sign` now returns a 64-byte signature `Buffer`, not an `ECSignature` object (#1084)
194
+ - `ECPair` (and all ECDSA code) now uses [`tiny-secp256k1`](https://github.com/bitcoinjs/tiny-secp256k1), which uses the [`libsecp256k1` library](https://github.com/bitcoin-core/secp256k1) (#1070)
195
+ - `TransactionBuilder` internal variables are now `__` prefixed to discourage public usage (#1038)
196
+ - `TransactionBuilder` now defaults to version 2 transaction versions (#1036)
197
+ - `script.decompile` now returns `[Buffer]` or `null`, if decompilation failed (#1039)
198
+
199
+ __fixed__
200
+ - Fixed `TransactionBuilder` rejecting uncompressed public keys to comply with BIP143 (#987)
201
+
202
+ __removed__
203
+ - Removed Node 4/5 LTS support (#1080)
204
+ - Removed `ECPair.fromPublicKeyBuffer`, use `ECPair.fromPublicKey` (#1070)
205
+ - Removed `ECPair.prototype.getAddress`, use `payments.p2pkh` instead (#1085)
206
+ - Removed `ECPair.prototype.getPrivateKey`, use `ECPair.prototype.privateKey` property (#1070)
207
+ - Removed `ECPair.prototype.getPublicKey`, use `ECPair.prototype.publicKey` property (#1070)
208
+ - Removed `ECPair.prototype.getNetwork`, use `ECPair.prototype.network` property (#1070)
209
+ - Removed `ECSignature`, use `script.signature.encode/decode` instead (#459)
210
+ - Removed `HDNode`, use `bip32` export instead (#1073)
211
+ - Removed `bufferutils` (#1035)
212
+ - Removed `networks.litecoin`, BYO non-Bitcoin networks instead (#1095)
213
+ - Removed `script.isCanonicalSignature`, use `script.isCanonicalScriptSignature` instead (#1094)
214
+ - Removed `script.*.input/output/check` functions (`templates`), use `payments.*` instead (`templates` previously added in #681, #682) (#1119)
215
+ - Removed dependency `bigi`, uses `bn.js` internally now (via `tiny-secp256k1`) (#1070, #1112)
216
+ - Removed public access to `ECPair` constructor, use exported functions `ECPair.fromPrivateKey`, `ECPair.fromWIF`, `ECPair.makeRandom`, or `ECPair.fromPublicKey` (#1070)
217
+
218
+ # 3.3.2
219
+ __fixed__
220
+ - Fixed `decodeStack` arbitrarily supporting non-Array arguments (#942)
221
+
222
+ # 3.3.1
223
+ __changed__
224
+ - Increased the `TransactionBuilder` `maximumFeeRate` from 1000 to 2500 satoshis/byte. (#931)
225
+
226
+ # 3.3.0
227
+ __added__
228
+ - Added `ECSignature.prototype.toRSBuffer`/`ECSignature.fromRSBuffer` (#915)
229
+ - Added support to `TransactionBuilder` for 64-byte signatures via `.sign` (#915)
230
+ - Added support to `TransactionBuilder` for the `.publicKey` standard as an alternative to `.getPublicKey()` (#915)
231
+
232
+ # 3.2.1
233
+ __fixed__
234
+ - Fixed `script.scripthash.input.check` recursion (#898)
235
+ - Fixed `TransactionBuilder` sometimes ignoring witness value (#901)
236
+ - Fixed `script.witnessScriptHash.input` implementation (previously used the P2SH impl.) (#911)
237
+
238
+ # 3.2.0
239
+ __added__
240
+ - Added `address.fromBech32/toBech32` (#846)
241
+
242
+ # 3.1.0
243
+ __added__
244
+ - Added `Transaction.prototype.virtualSize` (#811)
245
+ - Added `Transaction.prototype.weight` (#811)
246
+
247
+ # 3.0.0
248
+ From this release users can expect out-of-the-box Segregated Witness support.
249
+ The majority of breaking changes have been in how `script` encoding/decoding occurs, with the introduction of witness stacks.
250
+
251
+ __added__
252
+ - Added `script.types` enums (#679)
253
+ - Added `script.*.*.{check,encode,decode[,encodeStack,decodeStack]}` functions (#681, #682)
254
+ - Added minimal `TransactionBuilder.prototype.build` absurd fee-safety (#696)
255
+ - Added `script.(decompile/compile)PushOnly` and `script.toStack` functions (#700)
256
+ - Added `Transaction.prototype.toBuffer` Segregated Witness serialization support (#684, #701)
257
+ - Added `Transaction.prototype.hasWitnesses` (#718)
258
+ - Added `script.witnessCommitment.*` template
259
+ - Added `TransactionBuilder.prototype.sign` now has two additional parameters, `witnessValue`, and `witnessScript`
260
+ - Added `Transaction.hashForWitnessV0` and `Transaction.setWitness` (5c2fdb60436714f18440dc709f0be065928c1e49)
261
+
262
+ __fixed__
263
+ - Fixed `script` must compile minimally (#638)
264
+ - Fixed `Transaction` and `Block` versions should be Int32, signed integers (#662)
265
+
266
+ __removed__
267
+ - Removed `ecdsa.calcPubKeyRecoveryParam`, `ecdsa.recoverPubKey` (#456)
268
+ - Removed `buffer-equals`/`buffer-compare` dependencies (#650)
269
+ - Removed `HDNode.prototype.toString` (#665)
270
+ - Removed `dogecoin` network (#675)
271
+ - Removed `message` export, moved to [`bitcoinjs-message`](https://github.com/bitcoinjs/bitcoinjs-message) (#456)
272
+
273
+ __renamed__
274
+ - Removed `script.*` functions in favour of `bitcoin.script.*.(input/output).(encode/decode/check)` style (#682)
275
+
276
+ # 2.3.0
277
+ __added__
278
+ - Added `HDNode.prototype.isNeutered` (#536)
279
+ - Added `HDNode.prototype.derivePath` (#538)
280
+ - Added typeforce checking for `HDNode.prototype.derive*` (#539)
281
+ - Added `Transaction.prototype.isCoinbase` (#578)
282
+ - Added `Block.prototype.checkMerkleRoot` (#580)
283
+ - Added `Block.calculateMerkleRoot` (#580)
284
+ - Added `TransactionBuilder.prototype.setVersion` (#599)
285
+ - Added `script.isWitnessPubKeyHashOutput` (#602)
286
+ - Added `script.isWitnessScriptHashOutput` (#602)
287
+ - Added `script.witnessPubKeyHashOutput` (#602)
288
+ - Added `script.witnessScriptHashOutput` (#602)
289
+ - Added `script.witnessScriptHashInput` (#602)
290
+
291
+ __fixed__
292
+ - Fixed "BIP32 is undefined" when network list given to `HDNode` but no compatible version found (#550)
293
+ - Fixed `writePushDataInt` output to adhere to minimal data push policy (#617)
294
+
295
+
296
+ # 2.2.0
297
+ __added__
298
+ - Added `Block.calculateTarget` for difficulty calculations (#509)
299
+ - Added `Block.prototype.checkProofOfWork` (#509)
300
+ - Added `opcodes.OP_CHECKLOCKTIMEVERIFY` alias for `OP_NOP2` (#511)
301
+ - Added `script.number.[encode/decode]` for CScriptNum-encoded `Buffer`s (#516)
302
+ - Added `TransactionBuilder.prototype.setLockTime` (#507)
303
+
304
+ __fixed__
305
+ - Bumped `typeforce` version to fix erroneous error message from `types.Hash*bit` types (#534)
306
+
307
+
308
+ # 2.1.4
309
+ __fixed__
310
+ - script.isPubKeyHashOutput and script.isScriptHashOutput no longer allow for non-minimal data pushes (per bitcoin/bitcoin `IsStandard` policy) (#499)
311
+ - TransactionBuilder.addOutput now allows for SIGHASH_SINGLE, throwing if the contract is violated (#504)
312
+ - remove use of `const`, use ES5 only (#502)
313
+
314
+
315
+ # 2.1.3
316
+ __fixed__
317
+ - Bumped typeforce to 1.5.5 (see #493)
318
+
319
+
320
+ # 2.1.2
321
+ __fixed__
322
+ - Add missing CHANGELOG entry for 2.1.1
323
+
324
+
325
+ # 2.1.1
326
+ __changed__
327
+ - removed use of `buffer-reverse`, dependency only kept for `bufferutils.reverse`, to be deprecated (#478)
328
+
329
+ __fixed__
330
+ - `isMultisigOutput` no longer allows data chunks for `m`/`n` (#482)
331
+ - `isMultisigOutput`'s `n` value must now match the number of public keys (as per bitcoin/bitcoin) (#484)
332
+
333
+
334
+ # 2.1.0
335
+ From this release users should use the HDNode directly (compared to accessing `.keyPair`) when performing ECDSA operations such as `sign` or `verify`.
336
+ Ideally you shoud not have to directly access `HDNode` internals for general usage, as it can often be confusing and error prone.
337
+
338
+ __added__
339
+ - `ECPair.prototype.getNetwork`
340
+ - `HDNode.prototype.getNetwork`, wraps the underlying keyPair's `getNetwork` method
341
+ - `HDNode.prototype.getPublicKeyBuffer`, wraps the underlying keyPair's `getPublicKeyBuffer` method
342
+ - `HDNode.prototype.sign`, wraps the underlying keyPair's `sign` method
343
+ - `HDNode.prototype.verify`, wraps the underlying keyPair's `verify` method
344
+
345
+
346
+ # 2.0.0
347
+ In this release we have strived to simplify the API, [using native types](https://github.com/bitcoinjs/bitcoinjs-lib/issues/407) wherevever possible to encourage cross-compatibility with other open source community modules.
348
+
349
+ The `ecdsa` module has been removed in lieu of using a new ECDSA module (for performance and safety reasons) during the `2.x.y` major release.
350
+ Several other cumbersome modules have been removed, with their new independent modules recommended for usage instead for greater modularity in your projects.
351
+
352
+ -----------------------------
353
+
354
+ Backward incompatible changes:
355
+
356
+ __added__
357
+ - export `address`, for `address` based [utility functions](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/address.js), most compatible, just without `Address` instantiation, see #401, #444
358
+ - export `script`, for `script` based [utility functions](https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/script.js), mostly compatible, just without `Script` instantiation, see #438, #444
359
+ - export `ECPair`, a merged replacement for `ECKey`/`ECPubKey`, invalid types will throw via `typeforce`
360
+
361
+ __changed__
362
+ - `address.toOutputScript`, `ECPair.prototype.fromWIF` and `HDNode.prototype.fromBase58` no longer automatically detect the network, `networks.bitcoin` is always assumed unless given.
363
+ - `assert` was used for type checking, now replaced by `typeforce`
364
+ - `BIP66` compliant strict DER signature validation was added to `ECSignature.fromDER`, changing the exact exception messages slightly, see #448.
365
+
366
+ - `new HDNode(d/Q, chainCode, network)` -> `new HDNode(keyPair, chainCode)`, now uses `ECPair`
367
+ - `HDNode.prototype.toBase58(false)` -> `HDNode.prototype.neutered().toBase58()` for exporting an extended public key
368
+ - `HDNode.prototype.toBase58(true)` -> `HDNode.prototype.toBase58()` for exporting an extended private key
369
+
370
+ - `Transaction.prototype.hashForSignature(prevOutScript, inIndex, hashType)` -> `Transaction.prototype.hashForSignature(inIndex, prevOutScript, hashType)`
371
+ - `Transaction.prototype.addInput(hash, ...)`: `hash` could be a string, Transaction or Buffer -> `hash` can now **only** be a `Buffer`.
372
+ - `Transaction.prototype.addOutput(scriptPubKey, ...)`: `scriptPubKey ` could be a string, `Address` or a `Buffer` -> `scriptPubKey` can now **only** be a `Buffer`.
373
+ - `TransactionBuilder` API unchanged.
374
+
375
+ __removed__
376
+ - export `Address`, `strings` are now used, benchwith no performance loss for most use cases
377
+ - export `base58check`, use [`bs58check`](https://github.com/bitcoinjs/bs58check) instead
378
+ - export `ecdsa`, use [`ecurve`](https://github.com/cryptocoinjs/ecurve) instead
379
+ - export `ECKey`, use new export `ECPair` instead
380
+ - export `ECPubKey`, use new export `ECPair` instead
381
+ - export `Wallet`, see README.md#complementing-libraries instead
382
+ - export `Script`, use new utility export `script` instead (#438 for more information)
383
+
384
+ - `crypto.HmacSHA256 `, use [node crypto](https://nodejs.org/api/crypto.html) instead
385
+ - `crypto.HmacSHA512 `, use [node crypto](https://nodejs.org/api/crypto.html) instead
386
+
387
+ - `Transaction.prototype.sign`, use `TransactionBuilder.prototype.sign`
388
+ - `Transaction.prototype.signInput`, use `TransactionBuilder.prototype.sign`
389
+ - `Transaction.prototype.validateInput`, use `Transaction.prototype.hashForSignature` and `ECPair.verify`
390
+
391
+ - `HDNode.fromBuffer`, use `HDNode.fromBase58` instead
392
+ - `HDNode.fromHex`, use `HDNode.fromBase58` instead
393
+ - `HDNode.toBuffer`, use `HDNode.prototype.toBase58` instead
394
+ - `HDNode.toHex`, use `HDNode.prototype.toBase58` instead
395
+
396
+ - `networks.*.magic`, see the comment [here](https://github.com/bitcoinjs/bitcoinjs-lib/pull/432/files#r36715792)
397
+ - `networks.[viacoin|viacointestnet|gamerscoin|jumbucks|zetacoin]`, import these yourself (see #383/a0e6ee7)
398
+ - `networks.*.estimateFee`, out-dated
399
+
400
+ __renamed__
401
+ - `Message` -> `message`
402
+ - `scripts` -> `script`
403
+ - `scripts.dataOutput ` -> `script.nullDataOutput` (per [convention](https://org/en/glossary/null-data-transaction))
@@ -0,0 +1,83 @@
1
+
2
+ [//]: # (This is partially derived from https://github.com/bitcoin/bitcoin/blob/6579d80572d2d33aceabbd3db45a6a9f809aa5e3/CONTRIBUTING.md)
3
+
4
+ # Contributing to bitcoinjs-lib
5
+ Firstly in terms of structure, there is no particular concept of "bitcoinjs developers" in a sense of privileged people.
6
+ Open source revolves around a meritocracy where contributors who help gain trust from the community.
7
+
8
+ For practical purpose, there are repository "maintainers" who are responsible for merging pull requests.
9
+
10
+ We are always accepting of pull requests, but we do adhere to specific standards in regards to coding style, test driven development and commit messages.
11
+
12
+
13
+ ## Communication Channels
14
+ GitHub is the preferred method of communication between members.
15
+
16
+ Otherwise, in order of preference:
17
+ * #bitcoinjs-dev:matrix.org on Matrix (A part of the #bitcoinjs-space:matrix.org "Space")
18
+ * #bitcoinjs on libera.chat IRC
19
+
20
+
21
+ ## Workflow
22
+ The codebase is maintained using the "contributor workflow" where everyone without exception contributes patch proposals using "pull requests".
23
+ This facilitates social contribution, easy testing and peer review.
24
+
25
+ To contribute a patch, the workflow is as follows:
26
+
27
+ 1. Fork repository
28
+ 1. Create topic branch
29
+ 1. Commit patches
30
+ 1. Push changes to your fork
31
+ 1. Submit a pull request to https://github.com/bitcoinjs/bitcoinjs-lib
32
+
33
+ [Commits should be atomic](https://en.wikipedia.org/wiki/Atomic_commit#Atomic_commit_convention) and diffs easy to read.
34
+
35
+ If your pull request is accepted for merging, you may be asked by a maintainer to squash and or [rebase](https://git-scm.com/docs/git-rebase) your commits before it is merged.
36
+
37
+ Please refrain from creating several pull requests for the same change.
38
+
39
+ Patchsets should be focused:
40
+
41
+ * Adding a feature, or
42
+ * Fixing a bug, or
43
+ * Refactoring code.
44
+
45
+ If you combine these, the PR may be rejected or asked to be split up.
46
+
47
+ The length of time required for peer review is unpredictable and will vary from pull request to pull request.
48
+
49
+ Refer to the [Git manual](https://git-scm.com/doc) for any information about `git`.
50
+
51
+
52
+ ## Regarding TypeScript
53
+ This library is written in TypeScript with eslint, prettier, and the tsc transpiler. These tools will help during testing to notice improper logic before committing and sending a pull request.
54
+
55
+ Some rules regarding TypeScript:
56
+
57
+ * Modify the typescript source code in an IDE that will give you warnings for transpile/lint errors.
58
+ * Once you are done with the modifications, run `npm run format` then `npm test`
59
+ * Running the tests will transpile the ts files into js and d.ts files.
60
+ * Use `git diff` or other tools to verify that the ts and js are changing the same parts.
61
+ * Commit all changes to ts, js, and d.ts files.
62
+ * Add tests where necessary.
63
+ * Submit your pull request.
64
+
65
+ Using TypeScript is for preventing bugs while writing code, as well as automatically generating type definitions. However, the JS file diffs must be verified, and any unverified JS will not be published to npm.
66
+
67
+
68
+ ## We adhere to Bitcoin-Core policy
69
+ Bitcoin script payment/script templates are based on community consensus, but typically adhere to bitcoin-core node policy by default.
70
+
71
+ - `bitcoinjs.script.decompile` is consensus bound only, it does not reject based on policy.
72
+ - `bitcoinjs.script.compile` will try to adhere to bitcoin-core `IsStandard` policies rules. (eg. minimalpush in https://github.com/bitcoinjs/bitcoinjs-lib/pull/638)
73
+
74
+ Any elliptic curve `sign` operations should adhere to `IsStandard` policies, like `LOW_S`, but `verify` should not reject them [by default].
75
+
76
+ If you need non-standard rejecting `decoding`, you should use an external module, not this library.
77
+
78
+ #### TLDR
79
+ Where "standards compliant" refers to the default policies of bitcoin-core, we adhere to the following:
80
+ - Any "creation" event must create standards-compliant data (standards bound)
81
+ - Any "validation" event must allow for non-standards compliant data (consensus bound)
82
+
83
+ For stricter validation, use an external module which we [may have] provided.
@@ -0,0 +1,16 @@
1
+ import { Network } from './networks.js';
2
+ export interface Base58CheckResult {
3
+ hash: Buffer;
4
+ version: number;
5
+ }
6
+ export interface Bech32Result {
7
+ version: number;
8
+ prefix: string;
9
+ data: Buffer;
10
+ }
11
+ export declare function fromBase58Check(address: string): Base58CheckResult;
12
+ export declare function fromBech32(address: string): Bech32Result;
13
+ export declare function toBase58Check(hash: Buffer, version: number): string;
14
+ export declare function toBech32(data: Buffer, version: number, prefix: string): string;
15
+ export declare function fromOutputScript(output: Buffer, network?: Network): string;
16
+ export declare function toOutputScript(address: string, network?: Network): Buffer;
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
- export declare function check(buffer: Buffer): boolean;
3
- export declare function decode(buffer: Buffer): {
4
- r: Buffer;
5
- s: Buffer;
6
- };
7
- export declare function encode(r: Buffer, s: Buffer): Buffer;
1
+ export declare function check(buffer: Buffer): boolean;
2
+ export declare function decode(buffer: Buffer): {
3
+ r: Buffer;
4
+ s: Buffer;
5
+ };
6
+ export declare function encode(r: Buffer, s: Buffer): Buffer;
@@ -1,30 +1,29 @@
1
- /// <reference types="node" />
2
- import { Transaction } from './transaction';
3
- export declare class Block {
4
- version: number;
5
- prevHash?: Buffer;
6
- merkleRoot?: Buffer;
7
- timestamp: number;
8
- witnessCommit?: Buffer;
9
- bits: number;
10
- nonce: number;
11
- transactions?: Transaction[];
12
- static fromBuffer(buffer: Buffer): Block;
13
- static fromHex(hex: string): Block;
14
- static calculateTarget(bits: number): Buffer;
15
- static calculateMerkleRoot(transactions: Transaction[], forWitness?: boolean): Buffer;
16
- getWitnessCommit(): Buffer | null;
17
- hasWitnessCommit(): boolean;
18
- hasWitness(): boolean;
19
- weight(): number;
20
- byteLength(headersOnly?: boolean, allowWitness?: boolean): number;
21
- getHash(): Buffer;
22
- getId(): string;
23
- getUTCDate(): Date;
24
- toBuffer(headersOnly?: boolean): Buffer;
25
- toHex(headersOnly?: boolean): string;
26
- checkTxRoots(): boolean;
27
- checkProofOfWork(): boolean;
28
- private __checkMerkleRoot;
29
- private __checkWitnessCommit;
30
- }
1
+ import { Transaction } from './transaction.js';
2
+ export declare class Block {
3
+ version: number;
4
+ prevHash?: Buffer;
5
+ merkleRoot?: Buffer;
6
+ timestamp: number;
7
+ witnessCommit?: Buffer;
8
+ bits: number;
9
+ nonce: number;
10
+ transactions?: Transaction[];
11
+ static fromBuffer(buffer: Buffer): Block;
12
+ static fromHex(hex: string): Block;
13
+ static calculateTarget(bits: number): Buffer;
14
+ static calculateMerkleRoot(transactions: Transaction[], forWitness?: boolean): Buffer;
15
+ getWitnessCommit(): Buffer | null;
16
+ hasWitnessCommit(): boolean;
17
+ hasWitness(): boolean;
18
+ weight(): number;
19
+ byteLength(headersOnly?: boolean, allowWitness?: boolean): number;
20
+ getHash(): Buffer;
21
+ getId(): string;
22
+ getUTCDate(): Date;
23
+ toBuffer(headersOnly?: boolean): Buffer;
24
+ toHex(headersOnly?: boolean): string;
25
+ checkTxRoots(): boolean;
26
+ checkProofOfWork(): boolean;
27
+ private __checkMerkleRoot;
28
+ private __checkWitnessCommit;
29
+ }