Simulator 09

ExSan++

     1 I am studying Blockchain, the subject is so interesting.

     2 I have coded my first simulations using ExSan, which already

     3 has implemented binary tree in every block/node

     4 In this simulations I am tracking blockchains transactions 

     5 without hashing, every row is a peer, when it reaches the 

     6 end of the row it comes back to the begining of the rowand keeps on.

     7 My Profile  #opentowork

     8 

     9 ///----------CODE

    10 /***********START***************/

    11 void bckchxsn3() {

    12    setJobID("bch3_");

    13    string label = "BlockChainSimulator 3";

    14    out("", label);

    15 

    16    enum  FLOAT { ppF };

    17    enum  BOOL { ppB };

    18    enum  USHORT { ppU };

    19    enum  STRING { ppW };

    20    enum  CHAR { ppC };

    21 

    22    unsigned short int nProc{ 5 };

    23    unsigned short wtext{ 7 }, counToMerkel{ 0 }, wdt{ 3 }; //wdt display first and last wdt c

    24    unsigned short rows{ 10 }, cols{ 10 }; //always more than 1 here

    25 

    26    ///----

    27 

    28    boost::random::uniform_int_distribution<> uniformRndIntNBitCoins{ 0, 7 }; //#include 

    29    boost::random::uniform_int_distribution<> uniformRndIntTrueFals{ 0, 1 }; //#include 

    30    boost::random::uniform_int_distribution<> uniformRndIntTx{ 1, 5 };

    31 

    32    unsigned seed = chrono::system_clock::now().time_since_epoch().count();

    33    default_random_engine generator(seed);

    34    ///----

    35 

    36    NETPTR  net{ nullptr };

    37    CELLPTR ptr{ nullptr }, prevptr{ nullptr };

    38    ROWPTR  rptr{ nullptr };

    39 

    40    net = net->exsan(rows, cols, ppF, ppB, ppU, ppW, ppC);

    41 

    42    ///----

    43    unsigned short int rowCoord{ 0 }, colCoord{ 0 };

    44    unsigned short int thisRow{ 0 }, thisCol{ 0 };

    45    unsigned short int randRow(0), randRowTo{ 0 };

    46    unsigned short int nBitCoinsTotal{ 0 }, nBitCoins{ 0 }, nBitCoinsTx{ 0 };

    47    unsigned short int nRollTheDice{ 5 };

    48    bool  txRx{ 0 }, displayTxRx{ 0 };

    49 

    50    for (unsigned short test = 1; test <= nRollTheDice; test++) {

    51 

    52       boost::random::uniform_int_distribution<> RndIntRows{ 2, rows }; //#include 

    53       thisRow = RndIntRows(generator);

    54 

    55       boost::random::uniform_int_distribution<> uniformRndInt{ 1, thisRow }; //#include 

    56 

    57       boost::random::uniform_int_distribution<> RndIntCols{ 2, cols }; //#include 

    58       thisCol = RndIntCols(generator);

    59 

    60       net->set_work_sheet(net, ppF, thisRow, thisCol);

    61 

    62       bool* aryRows = new bool[net->get_rows_in_page(ppF, 'f') + 1];

    63       bool* aryCols = new bool[net->get_cols_in_page(ppF, 'f') + 1];

    64       for (thisRow = 1; thisRow <= net->get_rows_in_page(ppF, 'f'); thisRow++)    aryRows[thisRow

    65       for (thisCol = 1; thisCol <= net->get_cols_in_page(ppF, 'f'); thisCol++)    aryCols[thisCol

    66 

    67 

    68       //prepares all rowptr to the first col

    69       rptr = net->goto_row(net, ppF, 1, 'f');

    70       for (thisRow = 1; thisRow <= net->get_rows_in_page(ppF, 'f'); thisRow++) {

    71          rptr->tickInPoinTo(rptr->get_forward_ptr());

    72          rptr = rptr->get_down_ptr();

    73       }

    74 

    75       fout << "\n\n\tTEST " << setw(3) << test << " out of " << nRollTheDice;

    76       vector randIntVector;   // every pool a new vector

    77       nBitCoinsTotal = 0;

    78       aryCols[1] = 1;

    79       fout << "\n\tRANDOM GENERATED(peer in row, nBitcoins)";

    80       for (unsigned short counter = 0; counter < net->get_rows_in_page(ppF); counter++) {

    81          randRow = uniformRndInt(generator);

    82          //fout << "\n\trandRow" << setw(3) << randRow;                        

    83          if (std::find(randIntVector.begin(), randIntVector.end(), randRow) != randIntVector.end(

    84             --counter;

    85             //fout << "\tfound!!!!";

    86          }

    87          else {

    88             randIntVector.push_back(randRow);

    89             nBitCoins = uniformRndIntNBitCoins(generator);

    90             nBitCoinsTotal += nBitCoins;

    91             //fout << "\n\tNew entry row/peer " << setw(3) << randRow << "\tnrand Bitcoins assigned

    92             rptr = net->goto_row(net, ppF, randRow, 'f');

    93 

    94             ptr = rptr->get_ptrLasTick();

    95             ptr->set_data(ppF, nBitCoins);

    96             rptr->tickIn(ppF, ptr->get_data(ppF)); // next entry will be in col2

    97 

    98             if (!nBitCoins) rptr->tickInPoinTo(rptr->get_forward_ptr()); //points to col 1 

    99 

   100             if (counter == 1 && nBitCoinsTotal) {//ok there is more than one active bitcoin holder

   101                //fout << "\n\tAt this instant there are at least 2 peers in the layout that could sta

   102                     //         \n\tat least one of them has no zero bitcoins";

   103 

   104             }

   105             //next line togheter

   106             //aryRows[randRow] = 1;

   107             //fout << "\n\tNew entry row/peer " << setw(3) << randRow << "\tnrand Bitcoins assigned

   108          }

   109       }

   110 

   111       aryCols[1] = 1;

   112       fout << "\n\tORIGINAL SEED Total Bitcoins available " << nBitCoinsTotal << "  page " << p

   113 

   114       for (thisRow = 1; thisRow <= net->get_rows_in_page(ppF, 'f'); thisRow++)    aryRows[thisRow

   115       for (thisCol = 1; thisCol <= net->get_cols_in_page(ppF, 'f'); thisCol++)    aryCols[thisCol

   116 

   117       //there is already a data in col 1==???? 0 ????

   118 

   119       nProc = net->get_rows_in_page(ppF, 'f') * net->get_cols_in_page(ppF, 'f');

   120       boost::random::uniform_int_distribution<> RndIntProc{ nProc, int(nProc * 1.33) }; //#incl

   121       nProc = RndIntProc(generator);

   122 

   123       if (displayTxRx)fout << "\n\tSimmulation random peer and bitcoins to traded   nProc: " <<

   124       for (unsigned short pro = 1; pro <= nProc; pro++) {

   125          if (displayTxRx)fout.flush() << "\n\tProcess" << setw(3) << pro << " out of " << nProc;

   126          //nBitCoins = uniformRndIntNBitCoins(generator);

   127          randRow = uniformRndInt(generator);

   128          rptr = net->goto_row(net, ppF, randRow, 'f');

   129          ptr = rptr->get_ptrLasTick();

   130          //fout << "\n\tPeer" << setw(3) << randRow <<  "   next block: " << ptr->get_col();

   131 

   132          nBitCoinsTx = nBitCoins = 0;

   133          if (ptr->get_col() == 1) {

   134             //fout << "\n\tptr to first col**"; 

   135             nBitCoins = net->point_to(net, ppF, randRow, net->get_cols_in_page(ppF, 'f'), 'f')->get

   136             if (nBitCoins) {

   137                do {

   138                   randRowTo = uniformRndInt(generator);

   139                } while (randRowTo == randRow);

   140                boost::random::uniform_int_distribution<> uniformRndIntTx{ 1, nBitCoins }; //#include 

   141                nBitCoinsTx = uniformRndIntTx(generator);

   142                if (displayTxRx)fout.flush() << "\n\tPeer" << setw(3) << randRow << " ---will transfer

   143                //fout.flush() << "\n\tPeer[" << setw(3) << randRow << ", " << ptr->get_previous_ptr()

   144 

   145                ptr->set_data(ppF, nBitCoins - nBitCoinsTx);

   146                rptr->tickIn(ppF, ptr->get_data(ppF));  //updated pointer to next in row

   147             }

   148             else { if (displayTxRx) fout << "\n\tPeer[" << randRow << "] has no funds available to 

   149          }

   150          else {

   151             if (ptr->get_col() == net->get_cols_in_page(ppF, 'f')) {// fout << "\n\tlast col";  

   152                nBitCoins = net->point_to(net, ppF, randRow, net->get_cols_in_page(ppF, 'f'), 'f')->ge

   153                if (nBitCoins) {

   154                   do {

   155                      randRowTo = uniformRndInt(generator);

   156                   } while (randRowTo == randRow);

   157                   boost::random::uniform_int_distribution<> uniformRndIntTx{ 1, nBitCoins }; //#include

   158                   nBitCoinsTx = uniformRndIntTx(generator);

   159                   //fout.flush() << "\n\tRow " << setw(3) << randRow << "\tBitcoins available: " << nBi

   160                   if (displayTxRx)fout.flush() << "\n\tPeer" << setw(3) << randRow << "\t will transfer

   161                   ptr->set_data(ppF, ptr->get_previous_ptr()->get_data(ppF) - nBitCoinsTx);

   162                   //rptr->tickIn(ppF, ptr->get_data(ppF));  //updated pointer to next in row???? there 

   163 

   164                   rptr = net->goto_row(net, ppF, randRow, 'f');

   165                   rptr->tickInPoinTo(rptr->get_forward_ptr());

   166                }

   167                else { if (displayTxRx) fout << "\n\tPeer[" << randRow << "] has no funds available to

   168             }

   169             else {

   170                if (displayTxRx)fout << "\n\tptr points not to the first neither to the last";

   171                nBitCoins = ptr->get_previous_ptr()->get_data(ppF);

   172                if (nBitCoins) {

   173                   do {

   174                      randRowTo = uniformRndInt(generator);

   175                   } while (randRowTo == randRow);

   176 

   177                   boost::random::uniform_int_distribution<> uniformRndIntTx{ 1, nBitCoins }; //#include

   178                   nBitCoinsTx = uniformRndIntTx(generator);

   179                   //fout.flush() << "\n\tRow " << setw(3) << randRow << "\tBitcoins available: " << nBi

   180                   if (displayTxRx)fout.flush() << "\n\tPeer[" << setw(3) << randRow << ", " << ptr->get

   181                   ptr->set_data(ppF, ptr->get_previous_ptr()->get_data(ppF) - nBitCoinsTx);

   182                   rptr->tickIn(ppF, ptr->get_data(ppF));  //updated pointer to next in row

   183 

   184                   ptr->set_bool(ppB, 1);

   185                   aryRows[randRowTo] = 1;

   186                   aryRows[randRow] = 1;

   187                   //fout << "\n\tTx Layout updated";  net->show_page(net, ppF, 'f', 0, 3, wtext, 4, ary

   188                   aryRows[randRowTo] = 0;

   189                   aryRows[randRow] = 0;

   190                   ptr->set_bool(ppB, 0);

   191 

   192                }

   193                else { if (displayTxRx) fout << "\n\tPeer[" << randRow << "] has no funds available to

   194 

   195             }

   196          }

   197          if (nBitCoinsTx) {

   198             //fout << "\n\tThere was a Tx, update Receptor new block ";

   199             rptr = net->goto_row(net, ppF, randRowTo, 'f');

   200             ptr = rptr->get_ptrLasTick();

   201             //fout << "\n\tReceptor Peer: " << setw(3) << randRowTo << "   next block: " << ptr->ge

   202 

   203             if (ptr->get_col() == 1) {// fout << "\n\tRx first col"; 

   204                if (displayTxRx)if (displayTxRx) fout.flush() << "\n\tPeer" << setw(3) << randRowTo <<

   205                ptr->set_data(ppF, net->point_to(net, ppF, randRowTo, net->get_cols_in_page(ppF, 'f'),

   206                rptr->tickIn(ppF, ptr->get_data(ppF));  //updated pointer to next in row

   207                aryRows[randRowTo] = 1;

   208                aryRows[randRow] = 1;

   209                //fout << "\n\tRx Layout updated";  net->show_page(net, ppF, 'f', 0, 3, wtext, 4, aryR

   210                aryRows[randRowTo] = 0;

   211                aryRows[randRow] = 0;

   212             }

   213             else {

   214                if (ptr->get_col() == net->get_cols_in_page(ppF, 'f')) { //fout << "\n\tptr in last co

   215                   if (displayTxRx)fout.flush() << "\n\tPeer[" << setw(3) << randRowTo << "]\taccepts tr

   216                   ptr->set_data(ppF, ptr->get_previous_ptr()->get_data(ppF) + nBitCoinsTx); //+ in RX

   217                   rptr = net->goto_row(net, ppF, randRowTo, 'f');

   218                   rptr->tickInPoinTo(rptr->get_forward_ptr()); //next to be filled in col 1            

   219                }

   220                else {

   221                   if (displayTxRx) fout << "\n\tRx, ptr points not to the first neither to the last";

   222                   nBitCoins = ptr->get_previous_ptr()->get_data(ppF);

   223                   if (displayTxRx) fout.flush() << "\n\tPeer" << setw(3) << randRowTo << "\taccepts tra

   224                   ptr->set_data(ppF, ptr->get_previous_ptr()->get_data(ppF) + nBitCoinsTx);

   225                   rptr->tickIn(ppF, ptr->get_data(ppF));  //updated pointer to next in row

   226 

   227                   aryRows[randRowTo] = 1;

   228                   aryRows[randRow] = 1;

   229                   //fout << "\n\tLayout updated";  net->show_page(net, ppF, 'f', 0, 3, wtext, 4, aryRow

   230                   aryRows[randRowTo] = 0;

   231                   aryRows[randRow] = 0;

   232                }

   233             }

   234          }

   235          if (displayTxRx) {

   236             aryRows[randRowTo] = 1;

   237             aryRows[randRow] = 1;

   238             fout << "\n\tLayout updated";  net->show_page(net, ppF, 'f', 0, 3, wtext, 4, aryRows);

   239             aryRows[randRowTo] = 0;

   240             aryRows[randRow] = 0;

   241          }

   242       }

   243 

   244       //fout << "\n\tLayout at the end";  net->show_page(net, ppF, 'f', 0, 3, wtext, 4);

   245       fout << "\n\tThere has been  " << nProc << " transactions";

   246       fout << "\tthe layout at the end looks like pp " << ppF;  net->show_page(net, ppF, 'f', 0

   247 

   248       fout << "\n\tAt the end, let's veryfiy Sum Up of bitCoins[peer, col] = val";

   249       double bicoinCheck{ 0 };

   250       //rptr = net->goto_row(net, ppF, 1, 'f');

   251       if (1)

   252          for (thisRow = 1; thisRow <= net->get_rows_in_page(ppF, 'f'); thisRow++) {

   253             rptr = net->goto_row(net, ppF, thisRow, 'f');

   254             ptr = rptr->get_ptrLasTick();

   255             if (ptr->get_col() == 1) {

   256                bicoinCheck += net->point_to(net, ppF, thisRow, net->get_cols_in_page(ppF, 'f'), 'f')-

   257                fout << "\n\tLast block entry at the end of row    [" << setw(2) << thisRow << ", " <<

   258                fout << "\t  current sum up = " << bicoinCheck;

   259             }

   260             else {

   261                bicoinCheck += ptr->get_previous_ptr()->get_data(ppF);

   262                fout << "\n\t\t\t\t\t\tLast block entry  [" << setw(2) << thisRow << ", " << setw(2) <

   263                fout << "\t  current sum up = " << bicoinCheck;

   264             }

   265             //rptr = rptr->get_down_ptr();

   266          }

   267 

   268       fout << "\n\t\t\t\tLets see last entry and verify bitCoins sum up  bicoinCheck = " << set

   269       fout << "\n\t\t\t\tORIGINAL SEED Total Bitcoins available " << setw(3) << nBitCoinsTotal;

   270       if (bicoinCheck != nBitCoinsTotal) {

   271          fout << "\tERROR!!!\n\n\n\n";

   272          Beep(1333, 440);     //beep(1000, 1);

   273       }

   274       else fout << "\tOK SUM-UP OK!\n\n";

   275 

   276       //before re-using the layout in this for-loop reset                 

   277 

   278       rptr = net->goto_row(net, ppF, 1, 'u');

   279       for (thisRow = 1; thisRow <= net->get_rows_in_page(ppF, 'f'); thisRow++) {

   280          ptr = rptr->get_forward_ptr();

   281          //fout << "\n\n\trptr row: " << rptr->get_n_row() << "\t(" << ptr->get_row() << ", " << 

   282          for (thisCol = 1; thisCol <= net->get_cols_in_page(ppF, 'f'); thisCol++) {

   283             ptr->set_data(ppF, 0);

   284             ptr = ptr->get_next_ptr();

   285          }

   286          rptr = rptr->get_down_ptr();

   287       }

   288 

   289       //fout << "\n\n\tReset page: " << ppF;  net->show_page(net, ppF, 'f', 0, 3, wtext, 4);

   290    }

   291    net->kill_exsan(net);

   292 }

   293 /***********END bkxsn3**********/

   294 

   295 

   296 //////----------------output  SIMPLE TRACKING OF TRANSACTIONS

   297 | ExSan | C++ | ExSan | MSVSC2019_V16_11.23@01.11

   298 Tue Jan 31 07:54 : 44 2023

   299 

   300 exsan.plusplus@gmail.com   https ://twitter.com/#!/ExSan_com

   301 JOB:  bch3_5444

   302 

   303 BlockChainSimulator 3

   304 Generate Exsan(5, 5)

   305 

   306 TEST   1 out of 3

   307 RANDOM GENERATED(peer in row, nBitcoins)

   308 ORIGINAL SEED Total Bitcoins available 7  page 0

   309 WORKSHEET 0  @[4, 3] FLOAT

   310       A       B       C

   311      > ---------------------<

   312    1:  0       0       0

   313    2 : 5       0       0

   314    3 : 1       0       0

   315    4 : 1       0       0

   316    < --------------------->

   317 

   318    Simmulation random peer and bitcoins to traded

   319    Process  1 out of 5

   320    Peer[3] Tx-- - : nBitcoins 1  -- - : > to Peer[2]   then update ledger

   321    Peer 2   accepts transfer : 1 in Col[2]   then update ledger

   322    Layout updated

   323    WORKSHEET 0  @[3, 3] FLOAT

   324        A       B       C

   325       >---------------------<

   326    2:  5       6       0

   327    3 : 1       0       0

   328    < --------------------->

   329 

   330    Process  2 out of 5

   331    Peer[4] Tx-- - : nBitcoins 1  -- - : > to Peer[1]   then update ledger

   332    Peer1   accepts transfer : 1 in Col[1]   then update ledger

   333    Layout updated

   334    WORKSHEET 0  @[4, 3] FLOAT

   335        A       B       C

   336      >-------------------- - <

   337    1:  1       0       0

   338    4 : 1       0       0

   339    < --------------------->

   340 

   341    Process  3 out of 5

   342    Peer[1] Tx-- - : nBitcoins 1  -- - : > to Peer[2]   then update ledger

   343    Peer[2]accepts transfer : 1 in Col[3]   then update ledger

   344    Layout updated

   345    WORKSHEET 0  @[2, 3] FLOAT

   346        A       B       C

   347      >-------------------- - <

   348    1:  1       0       0

   349    2 : 5       6       7

   350    < --------------------->

   351 

   352    Process  4 out of 5

   353    Peer[3]   accepts transfer : 7 in Col[3]   then update ledger

   354    Layout updated

   355    WORKSHEET 0  @[3, 3] FLOAT

   356        A       B       C

   357     >-------------------- - <

   358    2:  0       6       7

   359    3 : 1       0       7

   360    < --------------------->

   361 

   362    Process  5 out of 5

   363    Peer[4] has no funds available to transfer : 0

   364    Layout updated

   365    WORKSHEET 0  @[4, 3] FLOAT

   366        A       B       C

   367    > -------------------- - <

   368    3:  1       0       7

   369    4 : 1       0       0

   370    < --------------------->

   371 

   372    Layout at the end

   373    WORKSHEET 0  @[4, 3] FLOAT

   374        A       B       C

   375    > -------------------- - <

   376    1:  1       0       0

   377    2 : 0       6       7

   378    3 : 1       0       7

   379    4 : 1       0       0

   380    < --------------------->

   381 

   382    Boost version : 1.80.0

   383    EXIT FROM EXSAN

   384 

   385 

   386 //////----------------output

   387 | ExSan | C++ | ExSan | MSVSC2019_V16_11.23@01.11

   388 Tue Jan 31 09:59 : 40 2023

   389 exsan.plusplus@gmail.com   https ://twitter.com/#!/ExSan_com

   390 JOB:  bch3_5940

   391 

   392 BlockChainSimulator 3

   393 Generate Exsan(10, 10)

   394 

   395 TEST   1 out of 5

   396 RANDOM GENERATED(peer in row, nBitcoins)

   397 ORIGINAL SEED Total Bitcoins available 12  page 0

   398 WORKSHEET 0  @[5, 1] FLOAT

   399         A

   400    > ------ - <

   401    1:  0

   402    2 : 0

   403    3 : 7

   404    4 : 4

   405    5 : 1

   406    < ------->

   407 

   408    There has been  26 transactions   the layout at the end looks like pp 0

   409    WORKSHEET 0  @[5, 4] FLOAT

   410       A       B       C       D

   411       > ---------------------------- <

   412    1: 3       8       2       0

   413    2 : 3       4       2       1

   414    3 : 2       3       2       8

   415    4 : 4       2       1       0

   416    5 : 0       1       1       2

   417    < ---------------------------- >

   418 

   419    At the end, let's veryfiy Sum Up of bitCoins[peer, col] = val

   420    Last block entry at the end of row[1, 4] = 0     current sum up = 0

   421    Last block entry[2, 1] = 3     current sum up = 3

   422    Last block entry at the end of row[3, 4] = 8     current sum up = 11

   423    Last block entry at the end of row[4, 4] = 0     current sum up = 11

   424    Last block entry[5, 2] = 1     current sum up = 12

   425    Lets see last entry and verify bitCoins sum up  bicoinCheck = 12

   426    ORIGINAL SEED Total Bitcoins available  12   OK SUM - UP OK!

   427 

   428 

   429 

   430    TEST   2 out of 5

   431    RANDOM GENERATED(peer in row, nBitcoins)

   432    ORIGINAL SEED Total Bitcoins available 14  page 0

   433    WORKSHEET 0  @[3, 1] FLOAT

   434        A

   435    >-------<

   436    1:  4

   437    2 : 6

   438    3 : 4

   439    < ------->

   440 

   441    There has been  12 transactions   the layout at the end looks like pp 0

   442    WORKSHEET 0  @[3, 4] FLOAT

   443        A       B       C       D

   444      >----------------------------<

   445    1:  8       5       1       0

   446    2 : 1      10       2       5

   447    3 : 5       8       4       1

   448    < ---------------------------- >

   449 

   450    At the end, let's veryfiy Sum Up of bitCoins[peer, col] = val

   451    Last block entry[1, 2] = 5     current sum up = 5

   452    Last block entry[2, 1] = 1     current sum up = 6

   453    Last block entry[3, 2] = 8     current sum up = 14

   454    Lets see last entry and verify bitCoins sum up  bicoinCheck = 14

   455    ORIGINAL SEED Total Bitcoins available  14   OK SUM - UP OK!

   456 

   457 

   458 

   459    TEST   3 out of 5

   460    RANDOM GENERATED(peer in row, nBitcoins)

   461    ORIGINAL SEED Total Bitcoins available 22  page 0

   462    WORKSHEET 0  @[5, 1] FLOAT

   463       A

   464    >------ - <

   465    1:  3

   466    2 : 6

   467    3 : 2

   468    4 : 4

   469    5 : 7

   470    < ------->

   471 

   472    There has been  11 transactions   the layout at the end looks like pp 0

   473    WORKSHEET 0  @[5, 2] FLOAT

   474       A       B

   475    > -------------- <

   476    1: 13       9

   477    2 : 1       0

   478    3 : 5       9

   479    4 : 4       0

   480    5 : 1       0

   481    < -------------- >

   482 

   483    At the end, let's veryfiy Sum Up of bitCoins[peer, col] = val

   484    Last block entry[1, 1] = 13     current sum up = 13

   485    Last block entry at the end of row[2, 2] = 0     current sum up = 13

   486    Last block entry[3, 1] = 5     current sum up = 18

   487    Last block entry[4, 1] = 4     current sum up = 22

   488    Last block entry at the end of row[5, 2] = 0     current sum up = 22

   489    Lets see last entry and verify bitCoins sum up  bicoinCheck = 22

   490    ORIGINAL SEED Total Bitcoins available  22   OK SUM - UP OK!

   491 

   492 

   493 

   494    TEST   4 out of 5

   495    RANDOM GENERATED(peer in row, nBitcoins)

   496    ORIGINAL SEED Total Bitcoins available 10  page 0

   497    WORKSHEET 0  @[2, 1] FLOAT

   498       A

   499    >-------<

   500    1:  4

   501    2 : 6

   502    < ------->

   503 

   504    There has been  14 transactions   the layout at the end looks like pp 0

   505    WORKSHEET 0  @[2, 6] FLOAT

   506         A       B       C       D       E       F

   507    > ------------------------------------------<

   508    1:   0       0       2       9      10       6

   509    2 : 10      10       8       1       0       4

   510    < ------------------------------------------ >

   511 

   512    At the end, let's veryfiy Sum Up of bitCoins[peer, col] = val

   513    Last block entry[1, 1] = 0     current sum up = 0

   514    Last block entry[2, 1] = 10     current sum up = 10

   515    Lets see last entry and verify bitCoins sum up  bicoinCheck = 10

   516    ORIGINAL SEED Total Bitcoins available  10   OK SUM - UP OK!

   517 

   518 

   519 

   520    TEST   5 out of 5

   521    RANDOM GENERATED(peer in row, nBitcoins)

   522    ORIGINAL SEED Total Bitcoins available 21  page 0

   523    WORKSHEET 0  @[7, 1] FLOAT

   524        A

   525    >------ - <

   526    1:  7

   527    2 : 0

   528    3 : 3

   529    4 : 1

   530    5 : 6

   531    6 : 2

   532    7 : 2

   533    < ------->

   534 

   535    There has been  69 transactions   the layout at the end looks like pp 0

   536    WORKSHEET 0  @[7, 8] FLOAT

   537        A       B       C       D       E       F       G       H

   538    > -------------------------------------------------------- <

   539    1:  0       2       1       1       0       1       0       1

   540    2 :10       2       7      12       0       3       3      12

   541    3 : 2       3       0       2      10       8       6       1

   542    4 : 0       4       2       6       8      18      17       1

   543    5 : 1      13      10       0       1       0      10       6

   544    6 : 2       0       1       0       0       0       0       0

   545    7 : 2      16      11      14      17       8      10      12

   546    < -------------------------------------------------------- >

   547 

   548    At the end, let's veryfiy Sum Up of bitCoins[peer, col] = val

   549    Last block entry[1, 3] = 1     current sum up = 1

   550    Last block entry[2, 6] = 3     current sum up = 4

   551    Last block entry[3, 2] = 3     current sum up = 7

   552    Last block entry[4, 3] = 2     current sum up = 9

   553    Last block entry[5, 3] = 10     current sum up = 19

   554    Last block entry[6, 4] = 0     current sum up = 19

   555    Last block entry[7, 1] = 2     current sum up = 21

   556    Lets see last entry and verify bitCoins sum up  bicoinCheck = 21

   557    ORIGINAL SEED Total Bitcoins available  21   OK SUM - UP OK!

   558 

   559    ENDS  bch3_5940   Elapsed Time : 0.203  sec

   560    Boost version : 1.80.0

   561 

   562    EXIT FROM EXSAN

Polulating ExSan with Market Data Tick by Tick
Previous         Low Latency Systematic Trading Algorithm         Next

+ + C   E x S a n   C + +
D o   N o t   A c c e p t   D e f a u l t s
T h i n k   D i f f e r e n t

Flag Counter

Comments

Popular posts from this blog

Blockchain Simulator - Hashing internal nodes of Merkle Tree - 13

Blockchain Simulator 10

Blockchain simulator - Sha256 Merkle Tree 12b