Bitcoin Forum
June 26, 2024, 12:24:22 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 ... 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 [186] 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 ... 334 »
3701  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 05:06:15 PM
Well I have gone on record with numerical examples my arguments

You have not created a model with statistical analysis - so we just have your "arguments" which I am not really interested in trying to model (and underlining them or putting them in bold or bigger fonts is just annoying basically).

If you think your idea is somehow "better" then "back it up" with the statistical analysis please (and create some software to do so).
3702  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 04:51:41 PM
Of course we shouldn't put such a wishy-washy idea in our model right now. I think the idea was in reference to the discussion about incentives.

Until we know that the network and blockchain are *secure* I don't think anything else much matters (i.e. you have no incentive to forge with a broken network and/or blockchain).
3703  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 04:47:48 PM
Does Anybody dares to develop the idea?

Really I don't think this is very helpful.

We are trying to analyse what we have now and work out firstly *if* it has any problems and then think about what we might do to fix/improve the situation.

Just jumping over to another algorithm (without statistical proof) is simply replacing "Peter" with "Paul".
3704  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 04:45:11 PM
this I don't understand at all - what exactly was your algorithm for calculating weights?

As stated in my other posts my initial algorithm was not a good "model" (and needed "log" to give the expected results).

It wasn't taking into account the idea that your "ticket number" actually "changes with time" (my updated version does that and produces very much the same as "log" results that the earlier version got without actually using "log").
3705  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 04:41:53 PM
there really isnt much point in this mechanism.  what you are describing is basically a rube goldberg contraption that produces the exact result of current NXT account/network forging

I would have to agree - and there is no point complicating further something we haven't seemingly even properly worked out (in terms of the modelling).
3706  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 04:15:24 PM
I believe in another thread (flaw thread) we came to the conclusion that it is important to have many accounts for modeling. 10 could be too few.

It could be - so at the moment I am focusing on some more "worst-case scenarios".

Once I am happy with the stats we are getting from those simulations then I will move to what are perhaps "more realistic scenarios".
3707  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 03:37:04 PM
you know, im really embarassed to have to ask this question, but can you go into even more detail here?  IM just not seeing it

In particular if your node is "behind" then you won't see that someone is now sending "blocks from the past" to you (if you did you might decide to ignore them) so they would have to be considered just as valid as any other versions of "blocks from the past" you are fed.

If you are being fed blocks from a "secret chain" that was not broadcast before then your node will simply decide based upon "total weight" which chain is better.

If the "secret" chain had "greater weight" then that will become your "main chain" and if that gets propagated across the network then "confirmations will be *undone*".
3708  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 03:33:20 PM
how many accounts are you running in each simulation instance?  Just a few will not cut it and is not a good representation of how TF works in the wild.  See the source code thread, I believe it was, for more info on this.  You need to model as many accounts as possible, I would say at least 100 per simulation run.

I have increased the number of accounts and changed some other things to head towards a better idea but basically it should be possible to "scale down" the numbers without greatly affecting the results at all (of course scaling down to just 2 or 3 accounts is not a good idea).
3709  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 03:17:36 PM
What are the assumptions now compared to earlier? (In english please Wink)

Okay - so before I was just randomly punishing 1 account every day - but now I am punishing 4 out of 11 (in reality the number being punished will be closer to total accounts / 1440) every day.

From what I understand the punishment will effectively apply "according" to your stake - I need to play with that more but am thinking you more or less are just going to either favour large streaks by a single large stake holder or by a pool of small stake holders.

Probably favoring the larger stake holders is better - also in reality if people are "not broadcasting blocks" then they are "losing fees" by just doing that.
3710  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 03:09:05 PM
I made a few more tweaks to the simulator for "penalising" that I think come a little closer to how it will work in reality and now have this result:

