-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmineBlock.cpp
More file actions
43 lines (27 loc) · 1.08 KB
/
mineBlock.cpp
File metadata and controls
43 lines (27 loc) · 1.08 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
#include <bits/stdc++.h>
uintmax_t mineBlock(string ruta, string prevHash, int blockProof){
ofstream file;
string senderID;
string receiverID;
int amount;
file.open(ruta, ios::app);
cout << "Type your sender ID: ";
cin >> senderID;
cout << "Type the receiver ID: ";
cin >> receiverID;
cout << "Amount to send: ";
cin >> amount;
hash <string> blockHash;
uintmax_t hashing = blockHash(prevHash + senderID + receiverID);
if(file.is_open()){
file << senderID + ',' + to_string(amount) + ',' + receiverID + ',' + to_string(blockProof) + ','+ prevHash + ',' + to_string(hashing) + ',' + '\n';
cout << endl <<"The block has been generated" << endl << endl;
cout << "senderID: " << senderID << endl;
cout << "amount: " << amount << endl;
cout << "receiverID: " << receiverID << endl;
cout << "blockProof: " << blockProof << endl;
cout << "prevHash: " << prevHash << endl;
cout << "hashing: " << hashing << endl;
}
return hashing;
}