elective-stereophonic
elective-stereophonic
Fixing the blocktimes singapore
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Nxt Client: Nxt 1.11.15

Pages: 1 [2]  All

Author Topic: Fixing the blocktimes  (Read 12726 times)

whale

  • Sr. Member
  • ****
  • Karma: +55/-80
  • Offline Offline
  • Posts: 427
    • View Profile
Re: Fixing the blocktimes
« Reply #20 on: September 22, 2015, 12:48:05 am »

Yes, we will do something about limiting the range of block times in the next hard fork.

Great news, thank you!
Logged

Jean-Luc

  • Core Dev
  • Hero Member
  • *****
  • Karma: +816/-81
  • Offline Offline
  • Posts: 1610
    • View Profile
Re: Fixing the blocktimes
« Reply #21 on: October 05, 2015, 08:04:15 pm »

I decided to use the current blockchain as sample data, and wrote code to simulate what blocktimes we would get under a different base target adjustment algorithm, assuming the same accounts were forging and with the same effective balances. This is the tool that I wrote, if anyone wants to play more with it. The defaults are the best parameters I found so far, similar to what mthcl suggested. I found that using simple moving average works better than exponential weighted, and average the blocktimes for the last three blocks, updating base target every other block. The gamma parameter is set to 0.64. The min/max limits on base target are actually never encountered, but I will leave them just in case (currently set to 90%, 5000%).

These are the test values I get with this algorithm and parameters, when re-processing blocks from height 170000 till now, compared to current blocktimes:

Cumulative difficulty 22070187965417248
Test cumulative difficulty 14622252011234419
Cumulative difficulty difference -33
Max blocktime 11068
Max test blocktime 699
Min blocktime 1
Min test blocktime 1
Average blocktime 109
Average test blocktime 60
Standard deviation of blocktime 158.18614616268653
Standard deviation of test blocktime 58.39785365308553


Code: [Select]
/******************************************************************************
 * Copyright © 2013-2015 The Nxt Core Developers.                             *
 *                                                                            *
 * See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at      *
 * the top-level directory of this distribution for the individual copyright  *
 * holder information and the developer policies on copyright and licensing.  *
 *                                                                            *
 * Unless otherwise agreed in a custom licensing agreement, no part of the    *
 * Nxt software, including this file, may be copied, modified, propagated,    *
 * or distributed except according to the terms contained in the LICENSE.txt  *
 * file.                                                                      *
 *                                                                            *
 * Removal or modification of this copyright notice is prohibited.            *
 *                                                                            *
 ******************************************************************************/

package nxt.tools;

import nxt.Constants;
import nxt.util.Convert;
import nxt.util.Logger;