blocks = 5256000
a: 5
b: 5
c: 5
d: 5
e: 5
f: 5
g: 5
h: 5
i: 5
j: 5
k: 50
wins( a ) = 168532
wins( b ) = 168436
wins( c ) = 168653
wins( d ) = 168924
wins( e ) = 168386
wins( f ) = 167850
wins( g ) = 167890
wins( h ) = 166853
wins( i ) = 167323
wins( j ) = 167573
wins( k ) = 3575580
best_streak( a ) = 4
best_streak( b ) = 4
best_streak( c ) = 4
best_streak( d ) = 5
best_streak( e ) = 4
best_streak( f ) = 3
best_streak( g ) = 4
best_streak( h ) = 4
best_streak( i ) = 4
best_streak( j ) = 4
best_streak( k ) = 40
best_combined_streak = 15

Which I think is perhaps looking a lot better in terms of the "combined streak" figure. The "best streak" is a bit misleading in this case so also not likely to be a problem in reality (will have to try and make further tweaks to be sure).

Code:
// Copyright (c) 2014 CIYAM Developers
//
// Distributed under the MIT/X11 software license, please refer to the file license.txt
// in the root project directory or http://www.opensource.org/licenses/mit-license.php.

#include <ctime>
#include <cmath>
#include <cstdlib>

#include <string>
#include <vector>
#include <sstream>
#include <iostream>

#define NUM_DAYS 1
#define NUM_YEARS 10

//#define USE_PENALISING

//#define PREVENT_IMMEDIATE_REPEAT

//#define SHOW_WINNERS
//#define SHOW_WINNERS_WEIGHT

using namespace std;

#ifndef NUM_YEARS
const size_t c_num_blocks = 1440 * NUM_DAYS;
#else
const size_t c_num_blocks = 1440 * 365 * NUM_YEARS;
#endif

int main( )
{
#ifdef SHOW_WINNERS
   string winners;
#endif
   vector< int > wins;
   vector< int > streaks;
   vector< int > balances;
   vector< int > best_streak;

   vector< int > combined;
   vector< long > weights;

   int combined_streak = 0;
   int best_combined_streak = 0;

   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 5 );
   balances.push_back( 50 );

   srand( ( unsigned int )time( 0 ) );

   for( size_t i = 0; i < balances.size( ); i++ )
   {
      wins.push_back( 0 );
      weights.push_back( 0 );
      streaks.push_back( 0 );
      combined.push_back( 0 );
      best_streak.push_back( 0 );
   }

   size_t penalising1 = 0;
   size_t penalising2 = 0;
   size_t penalising3 = 0;
   size_t last_winner = 0;
   for( size_t blocks = 0; blocks < c_num_blocks; blocks++ )
   {
#ifdef USE_PENALISING
      if( blocks % 1440 == 0 )
      {
         penalising1 = rand( ) % balances.size( );
         penalising2 = rand( ) % balances.size( );
         penalising3 = rand( ) % balances.size( );
         penalising4 = rand( ) % balances.size( );
      }
#endif

      long total_weight = 0;
      for( size_t i = 0; i < weights.size( ); i++ )
      {
         int divisor = rand( ) % 10;

         if( divisor == 0 )
            ++divisor;

         weights[ i ] = ( rand( ) % 10000 ) * ( balances[ i ] / divisor );

#ifdef USE_PENALISING
         if( i == penalising1 || i == penalising2 || i == penalising3 || i == penalising4 )
            weights[ i ] = 0;
#endif

         total_weight += weights[ i ];
      }

      size_t winner = 0;
      size_t runner_up = 0;
      long best_target = 0;
#ifdef PREVENT_IMMEDIATE_REPEAT
      long second_best_target = 0;
#endif

      for( size_t i = 0; i < balances.size( ); i++ )
      {
         long adjusted_weight = weights[ i ] * 1000 / total_weight;

         if( adjusted_weight > best_target )
         {
            winner = i;
            best_target = adjusted_weight;
         }
#ifdef PREVENT_IMMEDIATE_REPEAT
         else if( adjusted_weight > second_best_target )
         {
            runner_up = i;
            second_best_target = adjusted_weight;
         }
#endif
      }

#ifdef PREVENT_IMMEDIATE_REPEAT
      if( winner == last_winner )
         winner = runner_up;
#endif

#ifdef SHOW_WINNERS
      winners += ( char )( 'a' + winner );
#  ifdef SHOW_WINNERS_WEIGHT
      ostringstream osstr;
      osstr << best_target;
      winners += "(" + osstr.str( ) + ")";
#  endif
#endif
      ++wins[ winner ];

      if( winner != balances.size( ) - 1 )
      {
         ++combined_streak;
         if( combined_streak > best_combined_streak )
            best_combined_streak = combined_streak;
      }
      else
         combined_streak = 0;

      if( winner == last_winner )
      {
         ++streaks[ winner ];
         if( streaks[ winner ] > best_streak[ winner ] )
            best_streak[ winner ] = streaks[ winner ];
      }
      else
         streaks[ winner ] = 0;

      last_winner = winner;
   }

   cout << "blocks = " << c_num_blocks << endl;

   for( size_t i = 0; i < balances.size( ); i++ )
      cout << ( char )( 'a' + i ) << ": " << balances[ i ] << endl;

