Main Menu

Importing Balances

Started by barwizi, February 14, 2014, 12:16:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

barwizi

Quote from: newmine on February 19, 2014, 03:36:32 AM
Shouldn't FreeTrade know the answer to this?

i've sent him a PM, hopefully he'll assist
--Bar--  PiNEJGUv4AZVZkLuF6hV4xwbYTRp5etWWJ

The magical land of crypto, no freebies people.

NewMine

Shouldn't FreeTrade know the answer to this?

barwizi

#1
 am trying to import protoshares balances into a chain. I found the following pieces of code:-


Quotestd::map<std::string,int64> getGenesisBalances(){
   std::map<std::string,int64> genesisBalances;
   // ProtoShares balances, these will only be included if i get the method right
   ifstream myfile ("genesisbalances.txt");
   char * pEnd;
   std::string line;
   if (myfile.is_open()){
      while ( myfile.good() ){
         getline (myfile,line);
         std::vector<std::string> strs;
         boost::split(strs, line, boost::is_any_of(","));
         genesisBalances[strs[0]]=strtoll(strs[1].c_str(),&pEnd,10);
      }
      myfile.close();
   }   
   return genesisBalances;
}


then

Quoteif(pindexBest->nHeight+1==1){
   //Block 1 - add balances for beta testers, protoshares
       std::map<std::string,int64> genesisBalances= getGenesisBalances();
   std::map<std::string,int64>::iterator balit;
   int i=1;
   int64 total=0;
   txNew.vout.resize(genesisBalances.size()+1);
   for(balit=genesisBalances.begin(); balit!=genesisBalances.end(); ++balit){
      //printf("gb:%s,%llu",balit->first.c_str(),balit->second);
      CBitcoinAddress address(balit->first);
      txNew.vout.scriptPubKey.SetDestination( address.Get() );
      txNew.vout.nValue = balit->second;
      total=total+balit->second;
      i++;
   }
   printf("Total ...%llu\n",total); 
   }

now i am trying to figure out the structure of the genesisbalances.txt required


is it meant to be like this

QuotePZjWgGZQWdk5VHA18d6XE9JX7nbZESY7EV,13999.99500000
PgBqNfhXY6DAWRFKiao3E5ADsnYiQ83wGt,10999.00000000
PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD,10000.00000000
Piev8TMX2fT5mFtgxx2TXJaqXP37weMPuD,10000.00000000
PmrBYp4PzMYaixdaxQeQLEdXXtCVJsb7HQ,9996.93350272
PiR3em7nkSfBCZSALUrVKK7oVHxWXBJekZ,9847.88858195
PeTDLjj1mvH8dHNDrbpf2JegGhHetMdHqH,9823.25546630
PtLiyRBHaxpqNGvRd6m2tVsru6PjCGQca7,8200.00000000
PdSu1KoF7izeTWZmKV9jnKNfpwy3vByT5M,7674.80000000
Payg36hEzjSZxvnnF47sYoUUx4cUjVEs2H,7570.54421844

or with commas at the end like this :-

QuotePZjWgGZQWdk5VHA18d6XE9JX7nbZESY7EV,13999.99500000,
PgBqNfhXY6DAWRFKiao3E5ADsnYiQ83wGt,10999.00000000,
PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD,10000.00000000,
Piev8TMX2fT5mFtgxx2TXJaqXP37weMPuD,10000.00000000,
PmrBYp4PzMYaixdaxQeQLEdXXtCVJsb7HQ,9996.93350272,
PiR3em7nkSfBCZSALUrVKK7oVHxWXBJekZ,9847.88858195,
PeTDLjj1mvH8dHNDrbpf2JegGhHetMdHqH,9823.25546630,
PtLiyRBHaxpqNGvRd6m2tVsru6PjCGQca7,8200.00000000,
PdSu1KoF7izeTWZmKV9jnKNfpwy3vByT5M,7674.80000000,
Payg36hEzjSZxvnnF47sYoUUx4cUjVEs2H,7570.54421844,

or like this, with no new lines at the end?

QuotePZjWgGZQWdk5VHA18d6XE9JX7nbZESY7EV,13999.99500000,PgBqNfhXY6DAWRFKiao3E5ADsnYiQ83wGt,10999.00000000,PgsuLoe9ojRKFGJGVpqqk37gAqNJ4ozboD,10000.00000000,Piev8TMX2fT5mFtgxx2TXJaqXP37weMPuD,10000.00000000,PmrBYp4PzMYaixdaxQeQLEdXXtCVJsb7HQ,9996.93350272,PiR3em7nkSfBCZSALUrVKK7oVHxWXBJekZ,9847.88858195,PeTDLjj1mvH8dHNDrbpf2JegGhHetMdHqH,9823.25546630,PtLiyRBHaxpqNGvRd6m2tVsru6PjCGQca7,8200.00000000,PdSu1KoF7izeTWZmKV9jnKNfpwy3vByT5M,7674.80000000,Payg36hEzjSZxvnnF47sYoUUx4cUjVEs2H,7570.54421844,

--Bar--  PiNEJGUv4AZVZkLuF6hV4xwbYTRp5etWWJ

The magical land of crypto, no freebies people.