import java.math.BigInteger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public final class BaseTargetTest {

    private static final long MIN_BASE_TARGET = Constants.INITIAL_BASE_TARGET * 9 / 10;
    private static final long MAX_BASE_TARGET = Constants.INITIAL_BASE_TARGET * 50;

    private static final int MIN_BLOCKTIME_LIMIT = 53;
    private static final int MAX_BLOCKTIME_LIMIT = 67;

    private static final int GAMMA = 64;

    private static final int START_HEIGHT = 170000;

    private static final boolean USE_EWMA = false;
    private static final int EWMA_N = 8;
    private static final int SMA_N = 3;
    private static final int FREQUENCY = 2;

    private static long calculateBaseTarget(long previousBaseTarget, long blocktimeEMA) {
        long baseTarget;
        if (blocktimeEMA > 60) {
            baseTarget = (previousBaseTarget * Math.min(blocktimeEMA, MAX_BLOCKTIME_LIMIT)) / 60;
        } else {
            baseTarget = previousBaseTarget - previousBaseTarget * GAMMA * (60 - Math.max(blocktimeEMA, MIN_BLOCKTIME_LIMIT)) / 6000;
        }
        if (baseTarget < 0 || baseTarget > MAX_BASE_TARGET) {
            baseTarget = MAX_BASE_TARGET;
        }
        if (baseTarget < MIN_BASE_TARGET) {
            baseTarget = MIN_BASE_TARGET;
        }
        return baseTarget;
    }

    public static void main(String[] args) {

        try {

            BigInteger testCumulativeDifficulty = BigInteger.ZERO;
            long testBaseTarget;
            int testTimestamp;

            BigInteger cumulativeDifficulty = BigInteger.ZERO;
            long baseTarget;
            int timestamp;

            BigInteger previousCumulativeDifficulty = null;
            long previousBaseTarget = 0;
            int previousTimestamp = 0;

            BigInteger previousTestCumulativeDifficulty = null;
            long previousTestBaseTarget = 0;
            int previousTestTimestamp = 0;

            int height = START_HEIGHT;
            if (args.length == 1) {
                height = Integer.parseInt(args[0]);
            }

            long totalBlocktime = 0;
            long totalTestBlocktime = 0;
            long maxBlocktime = 0;
            long minBlocktime = Integer.MAX_VALUE;
            long maxTestBlocktime = 0;
            long minTestBlocktime = Integer.MAX_VALUE;
            double M = 0.0;
            double S = 0.0;
            double testM = 0.0;
            double testS = 0.0;
            long testBlocktimeEMA = 0;

            List<Integer> testBlocktimes = new ArrayList<>();

            int count = 0;

            try (Connection con = DriverManager.getConnection("jdbc:h2:./nxt_db/nxt;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE", "sa", "sa");
                 PreparedStatement selectBlocks = con.prepareStatement("SELECT * FROM block WHERE height > " + height + " ORDER BY db_id ASC");
                 ResultSet rs = selectBlocks.executeQuery()) {

                while (rs.next()) {

                    cumulativeDifficulty = new BigInteger(rs.getBytes("cumulative_difficulty"));
                    baseTarget = rs.getLong("base_target");
                    timestamp = rs.getInt("timestamp");
                    height = rs.getInt("height");

                    if (previousCumulativeDifficulty == null) {

                        previousCumulativeDifficulty = cumulativeDifficulty;
                        previousBaseTarget = baseTarget;
                        previousTimestamp = timestamp;

                        previousTestCumulativeDifficulty = previousCumulativeDifficulty;
                        previousTestBaseTarget = previousBaseTarget;
                        previousTestTimestamp = previousTimestamp;

                        continue;
                    }

                    int testBlocktime = (int)((previousBaseTarget * (timestamp - previousTimestamp - 1)) / previousTestBaseTarget) + 1;
                    if (testBlocktimeEMA == 0) {
                        testBlocktimeEMA = testBlocktime;
                    } else {
                        testBlocktimeEMA = (testBlocktime + testBlocktimeEMA * (EWMA_N - 1)) / EWMA_N;
                    }
                    testTimestamp = previousTestTimestamp + testBlocktime;

                    testBlocktimes.add(testBlocktime);
                    if (testBlocktimes.size() > SMA_N) {
                        testBlocktimes.remove(0);
                    }
                    int testBlocktimeSMA = 0;
                    for (int t : testBlocktimes) {
                        testBlocktimeSMA += t;
                    }
                    testBlocktimeSMA = testBlocktimeSMA / testBlocktimes.size();

                    if (height % FREQUENCY == 0) {
                        testBaseTarget = calculateBaseTarget(previousTestBaseTarget, USE_EWMA ? testBlocktimeEMA : testBlocktimeSMA);
                    } else {
                        testBaseTarget = previousTestBaseTarget;
                    }
                    testCumulativeDifficulty = previousTestCumulativeDifficulty.add(Convert.two64.divide(BigInteger.valueOf(testBaseTarget)));

                    int blocktime = timestamp - previousTimestamp;
                    if (blocktime > maxBlocktime) {
                        maxBlocktime = blocktime;
                    }
                    if (blocktime < minBlocktime) {
                        minBlocktime = blocktime;
                    }
                    if (testBlocktime > maxTestBlocktime) {
                        maxTestBlocktime = testBlocktime;
                    }
                    if (testBlocktime < minTestBlocktime) {
                        minTestBlocktime = testBlocktime;
                    }
                    totalBlocktime += blocktime;
                    totalTestBlocktime += testBlocktime;
                    count += 1;

                    double tmp = M;
                    M += (blocktime - tmp) / count;
                    S += (blocktime - tmp) * (blocktime - M);

                    tmp = testM;
                    testM += (testBlocktime - tmp) / count;
                    testS += (testBlocktime - tmp) * (testBlocktime - testM);

                    previousTestTimestamp = testTimestamp;
                    previousTestBaseTarget = testBaseTarget;
                    previousTestCumulativeDifficulty = testCumulativeDifficulty;

                    previousTimestamp = timestamp;
                    previousBaseTarget = baseTarget;
                    previousCumulativeDifficulty = cumulativeDifficulty;

                }

            }

            Logger.logMessage("Cumulative difficulty " + cumulativeDifficulty.toString());
            Logger.logMessage("Test cumulative difficulty " + testCumulativeDifficulty.toString());
            Logger.logMessage("Cumulative difficulty difference " + (testCumulativeDifficulty.subtract(cumulativeDifficulty))
                    .multiply(BigInteger.valueOf(100)).divide(cumulativeDifficulty).toString());
            Logger.logMessage("Max blocktime " + maxBlocktime);
            Logger.logMessage("Max test blocktime " + maxTestBlocktime);
            Logger.logMessage("Min blocktime " + minBlocktime);
            Logger.logMessage("Min test blocktime " + minTestBlocktime);
            Logger.logMessage("Average blocktime " + totalBlocktime / count);
            Logger.logMessage("Average test blocktime " + totalTestBlocktime / count);
            Logger.logMessage("Standard deviation of blocktime " + Math.sqrt(S / count));
            Logger.logMessage("Standard deviation of test blocktime " + Math.sqrt(testS / count));

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

To run that, save as src/java/nxt/tools/BaseTargetTest.java, compile, and run with "java -cp classes:conf:lib/* nxt.tools.BaseTargetTest".
Logged
GPG key fingerprint: 263A 9EB0 29CF C77A 3D06  FD13 811D 6940 E1E4 240C
NXT-X4LF-9A4G-WN9Z-2R322

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Fixing the blocktimes
« Reply #22 on: October 05, 2015, 08:29:06 pm »

I decided to use the current blockchain as sample data, and wrote code to simulate what blocktimes we would get under a different base target adjustment algorithm, assuming the same accounts were forging and with the same effective balances. This is the tool that I wrote, if anyone wants to play more with it. The defaults are the best parameters I found so far, similar to what mthcl suggested. I found that using simple moving average works better than exponential weighted, and average the blocktimes for the last three blocks, updating base target every other block. The gamma parameter is set to 0.64. The min/max limits on base target are actually never encountered, but I will leave them just in case (currently set to 90%, 5000%).

These are the test values I get with this algorithm and parameters, when re-processing blocks from height 170000 till now, compared to current blocktimes:

Cumulative difficulty 22070187965417248
Test cumulative difficulty 14622252011234419
Cumulative difficulty difference -33
Max blocktime 11068
Max test blocktime 699
Min blocktime 1
Min test blocktime 1
Average blocktime 109
Average test blocktime 60
Standard deviation of blocktime 158.18614616268653
Standard deviation of test blocktime 58.39785365308553


Code: [Select]
/******************************************************************************
 * Copyright © 2013-2015 The Nxt Core Developers.                             *
 *                                                                            *
 * See the AUTHORS.txt, DEVELOPER-AGREEMENT.txt and LICENSE.txt files at      *
 * the top-level directory of this distribution for the individual copyright  *
 * holder information and the developer policies on copyright and licensing.  *
 *                                                                            *
 * Unless otherwise agreed in a custom licensing agreement, no part of the    *
 * Nxt software, including this file, may be copied, modified, propagated,    *
 * or distributed except according to the terms contained in the LICENSE.txt  *
 * file.                                                                      *
 *                                                                            *
 * Removal or modification of this copyright notice is prohibited.            *
 *                                                                            *
 ******************************************************************************/

package nxt.tools;

import nxt.Constants;
import nxt.util.Convert;
import nxt.util.Logger;

import java.math.BigInteger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public final class BaseTargetTest {

    private static final long MIN_BASE_TARGET = Constants.INITIAL_BASE_TARGET * 9 / 10;
    private static final long MAX_BASE_TARGET = Constants.INITIAL_BASE_TARGET * 50;

    private static final int MIN_BLOCKTIME_LIMIT = 53;
    private static final int MAX_BLOCKTIME_LIMIT = 67;

    private static final int GAMMA = 64;

    private static final int START_HEIGHT = 170000;

    private static final boolean USE_EWMA = false;
    private static final int EWMA_N = 8;
    private static final int SMA_N = 3;
    private static final int FREQUENCY = 2;

    private static long calculateBaseTarget(long previousBaseTarget, long blocktimeEMA) {
        long baseTarget;
        if (blocktimeEMA > 60) {
            baseTarget = (previousBaseTarget * Math.min(blocktimeEMA, MAX_BLOCKTIME_LIMIT)) / 60;
        } else {
            baseTarget = previousBaseTarget - previousBaseTarget * GAMMA * (60 - Math.max(blocktimeEMA, MIN_BLOCKTIME_LIMIT)) / 6000;
        }
        if (baseTarget < 0 || baseTarget > MAX_BASE_TARGET) {
            baseTarget = MAX_BASE_TARGET;
        }
        if (baseTarget < MIN_BASE_TARGET) {
            baseTarget = MIN_BASE_TARGET;
        }
        return baseTarget;
    }

    public static void main(String[] args) {

        try {

            BigInteger testCumulativeDifficulty = BigInteger.ZERO;
            long testBaseTarget;
            int testTimestamp;

            BigInteger cumulativeDifficulty = BigInteger.ZERO;
            long baseTarget;
            int timestamp;

            BigInteger previousCumulativeDifficulty = null;
            long previousBaseTarget = 0;
            int previousTimestamp = 0;

            BigInteger previousTestCumulativeDifficulty = null;
            long previousTestBaseTarget = 0;
            int previousTestTimestamp = 0;

            int height = START_HEIGHT;
            if (args.length == 1) {
                height = Integer.parseInt(args[0]);
            }

            long totalBlocktime = 0;
            long totalTestBlocktime = 0;
            long maxBlocktime = 0;
            long minBlocktime = Integer.MAX_VALUE;
            long maxTestBlocktime = 0;
            long minTestBlocktime = Integer.MAX_VALUE;
            double M = 0.0;
            double S = 0.0;
            double testM = 0.0;
            double testS = 0.0;
            long testBlocktimeEMA = 0;

            List<Integer> testBlocktimes = new ArrayList<>();

            int count = 0;

            try (Connection con = DriverManager.getConnection("jdbc:h2:./nxt_db/nxt;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE", "sa", "sa");
                 PreparedStatement selectBlocks = con.prepareStatement("SELECT * FROM block WHERE height > " + height + " ORDER BY db_id ASC");
                 ResultSet rs = selectBlocks.executeQuery()) {

                while (rs.next()) {

                    cumulativeDifficulty = new BigInteger(rs.getBytes("cumulative_difficulty"));
                    baseTarget = rs.getLong("base_target");
                    timestamp = rs.getInt("timestamp");
                    height = rs.getInt("height");

                    if (previousCumulativeDifficulty == null) {

                        previousCumulativeDifficulty = cumulativeDifficulty;
                        previousBaseTarget = baseTarget;
                        previousTimestamp = timestamp;

                        previousTestCumulativeDifficulty = previousCumulativeDifficulty;
                        previousTestBaseTarget = previousBaseTarget;
                        previousTestTimestamp = previousTimestamp;

                        continue;
                    }

                    int testBlocktime = (int)((previousBaseTarget * (timestamp - previousTimestamp - 1)) / previousTestBaseTarget) + 1;
                    if (testBlocktimeEMA == 0) {
                        testBlocktimeEMA = testBlocktime;
                    } else {
                        testBlocktimeEMA = (testBlocktime + testBlocktimeEMA * (EWMA_N - 1)) / EWMA_N;
                    }
                    testTimestamp = previousTestTimestamp + testBlocktime;

                    testBlocktimes.add(testBlocktime);
                    if (testBlocktimes.size() > SMA_N) {
                        testBlocktimes.remove(0);
                    }
                    int testBlocktimeSMA = 0;
                    for (int t : testBlocktimes) {
                        testBlocktimeSMA += t;
                    }
                    testBlocktimeSMA = testBlocktimeSMA / testBlocktimes.size();

                    if (height % FREQUENCY == 0) {
                        testBaseTarget = calculateBaseTarget(previousTestBaseTarget, USE_EWMA ? testBlocktimeEMA : testBlocktimeSMA);
                    } else {
                        testBaseTarget = previousTestBaseTarget;
                    }
                    testCumulativeDifficulty = previousTestCumulativeDifficulty.add(Convert.two64.divide(BigInteger.valueOf(testBaseTarget)));

                    int blocktime = timestamp - previousTimestamp;
                    if (blocktime > maxBlocktime) {
                        maxBlocktime = blocktime;
                    }
                    if (blocktime < minBlocktime) {
                        minBlocktime = blocktime;
                    }
                    if (testBlocktime > maxTestBlocktime) {
                        maxTestBlocktime = testBlocktime;
                    }
                    if (testBlocktime < minTestBlocktime) {
                        minTestBlocktime = testBlocktime;
                    }
                    totalBlocktime += blocktime;
                    totalTestBlocktime += testBlocktime;
                    count += 1;

                    double tmp = M;
                    M += (blocktime - tmp) / count;
                    S += (blocktime - tmp) * (blocktime - M);

                    tmp = testM;
                    testM += (testBlocktime - tmp) / count;
                    testS += (testBlocktime - tmp) * (testBlocktime - testM);

                    previousTestTimestamp = testTimestamp;
                    previousTestBaseTarget = testBaseTarget;
                    previousTestCumulativeDifficulty = testCumulativeDifficulty;

                    previousTimestamp = timestamp;
                    previousBaseTarget = baseTarget;
                    previousCumulativeDifficulty = cumulativeDifficulty;

                }

            }

            Logger.logMessage("Cumulative difficulty " + cumulativeDifficulty.toString());
            Logger.logMessage("Test cumulative difficulty " + testCumulativeDifficulty.toString());
            Logger.logMessage("Cumulative difficulty difference " + (testCumulativeDifficulty.subtract(cumulativeDifficulty))
                    .multiply(BigInteger.valueOf(100)).divide(cumulativeDifficulty).toString());
            Logger.logMessage("Max blocktime " + maxBlocktime);
            Logger.logMessage("Max test blocktime " + maxTestBlocktime);
            Logger.logMessage("Min blocktime " + minBlocktime);
            Logger.logMessage("Min test blocktime " + minTestBlocktime);
            Logger.logMessage("Average blocktime " + totalBlocktime / count);
            Logger.logMessage("Average test blocktime " + totalTestBlocktime / count);
            Logger.logMessage("Standard deviation of blocktime " + Math.sqrt(S / count));
            Logger.logMessage("Standard deviation of test blocktime " + Math.sqrt(testS / count));

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

To run that, save as src/java/nxt/tools/BaseTargetTest.java, compile, and run with "java -cp classes:conf:lib/* nxt.tools.BaseTargetTest".
very nice!

Max test blocktime 699
this is good, if it is easy to get stats, curious as to the longest time 2 consecutive blocks needed
or 7
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

Sebastien256

  • Hero Member
  • *****
  • Karma: +169/-24
  • Offline Offline
  • Posts: 2823
  • ^LOOK UP^ = Nxt community!
    • View Profile
Re: Fixing the blocktimes
« Reply #23 on: October 05, 2015, 08:32:34 pm »

If someone can provide an executable that take as a string input the blockchain path and other parameters. I can use an optimizer that will try to optimize the parameters to get a minimal variance and such.

The problem is that I don't know java and all I need to do that is an executable that take the various parameters as input, the program would also need to output the results in a text file with the filename given as an input parameters. No fancy output is required.

In other words, the JL program would need to be modified to act as a function that take input and give output.

If any question, please ask.
« Last Edit: October 05, 2015, 09:08:11 pm by Sebastien256 »
Logged
Please drop your ideas concerning Nxt and/or NRS in this topic -> List of feature request for Nxt and/or NRS (with the full list in OP).

mthcl

  • Hero Member
  • *****
  • Karma: +96/-8
  • Offline Offline
  • Posts: 562
    • View Profile
Re: Fixing the blocktimes
« Reply #24 on: October 05, 2015, 11:43:32 pm »

If someone can provide an executable that take as a string input the blockchain path and other parameters. I can use an optimizer that will try to optimize the parameters to get a minimal variance and such.

The problem is that I don't know java and all I need to do that is an executable that take the various parameters as input, the program would also need to output the results in a text file with the filename given as an input parameters. No fancy output is required.

In other words, the JL program would need to be modified to act as a function that take input and give output.

If any question, please ask.

I don't think there is really a need for optimization; the algorithm with JLP's parameters works very well already, and, in any case, life is different from math models.  Also, there is not much room for optimization because of the following: if the stake is constant and the BT does not change at all, then the standard deviation would be 60 as well (this is just a property of the Exponential distribution: its expectation equals standard deviation). The standard deviation probably can be forced down just a little bit more (because the BT adjustment algorithm provides negative feedback), but this won't influence a lot the local picture of the sequence of the blocktimes.

So, I would vote for implementation of the algo with JLP's parameters.
« Last Edit: October 06, 2015, 11:06:11 pm by mthcl »
Logged

kushti

  • Core Dev
  • Sr. Member
  • ****
  • Karma: +184/-5
  • Offline Offline
  • Posts: 384
  • Nxt Core & Apps Dev
    • View Profile
Re: Fixing the blocktimes
« Reply #25 on: October 08, 2015, 08:57:28 pm »

1. Retargeting at every 10th block is already being used in Qora.
2. My vote is for such a change. Aside of blocktimes improvement it also should provide better resistance to short-range private forks(as retargeting for private stake will be slower).
3. There's forging simulation from us in Haskell, it's possible to play with the retargeting proposal with it:  https://github.com/ConsensusResearch/ForgingSimulation
Logged
for donations / messages: NXT-PKXM-WH25-UXXG-CJAVD (alias: kushti)

Jean-Luc

  • Core Dev
  • Hero Member
  • *****
  • Karma: +816/-81
  • Offline Offline
  • Posts: 1610
    • View Profile
Re: Fixing the blocktimes
« Reply #26 on: October 12, 2015, 03:57:02 pm »

We have the new algorithm running on the 1.7 testnet (that currently only the core devs use), and it is looking good, we are getting blocktimes slightly faster than 60s, around 1450-1490 blocks per day.

A related restriction in 1.7 will be an increase of minimum effective forging balance from 1 NXT to 1000 NXT. This limit doesn't apply when leasing to others, i.e. an account with 500 NXT only can still lease its balance to another, but the forging account needs to have a total effective balance (own balance plus all leases received) of more than 1000 NXT to be able to forge.

Logged
GPG key fingerprint: 263A 9EB0 29CF C77A 3D06  FD13 811D 6940 E1E4 240C
NXT-X4LF-9A4G-WN9Z-2R322

lurker10

  • Hero Member
  • *****
  • Karma: +168/-33
  • Offline Offline
  • Posts: 1334
    • View Profile
Re: Fixing the blocktimes
« Reply #27 on: October 12, 2015, 04:24:37 pm »

We have the new algorithm running on the 1.7 testnet (that currently only the core devs use), and it is looking good, we are getting blocktimes slightly faster than 60s, around 1450-1490 blocks per day.

A related restriction in 1.7 will be an increase of minimum effective forging balance from 1 NXT to 1000 NXT. This limit doesn't apply when leasing to others, i.e. an account with 500 NXT only can still lease its balance to another, but the forging account needs to have a total effective balance (own balance plus all leases received) of more than 1000 NXT to be able to forge.

To make it clear, you're talking about average block times?
Logged
Run a node - win a prize! "Lucky node" project jar: NXT-8F28-EDVE-LPPX-HY4E7

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Fixing the blocktimes
« Reply #28 on: October 12, 2015, 04:39:17 pm »

We have the new algorithm running on the 1.7 testnet (that currently only the core devs use), and it is looking good, we are getting blocktimes slightly faster than 60s, around 1450-1490 blocks per day.

A related restriction in 1.7 will be an increase of minimum effective forging balance from 1 NXT to 1000 NXT. This limit doesn't apply when leasing to others, i.e. an account with 500 NXT only can still lease its balance to another, but the forging account needs to have a total effective balance (own balance plus all leases received) of more than 1000 NXT to be able to forge.

To make it clear, you're talking about average block times?
curious to know the longest block of the average day

also by making 1000 NXT required, doesnt that make any N@S attack cost 1000x more? it seems that this will create some trolling that it is unfair that small NXT accounts cant forge. Requiring ~$10 to forge discriminates against the people who cant afford that much.

but in reality it seems that it only makes the N@S arguments that it costs nothing to do lots of hashes (ignoring the cost of the funded accounts) seem even less credible
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

mthcl

  • Hero Member
  • *****
  • Karma: +96/-8
  • Offline Offline
  • Posts: 562
    • View Profile
Re: Fixing the blocktimes
« Reply #29 on: October 12, 2015, 05:09:56 pm »

curious to know the longest block of the average day

So am I.

also by making 1000 NXT required, doesnt that make any N@S attack cost 1000x more? it seems that this will create some trolling that it is unfair that small NXT accounts cant forge. Requiring ~$10 to forge discriminates against the people who cant afford that much.
I think this doesn't have to do with N@S, at least for now (when there is no penalty for nonforging). But any unfairness argument of that sort would be just ridiculous: how many BTC's can one mine even for a 1000$ investment, without joining mining pools?..
Logged

LibertyNow

  • Sr. Member
  • ****
  • Karma: +78/-33
  • Offline Offline
  • Posts: 361
    • View Profile
    • Liquid Tech
Re: Fixing the blocktimes
« Reply #30 on: October 12, 2015, 06:09:33 pm »

I also think the $10 argument should NOT be considered for any serious blocktime conversations. 

Thanks @Jean-Luc, @jl777, and @mthcl for your efforts here. I'd love to get the longest block much farther below 10 minutes, but I'll take it as a good first step if that's our best solution right now.

LibertyNow
Logged
LQD NXT:17750387231635486778, EDGE NXT: 10713749908351947210
LQD: http://www.liquidtech.info, EDGE: https://www.bustabit.com/user/EDGE_NXTAE

EvilDave

  • Hero Member
  • *****
  • Karma: +341/-40
  • Offline Offline
  • Posts: 1789
    • View Profile
    • NXT Foundation
Re: Fixing the blocktimes
« Reply #31 on: October 12, 2015, 06:44:59 pm »

Yep.
Maybe this isn't the absolute perfect solution, but we do need to get the blocktimes sorted, and this looks like a step in the right direction.

A 1000 NXT limit of forging isn't really a hardship for anyone, seeing how unlikely the chance is of forging a block with such a small balance.
We might get trolled for it, but, hey, welcome to Nxt, we get trolled for getting out of bed in the morning.

So do it....or as J-L might say: make it so
Logged
Nulli Dei, nulli Reges, solum NXT
NXT Donations: NXT-BNZB-9V8M-XRPW-3S3WD
We will ride eternal, shiny and chrome!

Jean-Luc

  • Core Dev
  • Hero Member
  • *****
  • Karma: +816/-81
  • Offline Offline
  • Posts: 1610
    • View Profile
Re: Fixing the blocktimes
« Reply #32 on: October 12, 2015, 07:38:47 pm »

Running the same test code against testnet, after the hard fork, from block 439000 to 442739:

Cumulative difficulty 3002767086501175
Test cumulative difficulty 3002767086501175
Cumulative difficulty difference 0
Max blocktime 369
Max test blocktime 369
Min blocktime 1
Min test blocktime 1
Average blocktime 58
Average test blocktime 58
Standard deviation of blocktime 48.27112254042489
Standard deviation of test blocktime 48.27112254042489

The max blocktime was 369 s, average 58 s. The fact that test and real values got to match means there are no bugs in the test code, i.e. what it predicted with those parameter is same as what happened. And against mainnet data average is still 60 (max 740), so the slightly faster blocks on testnet must be because of differences between the two, no need to try to fudge it further.
Logged
GPG key fingerprint: 263A 9EB0 29CF C77A 3D06  FD13 811D 6940 E1E4 240C
NXT-X4LF-9A4G-WN9Z-2R322
Pages: 1 [2]  All
 

elective-stereophonic
elective-stereophonic
assembly
assembly