#ifdef SHOW_WINNERS
   cout << winners << endl;
#endif
   for( size_t i = 0; i < wins.size( ); i++ )
      cout << "wins( " << ( char )( 'a' + i ) << " ) = " << wins[ i ] << endl;

   for( size_t i = 0; i < best_streak.size( ); i++ )
      cout << "best_streak( " << ( char )( 'a' + i ) << " ) = " << ( best_streak[ i ] + 1 ) << endl;

   cout << "best_combined_streak = " << best_combined_streak << endl;
}
3711  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 02:12:32 PM
@CIYAM: Is there a special reason for taking this approach

Code:
         int divisor = rand( ) % 10;

         if( divisor == 0 )
            ++divisor;

         weights[ i ] = ( rand( ) % 10000 ) * ( balances[ i ] / divisor );


instead of taking an approach equivalent to the nxt implementation?
Something like

Code:
         weights[ i ] = ( rand( ) % 10000 ) / balances[ i ];


Am pretty sure that whether you pick the "highest" or "lowest" is not relevant - so although not identical in coding it is statistically equivalent.

If you'd like to change it and try please post the results (especially if that percentages or "lucky runs" change much).
3712  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 02:02:20 PM
@CIYAM: Is there a special reason for taking this approach

Code:
         int divisor = rand( ) % 10;

         if( divisor == 0 )
            ++divisor;

         weights[ i ] = ( rand( ) % 10000 ) * ( balances[ i ] / divisor );


instead of taking an approach equivalent to the nxt implementation?
Something like

Code:
         weights[ i ] = ( rand( ) % 10000 ) / balances[ i ];


