Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by prasanga on 2/19/18.
- //
- #ifndef MINIP_BLOCK_H
- #define MINIP_BLOCK_H
- #include <vector>
- #include <iostream>
- #include <sstream>
- #include <iterator>
- using namespace std;
- namespace bitenger_blockchain{
- class Block{
- private:
- std::string _sender;
- std::string _receiver;
- std::string _prevHash;
- std::string _data;
- public:
- long long _size;
- std::string _genesisHash;
- std::string _currentHash;
- Block(){
- _size = sizeof(*this);
- }
- bool verify(){
- };
- bool checkRecipient(const std::string id){
- return (id==this->_receiver);
- }
- std::string getData(std::string privateKey){
- if(checkRecipient(privateKey))
- return this->_data;
- return "";
- }
- std::string sendData(){
- return _genesisHash+" "+_currentHash+" "+_sender+" "+_receiver+" "+_prevHash+" "+_data;
- }
- void receiveData(string dat){
- std::stringstream ss(dat);
- std::istream_iterator<std::string> begin(ss);
- std::istream_iterator<std::string> end;
- std::vector<std::string> vstrings(begin, end);
- cout<<vstrings.size()<<endl;
- }
- };
- struct Node{
- Block data;
- Node *nextNode;
- };
- std::vector<struct Node> blockChain;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement