11// https://en.bitcoin.it/wiki/List_of_address_prefixes
22// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731
33
4- var networks = {
4+ module . exports = {
55 bitcoin : {
66 magic : 0xd9b4bef9 ,
77 messagePrefix : '\x18Bitcoin Signed Message:\n' ,
@@ -12,8 +12,7 @@ var networks = {
1212 pubKeyHash : 0x00 ,
1313 scriptHash : 0x05 ,
1414 wif : 0x80 ,
15- dustThreshold : 546 , // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162
16- feePerKb : 10000 // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53
15+ dustThreshold : 546 // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/core.h#L151-L162
1716 } ,
1817 testnet : {
1918 magic : 0xd9b4bef9 ,
@@ -25,8 +24,7 @@ var networks = {
2524 pubKeyHash : 0x6f ,
2625 scriptHash : 0xc4 ,
2726 wif : 0xef ,
28- dustThreshold : 546 ,
29- feePerKb : 10000
27+ dustThreshold : 546
3028 } ,
3129 litecoin : {
3230 magic : 0xd9b4bef9 ,
@@ -38,9 +36,7 @@ var networks = {
3836 pubKeyHash : 0x30 ,
3937 scriptHash : 0x05 ,
4038 wif : 0xb0 ,
41- dustThreshold : 0 , // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365
42- dustSoftThreshold : 100000 , // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53
43- feePerKb : 100000 // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56
39+ dustThreshold : 0 // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365
4440 } ,
4541 dogecoin : {
4642 messagePrefix : '\x19Dogecoin Signed Message:\n' ,
@@ -51,101 +47,6 @@ var networks = {
5147 pubKeyHash : 0x1e ,
5248 scriptHash : 0x16 ,
5349 wif : 0x9e ,
54- dustThreshold : 0 , // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160
55- dustSoftThreshold : 100000000 , // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.h#L62
56- feePerKb : 100000000 // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58
57- } ,
58- viacoin : {
59- messagePrefix : '\x18Viacoin Signed Message:\n' ,
60- bip32 : {
61- public : 0x0488b21e ,
62- private : 0x0488ade4
63- } ,
64- pubKeyHash : 0x47 ,
65- scriptHash : 0x21 ,
66- wif : 0xc7 ,
67- dustThreshold : 560 ,
68- dustSoftThreshold : 100000 ,
69- feePerKb : 100000
70- } ,
71- viacointestnet : {
72- messagePrefix : '\x18Viacoin Signed Message:\n' ,
73- bip32 : {
74- public : 0x043587cf ,
75- private : 0x04358394
76- } ,
77- pubKeyHash : 0x7f ,
78- scriptHash : 0xc4 ,
79- wif : 0xff ,
80- dustThreshold : 560 ,
81- dustSoftThreshold : 100000 ,
82- feePerKb : 100000
83- } ,
84- gamerscoin : {
85- messagePrefix : '\x19Gamerscoin Signed Message:\n' ,
86- bip32 : {
87- public : 0x019da462 ,
88- private : 0x019d9cfe
89- } ,
90- pubKeyHash : 0x26 ,
91- scriptHash : 0x05 ,
92- wif : 0xA6 ,
93- dustThreshold : 0 , // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L358-L363
94- dustSoftThreshold : 100000 , // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L51
95- feePerKb : 100000 // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L54
96- } ,
97- jumbucks : {
98- messagePrefix : '\x19Jumbucks Signed Message:\n' ,
99- bip32 : {
100- public : 0x037a689a ,
101- private : 0x037a6460
102- } ,
103- pubKeyHash : 0x2b ,
104- scriptHash : 0x05 ,
105- wif : 0xab ,
106- dustThreshold : 0 ,
107- dustSoftThreshold : 10000 ,
108- feePerKb : 10000
109- } ,
110- zetacoin : {
111- messagePrefix : '\x18Zetacoin Signed Message:\n' ,
112- bip32 : {
113- public : 0x0488b21e ,
114- private : 0x0488ade4
115- } ,
116- pubKeyHash : 0x50 ,
117- scriptHash : 0x09 ,
118- wif : 0xe0 ,
119- dustThreshold : 546 , // https://github.com/zetacoin/zetacoin/blob/master/src/core.h#L159
120- feePerKb : 10000 // https://github.com/zetacoin/zetacoin/blob/master/src/main.cpp#L54
50+ dustThreshold : 0 // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/core.h#L155-L160
12151 }
12252}
123-
124- function estimateFee ( tx , network ) {
125- var baseFee = network . feePerKb
126- var byteSize = tx . byteLength ( )
127-
128- var fee = baseFee * Math . ceil ( byteSize / 1000 )
129- if ( network . dustSoftThreshold === undefined ) return fee
130-
131- tx . outs . forEach ( function ( output ) {
132- if ( output . value < network . dustSoftThreshold ) {
133- fee += baseFee
134- }
135- } )
136-
137- return fee
138- }
139-
140- // FIXME: 1.5.3 compatibility patch(s)
141- function patchEstimateFee ( network , tx ) {
142- return estimateFee ( tx , network )
143- }
144-
145- for ( var networkName in networks ) {
146- var network = networks [ networkName ]
147-
148- network . estimateFee = patchEstimateFee . bind ( null , network )
149- }
150-
151- module . exports = networks
0 commit comments