Until I made that change the figures were coming out very badly indeed (try changing and you'll see yourself).

From how I gather that it works is that the "time" (in discreet intervals) affects your weighting - so this is a simple way to simulate that.
3713  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 01:20:12 PM
Okay - so I've tried to simulate the idea of "penalising" a node for *not* forging. Hopefully I've done something wrong because this simulation over 10 years did not look very good at all:

blocks = 5256000
a: 10
b: 10
c: 10
d: 10
e: 10
f: 50
wins( a ) = 515287
wins( b ) = 511740
wins( c ) = 511293
wins( d ) = 512904
wins( e ) = 508422
wins( f ) = 2696354
best_streak( a ) = 8
best_streak( b ) = 8
best_streak( c ) = 10
best_streak( d ) = 8
best_streak( e ) = 8
best_streak( f ) = 29
best_combined_streak = 7202

Code:
// Copyright (c) 2014 CIYAM Developers
//
// Distributed under the MIT/X11 software license, please refer to the file license.txt
// in the root project directory or http://www.opensource.org/licenses/mit-license.php.

#include <ctime>
#include <cmath>
#include <cstdlib>

#include <string>
#include <vector>
#include <sstream>
#include <iostream>

#define NUM_DAYS 1
#define NUM_YEARS 10

#define USE_PENALISING

//#define PREVENT_IMMEDIATE_REPEAT

//#define SHOW_WINNERS
//#define SHOW_WINNERS_WEIGHT

using namespace std;

#ifndef NUM_YEARS
const size_t c_num_blocks = 1440 * NUM_DAYS;
#else
const size_t c_num_blocks = 1440 * 365 * NUM_YEARS;
#endif

int main( )
{
#ifdef SHOW_WINNERS
   string winners;
#endif
   vector< int > wins;
   vector< int > streaks;
   vector< int > balances;
   vector< int > best_streak;

   vector< int > combined;
   vector< long > weights;

   int combined_streak = 0;
   int best_combined_streak = 0;

   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 50 );

   srand( ( unsigned int )time( 0 ) );

   for( size_t i = 0; i < balances.size( ); i++ )
   {
      wins.push_back( 0 );
      weights.push_back( 0 );
      streaks.push_back( 0 );
      combined.push_back( 0 );
      best_streak.push_back( 0 );
   }

   size_t penalising = 0;
   size_t last_winner = 0;
   for( size_t blocks = 0; blocks < c_num_blocks; blocks++ )
   {
#ifdef USE_PENALISING
      if( blocks % 1440 == 0 )
         penalising = rand( ) % balances.size( );
#endif

      long total_weight = 0;
      for( size_t i = 0; i < weights.size( ); i++ )
      {
         int divisor = rand( ) % 10;

         if( divisor == 0 )
            ++divisor;

         weights[ i ] = ( rand( ) % 10000 ) * ( balances[ i ] / divisor );

#ifdef USE_PENALISING
         if( i == penalising )
            weights[ i ] = 0;
#endif

         total_weight += weights[ i ];
      }

      size_t winner = 0;
      size_t runner_up = 0;
      long best_target = 0;
#ifdef PREVENT_IMMEDIATE_REPEAT
      long second_best_target = 0;
#endif

      for( size_t i = 0; i < balances.size( ); i++ )
      {
         long adjusted_weight = weights[ i ] * 1000 / total_weight;

         if( adjusted_weight > best_target )
         {
            winner = i;
            best_target = adjusted_weight;
         }
#ifdef PREVENT_IMMEDIATE_REPEAT
         else if( adjusted_weight > second_best_target )
         {
            runner_up = i;
            second_best_target = adjusted_weight;
         }
#endif
      }

#ifdef PREVENT_IMMEDIATE_REPEAT
      if( winner == last_winner )
         winner = runner_up;
#endif

#ifdef SHOW_WINNERS
      winners += ( char )( 'a' + winner );
#  ifdef SHOW_WINNERS_WEIGHT
      ostringstream osstr;
      osstr << best_target;
      winners += "(" + osstr.str( ) + ")";
#  endif
#endif
      ++wins[ winner ];

      if( winner != balances.size( ) - 1 )
      {
         ++combined_streak;
         if( combined_streak > best_combined_streak )
            best_combined_streak = combined_streak;
      }
      else
         combined_streak = 0;

      if( winner == last_winner )
      {
         ++streaks[ winner ];
         if( streaks[ winner ] > best_streak[ winner ] )
            best_streak[ winner ] = streaks[ winner ];
      }
      else
         streaks[ winner ] = 0;

      last_winner = winner;
   }

   cout << "blocks = " << c_num_blocks << endl;

   for( size_t i = 0; i < balances.size( ); i++ )
      cout << ( char )( 'a' + i ) << ": " << balances[ i ] << endl;

#ifdef SHOW_WINNERS
   cout << winners << endl;
#endif
   for( size_t i = 0; i < wins.size( ); i++ )
      cout << "wins( " << ( char )( 'a' + i ) << " ) = " << wins[ i ] << endl;

   for( size_t i = 0; i < best_streak.size( ); i++ )
      cout << "best_streak( " << ( char )( 'a' + i ) << " ) = " << ( best_streak[ i ] + 1 ) << endl;

   cout << "best_combined_streak = " << best_combined_streak << endl;
}
3714  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 12:43:18 PM
Guys before deciding we need to "go and change" the behaviour of forging we need to properly understand how it currently works so although it's nice that lots of people have creative ideas what would be more helpful is statistical analysis and modelling.
3715  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 12:24:23 PM
using floating point

