@opcat-labs/scrypt-ts-opcat 1.0.0 → 1.0.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 (379) hide show
  1. package/README.md +214 -0
  2. package/assets/.templates/smart-contract/builtin-libs/TxHashPreimageUtils.scrypt.map +1 -1
  3. package/assets/.templates/smart-contract/builtin-libs/backtrace.scrypt.map +1 -1
  4. package/assets/.templates/smart-contract/builtin-libs/byteStringReader.scrypt.map +1 -1
  5. package/assets/.templates/smart-contract/builtin-libs/byteStringWriter.scrypt.map +1 -1
  6. package/assets/.templates/smart-contract/builtin-libs/contextUtils.scrypt.map +1 -1
  7. package/assets/.templates/smart-contract/builtin-libs/contextUtils.scrypt.tpl +11 -21
  8. package/assets/.templates/smart-contract/builtin-libs/p2pk.scrypt.map +1 -1
  9. package/assets/.templates/smart-contract/builtin-libs/p2pkh.scrypt.map +1 -1
  10. package/assets/.templates/smart-contract/builtin-libs/stateLib.scrypt.map +1 -1
  11. package/assets/.templates/smart-contract/builtin-libs/stateUtils.scrypt.map +1 -1
  12. package/assets/.templates/smart-contract/builtin-libs/stateUtils.scrypt.tpl +2 -2
  13. package/assets/.templates/smart-contract/builtin-libs/stdUtils.scrypt.map +1 -1
  14. package/assets/.templates/smart-contract/builtin-libs/stdUtils.scrypt.tpl +10 -5
  15. package/assets/.templates/smart-contract/builtin-libs/txUtils.scrypt.map +1 -1
  16. package/assets/.templates/smart-contract/builtin-libs/txUtils.scrypt.tpl +7 -3
  17. package/assets/smart-contract/builtin-libs/TxHashPreimageUtils.scrypt +7 -7
  18. package/assets/smart-contract/builtin-libs/backtrace.scrypt +12 -12
  19. package/assets/smart-contract/builtin-libs/byteStringReader.scrypt +5 -5
  20. package/assets/smart-contract/builtin-libs/byteStringWriter.scrypt +6 -6
  21. package/assets/smart-contract/builtin-libs/contextUtils.scrypt +23 -33
  22. package/assets/smart-contract/builtin-libs/p2pk.scrypt +1 -1
  23. package/assets/smart-contract/builtin-libs/p2pkh.scrypt +1 -1
  24. package/assets/smart-contract/builtin-libs/stateLib.scrypt +1 -1
  25. package/assets/smart-contract/builtin-libs/stateUtils.scrypt +3 -3
  26. package/assets/smart-contract/builtin-libs/stdUtils.scrypt +21 -16
  27. package/assets/smart-contract/builtin-libs/txUtils.scrypt +16 -12
  28. package/assets/smart-contract/types/structs.scrypt +8 -8
  29. package/dist/cjs/features/call.cjs +34 -16
  30. package/dist/cjs/features/call.js.map +1 -1
  31. package/dist/cjs/features/deploy.cjs +22 -8
  32. package/dist/cjs/features/deploy.js.map +1 -1
  33. package/dist/cjs/features/deployGenesis.cjs +59 -0
  34. package/dist/cjs/features/deployGenesis.js.map +1 -0
  35. package/dist/cjs/features/index.cjs +3 -1
  36. package/dist/cjs/features/index.js.map +1 -1
  37. package/dist/cjs/index.cjs +42 -1
  38. package/dist/cjs/index.js.map +1 -1
  39. package/dist/cjs/networks.cjs +7 -30
  40. package/dist/cjs/networks.js.map +1 -1
  41. package/dist/cjs/providers/dummyProvider.cjs +21 -4
  42. package/dist/cjs/providers/dummyProvider.js.map +1 -1
  43. package/dist/cjs/providers/rpcProvider.cjs +1 -1
  44. package/dist/cjs/providers/utxoProvider.cjs +5 -1
  45. package/dist/cjs/providers/utxoProvider.js.map +1 -1
  46. package/dist/cjs/psbt/bufferutils.cjs +7 -2
  47. package/dist/cjs/psbt/bufferutils.js.map +1 -1
  48. package/dist/cjs/psbt/extPsbt.cjs +371 -60
  49. package/dist/cjs/psbt/extPsbt.js.map +1 -1
  50. package/dist/cjs/psbt/psbt.cjs +18 -22
  51. package/dist/cjs/psbt/psbt.js.map +1 -1
  52. package/dist/cjs/psbt/psbtutils.cjs +4 -7
  53. package/dist/cjs/psbt/psbtutils.js.map +1 -1
  54. package/dist/cjs/psbt/signatureutils.cjs +3 -8
  55. package/dist/cjs/psbt/signatureutils.js.map +1 -1
  56. package/dist/cjs/signers/defaultSigner.cjs +29 -3
  57. package/dist/cjs/signers/defaultSigner.js.map +1 -1
  58. package/dist/cjs/signers/unisatSigner.cjs +27 -1
  59. package/dist/cjs/signers/unisatSigner.js.map +1 -1
  60. package/dist/cjs/smart-contract/abi.cjs +123 -3
  61. package/dist/cjs/smart-contract/abi.js.map +1 -1
  62. package/dist/cjs/smart-contract/abstractContract.js.map +1 -1
  63. package/dist/cjs/smart-contract/builtin-libs/backtrace.cjs +9 -0
  64. package/dist/cjs/smart-contract/builtin-libs/backtrace.js.map +1 -1
  65. package/dist/cjs/smart-contract/builtin-libs/byteStringReader.cjs +4 -4
  66. package/dist/cjs/smart-contract/builtin-libs/byteStringReader.js.map +1 -1
  67. package/dist/cjs/smart-contract/builtin-libs/byteStringWriter.cjs +1 -1
  68. package/dist/cjs/smart-contract/builtin-libs/byteStringWriter.js.map +1 -1
  69. package/dist/cjs/smart-contract/builtin-libs/contextUtils.cjs +100 -45
  70. package/dist/cjs/smart-contract/builtin-libs/contextUtils.js.map +1 -1
  71. package/dist/cjs/smart-contract/builtin-libs/p2pk.cjs +9 -0
  72. package/dist/cjs/smart-contract/builtin-libs/p2pk.js.map +1 -1
  73. package/dist/cjs/smart-contract/builtin-libs/p2pkh.cjs +10 -0
  74. package/dist/cjs/smart-contract/builtin-libs/p2pkh.js.map +1 -1
  75. package/dist/cjs/smart-contract/builtin-libs/stateLib.cjs +22 -8
  76. package/dist/cjs/smart-contract/builtin-libs/stateLib.js.map +1 -1
  77. package/dist/cjs/smart-contract/builtin-libs/stateUtils.cjs +7 -4
  78. package/dist/cjs/smart-contract/builtin-libs/stateUtils.js.map +1 -1
  79. package/dist/cjs/smart-contract/builtin-libs/stdUtils.cjs +75 -19
  80. package/dist/cjs/smart-contract/builtin-libs/stdUtils.js.map +1 -1
  81. package/dist/cjs/smart-contract/builtin-libs/txHashPreimageUtils.cjs +27 -0
  82. package/dist/cjs/smart-contract/builtin-libs/txHashPreimageUtils.js.map +1 -1
  83. package/dist/cjs/smart-contract/builtin-libs/txUtils.cjs +23 -8
  84. package/dist/cjs/smart-contract/builtin-libs/txUtils.js.map +1 -1
  85. package/dist/cjs/smart-contract/consts.cjs +1 -11
  86. package/dist/cjs/smart-contract/consts.js.map +1 -1
  87. package/dist/cjs/smart-contract/deserializer.cjs +163 -0
  88. package/dist/cjs/smart-contract/deserializer.js.map +1 -0
  89. package/dist/cjs/smart-contract/fns/assert.cjs +1 -1
  90. package/dist/cjs/smart-contract/fns/bitwise.cjs +5 -5
  91. package/dist/cjs/smart-contract/fns/bitwise.js.map +1 -1
  92. package/dist/cjs/smart-contract/fns/byteString.cjs +8 -5
  93. package/dist/cjs/smart-contract/fns/byteString.js.map +1 -1
  94. package/dist/cjs/smart-contract/fns/equals.cjs +1 -1
  95. package/dist/cjs/smart-contract/fns/exit.cjs +16 -0
  96. package/dist/cjs/smart-contract/fns/exit.js.map +1 -0
  97. package/dist/cjs/smart-contract/fns/fill.cjs +1 -1
  98. package/dist/cjs/smart-contract/fns/index.cjs +3 -1
  99. package/dist/cjs/smart-contract/fns/index.js.map +1 -1
  100. package/dist/cjs/smart-contract/fns/math.cjs +4 -4
  101. package/dist/cjs/smart-contract/methods/backtraceToGenensis.cjs +12 -8
  102. package/dist/cjs/smart-contract/methods/backtraceToGenensis.js.map +1 -1
  103. package/dist/cjs/smart-contract/methods/checkCtx.cjs +10 -9
  104. package/dist/cjs/smart-contract/methods/checkCtx.js.map +1 -1
  105. package/dist/cjs/smart-contract/methods/checkInputState.cjs +1 -0
  106. package/dist/cjs/smart-contract/methods/checkInputState.js.map +1 -1
  107. package/dist/cjs/smart-contract/methods/checkInputStateHashes.cjs +3 -2
  108. package/dist/cjs/smart-contract/methods/checkInputStateHashes.js.map +1 -1
  109. package/dist/cjs/smart-contract/methods/checkSHPreimage.cjs +4 -3
  110. package/dist/cjs/smart-contract/methods/checkSHPreimage.js.map +1 -1
  111. package/dist/cjs/smart-contract/methods/checkSig.cjs +76 -12
  112. package/dist/cjs/smart-contract/methods/checkSig.js.map +1 -1
  113. package/dist/cjs/smart-contract/serializer.cjs +3 -30
  114. package/dist/cjs/smart-contract/serializer.js.map +1 -1
  115. package/dist/cjs/smart-contract/smartContract.cjs +77 -104
  116. package/dist/cjs/smart-contract/smartContract.js.map +1 -1
  117. package/dist/cjs/smart-contract/smartContractLib.cjs +5 -0
  118. package/dist/cjs/smart-contract/smartContractLib.js.map +1 -1
  119. package/dist/cjs/smart-contract/stateSerializer.cjs +21 -4
  120. package/dist/cjs/smart-contract/stateSerializer.js.map +1 -1
  121. package/dist/cjs/smart-contract/types/abi.js.map +1 -1
  122. package/dist/cjs/smart-contract/types/artifact.cjs +5 -1
  123. package/dist/cjs/smart-contract/types/artifact.js.map +1 -1
  124. package/dist/cjs/smart-contract/types/bn.cjs +18 -0
  125. package/dist/cjs/smart-contract/types/bn.js.map +1 -1
  126. package/dist/cjs/smart-contract/types/index.cjs +2 -1
  127. package/dist/cjs/smart-contract/types/index.js.map +1 -1
  128. package/dist/cjs/smart-contract/types/opCode.cjs +1 -1
  129. package/dist/cjs/smart-contract/types/primitives.cjs +17 -9
  130. package/dist/cjs/smart-contract/types/primitives.js.map +1 -1
  131. package/dist/cjs/utils/checkIntegrity.cjs +2 -2
  132. package/dist/cjs/utils/common.cjs +11 -39
  133. package/dist/cjs/utils/common.js.map +1 -1
  134. package/dist/cjs/utils/constants.cjs +3 -0
  135. package/dist/cjs/utils/constants.js.map +1 -1
  136. package/dist/cjs/utils/index.cjs +4 -1
  137. package/dist/cjs/utils/index.js.map +1 -1
  138. package/dist/cjs/utils/proof.cjs +15 -42
  139. package/dist/cjs/utils/proof.js.map +1 -1
  140. package/dist/esm/features/call.js +34 -16
  141. package/dist/esm/features/call.js.map +1 -1
  142. package/dist/esm/features/deploy.js +22 -8
  143. package/dist/esm/features/deploy.js.map +1 -1
  144. package/dist/esm/features/deployGenesis.js +55 -0
  145. package/dist/esm/features/deployGenesis.js.map +1 -0
  146. package/dist/esm/features/index.js +1 -0
  147. package/dist/esm/features/index.js.map +1 -1
  148. package/dist/esm/index.js +4 -0
  149. package/dist/esm/index.js.map +1 -1
  150. package/dist/esm/networks.js +7 -7
  151. package/dist/esm/networks.js.map +1 -1
  152. package/dist/esm/providers/dummyProvider.js +21 -4
  153. package/dist/esm/providers/dummyProvider.js.map +1 -1
  154. package/dist/esm/providers/rpcProvider.js +1 -1
  155. package/dist/esm/providers/utxoProvider.js +5 -1
  156. package/dist/esm/providers/utxoProvider.js.map +1 -1
  157. package/dist/esm/psbt/bufferutils.js +7 -2
  158. package/dist/esm/psbt/bufferutils.js.map +1 -1
  159. package/dist/esm/psbt/extPsbt.js +373 -62
  160. package/dist/esm/psbt/extPsbt.js.map +1 -1
  161. package/dist/esm/psbt/psbt.js +10 -14
  162. package/dist/esm/psbt/psbt.js.map +1 -1
  163. package/dist/esm/psbt/psbtutils.js +4 -7
  164. package/dist/esm/psbt/psbtutils.js.map +1 -1
  165. package/dist/esm/psbt/signatureutils.js +2 -9
  166. package/dist/esm/psbt/signatureutils.js.map +1 -1
  167. package/dist/esm/signers/defaultSigner.js +30 -4
  168. package/dist/esm/signers/defaultSigner.js.map +1 -1
  169. package/dist/esm/signers/unisatSigner.js +27 -1
  170. package/dist/esm/signers/unisatSigner.js.map +1 -1
  171. package/dist/esm/smart-contract/abi.js +124 -4
  172. package/dist/esm/smart-contract/abi.js.map +1 -1
  173. package/dist/esm/smart-contract/abstractContract.js.map +1 -1
  174. package/dist/esm/smart-contract/builtin-libs/backtrace.js +9 -0
  175. package/dist/esm/smart-contract/builtin-libs/backtrace.js.map +1 -1
  176. package/dist/esm/smart-contract/builtin-libs/byteStringReader.js +4 -4
  177. package/dist/esm/smart-contract/builtin-libs/byteStringReader.js.map +1 -1
  178. package/dist/esm/smart-contract/builtin-libs/byteStringWriter.js +1 -1
  179. package/dist/esm/smart-contract/builtin-libs/byteStringWriter.js.map +1 -1
  180. package/dist/esm/smart-contract/builtin-libs/contextUtils.js +100 -45
  181. package/dist/esm/smart-contract/builtin-libs/contextUtils.js.map +1 -1
  182. package/dist/esm/smart-contract/builtin-libs/p2pk.js +9 -0
  183. package/dist/esm/smart-contract/builtin-libs/p2pk.js.map +1 -1
  184. package/dist/esm/smart-contract/builtin-libs/p2pkh.js +10 -0
  185. package/dist/esm/smart-contract/builtin-libs/p2pkh.js.map +1 -1
  186. package/dist/esm/smart-contract/builtin-libs/stateLib.js +22 -8
  187. package/dist/esm/smart-contract/builtin-libs/stateLib.js.map +1 -1
  188. package/dist/esm/smart-contract/builtin-libs/stateUtils.js +7 -4
  189. package/dist/esm/smart-contract/builtin-libs/stateUtils.js.map +1 -1
  190. package/dist/esm/smart-contract/builtin-libs/stdUtils.js +75 -19
  191. package/dist/esm/smart-contract/builtin-libs/stdUtils.js.map +1 -1
  192. package/dist/esm/smart-contract/builtin-libs/txHashPreimageUtils.js +27 -0
  193. package/dist/esm/smart-contract/builtin-libs/txHashPreimageUtils.js.map +1 -1
  194. package/dist/esm/smart-contract/builtin-libs/txUtils.js +23 -8
  195. package/dist/esm/smart-contract/builtin-libs/txUtils.js.map +1 -1
  196. package/dist/esm/smart-contract/consts.js +0 -10
  197. package/dist/esm/smart-contract/consts.js.map +1 -1
  198. package/dist/esm/smart-contract/deserializer.js +156 -0
  199. package/dist/esm/smart-contract/deserializer.js.map +1 -0
  200. package/dist/esm/smart-contract/fns/assert.js +1 -1
  201. package/dist/esm/smart-contract/fns/bitwise.js +5 -5
  202. package/dist/esm/smart-contract/fns/bitwise.js.map +1 -1
  203. package/dist/esm/smart-contract/fns/byteString.js +8 -5
  204. package/dist/esm/smart-contract/fns/byteString.js.map +1 -1
  205. package/dist/esm/smart-contract/fns/equals.js +1 -1
  206. package/dist/esm/smart-contract/fns/exit.js +12 -0
  207. package/dist/esm/smart-contract/fns/exit.js.map +1 -0
  208. package/dist/esm/smart-contract/fns/fill.js +1 -1
  209. package/dist/esm/smart-contract/fns/index.js +1 -0
  210. package/dist/esm/smart-contract/fns/index.js.map +1 -1
  211. package/dist/esm/smart-contract/fns/math.js +4 -4
  212. package/dist/esm/smart-contract/methods/backtraceToGenensis.js +12 -8
  213. package/dist/esm/smart-contract/methods/backtraceToGenensis.js.map +1 -1
  214. package/dist/esm/smart-contract/methods/checkCtx.js +10 -9
  215. package/dist/esm/smart-contract/methods/checkCtx.js.map +1 -1
  216. package/dist/esm/smart-contract/methods/checkInputState.js +1 -0
  217. package/dist/esm/smart-contract/methods/checkInputState.js.map +1 -1
  218. package/dist/esm/smart-contract/methods/checkInputStateHashes.js +3 -2
  219. package/dist/esm/smart-contract/methods/checkInputStateHashes.js.map +1 -1
  220. package/dist/esm/smart-contract/methods/checkSHPreimage.js +4 -3
  221. package/dist/esm/smart-contract/methods/checkSHPreimage.js.map +1 -1
  222. package/dist/esm/smart-contract/methods/checkSig.js +74 -11
  223. package/dist/esm/smart-contract/methods/checkSig.js.map +1 -1
  224. package/dist/esm/smart-contract/serializer.js +5 -27
  225. package/dist/esm/smart-contract/serializer.js.map +1 -1
  226. package/dist/esm/smart-contract/smartContract.js +79 -106
  227. package/dist/esm/smart-contract/smartContract.js.map +1 -1
  228. package/dist/esm/smart-contract/smartContractLib.js +5 -0
  229. package/dist/esm/smart-contract/smartContractLib.js.map +1 -1
  230. package/dist/esm/smart-contract/stateSerializer.js +22 -5
  231. package/dist/esm/smart-contract/stateSerializer.js.map +1 -1
  232. package/dist/esm/smart-contract/types/abi.js.map +1 -1
  233. package/dist/esm/smart-contract/types/artifact.js +5 -1
  234. package/dist/esm/smart-contract/types/artifact.js.map +1 -1
  235. package/dist/esm/smart-contract/types/bn.js +18 -0
  236. package/dist/esm/smart-contract/types/bn.js.map +1 -1
  237. package/dist/esm/smart-contract/types/index.js +1 -1
  238. package/dist/esm/smart-contract/types/index.js.map +1 -1
  239. package/dist/esm/smart-contract/types/opCode.js +1 -1
  240. package/dist/esm/smart-contract/types/primitives.js +17 -9
  241. package/dist/esm/smart-contract/types/primitives.js.map +1 -1
  242. package/dist/esm/utils/checkIntegrity.js +2 -2
  243. package/dist/esm/utils/common.js +10 -36
  244. package/dist/esm/utils/common.js.map +1 -1
  245. package/dist/esm/utils/constants.js +3 -0
  246. package/dist/esm/utils/constants.js.map +1 -1
  247. package/dist/esm/utils/index.js +2 -2
  248. package/dist/esm/utils/index.js.map +1 -1
  249. package/dist/esm/utils/proof.js +15 -36
  250. package/dist/esm/utils/proof.js.map +1 -1
  251. package/dist/types/features/call.d.ts +40 -12
  252. package/dist/types/features/call.d.ts.map +1 -1
  253. package/dist/types/features/deploy.d.ts +14 -7
  254. package/dist/types/features/deploy.d.ts.map +1 -1
  255. package/dist/types/features/deployGenesis.d.ts +27 -0
  256. package/dist/types/features/deployGenesis.d.ts.map +1 -0
  257. package/dist/types/features/index.d.ts +1 -0
  258. package/dist/types/features/index.d.ts.map +1 -1
  259. package/dist/types/globalTypes.d.ts +33 -13
  260. package/dist/types/globalTypes.d.ts.map +1 -1
  261. package/dist/types/index.d.ts +6 -2
  262. package/dist/types/index.d.ts.map +1 -1
  263. package/dist/types/networks.d.ts +3 -4
  264. package/dist/types/networks.d.ts.map +1 -1
  265. package/dist/types/providers/chainProvider.d.ts +4 -0
  266. package/dist/types/providers/chainProvider.d.ts.map +1 -1
  267. package/dist/types/providers/dummyProvider.d.ts.map +1 -1
  268. package/dist/types/providers/rpcProvider.d.ts +1 -1
  269. package/dist/types/providers/utxoProvider.d.ts +5 -1
  270. package/dist/types/providers/utxoProvider.d.ts.map +1 -1
  271. package/dist/types/psbt/bufferutils.d.ts +7 -2
  272. package/dist/types/psbt/bufferutils.d.ts.map +1 -1
  273. package/dist/types/psbt/extPsbt.d.ts +332 -32
  274. package/dist/types/psbt/extPsbt.d.ts.map +1 -1
  275. package/dist/types/psbt/psbt.d.ts +4 -5
  276. package/dist/types/psbt/psbt.d.ts.map +1 -1
  277. package/dist/types/psbt/psbtutils.d.ts.map +1 -1
  278. package/dist/types/psbt/signatureutils.d.ts +19 -6
  279. package/dist/types/psbt/signatureutils.d.ts.map +1 -1
  280. package/dist/types/psbt/types.d.ts +66 -17
  281. package/dist/types/psbt/types.d.ts.map +1 -1
  282. package/dist/types/signers/defaultSigner.d.ts +26 -3
  283. package/dist/types/signers/defaultSigner.d.ts.map +1 -1
  284. package/dist/types/signers/unisatSigner.d.ts +27 -1
  285. package/dist/types/signers/unisatSigner.d.ts.map +1 -1
  286. package/dist/types/smart-contract/abi.d.ts +68 -13
  287. package/dist/types/smart-contract/abi.d.ts.map +1 -1
  288. package/dist/types/smart-contract/abstractContract.d.ts +2 -14
  289. package/dist/types/smart-contract/abstractContract.d.ts.map +1 -1
  290. package/dist/types/smart-contract/builtin-libs/backtrace.d.ts +13 -0
  291. package/dist/types/smart-contract/builtin-libs/backtrace.d.ts.map +1 -1
  292. package/dist/types/smart-contract/builtin-libs/contextUtils.d.ts +87 -9
  293. package/dist/types/smart-contract/builtin-libs/contextUtils.d.ts.map +1 -1
  294. package/dist/types/smart-contract/builtin-libs/p2pk.d.ts +9 -0
  295. package/dist/types/smart-contract/builtin-libs/p2pk.d.ts.map +1 -1
  296. package/dist/types/smart-contract/builtin-libs/p2pkh.d.ts +10 -0
  297. package/dist/types/smart-contract/builtin-libs/p2pkh.d.ts.map +1 -1
  298. package/dist/types/smart-contract/builtin-libs/stateLib.d.ts +22 -5
  299. package/dist/types/smart-contract/builtin-libs/stateLib.d.ts.map +1 -1
  300. package/dist/types/smart-contract/builtin-libs/stateUtils.d.ts +6 -2
  301. package/dist/types/smart-contract/builtin-libs/stateUtils.d.ts.map +1 -1
  302. package/dist/types/smart-contract/builtin-libs/stdUtils.d.ts +64 -13
  303. package/dist/types/smart-contract/builtin-libs/stdUtils.d.ts.map +1 -1
  304. package/dist/types/smart-contract/builtin-libs/txHashPreimageUtils.d.ts +27 -0
  305. package/dist/types/smart-contract/builtin-libs/txHashPreimageUtils.d.ts.map +1 -1
  306. package/dist/types/smart-contract/builtin-libs/txUtils.d.ts +9 -3
  307. package/dist/types/smart-contract/builtin-libs/txUtils.d.ts.map +1 -1
  308. package/dist/types/smart-contract/consts.d.ts +0 -10
  309. package/dist/types/smart-contract/consts.d.ts.map +1 -1
  310. package/dist/types/smart-contract/deserializer.d.ts +7 -0
  311. package/dist/types/smart-contract/deserializer.d.ts.map +1 -0
  312. package/dist/types/smart-contract/fns/assert.d.ts +1 -1
  313. package/dist/types/smart-contract/fns/bitwise.d.ts +4 -4
  314. package/dist/types/smart-contract/fns/byteString.d.ts +8 -5
  315. package/dist/types/smart-contract/fns/byteString.d.ts.map +1 -1
  316. package/dist/types/smart-contract/fns/equals.d.ts +1 -1
  317. package/dist/types/smart-contract/fns/exit.d.ts +9 -0
  318. package/dist/types/smart-contract/fns/exit.d.ts.map +1 -0
  319. package/dist/types/smart-contract/fns/fill.d.ts +1 -1
  320. package/dist/types/smart-contract/fns/index.d.ts +1 -0
  321. package/dist/types/smart-contract/fns/index.d.ts.map +1 -1
  322. package/dist/types/smart-contract/fns/math.d.ts +4 -4
  323. package/dist/types/smart-contract/methods/backtraceToGenensis.d.ts +12 -8
  324. package/dist/types/smart-contract/methods/backtraceToGenensis.d.ts.map +1 -1
  325. package/dist/types/smart-contract/methods/checkCtx.d.ts +10 -9
  326. package/dist/types/smart-contract/methods/checkCtx.d.ts.map +1 -1
  327. package/dist/types/smart-contract/methods/checkInputState.d.ts +1 -0
  328. package/dist/types/smart-contract/methods/checkInputState.d.ts.map +1 -1
  329. package/dist/types/smart-contract/methods/checkInputStateHashes.d.ts +3 -2
  330. package/dist/types/smart-contract/methods/checkInputStateHashes.d.ts.map +1 -1
  331. package/dist/types/smart-contract/methods/checkSHPreimage.d.ts +4 -3
  332. package/dist/types/smart-contract/methods/checkSHPreimage.d.ts.map +1 -1
  333. package/dist/types/smart-contract/methods/checkSig.d.ts +20 -4
  334. package/dist/types/smart-contract/methods/checkSig.d.ts.map +1 -1
  335. package/dist/types/smart-contract/serializer.d.ts +2 -32
  336. package/dist/types/smart-contract/serializer.d.ts.map +1 -1
  337. package/dist/types/smart-contract/smartContract.d.ts +61 -27
  338. package/dist/types/smart-contract/smartContract.d.ts.map +1 -1
  339. package/dist/types/smart-contract/smartContractLib.d.ts +5 -0
  340. package/dist/types/smart-contract/smartContractLib.d.ts.map +1 -1
  341. package/dist/types/smart-contract/stateSerializer.d.ts +17 -0
  342. package/dist/types/smart-contract/stateSerializer.d.ts.map +1 -1
  343. package/dist/types/smart-contract/types/abi.d.ts +13 -0
  344. package/dist/types/smart-contract/types/abi.d.ts.map +1 -1
  345. package/dist/types/smart-contract/types/artifact.d.ts +19 -6
  346. package/dist/types/smart-contract/types/artifact.d.ts.map +1 -1
  347. package/dist/types/smart-contract/types/bn.d.ts +18 -0
  348. package/dist/types/smart-contract/types/bn.d.ts.map +1 -1
  349. package/dist/types/smart-contract/types/context.d.ts +6 -8
  350. package/dist/types/smart-contract/types/context.d.ts.map +1 -1
  351. package/dist/types/smart-contract/types/index.d.ts +1 -1
  352. package/dist/types/smart-contract/types/index.d.ts.map +1 -1
  353. package/dist/types/smart-contract/types/opCode.d.ts +1 -1
  354. package/dist/types/smart-contract/types/primitives.d.ts +38 -12
  355. package/dist/types/smart-contract/types/primitives.d.ts.map +1 -1
  356. package/dist/types/smart-contract/types/structs.d.ts +8 -8
  357. package/dist/types/utils/checkIntegrity.d.ts +3 -3
  358. package/dist/types/utils/common.d.ts +7 -17
  359. package/dist/types/utils/common.d.ts.map +1 -1
  360. package/dist/types/utils/constants.d.ts +3 -0
  361. package/dist/types/utils/constants.d.ts.map +1 -1
  362. package/dist/types/utils/index.d.ts +2 -2
  363. package/dist/types/utils/index.d.ts.map +1 -1
  364. package/dist/types/utils/proof.d.ts +13 -13
  365. package/dist/types/utils/proof.d.ts.map +1 -1
  366. package/package.json +77 -79
  367. package/scrypt.index.json +4 -4
  368. package/src/smart-contract/builtin-libs/backtrace.ts +15 -1
  369. package/src/smart-contract/builtin-libs/byteStringReader.ts +4 -4
  370. package/src/smart-contract/builtin-libs/byteStringWriter.ts +2 -2
  371. package/src/smart-contract/builtin-libs/contextUtils.ts +104 -51
  372. package/src/smart-contract/builtin-libs/p2pk.ts +9 -0
  373. package/src/smart-contract/builtin-libs/p2pkh.ts +10 -0
  374. package/src/smart-contract/builtin-libs/stateLib.ts +28 -12
  375. package/src/smart-contract/builtin-libs/stateUtils.ts +8 -5
  376. package/src/smart-contract/builtin-libs/stdUtils.ts +77 -21
  377. package/src/smart-contract/builtin-libs/txHashPreimageUtils.ts +27 -1
  378. package/src/smart-contract/builtin-libs/txUtils.ts +19 -12
  379. package/src/smart-contract/types/structs.ts +8 -8
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ [![Test](https://github.com/OPCAT-Labs/ts-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/OPCAT-Labs/ts-tools/actions/workflows/ci.yml)
2
+
3
+ # scrypt-ts-opcat
4
+
5
+ `scrypt-ts-opcat` is a Typescript framework to write smart contracts on Opcat blockchains.
6
+
7
+ ## Installation
8
+
9
+ Use this `npm` to install `scrypt-ts-opcat`:
10
+
11
+ `npm install @opcat-labs/scrypt-ts-opcat`
12
+
13
+ ## Usage
14
+
15
+ ### Write a Contract
16
+
17
+ A contract can be written as a class that extends the `SmartContract` base, a simple example could be like this:
18
+
19
+ ```ts
20
+ import { SmartContract, method, prop, assert } from "@opcat-labs/scrypt-ts-opcat";
21
+
22
+ class Demo extends SmartContract {
23
+ @prop()
24
+ x: bigint;
25
+
26
+ constructor(x: bigint) {
27
+ super(x);
28
+ this.x = x;
29
+ }
30
+
31
+ @method()
32
+ public unlock(x: bigint) {
33
+ assert(this.add(this.x, 1n) === x);
34
+ }
35
+
36
+ @method()
37
+ add(x0: bigint, x1:bigint) : bigint {
38
+ return x0 + x1;
39
+ }
40
+ }
41
+ ```
42
+
43
+ #### Property Decorator: `@prop()`
44
+
45
+ Use this decorator on class properties to mark them as contract properties, which means the values would be stored on chain.
46
+
47
+
48
+ #### Method Decorator: `@method()`
49
+
50
+ Use this decorator on class methods to mark them as contract methods. The logic implemented in these methods would be stored and be executed on chain.
51
+
52
+ The class methods decorated by `@method()` have some special requirements / restrains that should be followed:
53
+
54
+ * Within these methods, only functions provided as built-ins from `@opcat-labs/scrypt-ts-opcat` or methods also decorated by `@method()` can be called; Similarly, only the properties decorated by `@prop()` can be use.
55
+
56
+ * With `public` modifier, a method is marked as an entry method that could be called outside the contract class. The main purpose of these methods is to validate / verify / check assertions for its input parameters according to its `@prop()` decorated properties. The return value must be `void`.
57
+
58
+ * Without a `public` modifier, a method is kind of an inner function usually be called within the contract class. It can return any valid types.
59
+
60
+ #### Types
61
+
62
+ The types can be used in `@prop()` and `@method()` are restricted to these kinds:
63
+
64
+ * Basic types: `boolean` / `ByteString` / `bigint`;
65
+
66
+ *Note*: the type `number` is not allowed in `@prop()` because it may cause precision issues when representing a floating point number. It can only be used in a few cases like when using `FixedArray` or `Loop`.
67
+
68
+ * User types can be defined using `type` or `interface`, made of basic types. For example,
69
+
70
+ ```ts
71
+ type ST = {
72
+ a: bigint;
73
+ b: boolean;
74
+ }
75
+
76
+ interface ST1 {
77
+ x: ST;
78
+ y: ByteString;
79
+ }
80
+ ```
81
+
82
+ * Array types **must** be declared using `FixedArray`, whose length must be known at compile time, like:
83
+
84
+ ```ts
85
+ let aaa: FixedArray<bigint, 3> = [1n, 3n, 3n];
86
+
87
+ // 2d array
88
+ let abb: FixedArray<FixedArray<bigint, 2>, 3> = [[1n, 3n], [1n, 3n], [1n, 3n]];
89
+ ```
90
+
91
+ * Other `SmartContract` subclasses are provided as libraries.
92
+
93
+ #### Statements
94
+
95
+ There are also some other restraints / rules on the statemets that could be used within the `@method`s besides the previously mentioned.
96
+
97
+ ##### `for` statement
98
+
99
+ Because of the underlaying limitation of `loop` implemetion on Bitcoin script, one can only use a compile time const number as the loop iterations.
100
+
101
+ So currently if you want to build a loop inside `@method`s, there is only one restricted version of `for` statement that could be used. It's looks like:
102
+
103
+ ```ts
104
+ for(let $i = 0; $i < $constNum; $i++) {
105
+ ...
106
+ }
107
+ ```
108
+
109
+ Note that the initial value `0` and the `<` operator and the post unary operator `++` are all unchangeable.
110
+
111
+ * `$i` can be whatever you named the induction variable;
112
+
113
+ * `$constNum` should be an expression of a CTC numeric value of the followings:
114
+
115
+ A number literal like:
116
+
117
+ ```ts
118
+ for(let i = 0; i < 5; i++ ) ...
119
+ ```
120
+
121
+ Or a `const` variable name like:
122
+
123
+ ```ts
124
+ const N = 3;
125
+ for(let i = 0; i < N; i++ ) ...
126
+ ```
127
+
128
+ Or a `readonly` property name like:
129
+
130
+ ```ts
131
+ class X {
132
+ static readonly N = 3;
133
+ }
134
+ for(let i = 0; i < X.N; i++ ) ...
135
+ ```
136
+
137
+ ##### `console.log` statement
138
+
139
+ As described before, all Javascript/Typescript built-in functions/global variables are not allowed in `@method`s, with only a few exceptions.
140
+
141
+ One exceptional statement is `console.log`, which can be used for debugging purpose.
142
+ ```ts
143
+ @method
144
+ add(x0: bigint, x1:bigint) : bigint {
145
+ console.log(x0);
146
+ return x0 + x1;
147
+ }
148
+ ```
149
+
150
+ ### Compile a Contract
151
+
152
+ Just run `npx opcat-cli@latest compile`, the contract will be compiled if there is no any issue and output the contract json file in the `artifact` folder inside the project.
153
+
154
+ ### Test a Contract
155
+
156
+ You could write tests using tools like `mocha`, for example:
157
+
158
+ ```js
159
+ import { use, expect } from 'chai';
160
+ import chaiAsPromised from 'chai-as-promised';
161
+ import {
162
+ Signer,
163
+ deploy,
164
+ ExtPsbt,
165
+ ChainProvider,
166
+ UtxoProvider,
167
+ call,
168
+ } from '@opcat-labs/scrypt-ts-opcat';
169
+ import { network } from '../utils/privateKey.js';
170
+ import { createLogger, getDefaultProvider, getDefaultSigner } from '../utils/index.js';
171
+ import { Demo } from '../contracts/demo.js';
172
+
173
+ import artifact from '../fixtures/demo.json' with { type: 'json' };
174
+
175
+ use(chaiAsPromised);
176
+
177
+ describe('Test Demo onchain', () => {
178
+ let signer: Signer;
179
+ let provider: ChainProvider & UtxoProvider;
180
+ let pubKey: string;
181
+ let demo: Demo;
182
+ const logger = createLogger('Test Demo onchain');
183
+
184
+ before(async () => {
185
+ Demo.loadArtifact(artifact);
186
+ signer = getDefaultSigner()
187
+ pubKey = await signer.getPublicKey();
188
+ provider = getDefaultProvider(network)
189
+ });
190
+
191
+ it('should deploy successfully', async () => {
192
+ demo = new Demo(1n, 2n);
193
+ const psbt = await deploy(signer, provider, demo);
194
+ expect(psbt.isFinalized).to.be.true;
195
+ logger.info('deployed successfully, txid: ', psbt.extractTransaction().id);
196
+ psbt.getChangeUTXO() && provider.addNewUTXO(psbt.getChangeUTXO()); // add change utxo
197
+ });
198
+
199
+ it('should unlock successfully', async () => {
200
+ const psbt = await call(signer, provider, demo, (demo: Demo, psbt: ExtPsbt) => {
201
+ demo.add(3n);
202
+ });
203
+ expect(psbt.isFinalized).to.be.true;
204
+
205
+ const txid = await provider.broadcast(psbt.extractTransaction().toHex());
206
+ logger.info('unlocked successfully, txid: ', txid);
207
+ });
208
+ });
209
+
210
+ ```
211
+
212
+ ## Documentation
213
+
214
+ The full version of `Opcat` documentation is available [here](https://docs.opcatlabs.io/overview).
@@ -1 +1 @@
1
- [[],[],[],[],[[8,0,9,13]],[[2,0,11,2],[18,0,11,9],[46,0,11,53],[61,0,11,37],[79,0,11,70]],[[4,0,12,4],[12,0,12,11],[16,0,12,15],[30,0,12,30],[40,0,12,11],[43,0,12,42]],[[4,0,13,23],[8,0,13,10],[21,0,13,23],[29,0,13,32],[50,0,13,52],[64,0,13,67],[76,0,13,78]],[[4,0,14,24],[8,0,14,10],[22,0,14,24],[30,0,14,33],[51,0,14,53],[65,0,14,68],[78,0,14,80]],[[4,0,15,4],[11,0,15,11],[19,0,16,6],[33,0,16,21],[42,0,16,6],[44,0,17,6],[52,0,17,15],[65,0,17,27],[77,0,16,6],[79,0,18,6],[93,0,18,21],[104,0,16,6],[106,0,19,6],[114,0,19,15],[127,0,19,27],[140,0,16,6],[142,0,20,6],[156,0,20,21],[168,0,16,6],[170,0,21,6],[184,0,21,21]],[],[[2,0,25,2],[18,0,25,9],[37,0,25,44],[52,0,25,28],[68,0,25,72],[72,0,25,60],[86,0,25,81]],[[4,0,26,4],[11,0,26,17],[25,0,26,32],[36,0,26,43],[47,0,26,43],[49,0,26,56],[55,0,26,76],[66,0,26,76],[68,0,26,89],[71,0,26,75],[73,0,26,95]],[],[[2,0,30,2],[18,0,30,9],[38,0,30,45],[53,0,30,29],[69,0,30,74],[73,0,30,61],[88,0,30,83]],[[4,0,31,4],[11,0,31,17],[25,0,31,32],[37,0,31,44],[49,0,31,44],[51,0,31,58],[57,0,31,79],[69,0,31,79],[71,0,31,93],[74,0,31,78],[76,0,31,99]],[],[]]
1
+ [[],[],[],[],[[8,0,14,13]],[[2,0,25,2],[18,0,25,9],[46,0,25,53],[61,0,25,37],[79,0,25,70]],[[4,0,26,4],[12,0,26,11],[16,0,26,15],[30,0,26,30],[40,0,26,11],[43,0,26,42]],[[4,0,27,23],[8,0,27,10],[21,0,27,23],[29,0,27,32],[50,0,27,52],[64,0,27,67],[76,0,27,78]],[[4,0,28,24],[8,0,28,10],[22,0,28,24],[30,0,28,33],[51,0,28,53],[65,0,28,68],[78,0,28,80]],[[4,0,29,4],[11,0,29,11],[19,0,30,6],[33,0,30,21],[42,0,30,6],[44,0,31,6],[52,0,31,15],[65,0,31,27],[77,0,30,6],[79,0,32,6],[93,0,32,21],[104,0,30,6],[106,0,33,6],[114,0,33,15],[127,0,33,27],[140,0,30,6],[142,0,34,6],[156,0,34,21],[168,0,30,6],[170,0,35,6],[184,0,35,21]],[],[[2,0,45,2],[18,0,45,9],[37,0,45,44],[52,0,45,28],[68,0,45,72],[72,0,45,60],[86,0,45,81]],[[4,0,46,4],[11,0,46,17],[25,0,46,32],[36,0,46,43],[47,0,46,43],[49,0,46,56],[55,0,46,76],[66,0,46,76],[68,0,46,89],[71,0,46,75],[73,0,46,95]],[],[[2,0,56,2],[18,0,56,9],[38,0,56,45],[53,0,56,29],[69,0,56,74],[73,0,56,61],[88,0,56,83]],[[4,0,57,4],[11,0,57,17],[25,0,57,32],[37,0,57,44],[49,0,57,44],[51,0,57,58],[57,0,57,79],[69,0,57,79],[71,0,57,93],[74,0,57,78],[76,0,57,99]],[],[]]
@@ -1 +1 @@
1
- [[],[],[],[],[],[],[[7,0,11,36]],[[2,0,12,18],[8,0,12,2]],[[2,0,13,20],[8,0,13,2]],[],[],[[8,0,21,13]],[[2,0,24,2],[18,0,24,9],[42,0,25,20],[57,0,25,4],[73,0,26,16],[79,0,26,4],[91,0,27,18],[95,0,27,4]],[[4,0,29,19],[10,0,29,10],[19,0,29,19],[38,0,29,39],[67,0,29,67]],[[4,0,30,4],[12,0,30,11],[19,0,30,11],[22,0,30,27],[33,0,30,39],[46,0,30,39],[48,0,30,54],[53,0,30,59],[66,0,30,59],[68,0,30,74],[71,0,30,59],[73,0,30,80]],[],[],[[2,0,41,2],[18,0,41,9],[37,0,42,19],[51,0,42,4],[66,0,43,23],[72,0,43,4],[91,0,44,18],[97,0,44,4],[111,0,45,23],[117,0,45,4]],[[4,0,47,16],[26,0,47,10],[32,0,47,16],[41,0,47,26],[57,0,47,41],[72,0,47,56]],[[4,0,48,4],[12,0,49,6],[15,0,49,10],[33,0,49,6],[36,0,49,31],[54,0,49,6],[57,0,49,52],[60,0,49,56],[76,0,49,52],[79,0,49,74]],[],[],[[2,0,63,2],[18,0,63,9],[35,0,64,19],[49,0,64,4],[64,0,65,21],[70,0,65,4],[87,0,66,18],[93,0,66,4],[107,0,67,23],[113,0,67,4]],[[4,0,69,16],[26,0,69,10],[32,0,69,16],[41,0,69,26],[57,0,69,41],[72,0,69,56]],[[4,0,70,4],[12,0,71,6],[15,0,71,10],[31,0,71,6],[34,0,71,28],[50,0,71,6],[53,0,71,47],[56,0,71,51],[72,0,71,47],[75,0,71,69]],[],[],[[2,0,85,2],[18,0,85,9],[33,0,86,19],[47,0,86,4],[62,0,87,23],[68,0,87,4],[89,0,88,5]],[[4,0,90,4],[12,0,92,8],[30,0,93,8],[43,0,93,22],[61,0,93,8],[63,0,93,41],[69,0,94,9],[82,0,94,23],[100,0,94,9],[102,0,94,42],[105,0,94,8],[107,0,94,48],[111,0,91,6],[114,0,96,6],[121,0,96,14],[133,0,96,25],[146,0,96,39]],[[4,0,99,27],[10,0,99,10],[27,0,99,27],[40,0,99,41],[52,0,99,53]],[[4,0,100,4],[12,0,101,6],[27,0,101,6],[30,0,102,8],[49,0,102,28],[78,0,102,56],[91,0,102,70]],[[4,0,106,6],[10,0,105,10],[27,0,107,8],[40,0,107,22],[59,0,107,41],[71,0,108,8],[84,0,108,22],[96,0,108,34],[113,0,108,8],[115,0,108,52],[118,0,108,8],[120,0,108,73],[125,0,109,9],[138,0,109,23],[150,0,109,35],[168,0,109,8],[170,0,109,54],[173,0,109,8],[175,0,109,75],[177,0,109,8],[179,0,109,104]],[[4,0,112,6],[10,0,111,10],[29,0,112,6],[44,0,112,6],[46,0,112,23],[54,0,112,32],[74,0,112,51],[87,0,112,65],[99,0,112,77]],[[4,0,113,4],[11,0,113,11]],[],[]]
1
+ [[],[],[],[],[],[],[[7,0,16,36]],[[2,0,17,18],[8,0,17,2]],[[2,0,18,20],[8,0,18,2]],[],[],[[8,0,26,13]],[[2,0,38,2],[18,0,38,9],[42,0,39,20],[57,0,39,4],[73,0,40,16],[79,0,40,4],[91,0,41,18],[95,0,41,4]],[[4,0,43,19],[10,0,43,10],[19,0,43,19],[38,0,43,39],[67,0,43,67]],[[4,0,44,4],[12,0,44,11],[19,0,44,11],[22,0,44,27],[33,0,44,39],[46,0,44,39],[48,0,44,54],[53,0,44,59],[66,0,44,59],[68,0,44,74],[71,0,44,59],[73,0,44,80]],[],[],[[2,0,55,2],[18,0,55,9],[37,0,56,19],[51,0,56,4],[66,0,57,23],[72,0,57,4],[91,0,58,18],[97,0,58,4],[111,0,59,23],[117,0,59,4]],[[4,0,61,16],[26,0,61,10],[32,0,61,16],[41,0,61,26],[57,0,61,41],[72,0,61,56]],[[4,0,62,4],[12,0,63,6],[15,0,63,10],[33,0,63,6],[36,0,63,31],[54,0,63,6],[57,0,63,52],[60,0,63,56],[76,0,63,52],[79,0,63,74]],[],[],[[2,0,77,2],[18,0,77,9],[35,0,78,19],[49,0,78,4],[64,0,79,21],[70,0,79,4],[87,0,80,18],[93,0,80,4],[107,0,81,23],[113,0,81,4]],[[4,0,83,16],[26,0,83,10],[32,0,83,16],[41,0,83,26],[57,0,83,41],[72,0,83,56]],[[4,0,84,4],[12,0,85,6],[15,0,85,10],[31,0,85,6],[34,0,85,28],[50,0,85,6],[53,0,85,47],[56,0,85,51],[72,0,85,47],[75,0,85,69]],[],[],[[2,0,99,2],[18,0,99,9],[33,0,100,19],[47,0,100,4],[62,0,101,23],[68,0,101,4],[89,0,102,5]],[[4,0,104,4],[12,0,106,8],[30,0,107,8],[43,0,107,22],[61,0,107,8],[63,0,107,41],[69,0,108,9],[82,0,108,23],[100,0,108,9],[102,0,108,42],[105,0,108,8],[107,0,108,48],[111,0,105,6],[114,0,110,6],[121,0,110,14],[133,0,110,25],[146,0,110,39]],[[4,0,113,27],[10,0,113,10],[27,0,113,27],[40,0,113,41],[52,0,113,53]],[[4,0,114,4],[12,0,115,6],[27,0,115,6],[30,0,116,8],[49,0,116,28],[78,0,116,56],[91,0,116,70]],[[4,0,120,6],[10,0,119,10],[27,0,121,8],[40,0,121,22],[59,0,121,41],[71,0,122,8],[84,0,122,22],[96,0,122,34],[113,0,122,8],[115,0,122,52],[118,0,122,8],[120,0,122,73],[125,0,123,9],[138,0,123,23],[150,0,123,35],[168,0,123,8],[170,0,123,54],[173,0,123,8],[175,0,123,75],[177,0,123,8],[179,0,123,104]],[[4,0,126,6],[10,0,125,10],[29,0,126,6],[44,0,126,6],[46,0,126,23],[54,0,126,32],[74,0,126,51],[87,0,126,65],[99,0,126,77]],[[4,0,127,4],[11,0,127,11]],[],[]]
@@ -1 +1 @@
1
- [[],[],[],[[8,0,10,13]],[[2,0,13,9],[8,0,13,4]],[[2,0,15,9],[6,0,15,4]],[[2,0,17,4],[14,0,17,21],[20,0,17,16]],[[4,0,19,8],[8,0,19,13],[13,0,19,8],[15,0,19,19]],[[4,0,20,8],[8,0,20,13],[13,0,20,8],[15,0,20,19]],[],[[11,0,28,4],[19,0,28,11]],[[4,0,29,8],[11,0,29,15],[15,0,29,20],[20,0,29,15],[23,0,29,27],[27,0,29,31],[31,0,29,36]],[],[[11,0,37,4],[25,0,37,17]],[[4,0,38,15],[8,0,38,12],[12,0,38,24]],[[4,0,39,17],[10,0,39,12],[16,0,39,30],[20,0,39,35]],[[4,0,40,17],[10,0,40,12],[16,0,40,43]],[[4,0,41,20],[8,0,41,12],[17,0,41,29],[24,0,41,51],[28,0,41,56],[33,0,41,61],[37,0,41,66],[44,0,41,71],[48,0,41,76],[53,0,41,71],[55,0,41,82]],[[4,0,42,8],[8,0,42,13],[12,0,42,8]],[[4,0,44,8],[7,0,44,12],[14,0,44,12],[16,0,44,21]],[[8,0,45,12],[10,0,45,12],[12,0,45,16]],[[8,0,46,12],[12,0,46,12],[14,0,46,24],[18,0,46,29],[22,0,46,34],[29,0,46,39],[33,0,46,44],[38,0,46,39],[40,0,46,50]],[[13,0,48,13],[16,0,48,17],[23,0,48,17],[26,0,48,27]],[[8,0,49,12],[10,0,49,12],[12,0,49,16],[20,0,49,25],[36,0,49,46],[40,0,49,51],[44,0,49,56],[51,0,49,61],[55,0,49,66],[60,0,49,61],[62,0,49,72]],[[8,0,50,12],[12,0,50,17],[17,0,50,12],[20,0,50,24]],[[8,0,51,12],[12,0,51,12],[14,0,51,24],[18,0,51,29],[23,0,51,34],[27,0,51,39],[34,0,51,44],[38,0,51,49],[43,0,51,44],[45,0,51,55]],[[13,0,53,13],[16,0,53,17],[23,0,53,17],[26,0,53,27]],[[8,0,54,12],[10,0,54,12],[12,0,54,16],[20,0,54,25],[36,0,54,46],[40,0,54,51],[45,0,54,56],[49,0,54,61],[56,0,54,66],[60,0,54,71],[65,0,54,66],[67,0,54,77]],[[8,0,55,12],[12,0,55,17],[17,0,55,12],[20,0,55,24]],[[8,0,56,12],[12,0,56,12],[14,0,56,24],[18,0,56,29],[23,0,56,34],[27,0,56,39],[34,0,56,44],[38,0,56,49],[43,0,56,44],[45,0,56,55]],[[13,0,58,13],[16,0,58,17],[23,0,58,17],[26,0,58,27]],[[8,0,59,12],[10,0,59,12],[12,0,59,16],[20,0,59,25],[36,0,59,46],[40,0,59,51],[45,0,59,56],[49,0,59,61],[56,0,59,66],[60,0,59,71],[65,0,59,66],[67,0,59,77]],[[8,0,60,12],[12,0,60,17],[17,0,60,12],[20,0,60,24]],[[8,0,61,12],[12,0,61,12],[14,0,61,24],[18,0,61,29],[23,0,61,34],[27,0,61,39],[34,0,61,44],[38,0,61,49],[43,0,61,44],[45,0,61,55]],[],[[8,0,65,12],[16,0,65,19]],[],[[4,0,68,8],[8,0,68,13],[13,0,68,8],[16,0,68,20]],[[4,0,69,8],[11,0,69,15]],[],[[11,0,78,4],[24,0,78,16]],[[4,0,79,17],[10,0,79,12],[16,0,79,36],[20,0,79,41],[25,0,79,46],[29,0,79,51],[36,0,79,56],[40,0,79,61],[45,0,79,56],[47,0,79,67]],[[4,0,80,8],[8,0,80,13],[12,0,80,8]],[[4,0,81,8],[11,0,81,28],[17,0,81,15],[20,0,81,37]],[],[[11,0,89,4],[26,0,89,18]],[[4,0,90,18],[10,0,90,12],[16,0,90,31]],[[4,0,91,21],[10,0,91,12],[19,0,91,27],[23,0,91,32],[28,0,91,37],[32,0,91,42],[39,0,91,47],[43,0,91,52],[48,0,91,47],[50,0,91,58]],[[4,0,92,8],[8,0,92,13],[12,0,92,8]],[[4,0,93,8],[7,0,93,12],[14,0,93,12],[17,0,93,35]],[[8,0,94,12],[12,0,94,12],[14,0,94,24],[18,0,94,29],[23,0,94,34],[27,0,94,39],[34,0,94,44],[38,0,94,49],[43,0,94,44],[45,0,94,55]],[[8,0,95,12],[12,0,95,17],[17,0,95,12],[20,0,95,24]],[[13,0,97,13],[16,0,97,17],[23,0,97,17],[26,0,97,40]],[[8,0,98,12],[12,0,98,12],[14,0,98,24],[18,0,98,29],[23,0,98,34],[27,0,98,39],[34,0,98,44],[38,0,98,49],[43,0,98,44],[45,0,98,55]],[[8,0,99,12],[12,0,99,17],[17,0,99,12],[20,0,99,24]],[[13,0,101,13],[16,0,101,17],[23,0,101,17],[26,0,101,40]],[[8,0,102,12],[12,0,102,12],[14,0,102,24],[18,0,102,29],[23,0,102,34],[27,0,102,39],[34,0,102,44],[38,0,102,49],[43,0,102,44],[45,0,102,55]],[[8,0,103,12],[12,0,103,17],[17,0,103,12],[20,0,103,24]],[],[[8,0,106,12],[12,0,106,12],[14,0,106,18]],[],[[4,0,108,8],[11,0,108,15],[19,0,108,24],[35,0,108,39]],[],[]]
1
+ [[],[],[],[[8,0,10,13]],[[2,0,13,9],[8,0,13,4]],[[2,0,15,9],[6,0,15,4]],[[2,0,17,4],[14,0,17,21],[20,0,17,16]],[[4,0,19,8],[8,0,19,13],[13,0,19,8],[15,0,19,19]],[[4,0,20,8],[8,0,20,13],[13,0,20,8],[15,0,20,19]],[],[[11,0,28,4],[19,0,28,11]],[[4,0,29,8],[11,0,29,15],[15,0,29,20],[20,0,29,15],[23,0,29,27],[27,0,29,31],[31,0,29,36]],[],[[11,0,37,4],[25,0,37,17]],[[4,0,38,15],[8,0,38,12],[12,0,38,24]],[[4,0,39,19],[10,0,39,14],[16,0,39,32],[20,0,39,37]],[[4,0,40,17],[10,0,40,12],[16,0,40,43]],[[4,0,41,22],[8,0,41,14],[17,0,41,31],[24,0,41,53],[28,0,41,58],[33,0,41,63],[37,0,41,68],[44,0,41,73],[48,0,41,78],[53,0,41,73],[55,0,41,84]],[[4,0,42,8],[8,0,42,13],[12,0,42,8]],[[4,0,44,8],[7,0,44,12],[14,0,44,12],[16,0,44,21]],[[8,0,45,12],[10,0,45,12],[12,0,45,16]],[[8,0,46,12],[12,0,46,12],[14,0,46,24],[18,0,46,29],[22,0,46,34],[29,0,46,39],[33,0,46,44],[38,0,46,39],[40,0,46,50]],[[13,0,48,13],[16,0,48,17],[23,0,48,17],[26,0,48,27]],[[8,0,49,12],[10,0,49,12],[12,0,49,16],[20,0,49,25],[36,0,49,46],[40,0,49,51],[44,0,49,56],[51,0,49,61],[55,0,49,66],[60,0,49,61],[62,0,49,72]],[[8,0,50,12],[12,0,50,17],[17,0,50,12],[20,0,50,24]],[[8,0,51,12],[12,0,51,12],[14,0,51,24],[18,0,51,29],[23,0,51,34],[27,0,51,39],[34,0,51,44],[38,0,51,49],[43,0,51,44],[45,0,51,55]],[[13,0,53,13],[16,0,53,17],[23,0,53,17],[26,0,53,27]],[[8,0,54,12],[10,0,54,12],[12,0,54,16],[20,0,54,25],[36,0,54,46],[40,0,54,51],[45,0,54,56],[49,0,54,61],[56,0,54,66],[60,0,54,71],[65,0,54,66],[67,0,54,77]],[[8,0,55,12],[12,0,55,17],[17,0,55,12],[20,0,55,24]],[[8,0,56,12],[12,0,56,12],[14,0,56,24],[18,0,56,29],[23,0,56,34],[27,0,56,39],[34,0,56,44],[38,0,56,49],[43,0,56,44],[45,0,56,55]],[[13,0,58,13],[16,0,58,17],[23,0,58,17],[26,0,58,27]],[[8,0,59,12],[10,0,59,12],[12,0,59,16],[20,0,59,25],[36,0,59,46],[40,0,59,51],[45,0,59,56],[49,0,59,61],[56,0,59,66],[60,0,59,71],[65,0,59,66],[67,0,59,77]],[[8,0,60,12],[12,0,60,17],[17,0,60,12],[20,0,60,24]],[[8,0,61,12],[12,0,61,12],[14,0,61,24],[18,0,61,29],[23,0,61,34],[27,0,61,39],[34,0,61,44],[38,0,61,49],[43,0,61,44],[45,0,61,55]],[],[[8,0,65,12],[16,0,65,19]],[],[[4,0,68,8],[8,0,68,13],[13,0,68,8],[16,0,68,20]],[[4,0,69,8],[11,0,69,15]],[],[[11,0,78,4],[24,0,78,16]],[[4,0,79,19],[10,0,79,14],[16,0,79,38],[20,0,79,43],[25,0,79,48],[29,0,79,53],[36,0,79,58],[40,0,79,63],[45,0,79,58],[47,0,79,69]],[[4,0,80,8],[8,0,80,13],[12,0,80,8]],[[4,0,81,8],[11,0,81,28],[17,0,81,15],[20,0,81,37]],[],[[11,0,89,4],[26,0,89,18]],[[4,0,90,18],[10,0,90,12],[16,0,90,31]],[[4,0,91,23],[10,0,91,14],[19,0,91,29],[23,0,91,34],[28,0,91,39],[32,0,91,44],[39,0,91,49],[43,0,91,54],[48,0,91,49],[50,0,91,60]],[[4,0,92,8],[8,0,92,13],[12,0,92,8]],[[4,0,93,8],[7,0,93,12],[14,0,93,12],[17,0,93,35]],[[8,0,94,12],[12,0,94,12],[14,0,94,24],[18,0,94,29],[23,0,94,34],[27,0,94,39],[34,0,94,44],[38,0,94,49],[43,0,94,44],[45,0,94,55]],[[8,0,95,12],[12,0,95,17],[17,0,95,12],[20,0,95,24]],[[13,0,97,13],[16,0,97,17],[23,0,97,17],[26,0,97,40]],[[8,0,98,12],[12,0,98,12],[14,0,98,24],[18,0,98,29],[23,0,98,34],[27,0,98,39],[34,0,98,44],[38,0,98,49],[43,0,98,44],[45,0,98,55]],[[8,0,99,12],[12,0,99,17],[17,0,99,12],[20,0,99,24]],[[13,0,101,13],[16,0,101,17],[23,0,101,17],[26,0,101,40]],[[8,0,102,12],[12,0,102,12],[14,0,102,24],[18,0,102,29],[23,0,102,34],[27,0,102,39],[34,0,102,44],[38,0,102,49],[43,0,102,44],[45,0,102,55]],[[8,0,103,12],[12,0,103,17],[17,0,103,12],[20,0,103,24]],[],[[8,0,106,12],[12,0,106,12],[14,0,106,18]],[],[[4,0,108,8],[11,0,108,15],[19,0,108,24],[35,0,108,39]],[],[]]
@@ -1 +1 @@
1
- [[],[],[],[[8,0,10,13]],[[2,0,12,9],[8,0,12,4]],[[2,0,14,4]],[[4,0,16,8],[8,0,16,13],[13,0,16,8],[15,0,16,32]],[],[[11,0,24,4],[22,0,24,20],[28,0,24,15]],[[4,0,25,16],[8,0,25,12],[12,0,25,16],[16,0,25,20]],[[4,0,27,20],[10,0,27,12],[19,0,27,46]],[[4,0,29,8],[7,0,29,12],[9,0,29,12],[11,0,29,16]],[[8,0,30,12],[15,0,30,12],[17,0,30,21],[25,0,30,30],[39,0,30,43],[42,0,30,46]],[[13,0,32,13],[16,0,32,17],[18,0,32,17],[20,0,32,21]],[[8,0,33,12],[15,0,33,12],[17,0,33,34],[23,0,33,21],[25,0,33,42],[33,0,33,51],[47,0,33,64],[50,0,33,67]],[[13,0,35,13],[16,0,35,17],[18,0,35,17],[20,0,35,21]],[[8,0,36,12],[15,0,36,12],[17,0,36,34],[23,0,36,21],[25,0,36,42],[33,0,36,51],[47,0,36,64],[50,0,36,67]],[[13,0,38,13],[16,0,38,17],[18,0,38,17],[20,0,38,21]],[[8,0,39,12],[15,0,39,12],[17,0,39,34],[23,0,39,21],[25,0,39,42],[33,0,39,51],[47,0,39,64],[50,0,39,67]],[],[[8,0,43,12],[16,0,43,19]],[],[[4,0,46,8],[8,0,46,13],[13,0,46,8],[16,0,46,20],[23,0,46,20],[25,0,46,29]],[],[],[[11,0,55,4],[21,0,55,17],[26,0,55,14]],[[4,0,56,8],[8,0,56,13],[13,0,56,8],[16,0,56,20],[20,0,56,37],[28,0,56,58]],[],[],[[11,0,65,4],[23,0,65,19],[27,0,65,16]],[[4,0,66,8],[12,0,66,15],[14,0,66,15],[17,0,66,20]],[[4,0,67,19],[8,0,67,12],[15,0,67,19]],[[4,0,68,8],[7,0,68,12],[9,0,68,12],[11,0,68,16]],[[8,0,69,12],[13,0,69,12],[15,0,69,19]],[[13,0,71,13],[16,0,71,17],[18,0,71,17],[20,0,71,21]],[[8,0,72,12],[12,0,72,17],[17,0,72,12],[20,0,72,37]],[[8,0,73,12],[13,0,73,12],[15,0,73,19]],[[13,0,75,13],[16,0,75,17],[18,0,75,17],[20,0,75,21]],[[8,0,76,12],[13,0,76,12],[15,0,76,19]],[[8,0,77,12],[12,0,77,17],[17,0,77,12],[20,0,77,37]],[],[[8,0,80,12],[13,0,80,12],[15,0,80,19]],[[8,0,81,12],[12,0,81,17],[17,0,81,12],[20,0,81,37]],[],[[4,0,83,8],[8,0,83,13],[13,0,83,8],[16,0,83,20],[24,0,83,29],[38,0,83,42],[41,0,83,45]],[],[],[]]
1
+ [[],[],[],[[8,0,10,13]],[[2,0,12,9],[8,0,12,4]],[[2,0,14,4]],[[4,0,16,8],[8,0,16,13],[13,0,16,8],[15,0,16,32]],[],[[11,0,24,4],[22,0,24,20],[28,0,24,15]],[[4,0,25,18],[8,0,25,14],[12,0,25,18],[16,0,25,22]],[[4,0,27,20],[10,0,27,12],[19,0,27,46]],[[4,0,29,8],[7,0,29,12],[9,0,29,12],[11,0,29,16]],[[8,0,30,12],[15,0,30,12],[17,0,30,21],[25,0,30,30],[39,0,30,43],[42,0,30,46]],[[13,0,32,13],[16,0,32,17],[18,0,32,17],[20,0,32,21]],[[8,0,33,12],[15,0,33,12],[17,0,33,34],[23,0,33,21],[25,0,33,42],[33,0,33,51],[47,0,33,64],[50,0,33,67]],[[13,0,35,13],[16,0,35,17],[18,0,35,17],[20,0,35,21]],[[8,0,36,12],[15,0,36,12],[17,0,36,34],[23,0,36,21],[25,0,36,42],[33,0,36,51],[47,0,36,64],[50,0,36,67]],[[13,0,38,13],[16,0,38,17],[18,0,38,17],[20,0,38,21]],[[8,0,39,12],[15,0,39,12],[17,0,39,34],[23,0,39,21],[25,0,39,42],[33,0,39,51],[47,0,39,64],[50,0,39,67]],[],[[8,0,43,12],[16,0,43,19]],[],[[4,0,46,8],[8,0,46,13],[13,0,46,8],[16,0,46,20],[23,0,46,20],[25,0,46,29]],[],[],[[11,0,55,4],[21,0,55,17],[26,0,55,14]],[[4,0,56,8],[8,0,56,13],[13,0,56,8],[16,0,56,20],[20,0,56,37],[28,0,56,58]],[],[],[[11,0,65,4],[23,0,65,19],[27,0,65,16]],[[4,0,66,8],[12,0,66,15],[14,0,66,15],[17,0,66,20]],[[4,0,67,19],[8,0,67,12],[15,0,67,19]],[[4,0,68,8],[7,0,68,12],[9,0,68,12],[11,0,68,16]],[[8,0,69,12],[13,0,69,12],[15,0,69,19]],[[13,0,71,13],[16,0,71,17],[18,0,71,17],[20,0,71,21]],[[8,0,72,12],[12,0,72,17],[17,0,72,12],[20,0,72,37]],[[8,0,73,12],[13,0,73,12],[15,0,73,19]],[[13,0,75,13],[16,0,75,17],[18,0,75,17],[20,0,75,21]],[[8,0,76,12],[13,0,76,12],[15,0,76,19]],[[8,0,77,12],[12,0,77,17],[17,0,77,12],[20,0,77,37]],[],[[8,0,80,12],[13,0,80,12],[15,0,80,19]],[[8,0,81,12],[12,0,81,17],[17,0,81,12],[20,0,81,37]],[],[[4,0,83,8],[8,0,83,13],[13,0,83,8],[16,0,83,20],[24,0,83,29],[38,0,83,42],[41,0,83,45]],[],[],[]]
@@ -1 +1 @@
1
- [[],[],[],[],[],[[8,0,15,13]],[[2,0,20,2],[9,0,20,9],[15,0,20,27],[23,0,20,18],[33,0,20,37],[41,0,20,45]],[[2,0,22,2],[9,0,22,9],[15,0,22,26],[22,0,22,18],[31,0,22,35],[38,0,22,55]],[[2,0,25,2],[9,0,25,9],[15,0,25,24],[19,0,25,18],[26,0,25,33]],[[2,0,28,2],[9,0,28,9],[15,0,28,21],[19,0,28,18],[23,0,28,30]],[[2,0,31,2],[9,0,31,9],[15,0,31,30],[21,0,31,18],[34,0,31,56]],[[2,0,35,2],[18,0,35,9],[28,0,35,22],[32,0,35,19],[35,0,35,39],[39,0,35,30],[50,0,35,48]],[[4,0,36,15],[8,0,36,10],[14,0,36,24],[16,0,36,24],[18,0,36,28]],[[4,0,38,4],[12,0,38,12],[16,0,38,12],[18,0,38,18],[23,0,38,23],[27,0,38,23],[29,0,38,29],[39,0,38,39]],[],[[2,0,41,2],[18,0,41,9],[23,0,41,17],[27,0,41,14],[30,0,41,34],[38,0,41,25],[47,0,41,53],[51,0,41,43],[61,0,41,64],[65,0,41,61],[68,0,41,84],[74,0,41,72],[86,0,41,109],[92,0,41,96],[107,0,41,122]],[[4,0,43,11],[8,0,43,8],[12,0,43,20],[21,0,43,20],[24,0,43,32],[26,0,43,32],[28,0,43,36],[30,0,43,36],[33,0,43,41]],[],[[4,0,45,4],[6,0,45,4],[8,0,45,8],[20,0,45,21],[31,0,45,31],[34,0,44,22]],[[4,0,47,4],[7,0,47,8],[9,0,47,8],[11,0,44,22],[90,0,47,12],[92,0,47,16]],[[8,0,48,6],[10,0,48,6],[12,0,44,22],[91,0,48,10],[93,0,48,14]],[],[[4,0,55,16],[8,0,55,10],[15,0,55,25],[16,0,55,32],[20,0,55,36]],[[4,0,56,17],[8,0,56,10],[15,0,56,17],[19,0,56,21],[24,0,56,37]],[[4,0,59,22],[10,0,59,10],[23,0,59,41],[36,0,59,59],[44,0,59,75],[47,0,59,78],[52,0,59,84],[53,0,59,91],[58,0,59,97],[61,0,59,97],[63,0,59,103],[74,0,59,41],[87,0,59,59],[95,0,59,75],[98,0,59,78],[103,0,59,84],[104,0,59,91]],[[4,0,61,13],[8,0,61,10],[12,0,61,22],[14,0,61,22],[16,0,61,27],[21,0,61,22],[23,0,61,34],[24,0,61,41]],[[4,0,63,14],[10,0,63,10],[15,0,63,40],[21,0,63,27],[23,0,64,6],[28,0,64,22],[31,0,63,27],[33,0,65,19],[39,0,63,27],[41,0,66,6],[46,0,66,22],[52,0,63,27],[54,0,67,6],[65,0,63,27],[67,0,68,19],[73,0,63,27],[75,0,69,6],[80,0,69,22],[86,0,63,27],[88,0,70,6],[99,0,63,27],[101,0,71,19]],[[4,0,72,4],[11,0,72,11],[15,0,72,15]],[],[[2,0,76,2],[18,0,76,9],[33,0,76,27],[39,0,76,24],[44,0,76,40]],[[4,0,79,4],[11,0,79,11],[18,0,79,27],[31,0,79,45],[34,0,79,48],[38,0,79,27],[40,0,79,68]],[],[[2,0,88,2],[18,0,88,9],[34,0,88,37],[45,0,88,25],[57,0,88,62],[63,0,88,49],[78,0,88,75]],[[4,0,89,4],[12,0,89,11],[16,0,89,15],[26,0,89,26],[37,0,89,11],[40,0,89,39]],[[4,0,90,4],[12,0,90,11],[16,0,90,15],[26,0,90,26],[41,0,90,11],[44,0,90,43]],[[4,0,91,4],[12,0,91,11],[16,0,91,15],[26,0,91,26],[44,0,91,11],[47,0,91,46]],[[4,0,92,4],[12,0,92,11],[16,0,92,15],[26,0,92,26],[42,0,92,11],[45,0,92,44]],[[4,0,93,4],[12,0,93,11],[22,0,93,22],[29,0,93,11],[32,0,93,31]],[[4,0,94,4],[12,0,94,11],[16,0,94,15],[26,0,94,26],[38,0,94,11],[41,0,94,40]],[[4,0,95,4],[12,0,95,11],[16,0,95,15],[26,0,95,26],[45,0,95,11],[48,0,95,47]],[[4,0,96,4],[12,0,96,11],[16,0,96,15],[26,0,96,26],[50,0,96,11],[53,0,96,52]],[[4,0,97,4],[12,0,97,11],[16,0,97,15],[26,0,97,26],[48,0,97,11],[51,0,97,50]],[[4,0,98,4],[12,0,98,11],[16,0,98,15],[26,0,98,26],[42,0,98,11],[45,0,98,44]],[[4,0,99,4],[12,0,99,11],[16,0,99,15],[26,0,99,26],[40,0,99,11],[43,0,99,42]],[[4,0,100,4],[12,0,100,11],[22,0,100,22],[34,0,100,11],[37,0,100,36]],[[4,0,101,4],[12,0,101,11],[22,0,101,22],[33,0,101,11],[36,0,101,35]],[[4,0,102,4],[12,0,102,11],[22,0,102,22],[35,0,102,11],[38,0,102,37],[40,0,102,11],[43,0,103,9],[53,0,103,20],[66,0,103,9],[69,0,103,35],[71,0,102,11],[74,0,104,9],[84,0,104,20],[97,0,104,9],[100,0,104,35],[102,0,102,11],[105,0,105,9],[115,0,105,20],[128,0,105,9],[131,0,105,35],[136,0,102,11],[139,0,106,9],[149,0,106,20],[162,0,106,9],[165,0,106,35],[170,0,102,11],[173,0,107,9],[183,0,107,20],[196,0,107,9],[199,0,107,35]],[[4,0,110,21],[10,0,110,10],[21,0,110,21],[31,0,110,32],[41,0,110,21],[43,0,111,8],[53,0,111,19],[67,0,110,21],[69,0,112,8],[79,0,112,19],[96,0,110,21],[98,0,113,8],[108,0,113,19],[123,0,110,21],[125,0,114,8],[132,0,114,16],[154,0,114,37],[164,0,114,48],[172,0,110,21],[174,0,115,8],[184,0,115,19],[195,0,110,21],[197,0,116,8],[207,0,116,19],[225,0,110,21],[227,0,117,8],[237,0,117,19],[260,0,110,21],[262,0,118,8],[272,0,118,19],[293,0,110,21],[295,0,119,8],[305,0,119,19],[320,0,110,21],[322,0,120,8],[332,0,120,19],[345,0,110,21],[347,0,121,8],[355,0,121,17],[369,0,121,30],[379,0,121,41],[392,0,121,53],[395,0,110,21],[397,0,122,8],[405,0,122,17],[419,0,122,30],[429,0,122,41],[441,0,122,52],[444,0,110,21],[446,0,123,8],[454,0,123,24],[464,0,123,35],[478,0,123,48]],[[4,0,125,13],[10,0,125,10],[14,0,125,26],[22,0,125,34]],[[4,0,126,15],[8,0,126,10],[14,0,126,21],[26,0,126,34],[32,0,127,6],[44,0,127,19],[60,0,127,34],[64,0,128,6],[76,0,128,19],[86,0,25,33],[165,0,28,30],[243,0,131,7],[255,0,131,20],[268,0,132,8]],[[4,0,133,4],[11,0,133,11]],[],[[2,0,137,2],[18,0,137,9],[38,0,137,41],[49,0,137,29],[63,0,137,54]],[[4,0,138,4],[12,0,138,11],[16,0,138,15],[26,0,138,26],[37,0,138,11],[40,0,138,39]],[[4,0,139,4],[12,0,139,11],[16,0,139,15],[26,0,139,26],[41,0,139,11],[44,0,139,43]],[[4,0,140,4],[12,0,140,11],[16,0,140,15],[26,0,140,26],[44,0,140,11],[47,0,140,46]],[[4,0,141,4],[12,0,141,11],[16,0,141,15],[26,0,141,26],[42,0,141,11],[45,0,141,44]],[[4,0,142,4],[12,0,142,11],[22,0,142,22],[29,0,142,11],[32,0,142,31]],[[4,0,143,4],[12,0,143,11],[16,0,143,15],[26,0,143,26],[38,0,143,11],[41,0,143,40]],[[4,0,144,4],[12,0,144,11],[16,0,144,15],[26,0,144,26],[45,0,144,11],[48,0,144,47]],[[4,0,145,4],[12,0,145,11],[16,0,145,15],[26,0,145,26],[50,0,145,11],[53,0,145,52]],[[4,0,146,4],[12,0,146,11],[16,0,146,15],[26,0,146,26],[48,0,146,11],[51,0,146,50]],[[4,0,147,4],[12,0,147,11],[16,0,147,15],[26,0,147,26],[42,0,147,11],[45,0,147,44]],[[4,0,148,4],[12,0,148,11],[16,0,148,15],[26,0,148,26],[40,0,148,11],[43,0,148,42]],[[4,0,149,4],[12,0,149,11],[22,0,149,22],[34,0,149,11],[37,0,149,36]],[[4,0,150,4],[12,0,150,11],[22,0,150,22],[33,0,150,11],[36,0,150,35]],[[4,0,151,4],[12,0,151,11],[22,0,151,22],[35,0,151,11],[38,0,151,37],[40,0,151,11],[43,0,152,9],[53,0,152,20],[66,0,152,9],[69,0,152,35],[71,0,151,11],[74,0,153,9],[84,0,153,20],[97,0,153,9],[100,0,153,35],[102,0,151,11],[105,0,154,9],[115,0,154,20],[128,0,154,9],[131,0,154,35],[136,0,151,11],[139,0,155,9],[149,0,155,20],[162,0,155,9],[165,0,155,35],[170,0,151,11],[173,0,156,9],[183,0,156,20],[196,0,156,9],[199,0,156,35]],[[4,0,159,21],[10,0,159,10],[21,0,159,21],[31,0,159,32],[41,0,159,21],[43,0,160,8],[53,0,160,19],[67,0,159,21],[69,0,161,8],[79,0,161,19],[96,0,159,21],[98,0,162,8],[108,0,162,19],[123,0,159,21],[125,0,163,8],[132,0,163,16],[154,0,163,37],[164,0,163,48],[172,0,159,21],[174,0,164,8],[184,0,164,19],[195,0,159,21],[197,0,165,8],[207,0,165,19],[225,0,159,21],[227,0,166,8],[237,0,166,19],[260,0,159,21],[262,0,167,8],[272,0,167,19],[293,0,159,21],[295,0,168,8],[305,0,168,19],[320,0,159,21],[322,0,169,8],[332,0,169,19],[345,0,159,21],[347,0,170,8],[355,0,170,17],[369,0,170,30],[379,0,170,41],[392,0,170,53],[395,0,159,21],[397,0,171,8],[405,0,171,17],[419,0,171,30],[429,0,171,41],[441,0,171,52],[444,0,159,21],[446,0,172,8],[454,0,172,24],[464,0,172,35],[478,0,172,48]],[[4,0,173,4],[11,0,173,11],[27,0,173,27]],[],[[2,0,185,2],[18,0,185,9],[32,0,186,14],[38,0,186,4],[48,0,187,20],[54,0,187,4],[70,0,188,18],[74,0,188,4],[88,0,189,18],[92,0,189,4],[108,0,190,5]],[[4,0,192,4],[12,0,192,11],[20,0,192,19],[30,0,192,11],[33,0,192,32]],[[4,0,193,4],[12,0,193,11],[25,0,193,11],[27,0,193,26]],[[4,0,194,4],[12,0,194,11],[25,0,194,11],[28,0,194,27],[36,0,194,36],[57,0,194,56],[67,0,194,66]],[[4,0,196,14],[10,0,196,10],[14,0,196,20],[23,0,196,30],[36,0,196,30],[38,0,196,45],[44,0,196,51],[57,0,196,51],[59,0,196,66],[62,0,196,50],[64,0,196,72]],[[4,0,197,4],[11,0,197,11],[12,0,198,20],[14,0,198,23],[18,0,198,27],[23,0,199,19],[31,0,199,28],[51,0,199,53],[53,0,199,56],[58,0,199,61]],[],[[2,0,210,2],[18,0,210,9],[36,0,211,23],[42,0,211,4],[61,0,212,24],[67,0,212,4],[87,0,213,18],[91,0,213,4]],[[4,0,215,4],[12,0,215,11],[20,0,215,19],[39,0,215,11],[42,0,215,41]],[[4,0,216,4],[12,0,216,11],[25,0,216,11],[28,0,216,27],[36,0,216,36],[57,0,216,56],[76,0,216,75]],[],[],[[2,0,226,2],[18,0,226,9],[36,0,227,18],[42,0,227,4],[56,0,228,24],[62,0,228,4],[84,0,229,5]],[[4,0,230,4],[12,0,230,11],[20,0,230,19],[34,0,230,11],[37,0,230,36]],[[4,0,231,4],[11,0,231,11],[19,0,231,20],[40,0,231,40],[54,0,231,54]],[],[[2,0,235,2],[18,0,235,9],[39,0,236,21],[45,0,236,4],[62,0,237,27],[68,0,237,4],[91,0,238,18],[95,0,238,4]],[[4,0,240,4],[12,0,240,11],[20,0,240,19],[37,0,240,11],[40,0,240,39]],[[4,0,241,4],[12,0,241,11],[25,0,241,11],[28,0,241,27],[36,0,241,36],[57,0,241,56],[74,0,241,73]],[],[],[[2,0,246,2],[18,0,246,9],[37,0,247,23],[43,0,247,4],[62,0,248,16],[66,0,248,4],[80,0,249,5]],[[4,0,250,4],[11,0,250,17],[29,0,250,36],[40,0,250,36],[42,0,250,49],[48,0,250,55],[59,0,250,55],[61,0,250,68],[64,0,250,54],[66,0,250,74]],[],[[2,0,254,2],[18,0,254,9],[33,0,255,18],[39,0,255,4],[53,0,256,16],[57,0,256,4],[71,0,257,5]],[[4,0,258,4],[11,0,258,11],[19,0,258,20],[35,0,258,41],[48,0,258,55],[59,0,258,55],[61,0,258,68],[66,0,258,73],[77,0,258,73],[79,0,258,86],[82,0,258,72],[84,0,258,92]],[],[[2,0,262,2],[18,0,262,9],[35,0,263,21],[41,0,263,4],[58,0,264,16],[62,0,264,4],[76,0,265,5]],[[4,0,266,4],[11,0,266,17],[27,0,266,34],[38,0,266,34],[40,0,266,47],[46,0,266,53],[57,0,266,53],[59,0,266,66],[62,0,266,52],[64,0,266,72]],[],[]]
1
+ [[],[],[],[],[],[[8,0,24,13]],[[2,0,29,2],[9,0,29,9],[15,0,29,27],[23,0,29,18],[33,0,29,37],[41,0,29,45]],[[2,0,31,2],[9,0,31,9],[15,0,31,26],[22,0,31,18],[31,0,31,35],[38,0,31,55]],[[2,0,34,2],[9,0,34,9],[15,0,34,24],[19,0,34,18],[26,0,34,33]],[[2,0,37,2],[9,0,37,9],[15,0,37,21],[19,0,37,18],[23,0,37,30]],[[2,0,40,2],[9,0,40,9],[15,0,40,30],[21,0,40,18],[34,0,40,56]],[[2,0,50,2],[18,0,50,9],[28,0,50,22],[32,0,50,19],[35,0,50,39],[39,0,50,30],[50,0,50,48]],[[4,0,51,15],[8,0,51,10],[14,0,51,24],[16,0,51,24],[18,0,51,28]],[[4,0,53,4],[12,0,53,12],[16,0,53,12],[18,0,53,18],[23,0,53,23],[27,0,53,23],[29,0,53,29],[39,0,53,39]],[],[[2,0,72,2],[18,0,72,9],[23,0,72,17],[27,0,72,14],[30,0,72,34],[38,0,72,25],[47,0,72,53],[51,0,72,43],[61,0,72,64],[65,0,72,61],[68,0,72,84],[74,0,72,72],[86,0,72,109],[92,0,72,96],[107,0,72,122]],[[4,0,74,11],[8,0,74,8],[12,0,74,20],[21,0,74,20],[24,0,74,32],[26,0,74,32],[28,0,74,36],[30,0,74,36],[32,0,74,40]],[],[[4,0,76,4],[6,0,76,4],[8,0,76,8],[20,0,76,21],[31,0,76,31],[34,0,75,22]],[[4,0,78,4],[7,0,78,8],[9,0,78,8],[11,0,75,22],[90,0,78,12],[92,0,78,16]],[[8,0,79,6],[10,0,79,6],[12,0,75,22],[91,0,79,10],[93,0,79,14]],[],[[4,0,86,16],[8,0,86,10],[15,0,86,25],[16,0,86,32],[20,0,86,36]],[[4,0,87,17],[8,0,87,10],[15,0,87,17],[19,0,87,21],[24,0,87,37]],[[4,0,90,22],[10,0,90,10],[23,0,90,41],[36,0,90,59],[44,0,90,75],[47,0,90,78],[52,0,90,84],[53,0,90,91],[58,0,90,97],[61,0,90,97],[63,0,90,103],[74,0,90,41],[87,0,90,59],[95,0,90,75],[98,0,90,78],[103,0,90,84],[104,0,90,91]],[[4,0,92,13],[8,0,92,10],[12,0,92,22],[14,0,92,22],[16,0,92,27],[21,0,92,22],[23,0,92,34],[24,0,92,41]],[[4,0,94,14],[10,0,94,10],[15,0,94,40],[21,0,94,27],[23,0,95,6],[28,0,95,22],[31,0,94,27],[33,0,96,19],[39,0,94,27],[41,0,97,6],[46,0,97,22],[52,0,94,27],[54,0,98,6],[65,0,94,27],[67,0,99,19],[73,0,94,27],[75,0,100,6],[80,0,100,22],[86,0,94,27],[88,0,101,6],[99,0,94,27],[101,0,102,19]],[[4,0,103,4],[11,0,103,11],[15,0,103,15]],[],[[2,0,112,2],[18,0,112,9],[33,0,112,27],[39,0,112,24],[44,0,112,40]],[[4,0,115,4],[11,0,115,11],[18,0,115,27],[31,0,115,45],[34,0,115,48],[38,0,115,27],[40,0,115,68]],[],[[2,0,127,2],[18,0,127,9],[34,0,127,37],[45,0,127,25],[57,0,127,62],[63,0,127,49],[78,0,127,75]],[[4,0,129,21],[20,0,129,10],[31,0,129,21],[43,0,129,34],[64,0,129,54]],[[4,0,131,13],[10,0,131,10],[14,0,131,26],[22,0,131,34]],[[4,0,132,15],[8,0,132,10],[14,0,132,21],[26,0,132,34],[32,0,133,6],[44,0,133,19],[60,0,133,34],[64,0,134,6],[76,0,134,19],[86,0,34,33],[165,0,37,30],[243,0,137,7],[255,0,137,20],[268,0,138,8]],[[4,0,139,4],[11,0,139,11]],[],[[2,0,150,2],[18,0,150,9],[38,0,150,41],[49,0,150,29],[63,0,150,54]],[[4,0,151,4],[12,0,151,11],[16,0,151,15],[26,0,151,26],[37,0,151,11],[40,0,151,39]],[[4,0,152,4],[12,0,152,11],[16,0,152,15],[26,0,152,26],[41,0,152,11],[44,0,152,43]],[[4,0,153,4],[12,0,153,11],[16,0,153,15],[26,0,153,26],[44,0,153,11],[47,0,153,46]],[[4,0,154,4],[12,0,154,11],[16,0,154,15],[26,0,154,26],[42,0,154,11],[45,0,154,44]],[[4,0,155,4],[12,0,155,11],[22,0,155,22],[29,0,155,11],[32,0,155,31]],[[4,0,156,4],[12,0,156,11],[16,0,156,15],[26,0,156,26],[38,0,156,11],[41,0,156,40]],[[4,0,157,4],[12,0,157,11],[16,0,157,15],[26,0,157,26],[45,0,157,11],[48,0,157,47]],[[4,0,158,4],[12,0,158,11],[16,0,158,15],[26,0,158,26],[50,0,158,11],[53,0,158,52]],[[4,0,159,4],[12,0,159,11],[16,0,159,15],[26,0,159,26],[48,0,159,11],[51,0,159,50]],[[4,0,160,4],[12,0,160,11],[16,0,160,15],[26,0,160,26],[42,0,160,11],[45,0,160,44]],[[4,0,161,4],[12,0,161,11],[16,0,161,15],[26,0,161,26],[40,0,161,11],[43,0,161,42]],[[4,0,162,4],[12,0,162,11],[22,0,162,22],[34,0,162,11],[37,0,162,36]],[[4,0,163,4],[12,0,163,11],[22,0,163,22],[33,0,163,11],[36,0,163,35]],[[4,0,164,4],[12,0,164,11],[22,0,164,22],[35,0,164,11],[38,0,164,37],[40,0,164,11],[43,0,165,9],[53,0,165,20],[66,0,165,9],[69,0,165,35],[71,0,164,11],[74,0,166,9],[84,0,166,20],[97,0,166,9],[100,0,166,35],[102,0,164,11],[105,0,167,9],[115,0,167,20],[128,0,167,9],[131,0,167,35],[136,0,164,11],[139,0,168,9],[149,0,168,20],[162,0,168,9],[165,0,168,35],[170,0,164,11],[173,0,169,9],[183,0,169,20],[196,0,169,9],[199,0,169,35]],[[4,0,172,21],[10,0,172,10],[21,0,172,21],[31,0,172,32],[41,0,172,21],[43,0,173,8],[53,0,173,19],[67,0,172,21],[69,0,174,8],[79,0,174,19],[96,0,172,21],[98,0,175,8],[108,0,175,19],[123,0,172,21],[125,0,176,8],[132,0,176,16],[154,0,176,37],[164,0,176,48],[172,0,172,21],[174,0,177,8],[184,0,177,19],[195,0,172,21],[197,0,178,8],[207,0,178,19],[225,0,172,21],[227,0,179,8],[237,0,179,19],[260,0,172,21],[262,0,180,8],[272,0,180,19],[293,0,172,21],[295,0,181,8],[305,0,181,19],[320,0,172,21],[322,0,182,8],[332,0,182,19],[345,0,172,21],[347,0,183,8],[355,0,183,17],[369,0,183,30],[379,0,183,41],[392,0,183,53],[395,0,172,21],[397,0,184,8],[405,0,184,17],[419,0,184,30],[429,0,184,41],[441,0,184,52],[444,0,172,21],[446,0,185,8],[454,0,185,24],[464,0,185,35],[478,0,185,48]],[[4,0,186,4],[11,0,186,11],[27,0,186,27]],[],[[2,0,198,2],[18,0,198,9],[32,0,199,14],[38,0,199,4],[48,0,200,20],[54,0,200,4],[70,0,201,18],[74,0,201,4],[88,0,202,18],[92,0,202,4],[108,0,203,5]],[[4,0,205,4],[12,0,205,11],[20,0,205,19],[30,0,205,11],[33,0,205,32]],[[4,0,206,4],[12,0,206,11],[25,0,206,11],[27,0,206,26]],[[4,0,207,4],[12,0,207,11],[25,0,207,11],[28,0,207,27],[36,0,207,36],[57,0,207,56],[67,0,207,66]],[[4,0,209,14],[10,0,209,10],[14,0,209,20],[23,0,209,30],[36,0,209,30],[38,0,209,45],[44,0,209,51],[57,0,209,51],[59,0,209,66],[62,0,209,50],[64,0,209,72]],[[4,0,210,4],[11,0,210,11],[12,0,211,20],[14,0,211,23],[18,0,211,27],[23,0,212,19],[31,0,212,28],[51,0,212,53],[53,0,212,56],[58,0,212,61]],[],[[2,0,223,2],[18,0,223,9],[36,0,224,23],[42,0,224,4],[61,0,225,24],[67,0,225,4],[87,0,226,18],[91,0,226,4]],[[4,0,228,4],[12,0,228,11],[20,0,228,19],[39,0,228,11],[42,0,228,41]],[[4,0,229,4],[12,0,229,11],[25,0,229,11],[28,0,229,27],[36,0,229,36],[57,0,229,56],[76,0,229,75]],[],[],[[2,0,239,2],[18,0,239,9],[36,0,240,18],[42,0,240,4],[56,0,241,22],[62,0,241,4],[82,0,242,5]],[[4,0,243,4],[12,0,243,11],[20,0,243,19],[34,0,243,11],[37,0,243,36]],[[4,0,244,4],[11,0,244,11],[19,0,244,20],[40,0,244,40],[54,0,244,54]],[],[[2,0,256,2],[18,0,256,9],[39,0,257,21],[45,0,257,4],[62,0,258,25],[68,0,258,4],[89,0,259,16],[93,0,259,4]],[[4,0,261,4],[12,0,261,11],[20,0,261,19],[37,0,261,11],[40,0,261,39]],[[4,0,262,4],[12,0,262,11],[23,0,262,11],[26,0,262,25],[34,0,262,34],[55,0,262,54],[72,0,262,71]],[],[],[[2,0,273,2],[18,0,273,9],[37,0,274,23],[43,0,274,4],[62,0,275,16],[66,0,275,4],[80,0,276,5]],[[4,0,277,4],[11,0,277,17],[29,0,277,36],[40,0,277,36],[42,0,277,49],[48,0,277,55],[59,0,277,55],[61,0,277,68],[64,0,277,54],[66,0,277,74]],[],[[2,0,287,2],[18,0,287,9],[33,0,288,18],[39,0,288,4],[53,0,289,16],[57,0,289,4],[71,0,290,5]],[[4,0,291,4],[11,0,291,11],[19,0,291,20],[35,0,291,41],[48,0,291,55],[59,0,291,55],[61,0,291,68],[66,0,291,73],[77,0,291,73],[79,0,291,86],[82,0,291,72],[84,0,291,92]],[],[[2,0,301,2],[18,0,301,9],[35,0,302,21],[41,0,302,4],[58,0,303,16],[62,0,303,4],[76,0,304,5]],[[4,0,305,4],[11,0,305,17],[27,0,305,34],[38,0,305,34],[40,0,305,47],[46,0,305,53],[57,0,305,53],[59,0,305,66],[62,0,305,52],[64,0,305,72]],[],[[2,0,315,2],[18,0,315,9],[33,0,316,16],[44,0,316,4],[56,0,317,15],[60,0,317,4],[73,0,318,6]],[[4,0,319,22],[8,0,319,10],[20,0,319,22],[28,0,319,31],[44,0,319,46],[54,0,319,57]],[[4,0,320,4],[12,0,320,12],[22,0,320,12],[24,0,320,24],[35,0,320,12],[39,0,320,40],[49,0,320,40],[51,0,320,52],[63,0,320,65],[73,0,320,76],[84,0,320,65],[86,0,320,88],[98,0,320,101],[104,0,320,12],[107,0,320,110],[117,0,320,121],[128,0,320,110],[131,0,320,134]],[],[]]
@@ -14,7 +14,7 @@ library ContextUtils {
14
14
  return (res < 0) ? res + modulus : res;
15
15
  }
16
16
  static function sign(int h, PrivKey privKey, int inverseK, int r, bytes rBigEndian, bytes sigHashType) : Sig {
17
- int s = inverseK * (h + r * (privKey));
17
+ int s = inverseK * (h + r * privKey);
18
18
 
19
19
  s = ContextUtils.normalize(s, 115792089237316195423570985008687907852837564279074904382605163141518161494337);
20
20
  if(s > 115792089237316195423570985008687907852837564279074904382605163141518161494337 / 2) {
@@ -31,21 +31,7 @@ library ContextUtils {
31
31
  return unpack(reverseBytes(b, 32) + b'00');
32
32
  }
33
33
  static function checkSHPreimage(SHPreimage shPreimage, bytes sigHashType) : Sig {
34
- require(len(shPreimage.nVersion) == 4);
35
- require(len(shPreimage.hashPrevouts) == 32);
36
- require(len(shPreimage.spentScriptHash) == 32);
37
- require(len(shPreimage.spentDataHash) == 32);
38
- require(shPreimage.value >= 0);
39
- require(len(shPreimage.nSequence) == 4);
40
- require(len(shPreimage.hashSpentAmounts) == 32);
41
- require(len(shPreimage.hashSpentScriptHashes) == 32);
42
- require(len(shPreimage.hashSpentDataHashes) == 32);
43
- require(len(shPreimage.hashSequences) == 32);
44
- require(len(shPreimage.hashOutputs) == 32);
45
- require(shPreimage.inputIndex >= 0);
46
- require(shPreimage.nLockTime >= 0);
47
- require(shPreimage.sigHashType == 1 || shPreimage.sigHashType == 2 || shPreimage.sigHashType == 3 || shPreimage.sigHashType == 0x81 || shPreimage.sigHashType == 0x82 || shPreimage.sigHashType == 0x83);
48
- bytes preimage = shPreimage.nVersion + shPreimage.hashPrevouts + shPreimage.spentScriptHash + shPreimage.spentDataHash + TxUtils.satoshisToByteString(shPreimage.value) + shPreimage.nSequence + shPreimage.hashSpentAmounts + shPreimage.hashSpentScriptHashes + shPreimage.hashSpentDataHashes + shPreimage.hashSequences + shPreimage.hashOutputs + StdUtils.toLEUnsigned(shPreimage.inputIndex, 4) + StdUtils.toLEUnsigned(shPreimage.nLockTime, 4) + num2bin(shPreimage.sigHashType, 4);
34
+ SigHashPreimage preimage = ContextUtils.serializeSHPreimage(shPreimage);
49
35
  bytes h = hash256(preimage);
50
36
  Sig sig = ContextUtils.sign(ContextUtils.fromBEUnsigned(h), ContextUtils.privKey, 90914631784428570546048907090666684794265392153046400654824470772421497439242, 7252565254521500021189571868467740368187828957595681190666767817830690399852, ContextUtils.rBigEndian, sigHashType);
51
37
  return sig;
@@ -80,13 +66,13 @@ library ContextUtils {
80
66
  require(t_inputCount == StdUtils.checkLenDivisibleBy(spentScriptHashes, 32));
81
67
  return true;
82
68
  }
83
- static function checkSpentAmounts(bytes spentAmounts, bytes t_hashSpentAmounts) : int {
84
- require(hash256(spentAmounts) == t_hashSpentAmounts);
69
+ static function checkSpentAmounts(bytes spentAmounts, bytes hashSpentAmounts) : int {
70
+ require(hash256(spentAmounts) == hashSpentAmounts);
85
71
  return StdUtils.checkLenDivisibleBy(spentAmounts, 8);
86
72
  }
87
- static function checkSpentDataHashes(bytes spentDataHashes, bytes t_hashSpentDataHashes, int t_inputCount) : bool {
88
- require(hash256(spentDataHashes) == t_hashSpentDataHashes);
89
- require(t_inputCount == StdUtils.checkLenDivisibleBy(spentDataHashes, 32));
73
+ static function checkSpentDataHashes(bytes spentDataHashes, bytes hashSpentDataHashes, int inputCount) : bool {
74
+ require(hash256(spentDataHashes) == hashSpentDataHashes);
75
+ require(inputCount == StdUtils.checkLenDivisibleBy(spentDataHashes, 32));
90
76
  return true;
91
77
  }
92
78
  static function getSpentScriptHash(bytes spentScriptHashes, int inputIndex) : bytes {
@@ -98,4 +84,8 @@ library ContextUtils {
98
84
  static function getSpentDataHash(bytes spentDataHashes, int inputIndex) : bytes {
99
85
  return spentDataHashes[inputIndex * 32 : (inputIndex + 1) * 32];
100
86
  }
87
+ static function checknLockTime(SHPreimage shPreimage, int nlockTime) : bool {
88
+ int nSequence = StdUtils.fromLEUnsigned(shPreimage.nSequence);
89
+ return (nSequence < 4294967295 && (nlockTime < 500000000 ? shPreimage.nLockTime < 500000000 : true) && shPreimage.nLockTime >= nlockTime);
90
+ }
101
91
  }
@@ -1 +1 @@
1
- [[],[[9,0,5,13]],[[2,0,7,4],[8,0,7,21],[15,0,7,13]],[[2,0,15,4],[18,0,15,11],[25,0,15,23],[29,0,15,18]],[[4,0,16,8],[12,0,16,20],[20,0,16,15],[21,0,16,29],[26,0,16,34],[30,0,16,39],[37,0,16,15]],[],[]]
1
+ [[],[[9,0,14,13]],[[2,0,16,4],[8,0,16,21],[15,0,16,13]],[[2,0,24,4],[18,0,24,11],[25,0,24,23],[29,0,24,18]],[[4,0,25,8],[12,0,25,20],[20,0,25,15],[21,0,25,29],[26,0,25,34],[30,0,25,39],[37,0,25,15]],[],[]]
@@ -1 +1 @@
1
- [[],[[9,0,6,13]],[[2,0,8,4],[8,0,8,19],[18,0,8,13]],[[2,0,16,4],[18,0,16,11],[25,0,16,23],[29,0,16,18],[34,0,16,36],[41,0,16,28]],[[4,0,17,8],[12,0,18,12],[20,0,18,24],[28,0,18,12],[31,0,18,35],[35,0,18,40]],[[4,0,21,8],[12,0,21,20],[20,0,21,15],[21,0,21,29],[26,0,21,34],[32,0,21,15]],[],[]]
1
+ [[],[[9,0,16,13]],[[2,0,18,4],[8,0,18,19],[18,0,18,13]],[[2,0,26,4],[18,0,26,11],[25,0,26,23],[29,0,26,18],[34,0,26,36],[41,0,26,28]],[[4,0,27,8],[12,0,28,12],[20,0,28,24],[28,0,28,12],[31,0,28,35],[35,0,28,40]],[[4,0,31,8],[12,0,31,20],[20,0,31,15],[21,0,31,29],[26,0,31,34],[32,0,31,15]],[],[]]
@@ -1 +1 @@
1
- [[],[[8,0,12,13]],[]]
1
+ [[],[[8,0,13,13]],[]]
@@ -1 +1 @@
1
- [[],[[8,0,14,13]],[[2,0,22,2],[18,0,22,9],[34,0,23,18],[38,0,23,4],[52,0,24,14],[58,0,24,4],[68,0,25,23],[74,0,25,4]],[[4,0,27,4],[12,0,29,8],[30,0,30,8],[43,0,30,8],[45,0,30,23],[51,0,31,9],[64,0,31,9],[66,0,31,24],[69,0,31,8],[71,0,31,30],[75,0,28,6],[78,0,32,11],[85,0,32,18]],[],[],[]]
1
+ [[],[[8,0,17,13]],[[2,0,25,2],[18,0,25,9],[34,0,26,18],[38,0,26,4],[52,0,27,15],[58,0,27,4],[69,0,28,23],[75,0,28,4]],[[4,0,30,4],[12,0,32,8],[30,0,33,8],[43,0,33,8],[45,0,33,23],[51,0,34,9],[64,0,34,9],[66,0,34,24],[69,0,34,8],[71,0,34,30],[75,0,31,6],[78,0,35,11]],[],[],[]]
@@ -1,7 +1,7 @@
1
1
 
2
2
  library StateUtils {
3
- static function checkInputState(int t_inputIndex, bytes rawState, bytes t_spentDataHashes) : bool {
4
- require(t_spentDataHashes[t_inputIndex * 32 : (t_inputIndex + 1) * 32] == sha256(rawState));
3
+ static function checkInputState(int t_inputIndex, bytes stateHash, bytes t_spentDataHashes) : bool {
4
+ require(t_spentDataHashes[t_inputIndex * 32 : (t_inputIndex + 1) * 32] == stateHash);
5
5
  return true;
6
6
  }
7
7
  }
@@ -1 +1 @@
1
- [[],[[7,0,12,24]],[[2,0,13,8],[8,0,13,2]],[[2,0,14,11],[6,0,14,2]],[],[],[[8,0,17,13]],[[2,0,19,2],[18,0,19,9],[38,0,19,32],[44,0,19,29],[47,0,19,47],[51,0,19,44],[56,0,19,56]],[[4,0,20,14],[8,0,20,10],[12,0,20,14],[16,0,20,18]],[[4,0,21,4],[12,0,21,11],[14,0,21,11],[16,0,21,15],[18,0,21,11],[21,0,21,20]],[[4,0,22,4],[11,0,22,11],[13,0,22,11],[15,0,22,15]],[],[[2,0,27,2],[18,0,27,9],[37,0,27,31],[41,0,27,28],[46,0,27,40]],[[4,0,28,4],[12,0,28,11],[14,0,28,11],[17,0,8,26],[19,0,28,11],[22,0,28,30],[24,0,28,30],[27,0,7,26]],[[4,0,29,4],[11,0,29,11],[19,0,29,20],[33,0,29,33],[36,0,29,36]],[],[[2,0,33,2],[18,0,33,9],[37,0,33,31],[41,0,33,28],[46,0,33,40]],[[4,0,34,4],[12,0,34,11],[14,0,34,11],[17,0,10,26],[19,0,34,11],[22,0,34,30],[24,0,34,30],[27,0,9,26]],[[4,0,35,4],[11,0,35,11],[19,0,35,20],[33,0,35,33],[36,0,35,36]],[],[[2,0,39,2],[18,0,39,9],[37,0,39,31],[43,0,39,28],[48,0,39,44]],[[4,0,40,4],[12,0,40,11],[16,0,40,15],[19,0,40,11],[22,0,40,21]],[[4,0,41,4],[11,0,41,11],[19,0,41,20],[35,0,41,35]],[],[[2,0,51,2],[18,0,51,9],[31,0,51,25],[35,0,51,22],[38,0,51,36],[42,0,51,33],[47,0,51,45]],[[4,0,52,14],[10,0,52,10],[14,0,52,14],[22,0,52,30],[25,0,52,33],[27,0,52,33],[29,0,52,37]],[[4,0,54,4],[11,0,54,17],[13,0,54,20],[17,0,54,24]],[],[[2,0,63,2],[18,0,63,9],[33,0,63,27],[39,0,63,24],[44,0,63,40]],[[4,0,64,4],[11,0,64,11],[18,0,64,27],[20,0,64,27],[22,0,64,44]],[],[[2,0,68,2],[18,0,68,9],[30,0,68,24],[34,0,68,21],[39,0,68,33]],[[4,0,69,11],[10,0,69,8],[14,0,69,37]],[[4,0,70,15],[8,0,70,8],[15,0,70,15]],[[4,0,71,4],[7,0,71,8],[9,0,71,8],[11,0,71,12]],[[8,0,72,6],[13,0,72,6],[15,0,72,13]],[[13,0,74,9],[16,0,74,13],[18,0,74,13],[20,0,74,17]],[[8,0,75,6],[10,0,75,6],[12,0,75,23]],[[8,0,76,6],[13,0,76,6],[15,0,76,13]],[[13,0,78,9],[16,0,78,13],[18,0,78,13],[20,0,78,17]],[[8,0,79,6],[10,0,79,6],[12,0,79,23]],[[8,0,80,6],[13,0,80,6],[15,0,80,13]],[],[[8,0,83,6],[10,0,83,6],[12,0,83,23]],[[8,0,84,6],[13,0,84,6],[15,0,84,13]],[],[[4,0,86,4],[11,0,86,11],[13,0,86,11],[15,0,86,15],[23,0,86,24],[37,0,86,37],[40,0,86,40]],[],[[2,0,96,2],[18,0,96,9],[27,0,96,23],[33,0,96,18],[40,0,96,36]],[[4,0,97,12],[8,0,97,8],[12,0,97,12],[16,0,97,16]],[[4,0,99,16],[10,0,99,8],[19,0,99,42]],[[4,0,101,4],[7,0,101,8],[9,0,101,8],[11,0,101,12]],[[8,0,102,6],[15,0,102,6],[17,0,102,15],[25,0,102,24],[39,0,102,37],[42,0,102,40]],[[13,0,104,9],[16,0,104,13],[18,0,104,13],[20,0,104,17]],[[8,0,105,6],[15,0,105,6],[17,0,105,28],[23,0,105,15],[25,0,105,36],[33,0,105,45],[47,0,105,58],[50,0,105,61]],[[13,0,107,9],[16,0,107,13],[18,0,107,13],[20,0,107,17]],[[8,0,108,6],[15,0,108,6],[17,0,108,28],[23,0,108,15],[25,0,108,36],[33,0,108,45],[47,0,108,58],[50,0,108,61]],[[13,0,110,9],[16,0,110,13],[18,0,110,13],[20,0,110,17]],[[8,0,111,6],[15,0,111,6],[17,0,111,28],[23,0,111,15],[25,0,111,36],[33,0,111,45],[47,0,111,58],[50,0,111,61]],[],[[8,0,115,6],[16,0,115,13]],[],[[4,0,118,4],[11,0,118,11],[18,0,118,11],[20,0,118,20]],[],[[2,0,127,2],[18,0,127,9],[29,0,127,25],[35,0,127,20],[40,0,127,42],[44,0,127,37],[51,0,127,51]],[[4,0,128,11],[8,0,128,8],[12,0,128,20]],[[4,0,129,13],[10,0,129,8],[16,0,129,39]],[[4,0,130,17],[8,0,130,8],[18,0,130,26]],[[4,0,131,18],[10,0,131,10],[19,0,131,37],[23,0,131,42],[29,0,131,47],[33,0,131,47],[35,0,131,53]],[[4,0,133,4],[7,0,133,8],[14,0,133,8],[17,0,133,31]],[[8,0,134,6],[10,0,134,6],[12,0,134,10],[20,0,134,19],[36,0,134,40],[40,0,134,45],[44,0,134,45],[46,0,134,51],[50,0,134,55],[54,0,134,55],[56,0,134,61]],[[8,0,135,6],[12,0,135,6],[14,0,135,18],[18,0,135,23],[22,0,135,27],[24,0,135,27],[26,0,135,32]],[[8,0,136,6],[16,0,136,6],[18,0,136,16],[22,0,136,16],[24,0,136,22],[26,0,136,16],[28,0,136,27]],[[13,0,138,9],[16,0,138,13],[23,0,138,13],[26,0,138,36]],[[8,0,139,6],[10,0,139,6],[12,0,139,10],[20,0,139,19],[36,0,139,40],[40,0,139,45],[44,0,139,45],[46,0,139,51],[50,0,139,55],[54,0,139,55],[56,0,139,61]],[[8,0,140,6],[12,0,140,6],[14,0,140,18],[18,0,140,23],[22,0,140,23],[24,0,140,29],[28,0,140,33],[32,0,140,33],[34,0,140,39],[36,0,140,33],[38,0,140,44]],[[8,0,141,6],[16,0,141,6],[18,0,141,16],[22,0,141,16],[24,0,141,22],[26,0,141,16],[28,0,141,27]],[[13,0,143,9],[16,0,143,13],[23,0,143,13],[26,0,143,36]],[[8,0,144,6],[10,0,144,6],[12,0,144,10],[20,0,144,19],[36,0,144,40],[40,0,144,45],[44,0,144,45],[46,0,144,51],[50,0,144,55],[54,0,144,55],[56,0,144,61]],[[8,0,145,6],[12,0,145,6],[14,0,145,18],[18,0,145,23],[22,0,145,23],[24,0,145,29],[28,0,145,33],[32,0,145,33],[34,0,145,39],[36,0,145,33],[38,0,145,44]],[[8,0,146,6],[16,0,146,6],[18,0,146,16],[22,0,146,16],[24,0,146,22],[26,0,146,16],[28,0,146,27]],[],[[8,0,148,6],[10,0,148,6],[12,0,148,10],[20,0,148,19],[36,0,148,40],[40,0,148,45],[46,0,148,50],[50,0,148,50],[52,0,148,56]],[[8,0,149,6],[12,0,149,6],[14,0,149,18],[18,0,149,23],[22,0,149,23],[24,0,149,29],[28,0,149,33],[32,0,149,33],[34,0,149,39],[36,0,149,33],[38,0,149,44]],[[8,0,150,6],[16,0,150,6],[18,0,150,16],[22,0,150,16],[24,0,150,22],[26,0,150,16],[28,0,150,27]],[],[[4,0,153,4],[11,0,153,11],[12,0,153,19],[17,0,153,33]],[],[]]
1
+ [[],[[7,0,12,24]],[[2,0,13,8],[8,0,13,2]],[[2,0,14,11],[6,0,14,2]],[],[],[[8,0,27,13]],[[2,0,36,2],[18,0,36,9],[38,0,36,32],[44,0,36,29],[47,0,36,47],[51,0,36,44],[56,0,36,56]],[[4,0,37,14],[8,0,37,10],[12,0,37,14],[16,0,37,18]],[[4,0,38,4],[12,0,38,11],[14,0,38,11],[16,0,38,15],[18,0,38,11],[21,0,38,20]],[[4,0,39,4],[11,0,39,11],[13,0,39,11],[15,0,39,15]],[],[[2,0,50,2],[18,0,50,9],[37,0,50,31],[41,0,50,28],[46,0,50,40]],[[4,0,51,4],[12,0,51,11],[14,0,51,11],[17,0,8,26],[19,0,51,11],[22,0,51,30],[24,0,51,30],[27,0,7,26]],[[4,0,52,4],[11,0,52,11],[19,0,52,20],[33,0,52,33],[36,0,52,36]],[],[[2,0,62,2],[18,0,62,9],[37,0,62,31],[41,0,62,28],[46,0,62,40]],[[4,0,63,4],[12,0,63,11],[14,0,63,11],[17,0,10,26],[19,0,63,11],[22,0,63,30],[24,0,63,30],[27,0,9,26]],[[4,0,64,4],[11,0,64,11],[19,0,64,20],[33,0,64,33],[36,0,64,36]],[],[[2,0,74,2],[18,0,74,9],[37,0,74,31],[43,0,74,28],[48,0,74,44]],[[4,0,75,4],[12,0,75,11],[16,0,75,15],[19,0,75,11],[22,0,75,21]],[[4,0,76,4],[11,0,76,11],[19,0,76,20],[35,0,76,35]],[],[[2,0,86,2],[18,0,86,9],[31,0,86,25],[35,0,86,22],[38,0,86,36],[42,0,86,33],[47,0,86,45]],[[4,0,87,14],[10,0,87,10],[14,0,87,14],[22,0,87,30],[25,0,87,33],[27,0,87,33],[29,0,87,37]],[[4,0,89,4],[11,0,89,17],[13,0,89,20],[17,0,89,24]],[],[[2,0,98,2],[18,0,98,9],[33,0,98,27],[39,0,98,24],[44,0,98,40]],[[4,0,99,4],[11,0,99,11],[18,0,99,27],[20,0,99,27],[22,0,99,44]],[],[[2,0,113,2],[18,0,113,9],[30,0,113,24],[34,0,113,21],[39,0,113,33]],[[4,0,114,11],[10,0,114,8],[14,0,114,37]],[[4,0,115,15],[8,0,115,8],[15,0,115,15]],[[4,0,116,4],[7,0,116,8],[9,0,116,8],[11,0,116,12]],[[8,0,117,6],[13,0,117,6],[15,0,117,13]],[[13,0,119,9],[16,0,119,13],[18,0,119,13],[20,0,119,17]],[[8,0,120,6],[10,0,120,6],[12,0,120,23]],[[8,0,121,6],[13,0,121,6],[15,0,121,13]],[[13,0,123,9],[16,0,123,13],[18,0,123,13],[20,0,123,17]],[[8,0,124,6],[10,0,124,6],[12,0,124,23]],[[8,0,125,6],[13,0,125,6],[15,0,125,13]],[],[[8,0,128,6],[10,0,128,6],[12,0,128,23]],[[8,0,129,6],[13,0,129,6],[15,0,129,13]],[],[[4,0,131,4],[11,0,131,11],[13,0,131,11],[15,0,131,15],[23,0,131,24],[37,0,131,37],[40,0,131,40]],[],[[2,0,148,2],[18,0,148,9],[27,0,148,23],[33,0,148,18],[40,0,148,36]],[[4,0,149,14],[8,0,149,10],[12,0,149,14],[16,0,149,18]],[[4,0,150,15],[8,0,150,8],[15,0,150,15]],[[4,0,151,16],[10,0,151,8],[19,0,151,42]],[[4,0,153,4],[7,0,153,8],[9,0,153,8],[11,0,153,12]],[[8,0,154,6],[13,0,154,6],[15,0,154,13]],[[8,0,155,6],[15,0,155,6],[17,0,155,28]],[[13,0,157,9],[16,0,157,13],[18,0,157,13],[20,0,157,17]],[[8,0,158,6],[13,0,158,6],[15,0,158,13]],[[8,0,159,6],[15,0,159,6],[17,0,159,28]],[[13,0,161,9],[16,0,161,13],[18,0,161,13],[20,0,161,17]],[[8,0,162,6],[13,0,162,6],[15,0,162,13]],[[8,0,163,6],[15,0,163,6],[17,0,163,28]],[[13,0,165,9],[16,0,165,13],[18,0,165,13],[20,0,165,17]],[[8,0,166,6],[13,0,166,6],[15,0,166,13]],[[8,0,167,6],[15,0,167,6],[17,0,167,28]],[],[[8,0,171,6],[16,0,171,13]],[],[[4,0,174,4],[11,0,174,11],[18,0,174,11],[20,0,174,20],[28,0,174,29],[42,0,174,42],[45,0,174,45]],[],[[2,0,183,2],[18,0,183,9],[29,0,183,25],[35,0,183,20],[40,0,183,42],[44,0,183,37],[51,0,183,51]],[[4,0,184,11],[8,0,184,8],[12,0,184,20]],[[4,0,185,13],[10,0,185,8],[16,0,185,39]],[[4,0,186,17],[8,0,186,8],[18,0,186,26]],[[4,0,187,18],[10,0,187,10],[19,0,187,37],[23,0,187,42],[29,0,187,47],[33,0,187,47],[35,0,187,53]],[[4,0,189,4],[7,0,189,8],[14,0,189,8],[17,0,189,31]],[[8,0,190,6],[10,0,190,6],[12,0,190,10],[20,0,190,19],[36,0,190,40],[40,0,190,45],[44,0,190,45],[46,0,190,51],[50,0,190,55],[54,0,190,55],[56,0,190,61]],[[8,0,191,6],[12,0,191,6],[14,0,191,18],[18,0,191,23],[22,0,191,27],[24,0,191,27],[26,0,191,32]],[[8,0,192,6],[16,0,192,6],[18,0,192,16],[22,0,192,16],[24,0,192,22],[26,0,192,16],[28,0,192,27]],[[13,0,194,9],[16,0,194,13],[23,0,194,13],[26,0,194,36]],[[8,0,195,6],[10,0,195,6],[12,0,195,10],[20,0,195,19],[36,0,195,40],[40,0,195,45],[44,0,195,45],[46,0,195,51],[50,0,195,55],[54,0,195,55],[56,0,195,61]],[[8,0,196,6],[12,0,196,6],[14,0,196,18],[18,0,196,23],[22,0,196,23],[24,0,196,29],[28,0,196,33],[32,0,196,33],[34,0,196,39],[36,0,196,33],[38,0,196,44]],[[8,0,197,6],[16,0,197,6],[18,0,197,16],[22,0,197,16],[24,0,197,22],[26,0,197,16],[28,0,197,27]],[[13,0,199,9],[16,0,199,13],[23,0,199,13],[26,0,199,36]],[[8,0,200,6],[10,0,200,6],[12,0,200,10],[20,0,200,19],[36,0,200,40],[40,0,200,45],[44,0,200,45],[46,0,200,51],[50,0,200,55],[54,0,200,55],[56,0,200,61]],[[8,0,201,6],[12,0,201,6],[14,0,201,18],[18,0,201,23],[22,0,201,23],[24,0,201,29],[28,0,201,33],[32,0,201,33],[34,0,201,39],[36,0,201,33],[38,0,201,44]],[[8,0,202,6],[16,0,202,6],[18,0,202,16],[22,0,202,16],[24,0,202,22],[26,0,202,16],[28,0,202,27]],[],[[8,0,204,6],[10,0,204,6],[12,0,204,10],[20,0,204,19],[36,0,204,40],[40,0,204,45],[46,0,204,50],[50,0,204,50],[52,0,204,56]],[[8,0,205,6],[12,0,205,6],[14,0,205,18],[18,0,205,23],[22,0,205,23],[24,0,205,29],[28,0,205,33],[32,0,205,33],[34,0,205,39],[36,0,205,33],[38,0,205,44]],[[8,0,206,6],[16,0,206,6],[18,0,206,16],[22,0,206,16],[24,0,206,22],[26,0,206,16],[28,0,206,27]],[],[[4,0,209,4],[11,0,209,11],[12,0,209,19],[17,0,209,33]],[],[]]
@@ -48,19 +48,24 @@ library StdUtils {
48
48
  }
49
49
  static function pushData(bytes buf) : bytes {
50
50
  int n = len(buf);
51
+ int size = 0;
51
52
  bytes header = b'';
52
53
  if(n < 0x4c) {
53
- header = StdUtils.toLEUnsigned(n, 1);
54
+ size = 1;
55
+ header = b'';
54
56
  } else if(n < 0x100) {
55
- header = b'4c' + StdUtils.toLEUnsigned(n, 1);
57
+ size = 1;
58
+ header = b'4c';
56
59
  } else if(n < 0x10000) {
57
- header = b'4d' + StdUtils.toLEUnsigned(n, 2);
60
+ size = 2;
61
+ header = b'4d';
58
62
  } else if(n < 0x100000000) {
59
- header = b'4e' + StdUtils.toLEUnsigned(n, 4);
63
+ size = 4;
64
+ header = b'4e';
60
65
  } else {
61
66
  require(false);
62
67
  }
63
- return header + buf;
68
+ return header + StdUtils.toLEUnsigned(n, size);
64
69
  }
65
70
  static function readVarint(bytes buf, int pos) : ReadVarintResult {
66
71
  int l = 0;
@@ -1 +1 @@
1
- [[],[],[],[],[[8,0,29,13]],[[2,0,32,2],[9,0,32,9],[15,0,32,29],[19,0,32,18],[31,0,32,38]],[[2,0,41,2],[18,0,41,9],[30,0,41,33],[36,0,41,21],[48,0,41,55],[52,0,41,45],[64,0,41,64]],[[4,0,42,4],[11,0,42,11],[18,0,42,19],[35,0,42,35],[47,0,42,47],[57,0,42,57],[64,0,42,77]],[],[[2,0,53,2],[18,0,53,9],[34,0,53,37],[40,0,53,25],[52,0,53,59],[56,0,53,49],[66,0,53,77],[72,0,53,67],[84,0,53,90]],[[4,0,54,26],[8,0,54,10],[24,0,54,26],[28,0,54,30]],[[4,0,55,24],[8,0,55,10],[22,0,55,24],[26,0,55,28]],[[4,0,57,4],[12,0,57,11],[26,0,57,11],[29,0,57,28]],[[4,0,58,4],[12,0,58,11],[24,0,58,11],[27,0,58,26]],[[4,0,59,4],[12,0,59,11],[21,0,59,11],[24,0,59,23]],[[4,0,60,4],[11,0,60,11],[19,0,60,27],[29,0,60,37],[32,0,60,11],[34,0,60,43],[45,0,60,11],[47,0,60,56]],[],[[2,0,69,2],[18,0,69,9],[36,0,69,35],[42,0,69,27],[52,0,69,43]],[[4,0,70,4],[11,0,70,11],[17,0,70,18],[27,0,70,11],[29,0,70,29],[33,0,71,8],[40,0,71,16],[57,0,71,32],[63,0,71,39],[76,0,71,51],[82,0,71,58],[93,0,71,68],[99,0,71,75],[112,0,72,21]],[],[[2,0,81,2],[18,0,81,9],[29,0,81,29],[34,0,81,20],[45,0,81,36]],[[4,0,82,4],[12,0,82,11],[16,0,82,15],[23,0,82,23],[36,0,82,11],[39,0,82,38]],[[4,0,83,4],[12,0,83,11],[16,0,83,15],[23,0,83,23],[36,0,83,11],[39,0,83,38]],[[4,0,84,4],[12,0,85,6],[19,0,85,14],[31,0,85,6],[33,0,86,6],[41,0,86,15],[61,0,86,34],[68,0,86,42],[86,0,85,6],[88,0,87,6],[95,0,87,14],[107,0,85,6],[109,0,88,6],[117,0,88,15],[137,0,88,34],[144,0,88,42]],[],[[2,0,98,2],[18,0,98,9],[38,0,98,35],[44,0,98,29],[52,0,98,48]],[[4,0,99,19],[10,0,99,10],[19,0,99,32],[25,0,99,19],[27,0,99,40],[32,0,99,56],[36,0,99,60],[43,0,99,19],[45,0,99,69]],[[4,0,100,4],[11,0,100,11],[18,0,100,19],[40,0,32,38],[43,0,100,11],[45,0,100,61],[52,0,100,68],[60,0,100,11],[62,0,100,78],[69,0,100,98]],[],[[2,0,109,2],[18,0,109,9],[35,0,109,32],[45,0,109,26],[53,0,109,39]],[[4,0,110,4],[12,0,111,19],[18,0,111,26],[26,0,111,6],[28,0,112,19],[34,0,112,26],[46,0,111,6],[48,0,113,6],[53,0,113,22],[57,0,111,6],[59,0,114,6],[64,0,111,6],[66,0,115,19],[72,0,115,26],[88,0,111,6],[90,0,116,19],[96,0,116,26]],[],[[2,0,127,2],[18,0,127,9],[35,0,127,34],[39,0,127,26],[47,0,127,48],[57,0,127,42],[63,0,127,64],[69,0,127,54],[81,0,127,77]],[[4,0,128,4],[11,0,128,11],[18,0,128,19],[35,0,128,35],[42,0,128,42],[49,0,128,50],[67,0,128,67],[75,0,128,75],[83,0,128,83]],[],[[2,0,137,2],[18,0,137,9],[38,0,137,35],[44,0,137,29],[52,0,137,48]],[[4,0,138,4],[11,0,138,24],[17,0,138,31],[27,0,138,11],[29,0,138,56],[35,0,138,63],[46,0,138,11],[48,0,138,76],[56,0,138,85],[66,0,138,94]],[],[[2,0,147,2],[18,0,147,9],[39,0,147,33],[43,0,147,30],[48,0,147,42]],[[4,0,148,4],[11,0,148,11],[19,0,148,20],[39,0,148,39]],[],[]]
1
+ [[],[],[],[],[[8,0,25,13]],[[2,0,28,2],[9,0,28,9],[15,0,28,29],[19,0,28,18],[31,0,28,38]],[[2,0,37,2],[18,0,37,9],[30,0,37,33],[36,0,37,21],[48,0,37,55],[52,0,37,45],[64,0,37,64]],[[4,0,38,4],[11,0,38,11],[18,0,38,19],[35,0,38,35],[47,0,38,47],[57,0,38,57],[64,0,38,77]],[],[[2,0,49,2],[18,0,49,9],[34,0,49,37],[40,0,49,25],[52,0,49,59],[56,0,49,49],[66,0,49,77],[72,0,49,67],[84,0,49,90]],[[4,0,50,26],[8,0,50,10],[24,0,50,26],[28,0,50,30]],[[4,0,51,24],[8,0,51,10],[22,0,51,24],[26,0,51,28]],[[4,0,53,4],[12,0,53,11],[26,0,53,11],[29,0,53,28]],[[4,0,54,4],[12,0,54,11],[24,0,54,11],[27,0,54,26]],[[4,0,55,4],[12,0,55,11],[21,0,55,11],[24,0,55,23]],[[4,0,56,4],[11,0,56,11],[18,0,56,19],[40,0,56,40],[50,0,56,11],[52,0,56,52],[63,0,56,11],[65,0,56,65]],[],[[2,0,65,2],[18,0,65,9],[36,0,65,35],[42,0,65,27],[52,0,65,43]],[[4,0,66,4],[11,0,66,11],[17,0,66,18],[27,0,66,11],[29,0,66,29],[33,0,67,8],[40,0,67,16],[57,0,67,32],[63,0,67,39],[76,0,67,51],[82,0,67,58],[93,0,67,68],[99,0,67,75],[112,0,68,21]],[],[[2,0,77,2],[18,0,77,9],[29,0,77,29],[34,0,77,20],[45,0,77,36]],[[4,0,78,4],[12,0,78,11],[16,0,78,15],[23,0,78,23],[36,0,78,11],[39,0,78,38]],[[4,0,79,4],[12,0,79,11],[16,0,79,15],[23,0,79,23],[36,0,79,11],[39,0,79,38]],[[4,0,80,4],[12,0,81,6],[19,0,81,14],[31,0,81,6],[33,0,82,6],[41,0,82,15],[61,0,82,34],[68,0,82,42],[86,0,81,6],[88,0,83,6],[95,0,83,14],[107,0,81,6],[109,0,84,6],[117,0,84,15],[137,0,84,34],[144,0,84,42]],[],[[2,0,94,2],[18,0,94,9],[38,0,94,35],[44,0,94,29],[52,0,94,48]],[[4,0,95,19],[10,0,95,10],[19,0,95,32],[25,0,95,19],[27,0,95,40],[32,0,95,56],[36,0,95,60],[43,0,95,19],[45,0,95,69]],[[4,0,96,4],[11,0,96,11],[18,0,96,19],[40,0,28,38],[43,0,96,11],[45,0,96,61],[52,0,96,68],[60,0,96,11],[62,0,96,78],[69,0,96,98]],[],[[2,0,105,2],[18,0,105,9],[35,0,105,32],[45,0,105,26],[53,0,105,39]],[[4,0,106,4],[12,0,107,19],[18,0,107,26],[26,0,107,6],[28,0,108,19],[34,0,108,26],[46,0,107,6],[48,0,109,6],[53,0,109,22],[57,0,107,6],[59,0,110,6],[64,0,107,6],[66,0,111,19],[72,0,111,26],[88,0,107,6],[90,0,112,19],[96,0,112,26]],[],[[2,0,123,2],[18,0,123,9],[35,0,123,34],[39,0,123,26],[47,0,123,48],[57,0,123,42],[65,0,123,55]],[[4,0,124,4],[11,0,124,11],[18,0,124,19],[35,0,124,35],[42,0,124,42],[49,0,124,50],[67,0,124,67],[75,0,124,75],[83,0,124,83],[90,0,124,103]],[],[[2,0,133,2],[18,0,133,9],[38,0,133,35],[44,0,133,29],[52,0,133,48]],[[4,0,134,4],[11,0,134,24],[17,0,134,31],[27,0,134,11],[29,0,134,56],[35,0,134,63],[46,0,134,11],[48,0,134,76],[56,0,134,85],[66,0,134,94]],[],[[2,0,143,2],[18,0,143,9],[39,0,143,33],[43,0,143,30],[48,0,143,42]],[[4,0,144,4],[11,0,144,11],[19,0,144,20],[39,0,144,39]],[],[[2,0,153,2],[18,0,153,9],[39,0,153,34],[45,0,153,30],[51,0,153,47]],[[4,0,154,4],[12,0,154,11],[16,0,154,15],[20,0,154,11],[23,0,154,22]],[[4,0,155,4],[11,0,155,11],[19,0,155,20],[35,0,155,35]],[],[]]
@@ -13,7 +13,7 @@ library TxUtils {
13
13
  require(scriptHashLen == 32);
14
14
  require(dataHashLen == 32);
15
15
  require(satoshis >= 0);
16
- return num2bin(satoshis, 8) + scriptHash + dataHash;
16
+ return TxUtils.satoshisToByteString(satoshis) + scriptHash + dataHash;
17
17
  }
18
18
  static function buildChangeOutput(TxOut change) : bytes {
19
19
  return change.satoshis > 0 ? TxUtils.buildDataOutput(change.scriptHash, change.satoshis, change.dataHash) : b'';
@@ -30,8 +30,8 @@ library TxUtils {
30
30
  static function buildP2PKHScript(Ripemd160 addr) : bytes {
31
31
  return (OpCode.OP_DUP + OpCode.OP_HASH160 + pack(20) + addr + OpCode.OP_EQUALVERIFY + OpCode.OP_CHECKSIG);
32
32
  }
33
- static function buildP2PKHOutput(int amount, Ripemd160 addr, bytes dataHash) : bytes {
34
- return TxUtils.buildDataOutput(sha256(TxUtils.buildP2PKHScript(addr)), amount, dataHash);
33
+ static function buildP2PKHOutput(int amount, Ripemd160 addr) : bytes {
34
+ return TxUtils.buildDataOutput(sha256(TxUtils.buildP2PKHScript(addr)), amount, sha256(b''));
35
35
  }
36
36
  static function buildOpreturnScript(bytes data) : bytes {
37
37
  return OpCode.OP_FALSE + OpCode.OP_RETURN + StdUtils.pushData(data);
@@ -39,4 +39,8 @@ library TxUtils {
39
39
  static function satoshisToByteString(int n) : bytes {
40
40
  return StdUtils.uint64ToByteString(n);
41
41
  }
42
+ static function byteStringToSatoshis(bytes bs) : int {
43
+ require(len(bs) == 8);
44
+ return StdUtils.fromLEUnsigned(bs);
45
+ }
42
46
  }
@@ -4,17 +4,17 @@ import "stdUtils.scrypt";
4
4
 
5
5
 
6
6
 
7
- library _opcat_labs_scrypt_ts_opcat_1_0_0__rs__TxHashPreimageUtils {
8
- static function getTxHashFromTxHashPreimage(_opcat_labs_scrypt_ts_opcat_1_0_0__rs__TxHashPreimage txHashPreimage) : bytes {
7
+ library _opcat_labs_scrypt_ts_opcat_1_0_2__rs__TxHashPreimageUtils {
8
+ static function getTxHashFromTxHashPreimage(_opcat_labs_scrypt_ts_opcat_1_0_2__rs__TxHashPreimage txHashPreimage) : bytes {
9
9
  require(len(txHashPreimage.version) == 4);
10
- int inputCount = _opcat_labs_scrypt_ts_opcat_1_0_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.inputList, 72);
11
- int outputCount = _opcat_labs_scrypt_ts_opcat_1_0_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.outputList, 72);
12
- return hash256(txHashPreimage.version + _opcat_labs_scrypt_ts_opcat_1_0_0__rs__StdUtils.writeVarInt(inputCount) + txHashPreimage.inputList + _opcat_labs_scrypt_ts_opcat_1_0_0__rs__StdUtils.writeVarInt(outputCount) + txHashPreimage.outputList + txHashPreimage.nLockTime);
10
+ int inputCount = _opcat_labs_scrypt_ts_opcat_1_0_2__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.inputList, 72);
11
+ int outputCount = _opcat_labs_scrypt_ts_opcat_1_0_2__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.outputList, 72);
12
+ return hash256(txHashPreimage.version + _opcat_labs_scrypt_ts_opcat_1_0_2__rs__StdUtils.writeVarInt(inputCount) + txHashPreimage.inputList + _opcat_labs_scrypt_ts_opcat_1_0_2__rs__StdUtils.writeVarInt(outputCount) + txHashPreimage.outputList + txHashPreimage.nLockTime);
13
13
  }
14
- static function getInputByteString(_opcat_labs_scrypt_ts_opcat_1_0_0__rs__TxHashPreimage txHashPreimage, int inputIndex) : bytes {
14
+ static function getInputByteString(_opcat_labs_scrypt_ts_opcat_1_0_2__rs__TxHashPreimage txHashPreimage, int inputIndex) : bytes {
15
15
  return txHashPreimage.inputList[inputIndex * 72 : (inputIndex + 1) * 72];
16
16
  }
17
- static function getOutputByteString(_opcat_labs_scrypt_ts_opcat_1_0_0__rs__TxHashPreimage txHashPreimage, int outputIndex) : bytes {
17
+ static function getOutputByteString(_opcat_labs_scrypt_ts_opcat_1_0_2__rs__TxHashPreimage txHashPreimage, int outputIndex) : bytes {
18
18
  return txHashPreimage.outputList[outputIndex * 72 : (outputIndex + 1) * 72];
19
19
  }
20
20
  }