-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (25 loc) · 882 Bytes
/
main.cpp
File metadata and controls
31 lines (25 loc) · 882 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
#include "src/wallet/wallet.h"
#include "src/generators/blockchain_generator.h"
#include "src/nodes/full_node/full_node.cpp"
#include "src/nodes/spv_node/spv_node.cpp"
int main(int argc, char *argv[]) {
// Alice wallet
Wallet alice_wallet(100);
// Joe wallet
Wallet joe_wallet(0);
std::cout << alice_wallet;
std::cout << joe_wallet;
// Generate random blockchain
Blockchain blockchain = generateBlockchain(2);
// Create full node
FullNode full_node(blockchain);
// Create new transaction
Transaction new_transaction = full_node.make_transaction(alice_wallet, joe_wallet, 30);
std::cout << full_node;
std::cout << alice_wallet;
std::cout << joe_wallet;
// Create spv node
SPVNode spvNode(full_node);
std::string stateDb_value = spvNode.verifyTransaction(new_transaction);
std::cout << stateDb_value;
}