James is laughing Wink

No doubt about it.  Grin
3716  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 12:18:17 PM
Okay - after some discussion with CfB and checking out another such simulation I think I can get mine a lot closer to what is "really" going on underneath the hood (of course it is "only a simulation" so it can only be of so much benefit).

So this version is 100 years worth of blocks *without log(balance)* but instead with a "random divisor" of your balance to take the place of "time to forge" and now the figures look like this:

blocks = 52560000
a: 10
b: 10
c: 10
d: 10
e: 10
f: 50
wins( a ) = 4453471
wins( b ) = 4447734
wins( c ) = 4448973
wins( d ) = 4443112
wins( e ) = 4437624
wins( f ) = 30329086
best_streak( a ) = 7
best_streak( b ) = 6
best_streak( c ) = 7
best_streak( d ) = 7
best_streak( e ) = 8
best_streak( f ) = 31
best_combined_streak = 22

and when run with the 90/10 we now get the following:

blocks = 52560000
a: 10
b: 90
wins( a ) = 5361825
wins( b ) = 47198175
best_streak( a ) = 7
best_streak( b ) = 136

Whether this is a good enough approximation to statistically what is going on I am not sure but at least the simulator is no longer using floating point nor "log" (and is giving less skewed results).

Code:
#include <ctime>
#include <cmath>
#include <cstdlib>

#include <string>
#include <vector>
#include <sstream>
#include <iostream>

#define NUM_DAYS 1
#define NUM_YEARS 100

//#define PREVENT_IMMEDIATE_REPEAT

//#define SHOW_WINNERS
//#define SHOW_WINNERS_WEIGHT

using namespace std;

#ifndef NUM_YEARS
const size_t c_num_blocks = 1440 * NUM_DAYS;
#else
const size_t c_num_blocks = 1440 * 365 * NUM_YEARS;
#endif

int main( )
{
#ifdef SHOW_WINNERS
   string winners;
#endif
   vector< int > wins;
   vector< int > streaks;
   vector< int > balances;
   vector< int > best_streak;

   vector< int > combined;
   vector< long > weights;

   int combined_streak = 0;
   int best_combined_streak = 0;

   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 50 );

   srand( ( unsigned int )time( 0 ) );

   for( size_t i = 0; i < balances.size( ); i++ )
   {
      wins.push_back( 0 );
      weights.push_back( 0 );
      streaks.push_back( 0 );
      combined.push_back( 0 );
      best_streak.push_back( 0 );
   }

   size_t last_winner = 0;
   for( size_t blocks = 0; blocks < c_num_blocks; blocks++ )
   {
      long total_weight = 0;
      for( size_t i = 0; i < weights.size( ); i++ )
      {
         int divisor = rand( ) % 10;

         if( divisor == 0 )
            ++divisor;

         weights[ i ] = ( rand( ) % 10000 ) * ( balances[ i ] / divisor );

         total_weight += weights[ i ];
      }

      size_t winner = 0;
      size_t runner_up = 0;
      long best_target = 0;
#ifdef PREVENT_IMMEDIATE_REPEAT
      long second_best_target = 0;
#endif

      for( size_t i = 0; i < balances.size( ); i++ )
      {
         long adjusted_weight = weights[ i ] * 1000 / total_weight;

         if( adjusted_weight > best_target )
         {
            winner = i;
            best_target = adjusted_weight;
         }
#ifdef PREVENT_IMMEDIATE_REPEAT
         else if( adjusted_weight > second_best_target )
         {
            runner_up = i;
            second_best_target = adjusted_weight;
         }
#endif
      }

#ifdef PREVENT_IMMEDIATE_REPEAT
      if( winner == last_winner )
         winner = runner_up;
#endif

#ifdef SHOW_WINNERS
      winners += ( char )( 'a' + winner );
#  ifdef SHOW_WINNERS_WEIGHT
      ostringstream osstr;
      osstr << best_target;
      winners += "(" + osstr.str( ) + ")";
#  endif
#endif
      ++wins[ winner ];

      if( winner != balances.size( ) - 1 )
      {
         ++combined_streak;
         if( combined_streak > best_combined_streak )
            best_combined_streak = combined_streak;
      }
      else
         combined_streak = 0;

      if( winner == last_winner )
      {
         ++streaks[ winner ];
         if( streaks[ winner ] > best_streak[ winner ] )
            best_streak[ winner ] = streaks[ winner ];
      }
      else
         streaks[ winner ] = 0;

      last_winner = winner;
   }

   cout << "blocks = " << c_num_blocks << endl;

   for( size_t i = 0; i < balances.size( ); i++ )
      cout << ( char )( 'a' + i ) << ": " << balances[ i ] << endl;

