trac-msb 0.1.76 → 0.1.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Whitelist/pubkeys.csv +1 -1
- package/msb.mjs +4 -4
- package/package.json +1 -1
- package/src/index.js +56 -12
- package/src/network.js +19 -14
- package/dump/LICENSE +0 -201
- package/dump/NOTICE +0 -17
- package/dump/README.md +0 -66
- package/dump/Whitelist/pubkeys.csv +0 -1
- package/dump/msb.mjs +0 -14
- package/dump/package.json +0 -40
- package/dump/src/index.js +0 -1005
- package/dump/src/network.js +0 -295
- package/dump/src/utils/check.js +0 -163
- package/dump/src/utils/constants.js +0 -63
- package/dump/src/utils/fileUtils.js +0 -31
- package/dump/src/utils/functions.js +0 -70
- package/dump/src/utils/msgUtils.js +0 -137
- package/dump/test/all.test.js +0 -18
- package/dump/test/check.test.js +0 -21
- package/dump/test/fileUtils.test.js +0 -16
- package/dump/test/functions.test.js +0 -22
package/Whitelist/pubkeys.csv
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/msb.mjs
CHANGED
|
@@ -4,11 +4,11 @@ const opts = {
|
|
|
4
4
|
stores_directory : 'stores2/',
|
|
5
5
|
store_name : typeof process !== "undefined" ? process.argv[2] : Pear.config.args[0],
|
|
6
6
|
bootstrap: 'a4951e5f744e2a9ceeb875a7965762481dab0a7bb0531a71568e34bf7abd2c53',
|
|
7
|
-
channel: '0002tracnetworkmainsettlementbus'
|
|
7
|
+
channel: '0002tracnetworkmainsettlementbus'
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const msb = new MainSettlementBus(opts);
|
|
11
11
|
|
|
12
|
-
msb.ready()
|
|
13
|
-
msb.interactiveMode();
|
|
14
|
-
});
|
|
12
|
+
msb.ready()
|
|
13
|
+
.then(() => { msb.interactiveMode(); })
|
|
14
|
+
.catch(function () { });
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -15,11 +15,9 @@ import {
|
|
|
15
15
|
OperationType,
|
|
16
16
|
EventType,
|
|
17
17
|
WHITELIST_SLEEP_INTERVAL,
|
|
18
|
-
UPDATER_INTERVAL,
|
|
19
18
|
MAX_INDEXERS,
|
|
20
19
|
MIN_INDEXERS,
|
|
21
20
|
WHITELIST_PREFIX,
|
|
22
|
-
TRAC_NAMESPACE
|
|
23
21
|
} from './utils/constants.js';
|
|
24
22
|
import Network from './network.js';
|
|
25
23
|
import Check from './utils/check.js';
|
|
@@ -56,6 +54,8 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
56
54
|
#readline_instance;
|
|
57
55
|
#enable_txlogs;
|
|
58
56
|
#disable_rate_limit;
|
|
57
|
+
#enableValidatorObserver;
|
|
58
|
+
#enableRoleRequester;
|
|
59
59
|
|
|
60
60
|
constructor(options = {}) {
|
|
61
61
|
super();
|
|
@@ -65,7 +65,8 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
65
65
|
this.#boot();
|
|
66
66
|
this.#setupInternalListeners();
|
|
67
67
|
this.#network = new Network(this.#base);
|
|
68
|
-
this.
|
|
68
|
+
this.#enableValidatorObserver = options.enableValidatorObserver !== undefined ? options.enableValidatorObserver : true;
|
|
69
|
+
this.#enableRoleRequester = options.enableRoleRequester !== undefined ? options.enableRoleRequester : true;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
#initInternalAttributes(options) {
|
|
@@ -454,20 +455,60 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
454
455
|
this.validatorObserver();
|
|
455
456
|
}
|
|
456
457
|
|
|
457
|
-
async
|
|
458
|
-
console.log('Closing everything...');
|
|
459
|
-
|
|
458
|
+
async _close() {
|
|
459
|
+
console.log('Closing everything gracefully... This may take a moment.');
|
|
460
|
+
|
|
461
|
+
if (this.#network !== null) {
|
|
462
|
+
this.#network.stopPool();
|
|
463
|
+
}
|
|
464
|
+
await sleep(100);
|
|
465
|
+
|
|
466
|
+
if (this.#enableValidatorObserver) {
|
|
467
|
+
this.stopValidatorObserver();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
await sleep(5_000); // stopValidatorObserver is using findValidator which is reading from the base, so we need to wait fot it to finish.. Temporary workaround?
|
|
471
|
+
if (this.#swarm !== null) {
|
|
460
472
|
await this.#swarm.destroy();
|
|
461
473
|
}
|
|
462
|
-
await
|
|
474
|
+
await sleep(100);
|
|
475
|
+
|
|
476
|
+
if (this.#base !== null) {
|
|
477
|
+
await this.#base.close();
|
|
478
|
+
}
|
|
479
|
+
await sleep(100);
|
|
480
|
+
if (this.#bee !== null) {
|
|
481
|
+
await this.#bee.close();
|
|
482
|
+
}
|
|
483
|
+
await sleep(100);
|
|
484
|
+
if (this.#readline_instance) {
|
|
485
|
+
|
|
486
|
+
const inputClosed = new Promise(resolve => this.#readline_instance.input.once('close', resolve));
|
|
487
|
+
const outputClosed = new Promise(resolve => this.#readline_instance.output.once('close', resolve));
|
|
488
|
+
|
|
489
|
+
this.#readline_instance.close();
|
|
490
|
+
this.#readline_instance.input.destroy();
|
|
491
|
+
this.#readline_instance.output.destroy();
|
|
492
|
+
|
|
493
|
+
// Do not remove this. Without it, readline may close too quickly and still hang.
|
|
494
|
+
await Promise.all([inputClosed, outputClosed]).catch(e => console.log("Error during closing readline stream:", e));
|
|
495
|
+
}
|
|
496
|
+
await sleep(100);
|
|
497
|
+
|
|
498
|
+
if (this.#store !== null) {
|
|
499
|
+
await this.#store.close();
|
|
500
|
+
}
|
|
501
|
+
await sleep(100);
|
|
463
502
|
}
|
|
464
503
|
|
|
465
504
|
async #setUpRoleAutomatically() {
|
|
466
|
-
if (!this.#base.writable) {
|
|
505
|
+
if (!this.#base.writable && this.#enableRoleRequester) {
|
|
506
|
+
console.log('Requesting writer role... This may take a moment.');
|
|
467
507
|
await this.#requestWriterRole(false)
|
|
468
508
|
setTimeout(async () => {
|
|
469
509
|
await this.#requestWriterRole(true)
|
|
470
510
|
}, 5_000);
|
|
511
|
+
await sleep(5_000);
|
|
471
512
|
}
|
|
472
513
|
}
|
|
473
514
|
|
|
@@ -835,9 +876,11 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
835
876
|
}
|
|
836
877
|
}
|
|
837
878
|
|
|
879
|
+
// TODO: AFTER WHILE LOOP SIGNAL TO THE PROCESS THAT VALIDATOR OBSERVER STOPPED OPERATING.
|
|
880
|
+
// OS CALLS, ACCUMULATORS, MAYBE THIS IS POSSIBLE TO CHECK I/O QUEUE IF IT COINTAIN IT. FOR NOW WE ARE USING SLEEP.
|
|
838
881
|
async validatorObserver() {
|
|
839
882
|
// Finding writers for admin recovery case
|
|
840
|
-
while (this.#enable_wallet) {
|
|
883
|
+
while (this.#enableValidatorObserver && this.#enable_wallet) {
|
|
841
884
|
|
|
842
885
|
if (this.#dht_node === null || this.#network.validator_stream !== null) {
|
|
843
886
|
await sleep(1000);
|
|
@@ -911,6 +954,10 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
911
954
|
await this.#banValidator(tracPublicKey);
|
|
912
955
|
}
|
|
913
956
|
|
|
957
|
+
stopValidatorObserver() {
|
|
958
|
+
this.#enableValidatorObserver = false;
|
|
959
|
+
}
|
|
960
|
+
|
|
914
961
|
printHelp() {
|
|
915
962
|
console.log('Available commands:');
|
|
916
963
|
console.log('- /add_writer: add yourself as validator to this MSB once whitelisted.');
|
|
@@ -938,10 +985,8 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
938
985
|
this.printHelp();
|
|
939
986
|
break;
|
|
940
987
|
case '/exit':
|
|
941
|
-
console.log('Exiting...');
|
|
942
988
|
rl.close();
|
|
943
989
|
await this.close();
|
|
944
|
-
typeof process !== "undefined" ? process.exit(0) : Pear.exit(0);
|
|
945
990
|
break;
|
|
946
991
|
case '/push_writer_add':
|
|
947
992
|
await this.#requestWriterRole(true)
|
|
@@ -1001,5 +1046,4 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
1001
1046
|
|
|
1002
1047
|
}
|
|
1003
1048
|
|
|
1004
|
-
function noop() { }
|
|
1005
1049
|
export default MainSettlementBus;
|
package/src/network.js
CHANGED
|
@@ -20,6 +20,7 @@ import c from 'compact-encoding'
|
|
|
20
20
|
const wakeup = new w();
|
|
21
21
|
|
|
22
22
|
class Network {
|
|
23
|
+
#shouldStopPool = false;
|
|
23
24
|
constructor(base) {
|
|
24
25
|
this.tx_pool = [];
|
|
25
26
|
this.pool(base);
|
|
@@ -28,7 +29,7 @@ class Network {
|
|
|
28
29
|
this.admin = null
|
|
29
30
|
this.validator_stream = null
|
|
30
31
|
this.validator = null;
|
|
31
|
-
this.custom_stream =
|
|
32
|
+
this.custom_stream = null;
|
|
32
33
|
this.custom_node = null
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -48,7 +49,7 @@ class Network {
|
|
|
48
49
|
let clean = Date.now();
|
|
49
50
|
let conns = {};
|
|
50
51
|
|
|
51
|
-
swarm = new Hyperswarm({ keyPair, bootstrap
|
|
52
|
+
swarm = new Hyperswarm({ keyPair, bootstrap: bootstrap, maxPeers: MAX_PEERS, maxParallel: MAX_PARALLEL, maxServerConnections: MAX_SERVER_CONNECTIONS, maxClientConnections: MAX_CLIENT_CONNECTIONS });
|
|
52
53
|
|
|
53
54
|
console.log(`Channel: ${b4a.toString(channel)}`);
|
|
54
55
|
swarm.on('connection', async (connection) => {
|
|
@@ -68,7 +69,7 @@ class Network {
|
|
|
68
69
|
encoding: c.json,
|
|
69
70
|
async onmessage(msg) {
|
|
70
71
|
try {
|
|
71
|
-
|
|
72
|
+
|
|
72
73
|
if (msg === 'get_validator') {
|
|
73
74
|
const nonce = Wallet.generateNonce().toString('hex');
|
|
74
75
|
const _msg = {
|
|
@@ -78,7 +79,7 @@ class Network {
|
|
|
78
79
|
channel: b4a.toString(channel, 'utf8')
|
|
79
80
|
};
|
|
80
81
|
const sig = wallet.sign(JSON.stringify(_msg) + nonce);
|
|
81
|
-
message.send({response: _msg, sig, nonce})
|
|
82
|
+
message.send({ response: _msg, sig, nonce })
|
|
82
83
|
swarm.leavePeer(connection.remotePublicKey)
|
|
83
84
|
} else if (msg === 'get_admin') {
|
|
84
85
|
const res = await msb.get(EntryType.ADMIN);
|
|
@@ -91,10 +92,10 @@ class Network {
|
|
|
91
92
|
channel: b4a.toString(channel, 'utf8')
|
|
92
93
|
};
|
|
93
94
|
const sig = wallet.sign(JSON.stringify(_msg) + nonce);
|
|
94
|
-
message.send({response: _msg, sig, nonce})
|
|
95
|
+
message.send({ response: _msg, sig, nonce })
|
|
95
96
|
swarm.leavePeer(connection.remotePublicKey)
|
|
96
|
-
} else
|
|
97
|
-
|
|
97
|
+
} else if (msg === 'get_node') {
|
|
98
|
+
|
|
98
99
|
const nonce = Wallet.generateNonce().toString('hex');
|
|
99
100
|
const _msg = {
|
|
100
101
|
op: 'node',
|
|
@@ -103,9 +104,9 @@ class Network {
|
|
|
103
104
|
channel: b4a.toString(channel, 'utf8')
|
|
104
105
|
};
|
|
105
106
|
const sig = wallet.sign(JSON.stringify(_msg) + nonce);
|
|
106
|
-
message.send({response: _msg, sig, nonce})
|
|
107
|
+
message.send({ response: _msg, sig, nonce })
|
|
107
108
|
swarm.leavePeer(connection.remotePublicKey)
|
|
108
|
-
|
|
109
|
+
|
|
109
110
|
} else if (msg.response !== undefined && msg.response.op !== undefined && msg.response.op === 'validator') {
|
|
110
111
|
const res = await msb.get(msg.response.address);
|
|
111
112
|
if (res === null) return;
|
|
@@ -127,7 +128,7 @@ class Network {
|
|
|
127
128
|
}
|
|
128
129
|
swarm.leavePeer(connection.remotePublicKey)
|
|
129
130
|
}
|
|
130
|
-
else if (msg.response !== undefined && msg.response.op !== undefined && msg.response.op === 'node'){
|
|
131
|
+
else if (msg.response !== undefined && msg.response.op !== undefined && msg.response.op === 'node') {
|
|
131
132
|
|
|
132
133
|
const verified = wallet.verify(msg.sig, JSON.stringify(msg.response) + msg.nonce, msg.response.address)
|
|
133
134
|
if (verified && msg.response.channel === b4a.toString(channel, 'utf8')) {
|
|
@@ -180,7 +181,7 @@ class Network {
|
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
if (conns[peer] === undefined) {
|
|
183
|
-
conns[peer] = {prev: _now, now: 0, tx_cnt: 0}
|
|
184
|
+
conns[peer] = { prev: _now, now: 0, tx_cnt: 0 }
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
conns[peer].now = _now;
|
|
@@ -227,7 +228,7 @@ class Network {
|
|
|
227
228
|
wp: wallet.publicKey,
|
|
228
229
|
wn: nonce
|
|
229
230
|
};
|
|
230
|
-
network.tx_pool.push({tx: parsedPreTx.tx, append_tx: append_tx});
|
|
231
|
+
network.tx_pool.push({ tx: parsedPreTx.tx, append_tx: append_tx });
|
|
231
232
|
}
|
|
232
233
|
|
|
233
234
|
swarm.leavePeer(connection.remotePublicKey)
|
|
@@ -260,6 +261,7 @@ class Network {
|
|
|
260
261
|
|
|
261
262
|
// must be called AFTER the protomux init above
|
|
262
263
|
const stream = store.replicate(connection);
|
|
264
|
+
stream.on('error', (error) => { });
|
|
263
265
|
wakeup.addStream(stream);
|
|
264
266
|
|
|
265
267
|
connection.on('error', (error) => { });
|
|
@@ -276,7 +278,7 @@ class Network {
|
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
async pool(base) {
|
|
279
|
-
while (
|
|
281
|
+
while (!this.#shouldStopPool) {
|
|
280
282
|
if (this.tx_pool.length > 0) {
|
|
281
283
|
const length = this.tx_pool.length;
|
|
282
284
|
const batch = [];
|
|
@@ -290,6 +292,9 @@ class Network {
|
|
|
290
292
|
await sleep(5);
|
|
291
293
|
}
|
|
292
294
|
}
|
|
293
|
-
}
|
|
294
295
|
|
|
296
|
+
stopPool() {
|
|
297
|
+
this.#shouldStopPool = true;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
295
300
|
export default Network;
|
package/dump/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
package/dump/NOTICE
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Copyright 2025 Trac Systems UG
|
|
2
|
-
|
|
3
|
-
This project is part of the Trac Network.
|
|
4
|
-
Any derivative, open-source or not, that is not managed by Trac Systems UG,
|
|
5
|
-
is considered non-canonical and not supported.
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
package/dump/README.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Main Settlement Bus (MSB)
|
|
2
|
-
|
|
3
|
-
A peer-to-peer crypto validator network to verify and append transactions.
|
|
4
|
-
|
|
5
|
-
Release 1 (R1) must be used alongside Trac Network R1 releases to maintain contract consistency.
|
|
6
|
-
|
|
7
|
-
The MSB is utilizing the [Pear Runtime and Holepunch](https://pears.com/).
|
|
8
|
-
|
|
9
|
-
## Install
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
git clone -b msb-r1 --single-branch git@github.com:Trac-Systems/main_settlement_bus.git
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
While the MSB supports native node-js, it is encouraged to use Pear:
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
cd main_settlement_bus
|
|
21
|
-
npm install -g pear
|
|
22
|
-
npm install
|
|
23
|
-
pear run . store1
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Deploy Bootstrap (admin):**
|
|
27
|
-
|
|
28
|
-
- Choose option 1)
|
|
29
|
-
- Copy and backup the seedphrase
|
|
30
|
-
- Copy the "MSB Writer" address
|
|
31
|
-
- With a text editor, open the file msb.mjs in document root
|
|
32
|
-
- Replace the bootstrap address with the copied writer address
|
|
33
|
-
- Choose a channel name (exactly 32 characters)
|
|
34
|
-
- Run again: pear run . store1
|
|
35
|
-
- After the options appear, type /add_admin and hit enter
|
|
36
|
-
- Your instance is now the Bootstrap and admin peer, required to control validators
|
|
37
|
-
- Keep your bootstrap node running
|
|
38
|
-
- Strongly recommended: add a couple of nodes as writers
|
|
39
|
-
|
|
40
|
-
**Running indexers (admin)**
|
|
41
|
-
|
|
42
|
-
- Install on different machines than the Bootstrap's (ideally different data centers)
|
|
43
|
-
- Follow the "Running as validator" and then "Adding validators" procedures below
|
|
44
|
-
- Copy the MSB Writer address from your writer screen
|
|
45
|
-
- In your Bootstrap screen, add activate the new writers:
|
|
46
|
-
- /add_indexer <MSB Writer address (not the MSB address!)>
|
|
47
|
-
- You should see a success confirmation
|
|
48
|
-
- Usually 2 indexers on different locations are enough, we recommend 2 to max. 4 in addition to the Bootstrap
|
|
49
|
-
|
|
50
|
-
**Running as validator (first run):**
|
|
51
|
-
|
|
52
|
-
- Choose option 1)
|
|
53
|
-
- Copy and backup the seedphrase
|
|
54
|
-
- Copy the "MSB Address" after the screen fully loaded
|
|
55
|
-
- Hand your "MSB Address" over to the MSB admin for whitelisting
|
|
56
|
-
- Wait for the admin to announce the whitelist event
|
|
57
|
-
- In the screen type /add_writer
|
|
58
|
-
- After a few seconds you should see your validator being added as a writer
|
|
59
|
-
|
|
60
|
-
**Adding validators (admin):**
|
|
61
|
-
|
|
62
|
-
- Open the file /Whitelist/pubkeys.csv with a text editor
|
|
63
|
-
- Add as man Trac Network addresses as you wish
|
|
64
|
-
- In the MSB screen, enter /add_whitelist
|
|
65
|
-
- Wait for the listto be fully processed
|
|
66
|
-
- Inform your validator community being whitelisted
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7a28af069a36ce674ad04718e8ee63fe38c81a7770b144714c7666d085897d1c
|
package/dump/msb.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {MainSettlementBus} from './src/index.js';
|
|
2
|
-
|
|
3
|
-
const opts = {
|
|
4
|
-
stores_directory : 'stores2/',
|
|
5
|
-
store_name : typeof process !== "undefined" ? process.argv[2] : Pear.config.args[0],
|
|
6
|
-
bootstrap: 'a4951e5f744e2a9ceeb875a7965762481dab0a7bb0531a71568e34bf7abd2c53',
|
|
7
|
-
channel: '0002tracnetworkmainsettlementbus',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const msb = new MainSettlementBus(opts);
|
|
11
|
-
|
|
12
|
-
msb.ready().then(() => {
|
|
13
|
-
msb.interactiveMode();
|
|
14
|
-
});
|
package/dump/package.json
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "trac-msb",
|
|
3
|
-
"main": "msb.mjs",
|
|
4
|
-
"version": "0.1.75",
|
|
5
|
-
"pear": {
|
|
6
|
-
"name": "trac-msb",
|
|
7
|
-
"type": "terminal"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"dev": "pear run -d .",
|
|
12
|
-
"test:node": "brittle test/all.test.js",
|
|
13
|
-
"test:bare": "bare test/all.test.js"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"autobase": "7.6.3",
|
|
17
|
-
"hypercore": "^11.6.3",
|
|
18
|
-
"corestore": "^7.4.2",
|
|
19
|
-
"b4a": "1.6.7",
|
|
20
|
-
"bare-readline": "1.0.7",
|
|
21
|
-
"bare-tty": "5.0.2",
|
|
22
|
-
"compact-encoding": "^2.16.0",
|
|
23
|
-
"fastest-validator": "1.19.0",
|
|
24
|
-
"hyperbee": "^2.24.2",
|
|
25
|
-
"hypercore-crypto": "^3.4.0",
|
|
26
|
-
"hyperdht": "^6.20.5",
|
|
27
|
-
"hyperswarm": "^4.11.5",
|
|
28
|
-
"protomux": "^3.10.1",
|
|
29
|
-
"protomux-wakeup": "2.4.0",
|
|
30
|
-
"readline": "npm:bare-node-readline",
|
|
31
|
-
"ready-resource": "1.1.2",
|
|
32
|
-
"trac-wallet": "0.0.43",
|
|
33
|
-
"tty": "npm:bare-node-tty"
|
|
34
|
-
},
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"registry": "https://registry.npmjs.org",
|
|
37
|
-
"access": "public",
|
|
38
|
-
"brittle": "^3.16.2"
|
|
39
|
-
}
|
|
40
|
-
}
|