Skip to content

Commit

Permalink
make txns.txt to loop over txns in mempool
Browse files Browse the repository at this point in the history
  • Loading branch information
110CodingP committed Apr 8, 2024
1 parent 41ad603 commit 331b9b0
Show file tree
Hide file tree
Showing 5 changed files with 16,290 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ Second, we need to validate the transactions using that info, but then how do we

Third,build the block
Fourth, we need to find the nonce which passes difficulty and hence the hash
We need to output the coinbase txn also
We need to output the coinbase txn also


// since cpp doesn't have a function for iterating over files in a directory had to make "txns.txt".
Binary file modified mine
Binary file not shown.
27 changes: 24 additions & 3 deletions mine.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
#include <iostream>//damn! the steam is really I/O stream!
#include <iostream>//damn! the stream is really I/O stream!
#include <fstream>
#include <string>
#include <vector>
using namespace std;

//create a serialise function to serialise txns

int main() {
//use freopen etc. to read json files

freopen("output.txt","w",stdout);
cout<<"Hello World\n";

ifstream myfile;
myfile.open("txns.txt");
string mystring;

vector<string> txns;

while (myfile.good()) {
getline(myfile,mystring);
txns.push_back(mystring);
}
myfile.close();

for (string txn: txns) {
string filename = "mempool/" + txn;
myfile.open(filename);
//getline(myfile,mystring);
//cout<<mystring<<'\n';
}
return 0;
}
Loading

0 comments on commit 331b9b0

Please sign in to comment.