elective-stereophonic
elective-stereophonic
Maximum amount of coins  
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Nxt Client: Nxt 1.11.15

Author Topic: Maximum amount of coins  (Read 1585 times)

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Maximum amount of coins
« on: May 22, 2018, 07:42:51 am »

Hey, I'm just reading some of the nxt-Code and testing a ltitle bit.
I saw, that there is a maximum of coin--balance in constants.java: MAX_BALANCE_NXT = 1000000000; (nine zeros).
In addition there is one nxt defined: ONE_NXT = 100000000; (eight zeros).

The sum of the amounts of genesisaccounts must not exceed the MAX_BALANCE_NXT.

If I increment the MAX_BALANCE_NXT to  1.000.000.000.000 (twelve zeros) and in addition a new genesis account with the same (amount + the 8 zeros of the ONE_NXT),
I get a Long.NumberFormatException.

Why?

Because
Long.MAX_VALUE= 9223372036854775807

Is there a possibility to step over the limit?


greetings
jmangold
Logged

Right.Here

  • Sr. Member
  • ****
  • Karma: +22/-4
  • Offline Offline
  • Posts: 264
    • View Profile
Re: Maximum amount of coins
« Reply #1 on: May 22, 2018, 01:42:15 pm »

Hi  :D

i think you have a wrong (.) in your code...
Long.MAX_VALUE= 9223372036854775807
Logged
NXT-LJV5-YSF4-MXXX-438D5

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: Maximum amount of coins
« Reply #2 on: May 22, 2018, 02:02:38 pm »

I'm confused, why should it be wrong? :D

okay..

public static final long MAX_VALUE = 9223372036854775807L

better? :P

