-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathConfigure.java
More file actions
33 lines (26 loc) · 1.29 KB
/
Configure.java
File metadata and controls
33 lines (26 loc) · 1.29 KB
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
/// Changing the default configuration
// In order to change the default configuration, just use the classes inside in3.config package.
package in3;
import in3.*;
import in3.config.*;
import in3.eth1.Block;
public class Configure {
//
public static void main(String[] args) {
// create incubed client
IN3 in3 = IN3.forChain(Chain.GOERLI); // set it to goerli
// Setup a Configuration object for the client
ClientConfiguration clientConfig = in3.getConfig();
clientConfig.setReplaceLatestBlock(6); // define that latest will be -6
clientConfig.setAutoUpdateList(false); // prevents node automatic update
clientConfig.setMaxAttempts(1); // sets max attempts to 1 before giving up
clientConfig.setProof(Proof.none); // does not require proof (not recommended)
// Setup the ChainConfiguration object for the nodes on a certain chain
NodeRegistryConfiguration chainConfiguration = clientConfig.getNodeRegistry();
chainConfiguration.setNeedsUpdate(false);
chainConfiguration.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f");
chainConfiguration.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb");
Block block = in3.getEth1API().getBlockByNumber(Block.LATEST, true);
System.out.println(block.getHash());
}
}