#ifdef SHOW_WINNERS
   cout << winners << endl;
#endif
   for( size_t i = 0; i < wins.size( ); i++ )
      cout << "wins( " << ( char )( 'a' + i ) << " ) = " << wins[ i ] << endl;

   for( size_t i = 0; i < best_streak.size( ); i++ )
      cout << "best_streak( " << ( char )( 'a' + i ) << " ) = " << ( best_streak[ i ] + 1 ) << endl;

   cout << "best_combined_streak = " << best_combined_streak << endl;
}
3717  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 11:10:03 AM
In your test case with 5 accounts of 10 nxt und 1 account of 50 nxt, the 50 nxt account should forge 61.5% of all blocks and the other account together 38.5%.
But your code let's the big account forge about 83% and thus he creates longer streaks than he really would.

So if the figures from the blockchain are correct then the forging algo results look closer to the "log" results even though it is not using "log".

Unfortunately I am not sure how to make my simulator work the same - and I am unable to "parse" the Java so if someone could work out a closer simulation we'd be able to continue with this analysis.
3718  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 11:00:19 AM
That's not how the nxt forging algorithm works.
You are looking for the maximum of random number * balance to get the winner where you really should calculate the minimum of random number / balance and let the minimum win.

I think that how you choose the winner is irrelevant - it is only the probabilities that matter here.
3719  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 10:38:52 AM
Here is the source code to my simulator:

Code:
#include <ctime>
#include <cmath>
#include <cstdlib>

#include <string>
#include <vector>
#include <sstream>
#include <iostream>

//#define USE_LOG

#define NUM_DAYS 1
//#define NUM_YEARS 100

//#define PREVENT_IMMEDIATE_REPEAT

//#define SHOW_WINNERS
//#define SHOW_WINNERS_WEIGHT

using namespace std;

#ifndef NUM_YEARS
const size_t c_num_blocks = 1440 * NUM_DAYS;
#else
const size_t c_num_blocks = 1440 * 365 * NUM_YEARS;
#endif