(I can't format the string into code, because: "Sorry, you are not allowed to post external links." , dayum )

However, I still get the FormatException..
Logged

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: Maximum amount of coins
« Reply #3 on: May 25, 2018, 07:44:57 am »

Soon 100times read and no answer?

1 No one knows an answer,
2 am I just stupid,
3 is my english to bad,
4 or is it just a bad explanation, that nobody understands?

 ;D
Logged

SwissAlps

  • Hero Member
  • *****
  • Karma: +31/-16
  • Offline Offline
  • Posts: 519
    • View Profile
    • NxtTracker.com
Re: Maximum amount of coins
« Reply #4 on: May 25, 2018, 02:41:52 pm »

Soon 100times read and no answer?

1 No one knows an answer,
2 am I just stupid,
3 is my english to bad,
4 or is it just a bad explanation, that nobody understands?

 ;D
Hi,

Do not be too surprised, this forum is not dead but very very lethargic these last months.....  :( :( :(   

If you have syntax problems, I suggest you go to https://stackoverflow.com    ;D ;D ;D      
Logged
CryptoNanoPay project
Note that the "Barter Point" test has just started...

Right.Here

  • Sr. Member
  • ****
  • Karma: +22/-4
  • Offline Offline
  • Posts: 264
    • View Profile
Re: Maximum amount of coins
« Reply #5 on: May 25, 2018, 09:16:13 pm »

Hi  :D

i don't see where is the problem here  ???
...
The sum of the amounts of genesisaccounts must not exceed the MAX_BALANCE_NXT.
...
the MAX_BALANCE_NXT must be exactly the sum of the genesis accounts...

and where is this ? in constants.java ?
Quote
public static final long MAX_VALUE = 9223372036854775807L

if you have already created a blockchain in your NBCK, remove it each time you touch to the base java settings and files like the snapshot ones... verify if there is no missing ( ; ) in java and (,) in the json files...

so try again and let me know  :D
Logged
NXT-LJV5-YSF4-MXXX-438D5

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: Maximum amount of coins
« Reply #6 on: May 28, 2018, 07:46:48 am »

Hey, thanks for your reply! :)

<-- start
Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: "4500000000000000000000"
   at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
   at java.lang.Long.parseLong(Long.java:592)
   at java.lang.Long.valueOf(Long.java:803)
   at org.json.simple.parser.Yylex.yylex(Yylex.java:660)
   at org.json.simple.parser.JSONParser.nextToken(JSONParser.java:269)
   at org.json.simple.parser.JSONParser.parse(JSONParser.java:118)
   at org.json.simple.parser.JSONParser.parse(JSONParser.java:92)
   at org.json.simple.JSONValue.parseWithException(JSONValue.java:73)
   at nxt.Genesis.loadGenesisAccountsJSON(Genesis.java:59)
   at nxt.Genesis.newGenesisBlock(Genesis.java:69)
   at nxt.BlockchainProcessorImpl.addGenesisBlock(BlockchainProcessorImpl.java:1272)
   at nxt.BlockchainProcessorImpl.lambda$new$5(BlockchainProcessorImpl.java:971)
   at nxt.util.ThreadPool.lambda$runAll$1(ThreadPool.java:126)
   at java.lang.Thread.run(Thread.java:748)
2018-05-28 09:37:17 SEVERE: Errors running startup tasks:
For input string: "4500000000000000000000"

java.lang.RuntimeException: Errors running startup tasks:
For input string: "4500000000000000000000"
end-->

That is exactly my error.

similar my genesisAccounts.json:

{"balances":{
  "NXT-6QQS-86H9-VSRP-2NT7M":4500000000000000000000
},"publicKeys":[
  "0eb8815978f59e22fd4e3c4617213fcf3d4042cd5aebf10277b6c2c9b145b91a"
]}

also my constants in Constants.java:

    public static final long MAX_BALANCE_NXT = new Long("45000000000000");
    public static final long ONE_NXT = 100000000;

But I think, the Constants.java doesn't matter to the Problem.
That should be all right, shouldn't it?

Greetings
« Last Edit: May 28, 2018, 08:54:52 am by jmangold »
Logged

Right.Here

  • Sr. Member
  • ****
  • Karma: +22/-4
  • Offline Offline
  • Posts: 264
    • View Profile
Re: Maximum amount of coins
« Reply #7 on: May 28, 2018, 11:29:50 pm »

Hi  :D

i think this happend because of the java Long limitation... the max value of a Long is 9,223,372,036,854,775,807...

so you have to divide the total amount over multiple accounts (under 18 digits amounts)...

this can be like it was because is correct
Quote
public static final long MAX_BALANCE_NXT = 45000000000000;

i think you have to add a space between the ( : ) and the amount in your genesisAccounts.json
Quote
"NXT-6QQS-86H9-VSRP-2NT7M": 4500000000000000000000
« Last Edit: May 28, 2018, 11:53:54 pm by Right.Here »
Logged
NXT-LJV5-YSF4-MXXX-438D5

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: Maximum amount of coins
« Reply #8 on: May 29, 2018, 11:18:57 am »

Aye okay, so I'm right.
hm, so for my own big Amount i must do 1000 Accounts manually. :D

I may have a second method:
What if I reduce the zeros behind the comma?
I take 3 Zeros away
    public static final long ONE_NXT = 100000;
and add them to the
    public static final long MAX_BALANCE_NXT = 45000000000000l;

The Problem is:


In the Balance are 3 Zeros missing, and if I send them to an another account, I have 0 Coins.
The Effective Balance hasnt changed, but I have no access to the missing Coins.
Also, if I add an Item in the Marketplace, it wants a fee of 0.002 Coins.

I dont know, if I should go this second way, to increase my maximum amount of coins, or creating 1000 Accounts manually and add them to the genesisblock.

(Other Question, why is nxt range after the comma 8 digits, even if the minimum fee is 1nxt? Maximum i figured out is 2 digits behind the comma in the marketplace. But 8?)
Logged

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: Maximum amount of coins
« Reply #9 on: May 29, 2018, 01:21:18 pm »

edit: Maybe I am missing a constant in javascript to change to 100000 ?
Logged

Right.Here

  • Sr. Member
  • ****
  • Karma: +22/-4
  • Offline Offline
  • Posts: 264
    • View Profile
Re: Maximum amount of coins
« Reply #10 on: May 29, 2018, 02:33:12 pm »

Hi  :D
edit: Maybe I am missing a constant in javascript to change to 100000 ?
you must keep the 1NXT/NQT values as is because there is many things linked to ONE_NXT... to change the fees you have to do it in its relative places...

search this in the code... it will show you where are the things
Quote
_FEE = new Fee.
for eg; the DGS listing is here
cloneFolder\src\java\nxt\TransactionType.java line 2090
           
Quote
...
private final Fee DGS_LISTING_FEE = new Fee.SizeBasedFee(2 * (Constants.ONE_NXT/10), 2 * (Constants.ONE_NXT/10), 32) ...
as you see here all the fees are /10 (0.1 coin) in my NBCK... the prenable things /100 (0.01)
courage and good continuation  :D
Logged
NXT-LJV5-YSF4-MXXX-438D5

jmangold

  • Newbie
  • *
  • Karma: +0/-0
  • Offline Offline
  • Posts: 7
    • View Profile
Re: Maximum amount of coins
« Reply #11 on: May 29, 2018, 03:09:12 pm »

Hi, thanks for your reply! :D

Quote
you must keep the 1NXT/NQT values as is because there is many things linked to ONE_NXT

So you mean my second option is not viable? :/

Meanwhile I found my hardcoded "Bug" in nrs.util.js functions line 124 and 185:
Quote
...
        var fractionalPart = amount.mod(new BigInteger("100000")).toString();
        amount = amount.divide(new BigInteger("100000"));
...
if (parts.length == 1) {
            fraction = "00000";
      } else if (parts.length == 2) {
         if (parts[1].length <= 5) {
                fraction = parts[1];
         } else {
                fraction = parts[1].substring(0, 5);
         }
      } else {
         throw $.t("error_invalid_input");
      }
...

With these changes it shows my Amount correctly. (Before: 8 Zeros || After: 5 Zeros)

Isn't it fine, that ONE_NXT is linked to many variables? Because you only need to change one place to manage a "global" reduction of digits behind the comma?  ???
« Last Edit: May 30, 2018, 11:17:44 am by jmangold »
Logged
 

elective-stereophonic
elective-stereophonic
assembly
assembly