-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
33 lines (28 loc) · 785 Bytes
/
main.js
File metadata and controls
33 lines (28 loc) · 785 Bytes
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
const Blockchain = require('./Blockchain')
const DoWork = require('./DoWork')
let jmrCoin = new Blockchain()
// temp variables for testing
let temp = 0
let proofs = []
for(let i = 0; i < 3; i++) {
let data = {}
let amount = Math.floor(Math.random() * 101)
data.amount = amount
let proof = ''
// test both good work and bad work
// dot it randomly based on whether amount is even/odd
// if(amount % 2 !== 0) {
temp++
proof = DoWork.goodWork(data, jmrCoin.getConditionString())
proofs.push(proof)
// } else {
// proof = DoWork.bogusWork()
// }
jmrCoin.addBlock(data, proof)
}
console.log(`
I FOUND ${temp} BLOCK(S) TO ADD...
HERE ARE THE VALID PROOFS:
${proofs}
`)
console.log(JSON.stringify(jmrCoin, null, 4))