Coverage Summary for Class: BridgeTestNetConstants (co.rsk.config)
Class |
Class, %
|
Method, %
|
Line, %
|
BridgeTestNetConstants |
0%
(0/1)
|
0%
(0/3)
|
0%
(0/50)
|
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2017 RSK Labs Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 package co.rsk.config;
20
21 import co.rsk.bitcoinj.core.BtcECKey;
22 import co.rsk.bitcoinj.core.Coin;
23 import co.rsk.bitcoinj.core.NetworkParameters;
24 import co.rsk.peg.AddressBasedAuthorizer;
25 import co.rsk.peg.Federation;
26 import co.rsk.peg.FederationMember;
27 import java.util.ArrayList;
28 import org.bouncycastle.util.encoders.Hex;
29 import org.ethereum.crypto.ECKey;
30
31 import java.time.Instant;
32 import java.util.Arrays;
33 import java.util.List;
34 import java.util.stream.Collectors;
35
36 public class BridgeTestNetConstants extends BridgeConstants {
37 private static BridgeTestNetConstants instance = new BridgeTestNetConstants();
38
39 BridgeTestNetConstants() {
40 btcParamsString = NetworkParameters.ID_TESTNET;
41
42 BtcECKey federator0PublicKey = BtcECKey.fromPublicOnly(Hex.decode("039a060badbeb24bee49eb2063f616c0f0f0765d4ca646b20a88ce828f259fcdb9"));
43 BtcECKey federator1PublicKey = BtcECKey.fromPublicOnly(Hex.decode("02afc230c2d355b1a577682b07bc2646041b5d0177af0f98395a46018da699b6da"));
44 BtcECKey federator2PublicKey = BtcECKey.fromPublicOnly(Hex.decode("0344a3c38cd59afcba3edcebe143e025574594b001700dec41e59409bdbd0f2a09"));
45 BtcECKey federator3PublicKey = BtcECKey.fromPublicOnly(Hex.decode("034844a99cd7028aa319476674cc381df006628be71bc5593b8b5fdb32bb42ef85"));
46
47 List<BtcECKey> genesisFederationPublicKeys = Arrays.asList(federator0PublicKey, federator1PublicKey, federator2PublicKey, federator3PublicKey);
48
49 // IMPORTANT: BTC, RSK and MST keys are the same.
50 // Change upon implementation of the <INSERT FORK NAME HERE> fork.
51 List<FederationMember> federationMembers = FederationMember.getFederationMembersFromKeys(genesisFederationPublicKeys);
52
53 // Currently set to:
54 // Currently set to: Monday, October 8, 2018 12:00:00 AM GMT-03:00
55 Instant genesisFederationAddressCreatedAt = Instant.ofEpochMilli(1538967600l);
56
57 genesisFederation = new Federation(
58 federationMembers,
59 genesisFederationAddressCreatedAt,
60 1L,
61 getBtcParams()
62 );
63
64 btc2RskMinimumAcceptableConfirmations = 10;
65 btc2RskMinimumAcceptableConfirmationsOnRsk = 10;
66 rsk2BtcMinimumAcceptableConfirmations = 10;
67
68 updateBridgeExecutionPeriod = 3 * 60 * 1000; // 3 minutes
69
70 maxBtcHeadersPerRskBlock = 500;
71
72 legacyMinimumPeginTxValueInSatoshis = Coin.valueOf(1_000_000);
73 minimumPeginTxValueInSatoshis = Coin.valueOf(500_000);
74 legacyMinimumPegoutTxValueInSatoshis = Coin.valueOf(500_000);
75 minimumPegoutTxValueInSatoshis = Coin.valueOf(250_000);
76
77 // Passphrases are kept private
78 List<ECKey> federationChangeAuthorizedKeys = Arrays.stream(new String[]{
79 "04d9052c2022f6f35da53f04f02856ff5e59f9836eec03daad0328d12c5c66140205da540498e46cd05bf63c1201382dd84c100f0d52a10654159965aea452c3f2",
80 "04bf889f2035c8c441d7d1054b6a449742edd04d202f44a29348b4140b34e2a81ce66e388f40046636fd012bd7e3cecd9b951ffe28422334722d20a1cf6c7926fb",
81 "047e707e4f67655c40c539363fb435d89574b8fe400971ba0290de9c2adbb2bd4e1e5b35a2188b9409ff2cc102292616efc113623483056bb8d8a02bf7695670ea"
82 }).map(hex -> ECKey.fromPublicOnly(Hex.decode(hex))).collect(Collectors.toList());
83
84 federationChangeAuthorizer = new AddressBasedAuthorizer(
85 federationChangeAuthorizedKeys,
86 AddressBasedAuthorizer.MinimumRequiredCalculation.MAJORITY
87 );
88
89 // Passphrases are kept private
90 List<ECKey> lockWhitelistAuthorizedKeys = Arrays.stream(new String[]{
91 "04bf7e3bca7f7c58326382ed9c2516a8773c21f1b806984bb1c5c33bd18046502d97b28c0ea5b16433fbb2b23f14e95b36209f304841e814017f1ede1ecbdcfce3"
92 }).map(hex -> ECKey.fromPublicOnly(Hex.decode(hex))).collect(Collectors.toList());
93
94 lockWhitelistChangeAuthorizer = new AddressBasedAuthorizer(
95 lockWhitelistAuthorizedKeys,
96 AddressBasedAuthorizer.MinimumRequiredCalculation.ONE
97 );
98
99 federationActivationAge = 60L;
100
101 fundsMigrationAgeSinceActivationBegin = 60L;
102 fundsMigrationAgeSinceActivationEnd = 900L;
103
104 List<ECKey> feePerKbAuthorizedKeys = Arrays.stream(new String[]{
105 "04701d1d27f8c2ae97912d96fb1f82f10c2395fd320e7a869049268c6b53d2060dfb2e22e3248955332d88cd2ae29a398f8f3858e48dd6d8ffbc37dfd6d1aa4934",
106 "045ef89e4a5645dc68895dbc33b4c966c3a0a52bb837ecdd2ba448604c4f47266456d1191420e1d32bbe8741f8315fde4d1440908d400e5998dbed6549d499559b",
107 "0455db9b3867c14e84a6f58bd2165f13bfdba0703cb84ea85788373a6a109f3717e40483aa1f8ef947f435ccdf10e530dd8b3025aa2d4a7014f12180ee3a301d27"
108 }).map(hex -> ECKey.fromPublicOnly(Hex.decode(hex))).collect(Collectors.toList());
109
110 feePerKbChangeAuthorizer = new AddressBasedAuthorizer(
111 feePerKbAuthorizedKeys,
112 AddressBasedAuthorizer.MinimumRequiredCalculation.MAJORITY
113 );
114
115 genesisFeePerKb = Coin.MILLICOIN;
116
117 maxFeePerKb = Coin.valueOf(5_000_000L);
118
119 List<ECKey> increaseLockingCapAuthorizedKeys = Arrays.stream(new String[]{
120 "04701d1d27f8c2ae97912d96fb1f82f10c2395fd320e7a869049268c6b53d2060dfb2e22e3248955332d88cd2ae29a398f8f3858e48dd6d8ffbc37dfd6d1aa4934",
121 "045ef89e4a5645dc68895dbc33b4c966c3a0a52bb837ecdd2ba448604c4f47266456d1191420e1d32bbe8741f8315fde4d1440908d400e5998dbed6549d499559b",
122 "0455db9b3867c14e84a6f58bd2165f13bfdba0703cb84ea85788373a6a109f3717e40483aa1f8ef947f435ccdf10e530dd8b3025aa2d4a7014f12180ee3a301d27"
123 }).map(hex -> ECKey.fromPublicOnly(Hex.decode(hex))).collect(Collectors.toList());
124
125 increaseLockingCapAuthorizer = new AddressBasedAuthorizer(
126 increaseLockingCapAuthorizedKeys,
127 AddressBasedAuthorizer.MinimumRequiredCalculation.ONE
128 );
129
130 lockingCapIncrementsMultiplier = 2;
131 initialLockingCap = Coin.COIN.multiply(200); // 200 BTC
132
133 btcHeightWhenBlockIndexActivates = 700_000; //TODO define this value when Iris activation height in RSK is determined
134 maxDepthToSearchBlocksBelowIndexActivation = 1_000; //TODO define this value with Sergio
135
136 // TODO: These value is not real
137 erpFedActivationDelay = 5063;
138
139 // TODO: WE NEED TO DEFINE THESE KEYS
140 erpFedPubKeysList = new ArrayList<>();
141
142 // Multisig address created in bitcoind with the following private keys:
143 // 47129ffed2c0273c75d21bb8ba020073bb9a1638df0e04853407461fdd9e8b83
144 // 9f72d27ba603cfab5a0201974a6783ca2476ec3d6b4e2625282c682e0e5f1c35
145 // e1b17fcd0ef1942465eee61b20561b16750191143d365e71de08b33dd84a9788
146 oldFederationAddress = "2N7ZgQyhFKm17RbaLqygYbS7KLrQfapyZzu";
147
148 minSecondsBetweenCallsReceiveHeader = 300; // 5 minutes in Seconds
149 maxDepthBlockchainAccepted = 25;
150
151 minimumPegoutValuePercentageToReceiveAfterFee = 20;
152 }
153
154 public static BridgeTestNetConstants getInstance() {
155 return instance;
156 }
157
158 }