int main( )
{
#ifdef SHOW_WINNERS
   string winners;
#endif
   vector< int > wins;
   vector< int > streaks;
   vector< int > balances;
   vector< int > best_streak;

   vector< int > combined;
   vector< double > weights;

   int combined_streak = 0;
   int best_combined_streak = 0;

   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 10 );
   balances.push_back( 50 );

   srand( ( unsigned int )time( 0 ) );

   for( size_t i = 0; i < balances.size( ); i++ )
   {
      wins.push_back( 0 );
      weights.push_back( 0 );
      streaks.push_back( 0 );
      combined.push_back( 0 );
      best_streak.push_back( 0 );
   }

   size_t last_winner = 0;
   for( size_t blocks = 0; blocks < c_num_blocks; blocks++ )
   {
      double total_weight = 0;
      for( size_t i = 0; i < weights.size( ); i++ )
      {
#ifndef USE_LOG
         weights[ i ] = ( rand( ) % 1000 ) * balances[ i ];
#else
         weights[ i ] = ( rand( ) % 1000 ) * log( ( double )balances[ i ] );
#endif
         total_weight += weights[ i ];
      }

      size_t winner = 0;
      size_t runner_up = 0;
      double best_target = 0;
#ifdef PREVENT_IMMEDIATE_REPEAT
      double second_best_target = 0;
#endif

      for( size_t i = 0; i < balances.size( ); i++ )
      {
         double adjusted_weight = weights[ i ] * 1000 / total_weight;

         if( adjusted_weight > best_target )
         {
            winner = i;
            best_target = adjusted_weight;
         }
#ifdef PREVENT_IMMEDIATE_REPEAT
         else if( adjusted_weight > second_best_target )
         {
            runner_up = i;
            second_best_target = adjusted_weight;
         }
#endif
      }

#ifdef PREVENT_IMMEDIATE_REPEAT
      if( winner == last_winner )
         winner = runner_up;
#endif

#ifdef SHOW_WINNERS
      winners += ( char )( 'a' + winner );
#  ifdef SHOW_WINNERS_WEIGHT
      ostringstream osstr;
      osstr << best_target;
      winners += "(" + osstr.str( ) + ")";
#  endif
#endif
      ++wins[ winner ];

      if( winner != balances.size( ) - 1 )
      {
         ++combined_streak;
         if( combined_streak > best_combined_streak )
            best_combined_streak = combined_streak;
      }
      else
         combined_streak = 0;

      if( winner == last_winner )
      {
         ++streaks[ winner ];
         if( streaks[ winner ] > best_streak[ winner ] )
            best_streak[ winner ] = streaks[ winner ];
      }
      else
         streaks[ winner ] = 0;

      last_winner = winner;
   }

   cout << "blocks = " << c_num_blocks << endl;

   for( size_t i = 0; i < balances.size( ); i++ )
      cout << ( char )( 'a' + i ) << ": " << balances[ i ] << endl;

#ifdef SHOW_WINNERS
   cout << winners << endl;
#endif
   for( size_t i = 0; i < wins.size( ); i++ )
      cout << "wins( " << ( char )( 'a' + i ) << " ) = " << wins[ i ] << endl;

   for( size_t i = 0; i < best_streak.size( ); i++ )
      cout << "best_streak( " << ( char )( 'a' + i ) << " ) = " << ( best_streak[ i ] + 1 ) << endl;

   cout << "best_combined_streak = " << best_combined_streak << endl;
}
3720  Alternate cryptocurrencies / Announcements (Altcoins) / Re: NXT :: descendant of Bitcoin - Updated Information on: February 26, 2014, 10:34:14 AM
People have been wondering about some of the figures that my simulator has come up with so far - but there is actually a much worse picture here than I have so far shown as my simulator has been using "log(balance)" rather than just "balance" as the "stake multiplier".

So get ready for something that approaches more closely how Nxt actually works as it does not use log(balance):

blocks = 1440
a: 10
b: 10
c: 10
d: 10
e: 10
f: 50
wins( a ) = 48
wins( b ) = 50
wins( c ) = 50
wins( d ) = 41
wins( e ) = 52
wins( f ) = 1199
best_streak( a ) = 2
best_streak( b ) = 2
best_streak( c ) = 2
best_streak( d ) = 2
best_streak( e ) = 2
best_streak( f ) = 49
best_combined_streak = 3

In particular pay attention to the figure for "f" in regards to both "wins" and its "best streak".
Pages: « 1 ... 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 [186] 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 ... 334 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!