-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
50 lines (41 loc) · 1.25 KB
/
test.js
File metadata and controls
50 lines (41 loc) · 1.25 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const Blockchain = require('./Blockchain.js');
const Block = require('./Block.js');
let bc = new Blockchain();
// bc.validateBlock(1).then( (res) => console.log(res))
// console.log(bb)
(function theLoop (i) {
setTimeout(function () {
let blockTest = new Block("Test Block - " + (i + 1));
bc.addBlock(blockTest)
// bc.getBlock(i).then((res) => console.log(res));
// console.log(result);
i++;
if (i < 4) theLoop(i);
}, 2000);
})(0);
bc.validateChain();
// bc.getBlock(111).then( (block) => {
// console.log(block);
// }).catch( (err)=> {
// console.log('Error getting block ' + err);
// });
// bc.getBlock(118).then( (block) => {
// console.log(block);
// }).catch( (err)=> {
// console.log('Error getting block ' + err);
// });
// bc.getBlock(119).then( (block) => {
// console.log(block);
// }).catch( (err)=> {
// console.log('Error getting block ' + err);
// });
// bc.getBlock(120).then( (block) => {
// console.log(block);
// }).catch( (err)=> {
// console.log('Error getting block ' + err);
// });
// bc.saveBlock(key, block).then( (value) => {
// console.log(value);
// }).catch( (err)=> {
// console.log('Block ' + key + ' submission failed', err);
// });