-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.ts
More file actions
28 lines (19 loc) · 917 Bytes
/
tests.ts
File metadata and controls
28 lines (19 loc) · 917 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
import { Blockchain, Transaction } from './main';
let rileyCoin = new Blockchain();
rileyCoin.createTransaction(new Transaction('addressUno', 'addressDos', 100));
rileyCoin.createTransaction(new Transaction('addressDos', 'addressUno', 50));
console.log('\n Starting the Miner....');
rileyCoin.minePendingTransaction('My-mothers-address'); //Mining with 'My Mothers Address', this would be a users id
console.log(
'\n The balance of my mother is : ',
rileyCoin.getBalanceOfAddress('My-mothers-address')
);
console.log('\n Starting the Miner....');
rileyCoin.minePendingTransaction('My-mothers-address');
//Here you will see the added reward balance from the first block mined since it went into the pending array
console.log(
'\n The balance of my mother is : ',
rileyCoin.getBalanceOfAddress('My-mothers-address')
);
//Is the chain valid?
console.log('Is chain valid? : ', rileyCoin.isChainValid());