UNPKG

3.3 kBJavaScriptView Raw
1'use strict'
2const Hasher = require('./util/hasher');
3const Signer = require("./util/signer");
4
5module.exports = class Config {
6 static NETWORK = 'SASEUL PUBLIC NETWORK';
7
8 static ZERO_ADDRESS = '00000000000000000000000000000000000000000000';
9
10 static FULL_LEDGER = 'full';
11 static PARTIAL_LEDGER = 'partial';
12 static LEDGER_FILESIZE_LIMIT = 268435456;
13
14 static MAIN_CHAIN_INTERVAL = 1000000;
15 static MAIN_CONSENSUS_PER = 0.6;
16
17 static RESOURCE_INTERVAL = 60000000;
18 static RESOURCE_CONFIRM_COUNT = 10;
19 static CONFIRM_INTERVAL = this.RESOURCE_INTERVAL * this.RESOURCE_CONFIRM_COUNT;
20 static VALIDATOR_COUNT = 9;
21
22 static DIFFICULTY_CHANGE_CYCLE = 1440;
23 static DEFAULT_DIFFICULTY = '100000';
24 static MINING_INTERVAL = 15000000;
25 static REFRESH_INTERVAL = 15000000;
26
27 static MAX_DIFFICULTY_WEIGHT = 4;
28 static MIN_DIFFICULTY_WEIGHT = 0.25;
29
30 static HASH_COUNT = '115792089237316195423570985008687907853269984665640564039457584007913129639936';
31
32 static BLOCK_TX_SIZE_LIMIT = 16777216;
33 static BLOCK_TX_COUNT_LIMIT = 2048;
34 static TX_SIZE_LIMIT = 1048576;
35 static STATUS_SIZE_LIMIT = 65536;
36
37 static RECEIPT_COUNT_LIMIT = 256;
38 static TIMESTAMP_ERROR_LIMIT = 5000000;
39
40 static EXA = '1000000000000000000';
41 static STANDARD_AMOUNT = '2000000000000000000000';
42 static CREDIT_AMOUNT = '60000000000000000000000000';
43
44 static ROUND_TIMEOUT = 1;
45 static DATA_TIMEOUT = 2;
46
47 static MASTER_ADDR = '127.0.0.1';
48 static MASTER_PORT = 9933;
49 static DATA_POOL_ADDR = '127.0.0.1';
50 static DATA_POOL_PORT = 9934;
51
52 // keep for observer
53 static BLOCK_AFFIX_LENGTH = 2;
54 static BLOCK_PER_FILE = 16 ** this.BLOCK_AFFIX_LENGTH;
55 static BLOCK_PER_GENERATION = this.BLOCK_PER_FILE ** 2;
56 static SPLIT_COUNT = 1048576;
57
58 static SYSTEM_CONTRACTS = ['Genesis', 'Register', 'Oracle', 'HotFix', 'Grant', 'Revoke'];
59
60 static _network = '';
61 static _system_nonce = 'Fiat lux. ';
62 static _genesis_address = '';
63 static _manager_addresses = [];
64
65 static RootSpace()
66 {
67 return Hasher.Hash(this._system_nonce);
68 }
69
70 static RootSpaceId()
71 {
72 return Hasher.SpaceId(this.ZERO_ADDRESS, this.RootSpace());
73 }
74
75 static SystemNonce = this.RootSpace; // legacy
76
77 static NetworkKey()
78 {
79 return Hasher.Hash(this.NETWORK);
80 }
81
82 static NetworkAddress()
83 {
84 return Signer.Address(this.NetworkKey());
85 }
86
87 static TxCountHash()
88 {
89 return Hasher.StatusHash(this.ZERO_ADDRESS, this.RootSpace(), 'transaction_count', this.ZERO_ADDRESS);
90 }
91
92 static CalculatedHeightHash()
93 {
94 return Hasher.StatusHash(this.ZERO_ADDRESS, this.RootSpace(), 'fixed_height', this.ZERO_ADDRESS);
95 }
96
97 static ResourceHash(address)
98 {
99 return Hasher.StatusHash(this.ZERO_ADDRESS, this.RootSpace(), 'resource', address);
100 }
101
102 static RecycleResourceHash()
103 {
104 return Hasher.StatusHash(this.ZERO_ADDRESS, this.RootSpace(), 'recycle_resource', this.ZERO_ADDRESS);
105 }
106
107 static ContractPrefix()
108 {
109 return Hasher.StatusPrefix(this.ZERO_ADDRESS, this.RootSpace(), 'contract');
110 }
111
112 static RequestPrefix()
113 {
114 return Hasher.StatusPrefix(this.ZERO_ADDRESS, this.RootSpace(), 'request');
115 }
116}
\No newline at end of file