-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathConfiguration.ts
166 lines (140 loc) · 5.62 KB
/
Configuration.ts
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
export interface Configuration extends LoggingConfiguration, BitcoinRPCConfiguration, ExchangeConfiguration {
readonly rabbitmqUrl: string
readonly exchangePrefix: string
readonly mongodbUser: string
readonly mongodbPassword: string
readonly mongodbHost: string
readonly mongodbPort: number
readonly mongodbDatabase: string
readonly mongodbUrl: string
readonly ipfsUrl: string
readonly ipfsArchiveUrlPrefix: string
readonly apiPort: number
readonly poetNetwork: string
readonly poetVersion: number
readonly blockchainReaderIntervalInSeconds: number
readonly minimumBlockHeight: number
readonly forceBlockHeight?: number
readonly enableAnchoring: boolean
readonly anchorIntervalInSeconds: number
readonly purgeStaleTransactionsIntervalInSeconds: number
readonly maximumTransactionAgeInBlocks: number
readonly healthIntervalInSeconds: number
readonly lowWalletBalanceInBitcoin: number
readonly feeEstimateMinTargetBlock: number
readonly downloadIntervalInSeconds: number
readonly downloadRetryDelayInMinutes: number
readonly downloadMaxAttempts: number
readonly downloadTimeoutInSeconds: number
readonly batchCreationIntervalInSeconds: number
readonly transactionMaxAgeInSeconds: number
readonly readDirectoryIntervalInSeconds: number
readonly uploadClaimIntervalInSeconds: number
readonly uploadClaimMaxAttempts: number
readonly bitcoinFeeEstimateMode: 'CONSERVATIVE' | 'ECONOMICAL'
readonly bitcoinFeeRate: number
readonly ethereumRegistryWriterApiPort: number
readonly ethereumRpcUrl: string
readonly ethereumChainId: number
readonly ethereumRegistryContractAddress: string
readonly ethereumRegistryPrivateKey: string
readonly ethereumRegistryUploadAnchorReceiptIntervalInSeconds: number
readonly ethereumRegistryRegisterNextDirectoryIntervalInSeconds: number
readonly ethereumGasPrice: number
readonly ethereumMaximumUnconfirmedTransactionAgeInSeconds: number
}
export interface LoggingConfiguration {
readonly loggingLevel: string
readonly loggingPretty: boolean
}
export interface BitcoinRPCConfiguration {
readonly bitcoinUrl: string
readonly bitcoinPort: number
readonly bitcoinNetwork: string
readonly bitcoinUsername: string
readonly bitcoinPassword: string
}
export interface ExchangeConfiguration {
readonly exchangeAnchorNextHashRequest: string
readonly exchangeBatchReaderReadNextDirectoryRequest: string
readonly exchangeBatchReaderReadNextDirectorySuccess: string
readonly exchangeBatchWriterCreateNextBatchRequest: string
readonly exchangeBatchWriterCreateNextBatchSuccess: string
readonly exchangeNewClaim: string
readonly exchangeClaimIpfsHash: string
readonly exchangeIpfsHashTxId: string
readonly exchangePoetAnchorDownloaded: string
readonly exchangeClaimsDownloaded: string
readonly exchangeClaimsNotDownloaded: string
readonly exchangeStorageWriterStoreNextClaim: string
readonly exchangeGetHealth: string
readonly exchangePurgeStaleTransactions: string
readonly exchangeForkDetected: string
}
export const DefaultConfiguration: Configuration = {
rabbitmqUrl: 'amqp://admin:adminPass@localhost',
exchangePrefix: '',
mongodbUser: '',
mongodbPassword: '',
mongodbHost: 'localhost',
mongodbPort: 27017,
mongodbDatabase: 'poet',
mongodbUrl: 'mongodb://localhost:27017/poet',
ipfsUrl: 'http://localhost:5001',
ipfsArchiveUrlPrefix: 'https://ipfs.io/ipfs',
bitcoinUrl: '127.0.0.1',
bitcoinPort: 18443,
bitcoinNetwork: 'regtest',
bitcoinUsername: 'bitcoinrpcuser',
bitcoinPassword: 'bitcoinrpcpassword',
apiPort: 18080,
poetNetwork: 'POET',
poetVersion: 0,
minimumBlockHeight: 100,
blockchainReaderIntervalInSeconds: 5,
enableAnchoring: false,
anchorIntervalInSeconds: 30,
purgeStaleTransactionsIntervalInSeconds: 600,
maximumTransactionAgeInBlocks: 25,
bitcoinFeeEstimateMode: 'CONSERVATIVE',
bitcoinFeeRate: undefined,
healthIntervalInSeconds: 30,
lowWalletBalanceInBitcoin: 1,
feeEstimateMinTargetBlock: 1,
downloadIntervalInSeconds: 5,
downloadRetryDelayInMinutes: 10,
downloadMaxAttempts: 20,
downloadTimeoutInSeconds: 10,
loggingLevel: 'info',
loggingPretty: true,
batchCreationIntervalInSeconds: 600,
transactionMaxAgeInSeconds: 1800,
readDirectoryIntervalInSeconds: 30,
uploadClaimIntervalInSeconds: 30,
uploadClaimMaxAttempts: 10,
forceBlockHeight: undefined,
ethereumRegistryWriterApiPort: 18081,
ethereumRpcUrl: 'http://localhost:8545',
ethereumChainId: 4,
ethereumRegistryContractAddress: '',
ethereumRegistryPrivateKey: '',
ethereumRegistryUploadAnchorReceiptIntervalInSeconds: 60,
ethereumRegistryRegisterNextDirectoryIntervalInSeconds: 60,
ethereumGasPrice: 1e9,
ethereumMaximumUnconfirmedTransactionAgeInSeconds: 5 * 60 * 1000,
exchangeAnchorNextHashRequest: 'ANCHOR_NEXT_HASH_REQUEST',
exchangeBatchReaderReadNextDirectoryRequest: 'BATCH_READER::READ_NEXT_DIRECTORY_REQUEST',
exchangeBatchReaderReadNextDirectorySuccess: 'BATCH_READER::READ_NEXT_DIRECTORY_SUCCESS',
exchangeBatchWriterCreateNextBatchRequest: 'BATCH_WRITER::CREATE_NEXT_BATCH_REQUEST',
exchangeBatchWriterCreateNextBatchSuccess: 'BATCH_WRITER::CREATE_NEXT_BATCH_SUCCESS',
exchangeNewClaim: 'NEW_CLAIM',
exchangeClaimIpfsHash: 'CLAIM_IPFS_HASH',
exchangeIpfsHashTxId: 'IPFS_HASH_TX_ID',
exchangePoetAnchorDownloaded: 'POET_ANCHOR_DOWNLOADED',
exchangeClaimsDownloaded: 'CLAIMS_DOWNLOADED',
exchangeClaimsNotDownloaded: 'CLAIMS_NOT_DOWNLOADED',
exchangeStorageWriterStoreNextClaim: 'STORAGE_WRITER::STORE_NEXT_CLAIM',
exchangeGetHealth: 'HEALTH::GET_HEALTH',
exchangePurgeStaleTransactions: 'BLOCK_WRITER::PURGE_STALE_TRANSACTIONS',
exchangeForkDetected: 'FORK_DETECTED',
}