@opcat-labs/opcat 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.yaml +3 -0
- package/index.d.ts +1541 -0
- package/index.js +74 -0
- package/lib/address.js +478 -0
- package/lib/block/block.js +277 -0
- package/lib/block/blockheader.js +295 -0
- package/lib/block/index.js +4 -0
- package/lib/block/merkleblock.js +323 -0
- package/lib/bn.js +3423 -0
- package/lib/crypto/bn.js +278 -0
- package/lib/crypto/ecdsa.js +339 -0
- package/lib/crypto/hash.browser.js +171 -0
- package/lib/crypto/hash.js +2 -0
- package/lib/crypto/hash.node.js +171 -0
- package/lib/crypto/point.js +221 -0
- package/lib/crypto/random.browser.js +28 -0
- package/lib/crypto/random.js +2 -0
- package/lib/crypto/random.node.js +11 -0
- package/lib/crypto/signature.js +325 -0
- package/lib/encoding/base58.js +111 -0
- package/lib/encoding/base58check.js +121 -0
- package/lib/encoding/bufferreader.js +212 -0
- package/lib/encoding/bufferwriter.js +140 -0
- package/lib/encoding/decode-asm.js +24 -0
- package/lib/encoding/decode-hex.js +32 -0
- package/lib/encoding/decode-script-chunks.js +43 -0
- package/lib/encoding/encode-hex.js +284 -0
- package/lib/encoding/is-hex.js +7 -0
- package/lib/encoding/varint.js +75 -0
- package/lib/errors/index.js +54 -0
- package/lib/errors/spec.js +314 -0
- package/lib/hash-cache.js +50 -0
- package/lib/hdprivatekey.js +678 -0
- package/lib/hdpublickey.js +525 -0
- package/lib/message/message.js +191 -0
- package/lib/mnemonic/mnemonic.js +303 -0
- package/lib/mnemonic/pbkdf2.browser.js +68 -0
- package/lib/mnemonic/pbkdf2.js +2 -0
- package/lib/mnemonic/pbkdf2.node.js +68 -0
- package/lib/mnemonic/words/chinese.js +2054 -0
- package/lib/mnemonic/words/english.js +2054 -0
- package/lib/mnemonic/words/french.js +2054 -0
- package/lib/mnemonic/words/index.js +8 -0
- package/lib/mnemonic/words/italian.js +2054 -0
- package/lib/mnemonic/words/japanese.js +2054 -0
- package/lib/mnemonic/words/spanish.js +2054 -0
- package/lib/networks.js +379 -0
- package/lib/opcode.js +255 -0
- package/lib/privatekey.js +374 -0
- package/lib/publickey.js +386 -0
- package/lib/script/index.js +5 -0
- package/lib/script/interpreter.js +1834 -0
- package/lib/script/script.js +1074 -0
- package/lib/script/stack.js +109 -0
- package/lib/script/write-i32-le.js +17 -0
- package/lib/script/write-push-data.js +35 -0
- package/lib/script/write-u16-le.js +12 -0
- package/lib/script/write-u32-le.js +16 -0
- package/lib/script/write-u64-le.js +24 -0
- package/lib/script/write-u8-le.js +8 -0
- package/lib/script/write-varint.js +46 -0
- package/lib/transaction/index.js +7 -0
- package/lib/transaction/input/index.js +5 -0
- package/lib/transaction/input/input.js +354 -0
- package/lib/transaction/input/multisig.js +242 -0
- package/lib/transaction/input/publickey.js +100 -0
- package/lib/transaction/input/publickeyhash.js +118 -0
- package/lib/transaction/output.js +231 -0
- package/lib/transaction/sighash.js +167 -0
- package/lib/transaction/signature.js +97 -0
- package/lib/transaction/transaction.js +1639 -0
- package/lib/transaction/unspentoutput.js +113 -0
- package/lib/util/_.js +47 -0
- package/lib/util/js.js +90 -0
- package/lib/util/preconditions.js +33 -0
- package/package.json +26 -0
- package/test/address.js +509 -0
- package/test/block/block.js +251 -0
- package/test/block/blockheader.js +275 -0
- package/test/block/merklebloack.js +211 -0
- package/test/crypto/bn.js +177 -0
- package/test/crypto/ecdsa.js +391 -0
- package/test/crypto/hash.browser.js +135 -0
- package/test/crypto/hash.js +136 -0
- package/test/crypto/point.js +224 -0
- package/test/crypto/random.js +32 -0
- package/test/crypto/signature.js +409 -0
- package/test/data/bip69.json +215 -0
- package/test/data/bitcoind/base58_keys_invalid.json +52 -0
- package/test/data/bitcoind/base58_keys_valid.json +335 -0
- package/test/data/bitcoind/blocks.json +22 -0
- package/test/data/bitcoind/script_tests.json +3822 -0
- package/test/data/bitcoind/sig_canonical.json +7 -0
- package/test/data/bitcoind/sig_noncanonical.json +36 -0
- package/test/data/bitcoind/tx_invalid.json +445 -0
- package/test/data/bitcoind/tx_valid.json +44 -0
- package/test/data/blk86756-testnet.dat +0 -0
- package/test/data/blk86756-testnet.js +14 -0
- package/test/data/blk86756-testnet.json +684 -0
- package/test/data/block.hex +1 -0
- package/test/data/ecdsa.json +230 -0
- package/test/data/merkleblocks.js +488 -0
- package/test/data/messages.json +22 -0
- package/test/data/sighash.json +12 -0
- package/test/data/tx_creation.json +95 -0
- package/test/encoding/base58.js +131 -0
- package/test/encoding/base58check.js +136 -0
- package/test/encoding/bufferreader.js +337 -0
- package/test/encoding/bufferwriter.js +172 -0
- package/test/encoding/varint.js +104 -0
- package/test/hashCache.js +67 -0
- package/test/hdkeys.js +445 -0
- package/test/hdprivatekey.js +332 -0
- package/test/hdpublickey.js +304 -0
- package/test/index.js +16 -0
- package/test/message/message.js +204 -0
- package/test/mnemonic/data/fixtures.json +300 -0
- package/test/mnemonic/mnemonic.js +259 -0
- package/test/mnemonic/mocha.opts +1 -0
- package/test/mnemonic/pbkdf2.test.js +59 -0
- package/test/networks.js +159 -0
- package/test/opcode.js +161 -0
- package/test/privatekey.js +439 -0
- package/test/publickey.js +554 -0
- package/test/script/interpreter.js +734 -0
- package/test/script/script.js +1437 -0
- package/test/transaction/deserialize.js +34 -0
- package/test/transaction/input/input.js +90 -0
- package/test/transaction/input/multisig.js +90 -0
- package/test/transaction/input/publickey.js +68 -0
- package/test/transaction/input/publickeyhash.js +51 -0
- package/test/transaction/output.js +185 -0
- package/test/transaction/sighash.js +65 -0
- package/test/transaction/signature.js +114 -0
- package/test/transaction/transaction.js +1109 -0
- package/test/transaction/unspentoutput.js +110 -0
- package/test/util/js.js +76 -0
- package/test/util/preconditions.js +79 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0000002026f7e50543e9ee2bfdab161b7bc434d5de42f3d7ca58270faf1a61256c247a2079b3053ae552b1f4e6767371fba2e17e5d0809b0e0d89593615165f684b56c9f71d03f68ffff7f20010000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0c510101082f454233322e302fffffffff0100f2052a010000001976a914fff49bb07d131b98555c1162332307f1aff41fc488ac0000000000
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
{
|
|
2
|
+
"valid": [
|
|
3
|
+
{
|
|
4
|
+
"d": "01",
|
|
5
|
+
"k": "ec633bd56a5774a0940cb97e27a9e4e51dc94af737596a0c5cbb3d30332d92a5",
|
|
6
|
+
"message": "Everything should be made as simple as possible, but not simpler.",
|
|
7
|
+
"i": 0,
|
|
8
|
+
"signature": {
|
|
9
|
+
"r": "23362334225185207751494092901091441011938859014081160902781146257181456271561",
|
|
10
|
+
"s": "50433721247292933944369538617440297985091596895097604618403996029256432099938"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"d": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
|
|
15
|
+
"k": "9dc74cbfd383980fb4ae5d2680acddac9dac956dca65a28c80ac9c847c2374e4",
|
|
16
|
+
"message": "Equations are more important to me, because politics is for the present, but an equation is something for eternity.",
|
|
17
|
+
"i": 0,
|
|
18
|
+
"signature": {
|
|
19
|
+
"r": "38341707918488238920692284707283974715538935465589664377561695343399725051885",
|
|
20
|
+
"s": "3180566392414476763164587487324397066658063772201694230600609996154610926757"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"d": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
|
|
25
|
+
"k": "fd27071f01648ebbdd3e1cfbae48facc9fa97edc43bbbc9a7fdc28eae13296f5",
|
|
26
|
+
"message": "Not only is the Universe stranger than we think, it is stranger than we can think.",
|
|
27
|
+
"i": 0,
|
|
28
|
+
"signature": {
|
|
29
|
+
"r": "115464191557905790016094131873849783294273568009648050793030031933291767741904",
|
|
30
|
+
"s": "50562520307781850052192542766631199590053690478900449960232079510155113443971"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"d": "0000000000000000000000000000000000000000000000000000000000000001",
|
|
35
|
+
"k": "f0cd2ba5fc7c183de589f6416220a36775a146740798756d8d949f7166dcc87f",
|
|
36
|
+
"message": "How wonderful that we have met with a paradox. Now we have some hope of making progress.",
|
|
37
|
+
"i": 1,
|
|
38
|
+
"signature": {
|
|
39
|
+
"r": "87230998027579607140680851455601772643840468630989315269459846730712163783123",
|
|
40
|
+
"s": "53231320085894623106179381504478252331065330583563809963303318469380290929875"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"d": "69ec59eaa1f4f2e36b639716b7c30ca86d9a5375c7b38d8918bd9c0ebc80ba64",
|
|
45
|
+
"k": "6bb4a594ad57c1aa22dbe991a9d8501daf4688bf50a4892ef21bd7c711afda97",
|
|
46
|
+
"message": "Computer science is no more about computers than astronomy is about telescopes.",
|
|
47
|
+
"i": 0,
|
|
48
|
+
"signature": {
|
|
49
|
+
"r": "51348483531757779992459563033975330355971795607481991320287437101831125115997",
|
|
50
|
+
"s": "6277080015686056199074771961940657638578000617958603212944619747099038735862"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"d": "00000000000000000000000000007246174ab1e92e9149c6e446fe194d072637",
|
|
55
|
+
"k": "097b5c8ee22c3ea78a4d3635e0ff6fe85a1eb92ce317ded90b9e71aab2b861cb",
|
|
56
|
+
"message": "...if you aren't, at any given time, scandalized by code you wrote five or even three years ago, you're not learning anywhere near enough",
|
|
57
|
+
"i": 1,
|
|
58
|
+
"signature": {
|
|
59
|
+
"r": "113979859486826658566290715281614250298918272782414232881639314569529560769671",
|
|
60
|
+
"s": "6517071009538626957379450615706485096874328019806177698938278220732027419959"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"d": "000000000000000000000000000000000000000000056916d0f9b31dc9b637f3",
|
|
65
|
+
"k": "19355c36c8cbcdfb2382e23b194b79f8c97bf650040fc7728dfbf6b39a97c25b",
|
|
66
|
+
"message": "The question of whether computers can think is like the question of whether submarines can swim.",
|
|
67
|
+
"i": 1,
|
|
68
|
+
"signature": {
|
|
69
|
+
"r": "93122007060065279508564838030979550535085999589142852106617159184757394422777",
|
|
70
|
+
"s": "3078539468410661027472930027406594684630312677495124015420811882501887769839"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"invalid": {
|
|
75
|
+
"sigError": [
|
|
76
|
+
{
|
|
77
|
+
"description": "The wrong signature",
|
|
78
|
+
"exception": "Invalid signature",
|
|
79
|
+
"d": "01",
|
|
80
|
+
"message": "foo",
|
|
81
|
+
"signature": {
|
|
82
|
+
"r": "38341707918488238920692284707283974715538935465589664377561695343399725051885",
|
|
83
|
+
"s": "3180566392414476763164587487324397066658063772201694230600609996154610926757"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"description": "Invalid r value (< 0)",
|
|
88
|
+
"exception": "r and s not in range",
|
|
89
|
+
"d": "01",
|
|
90
|
+
"message": "foo",
|
|
91
|
+
"signature": {
|
|
92
|
+
"r": "-1",
|
|
93
|
+
"s": "2"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"description": "Invalid r value (== 0)",
|
|
98
|
+
"exception": "r and s not in range",
|
|
99
|
+
"d": "01",
|
|
100
|
+
"message": "foo",
|
|
101
|
+
"signature": {
|
|
102
|
+
"r": "0",
|
|
103
|
+
"s": "2"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"description": "Invalid r value (>= n)",
|
|
108
|
+
"exception": "r and s not in range",
|
|
109
|
+
"d": "01",
|
|
110
|
+
"message": "foo",
|
|
111
|
+
"signature": {
|
|
112
|
+
"r": "115792089237316195423570985008687907852837564279074904382605163141518161494337",
|
|
113
|
+
"s": "2"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"description": "Invalid s value (< 0)",
|
|
118
|
+
"exception": "r and s not in range",
|
|
119
|
+
"d": "01",
|
|
120
|
+
"message": "foo",
|
|
121
|
+
"signature": {
|
|
122
|
+
"r": "2",
|
|
123
|
+
"s": "-1"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"description": "Invalid s value (== 0)",
|
|
128
|
+
"exception": "r and s not in range",
|
|
129
|
+
"d": "01",
|
|
130
|
+
"message": "foo",
|
|
131
|
+
"signature": {
|
|
132
|
+
"r": "2",
|
|
133
|
+
"s": "0"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"description": "Invalid s value (>= n)",
|
|
138
|
+
"exception": "r and s not in range",
|
|
139
|
+
"d": "01",
|
|
140
|
+
"message": "foo",
|
|
141
|
+
"signature": {
|
|
142
|
+
"r": "2",
|
|
143
|
+
"s": "115792089237316195423570985008687907852837564279074904382605163141518161494337"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"description": "Invalid r, s values (r = s = -n)",
|
|
148
|
+
"exception": "r and s not in range",
|
|
149
|
+
"d": "01",
|
|
150
|
+
"message": "foo",
|
|
151
|
+
"signature": {
|
|
152
|
+
"r": "-115792089237316195423570985008687907852837564279074904382605163141518161494337",
|
|
153
|
+
"s": "-115792089237316195423570985008687907852837564279074904382605163141518161494337"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"deterministicK": [
|
|
159
|
+
{
|
|
160
|
+
"message": "test data",
|
|
161
|
+
"privkey": "fee0a1f7afebf9d2a5a80c0c98a31c709681cce195cbcd06342b517970c0be1e",
|
|
162
|
+
"k_bad00": "fcce1de7a9bcd6b2d3defade6afa1913fb9229e3b7ddf4749b55c4848b2a196e",
|
|
163
|
+
"k_bad01": "727fbcb59eb48b1d7d46f95a04991fc512eb9dbf9105628e3aec87428df28fd8",
|
|
164
|
+
"k_bad15": "398f0e2c9f79728f7b3d84d447ac3a86d8b2083c8f234a0ffa9c4043d68bd258"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"message": "Everything should be made as simple as possible, but not simpler.",
|
|
168
|
+
"privkey": "0000000000000000000000000000000000000000000000000000000000000001",
|
|
169
|
+
"k_bad00": "ec633bd56a5774a0940cb97e27a9e4e51dc94af737596a0c5cbb3d30332d92a5",
|
|
170
|
+
"k_bad01": "df55b6d1b5c48184622b0ead41a0e02bfa5ac3ebdb4c34701454e80aabf36f56",
|
|
171
|
+
"k_bad15": "def007a9a3c2f7c769c75da9d47f2af84075af95cadd1407393dc1e26086ef87"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"message": "Satoshi Nakamoto",
|
|
175
|
+
"privkey": "0000000000000000000000000000000000000000000000000000000000000002",
|
|
176
|
+
"k_bad00": "d3edc1b8224e953f6ee05c8bbf7ae228f461030e47caf97cde91430b4607405e",
|
|
177
|
+
"k_bad01": "f86d8e43c09a6a83953f0ab6d0af59fb7446b4660119902e9967067596b58374",
|
|
178
|
+
"k_bad15": "241d1f57d6cfd2f73b1ada7907b199951f95ef5ad362b13aed84009656e0254a"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"message": "Diffie Hellman",
|
|
182
|
+
"privkey": "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
|
|
183
|
+
"k_bad00": "c378a41cb17dce12340788dd3503635f54f894c306d52f6e9bc4b8f18d27afcc",
|
|
184
|
+
"k_bad01": "90756c96fef41152ac9abe08819c4e95f16da2af472880192c69a2b7bac29114",
|
|
185
|
+
"k_bad15": "7b3f53300ab0ccd0f698f4d67db87c44cf3e9e513d9df61137256652b2e94e7c"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"message": "Japan",
|
|
189
|
+
"privkey": "8080808080808080808080808080808080808080808080808080808080808080",
|
|
190
|
+
"k_bad00": "f471e61b51d2d8db78f3dae19d973616f57cdc54caaa81c269394b8c34edcf59",
|
|
191
|
+
"k_bad01": "6819d85b9730acc876fdf59e162bf309e9f63dd35550edf20869d23c2f3e6d17",
|
|
192
|
+
"k_bad15": "d8e8bae3ee330a198d1f5e00ad7c5f9ed7c24c357c0a004322abca5d9cd17847"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"message": "Bitcoin",
|
|
196
|
+
"privkey": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
|
|
197
|
+
"k_bad00": "36c848ffb2cbecc5422c33a994955b807665317c1ce2a0f59c689321aaa631cc",
|
|
198
|
+
"k_bad01": "4ed8de1ec952a4f5b3bd79d1ff96446bcd45cabb00fc6ca127183e14671bcb85",
|
|
199
|
+
"k_bad15": "56b6f47babc1662c011d3b1f93aa51a6e9b5f6512e9f2e16821a238d450a31f8"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"message": "i2FLPP8WEus5WPjpoHwheXOMSobUJVaZM1JPMQZq",
|
|
203
|
+
"privkey": "fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
|
|
204
|
+
"k_bad00": "6e9b434fcc6bbb081a0463c094356b47d62d7efae7da9c518ed7bac23f4e2ed6",
|
|
205
|
+
"k_bad01": "ae5323ae338d6117ce8520a43b92eacd2ea1312ae514d53d8e34010154c593bb",
|
|
206
|
+
"k_bad15": "3eaa1b61d1b8ab2f1ca71219c399f2b8b3defa624719f1e96fe3957628c2c4ea"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"message": "lEE55EJNP7aLrMtjkeJKKux4Yg0E8E1SAJnWTCEh",
|
|
210
|
+
"privkey": "3881e5286abc580bb6139fe8e83d7c8271c6fe5e5c2d640c1f0ed0e1ee37edc9",
|
|
211
|
+
"k_bad00": "5b606665a16da29cc1c5411d744ab554640479dd8abd3c04ff23bd6b302e7034",
|
|
212
|
+
"k_bad01": "f8b25263152c042807c992eacd2ac2cc5790d1e9957c394f77ea368e3d9923bd",
|
|
213
|
+
"k_bad15": "ea624578f7e7964ac1d84adb5b5087dd14f0ee78b49072aa19051cc15dab6f33"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"message": "2SaVPvhxkAPrayIVKcsoQO5DKA8Uv5X/esZFlf+y",
|
|
217
|
+
"privkey": "7259dff07922de7f9c4c5720d68c9745e230b32508c497dd24cb95ef18856631",
|
|
218
|
+
"k_bad00": "3ab6c19ab5d3aea6aa0c6da37516b1d6e28e3985019b3adb388714e8f536686b",
|
|
219
|
+
"k_bad01": "19af21b05004b0ce9cdca82458a371a9d2cf0dc35a813108c557b551c08eb52e",
|
|
220
|
+
"k_bad15": "117a32665fca1b7137a91c4739ac5719fec0cf2e146f40f8e7c21b45a07ebc6a"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"message": "00A0OwO2THi7j5Z/jp0FmN6nn7N/DQd6eBnCS+/b",
|
|
224
|
+
"privkey": "0d6ea45d62b334777d6995052965c795a4f8506044b4fd7dc59c15656a28f7aa",
|
|
225
|
+
"k_bad00": "79487de0c8799158294d94c0eb92ee4b567e4dc7ca18addc86e49d31ce1d2db6",
|
|
226
|
+
"k_bad01": "9561d2401164a48a8f600882753b3105ebdd35e2358f4f808c4f549c91490009",
|
|
227
|
+
"k_bad15": "b0d273634129ff4dbdf0df317d4062a1dbc58818f88878ffdb4ec511c77976c0"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|