-
Notifications
You must be signed in to change notification settings - Fork 0
/
StarBlockChainTest.java
64 lines (48 loc) · 2.66 KB
/
StarBlockChainTest.java
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import com.aidev.starblockchain.MetaData;
import com.aidev.starblockchain.StarBlockChain;
import java.util.ArrayList;
import java.util.Arrays;
public class StarBlockChainTest{
public static void main(String []args){
long startTime = System.nanoTime();
String secretKey = "Secret";
String saltValue = "SimpleSalt";
ArrayList<String> userNames = new ArrayList<>(Arrays.asList("Imran"));
// StarBlockChain starBlockChain = new StarBlockChain();
StarBlockChain starBlockChain = new StarBlockChain(MetaData.AES, secretKey, saltValue);
// StarBlockChain starBlockChain = new StarBlockChain(MetaData.RSA);
starBlockChain.newStarBlock("Confidential data v1", userNames);
starBlockChain.newStarBlock("Confidential data v2", true, userNames);
// starBlockChain.newStarBlock("Music Notes v1", userNames);
// starBlockChain.newStarBlock("Music Notes v2", true, userNames);
// starBlockChain.newStarBlock("Music Notes v3", true, userNames);
// starBlockChain.newStarBlock("Confidential data v3", true, false, 0, userNames);
// starBlockChain.newStarBlock("Music Notes v4", true, userNames);
starBlockChain.newStarBlock("Home Loan v1", userNames);
starBlockChain.newStarBlock("Home Loan v2", true, userNames);
// for(int i=0; i<50; i++){
// starBlockChain.newStarBlock("Home Loan v"+(3+i), true, userNames);
// }
// starBlockChain.newStarBlock("Confidential data v4", true, false, 0);
// for(int i=0; i<1000; i++){
// starBlockChain.newStarBlock("Music Notes v"+(4+i), true, false, 1);
// }
// starblock chain without versioning
// for(int i=0; i<500; i++){
// starBlockChain.newStarBlock("Data v"+i, userNames);
// }
// System.out.println(starBlockChain.printStarBlockChain(secretKey, saltValue));
// System.out.println(starBlockChain.printStarBlockChain());
try{
boolean isValid = starBlockChain.isStarBlockChainValid();
System.out.println("Is StarBlockChain Valid? "+isValid);
}catch(Exception e){
e.printStackTrace();
}
long endTime = System.nanoTime();
double duration = (double)(endTime - startTime)/1000000000;
System.out.println("Verification time "+duration);
System.out.println("Total newtwork strength at Index "+starBlockChain.getTotalTensorNetworkStrengthAtIndex(0L));
System.out.println("Total network strength "+starBlockChain.getTotalTensorNetworkStrength());
}
}