-
Notifications
You must be signed in to change notification settings - Fork 43
/
b2x.js
45 lines (39 loc) · 3.1 KB
/
b2x.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//https://explorer.b2x-segwit.io/tx/7d2d8fe117e5c368470d9448e417a61dbc36d126e2c6b7ddd4340c01ec084f07
//f9beb4d9747800000000000000000000e1000000074f08ec0200000001dec65c4c4d39beb6d8f9ffed142979d982918010229cfa7601936efba01906e0010000006a47304402203d5e72280fc669683d781e4d39841dd99294d08d3346826746e018a835c19e3e022067be96a663fe1389a95e92e878d739213e7c1c88aee62b33e2eebfa4679fec5b21210251b9e1d5a7b09c1821fe53437f94a745e00f6c790fbc0a93794d30712eea59d4feffffff027a591900000000001976a91477ca15df5cf638208ae9ed20eef8585b720922d588accdf8b900000000001976a914c36fbbd9a2addc11d01d22f950f7fbcc9112e4ce88acceed0700
//0200000001dec65c4c4d39beb6d8f9ffed142979d982918010229cfa7601936efba01906e0010000006a47304402203d5e72280fc669683d781e4d39841dd99294d08d3346826746e018a835c19e3e022067be96a663fe1389a95e92e878d739213e7c1c88aee62b33e2eebfa4679fec5b21210251b9e1d5a7b09c1821fe53437f94a745e00f6c790fbc0a93794d30712eea59d4feffffff027a591900000000001976a91477ca15df5cf638208ae9ed20eef8585b720922d588accdf8b900000000001976a914c36fbbd9a2addc11d01d22f950f7fbcc9112e4ce88acceed0700
node index.js B2X decode 0200000001dec65c4c4d39beb6d8f9ffed142979d982918010229cfa7601936efba01906e0010000006a47304402203d5e72280fc669683d781e4d39841dd99294d08d3346826746e018a835c19e3e022067be96a663fe1389a95e92e878d739213e7c1c88aee62b33e2eebfa4679fec5b21210251b9e1d5a7b09c1821fe53437f94a745e00f6c790fbc0a93794d30712eea59d4feffffff027a591900000000001976a91477ca15df5cf638208ae9ed20eef8585b720922d588accdf8b900000000001976a914c36fbbd9a2addc11d01d22f950f7fbcc9112e4ce88acceed0700
/*
Version B2X
decode
{ input:
[ { hash: 'e00619a0fb6e930176fa9c2210809182d9792914edfff9d8b6be394d4c5cc6de',
n: 1,
scriptSigLen: 106,
scriptSig: [Object],
script: [Object],
nSequence: <Buffer ff ff ff fe> } ],
output:
[ { nValue: 1661306,
scriptPubkeyLen: <Buffer 19>,
scriptPubkey: <Buffer 76 a9 14 77 ca 15 df 5c f6 38 20 8a e9 ed 20 ee f8 58 5b 72 09 22 d5 88 ac>,
address: '1BvPVyH8x2ihYhn4EtDyvMMDY4npy6nhAY',
type: 'p2pkh' },
{ nValue: 12187853,
scriptPubkeyLen: <Buffer 19>,
scriptPubkey: <Buffer 76 a9 14 c3 6f bb d9 a2 ad dc 11 d0 1d 22 f9 50 f7 fb cc 91 12 e4 ce 88 ac>,
address: '1JpNconrgmNDDdUFeyZDTePnuBBALxRorX',
type: 'p2pkh' } ],
s: 0,
nVersion: <Buffer 02 00 00 00>,
nbinput: 1,
nboutput: 2,
nLockTime: <Buffer ce ed 07 00> }
*/
node index.js B2X verify 0200000001dec65c4c4d39beb6d8f9ffed142979d982918010229cfa7601936efba01906e0010000006a47304402203d5e72280fc669683d781e4d39841dd99294d08d3346826746e018a835c19e3e022067be96a663fe1389a95e92e878d739213e7c1c88aee62b33e2eebfa4679fec5b21210251b9e1d5a7b09c1821fe53437f94a745e00f6c790fbc0a93794d30712eea59d4feffffff027a591900000000001976a91477ca15df5cf638208ae9ed20eef8585b720922d588accdf8b900000000001976a914c36fbbd9a2addc11d01d22f950f7fbcc9112e4ce88acceed0700 76a914bfa8359ad7e85bd1d69e73a9db558406e24b5e0088ac 0.13850342
/*
Version B2X
verify
----- Transaction hash: 7d2d8fe117e5c368470d9448e417a61dbc36d126e2c6b7ddd4340c01ec084f07
----- Transaction verified
----- Transaction hash: 7d2d8fe117e5c368470d9448e417a61dbc36d126e2c6b7ddd4340c01ec084f07
*/