Pages:
Author

Topic: ♘♕♔SWING♚ ♛♞ ▬▬▬▬●Programmatically Fluctuating Miners Cost!●▬▬▬▬ Now On Bittrex! - page 16. (Read 119577 times)

hero member
Activity: 728
Merit: 500
So traditionally when writing the rewards code in an altcoin it looks like this

@Blocks X - Z:

reward = indendedOutput * Coin

intendedOutput=number you want to be rewarded for that block
Coin is usually dismissed and not thought about.

After we started having issues I dug into it and it turns out Coin is only used to format the rewards section in a more sensible manner.

Coin = 100000000 (adds 8 0's to your coin amount)

So, if we want a reward of 1 coin:

reward = 1 * Coin

But in reality this pushes 100000000, which is sent to be formatted and turns into 1.00000000

So when I tried to do something like:

9.87 * coin, we get issues. Functions like this are only accurate to a certain decimal place in programming.

Instead of 987000000, we get 987000000.00000011920928955078125

While most operating systems would round this particular example to 987000000 automatically, not all results &or operating systems round so cleanly.

So rounding errors like this is some higher (lower?) level computer science voodoo that I honestly wasn't aware of, and didn't show up in my testing.

It can be fixed, but that's the biggest issue facing swing currently.

(On a side note, most altcoins forking issues are caused by this. Lots of devs never figure out the cause and it's killed tons of coins.)

Fortunately I learned of rounding errors thanks to the dev lounge in my slack group, and had a computer based PHD student / friend help me dissect the code to see exactly where things were going wrong.

Also the resulting issues aren't too severe for us (yet). I don't think we are in much danger of catastrophic failure, just minor annoyances.



A side note, if you want to help with core development in Swing reach out to me!


More casually helping people holding Swing and a basic understanding of development = Faster / Better / Cooler upgrades.

Only know how to code? I'm happy to share core development basics. You don't have to understand the entire core to work on an altcoin.

If we want Swing to thrive, we need devs more than anything else.

I'll keep trying to make progress solo in the meantime.


Ok, good. Thanks for the clarification. Looking forward to a bright future for Swing.

hero member
Activity: 938
Merit: 1002
So traditionally when writing the rewards code in an altcoin it looks like this

@Blocks X - Z:

reward = indendedOutput * Coin

intendedOutput=number you want to be rewarded for that block
Coin is usually dismissed and not thought about.

After we started having issues I dug into it and it turns out Coin is only used to format the rewards section in a more sensible manner.

Coin = 100000000 (adds 8 0's to your coin amount)

So, if we want a reward of 1 coin:

reward = 1 * Coin

But in reality this pushes 100000000, which is sent to be formatted and turns into 1.00000000

So when I tried to do something like:

9.87 * coin, we get issues. Functions like this are only accurate to a certain decimal place in programming.

Instead of 987000000, we get 987000000.00000011920928955078125

While most operating systems would round this particular example to 987000000 automatically, not all results &or operating systems round so cleanly.

So rounding errors like this is some higher (lower?) level computer science voodoo that I honestly wasn't aware of, and didn't show up in my testing.

It can be fixed, but that's the biggest issue facing swing currently.

(On a side note, most altcoins forking issues are caused by this. Lots of devs never figure out the cause and it's killed tons of coins.)

Fortunately I learned of rounding errors thanks to the dev lounge in my slack group, and had a computer based PHD student / friend help me dissect the code to see exactly where things were going wrong.

Also the resulting issues aren't too severe for us (yet). I don't think we are in much danger of catastrophic failure, just minor annoyances.



A side note, if you want to help with core development in Swing reach out to me!


More casually helping people holding Swing and a basic understanding of development = Faster / Better / Cooler upgrades.

Only know how to code? I'm happy to share core development basics. You don't have to understand the entire core to work on an altcoin.

If we want Swing to thrive, we need devs more than anything else.

I'll keep trying to make progress solo in the meantime.
hero member
Activity: 938
Merit: 1002
Quote from: murderouskirk

Let me give some insight.

I've recently been digging into what happens with the rewards when they are calculated, and exactly what's going on when getting calculated.

With the current setup, that process looks something like this:

Note that the final reward amount is later formatted. So 975000000 would become 9.75000000

Code:
Block Count: 975 Last Three Digits: 975 Decimal: 9.75 Final:975000000

Block Count: 976 Last Three Digits: 976 Decimal: 9.76 Final:976000000

Block Count: 977 Last Three Digits: 977 Decimal: 9.77 Final:977000000

Block Count: 978 Last Three Digits: 978 Decimal: 9.78 Final:977999999.99999988079071044921875

Block Count: 979 Last Three Digits: 979 Decimal: 9.790000000000001 Final:979000000.00000011920928955078125

Block Count: 980 Last Three Digits: 980 Decimal: 9.8 Final:980000000.00000011920928955078125

Block Count: 981 Last Three Digits: 981 Decimal: 9.81 Final:981000000

Block Count: 982 Last Three Digits: 982 Decimal: 9.82 Final:982000000

Block Count: 983 Last Three Digits: 983 Decimal: 9.83 Final:983000000

Block Count: 984 Last Three Digits: 984 Decimal: 9.84 Final:984000000

Block Count: 985 Last Three Digits: 985 Decimal: 9.85 Final:985000000

Block Count: 986 Last Three Digits: 986 Decimal: 9.86 Final:986000000

Block Count: 987 Last Three Digits: 987 Decimal: 9.870000000000001 Final:987000000.00000011920928955078125

Block Count: 988 Last Three Digits: 988 Decimal: 9.88 Final:988000000.00000011920928955078125

HERE is the section of code that spits this out. I just used block 1 - 999 as sample output. For the sake of clarity i re-coded the process in java for faster debugging. (im just better at java is all, but java may produce slightly different results is the point)

So what I discovered is that somewhere else in the code the decimal is inserted into a full number with 9+ digits.
The end result in this section of code that gets passed out looks something like '9.87 * COIN' (=987000000).

Me attempting to put in the decimal during the reward calculation instead of letting it do it after results in some unnecessary math. Math that doesn't always turn out clean, and leaves room to lose accuracy when clipping/rounding the final result to a full number.

We need to re-code this section so results like this:

Block Count: 987 Last Three Digits: 987 Decimal: 9.870000000000001 Final:987000000.00000011920928955078125

Instead act like this:

Block Count: 987 Last Three Digits: 987 Final:987000000


Now, this is an example of POS. POW gets a little more challenging since rewards need to be multiplied by 10%.. 20%.. 30%.. etc.. But I'm working on doing that cleanly too.

But that's essentially where we have room for core upgrades and cleaning up the internal math for increased accuracy.

So that should give you guys a little better idea at what I've been looking at.

Will post more later as I make progress.
hero member
Activity: 938
Merit: 1002
Looks like it's back on track.

I've got a little more free time now. I'm going to resume looking into core upgrades and will try to post about progress.

The process looks like this

[✓] Identify problems
[✓] Identify potential solutions
[Partial] Code upgrades
[Partial] Test upgrades in simulation environments
[X] Work upgrade into core
[X] Test upgraded code across multiple clients
[X] Decide on fork method (hard or soft)
[X] Allow community to do a code-review of the proposed update
[X] Set fork date
[X] Notify Services and Exchanges
[X] Push new version

Yep, it's working again... my wallet is staking now.

Awesome to hear about the new core upgrade roadmap.  What exactly is going to be changed or added to the core?



So basically the way it does the reward math is a little shitty and causes rounding errors. It sometimes results in weird reward output that can get rounded differently on different operating systems (causing disagreement across the network). Unfortunately I didn't do enough cross-platform testing pre-launch to identify this as a potential problem. The result is some users not on linux falling out of sync, and needing to re-download the chain occasionally. It's also probably the cause of blockchain freezes like we just experienced. I think we've had that happen twice now.

The fix is to clean up the math so it outputs clean amounts for every block reward, and doesn't leave it up to the operating system to decide how to finalize the numbers.

I'll be sure to put clear examples of any potential changes, showing the exact results that will change. I'll also show the code proposals so the more tech-savvy users can dissect and give feedback.

I think I made a post a while back that makes this a little clearer. I'll try to dig it up and quote.
hero member
Activity: 728
Merit: 500
Looks like it's back on track.

I've got a little more free time now. I'm going to resume looking into core upgrades and will try to post about progress.

The process looks like this

[✓] Identify problems
[✓] Identify potential solutions
[Partial] Code upgrades
[Partial] Test upgrades in simulation environments
[X] Work upgrade into core
[X] Test upgraded code across multiple clients
[X] Decide on fork method (hard or soft)
[X] Allow community to do a code-review of the proposed update
[X] Set fork date
[X] Notify Services and Exchanges
[X] Push new version

Yep, it's working again... my wallet is staking now.

Awesome to hear about the new core upgrade roadmap.  What exactly is going to be changed or added to the core?

hero member
Activity: 938
Merit: 1002
Looks like it's back on track.

I've got a little more free time now. I'm going to resume looking into core upgrades and will try to post about progress.

The process looks like this

[✓] Identify problems
[✓] Identify potential solutions
[Partial] Code upgrades
[Partial] Test upgrades in simulation environments
[X] Work upgrade into core
[X] Test upgraded code across multiple clients
[X] Decide on fork method (hard or soft)
[X] Allow community to do a code-review of the proposed update
[X] Set fork date
[X] Notify Services and Exchanges
[X] Push new version
hero member
Activity: 728
Merit: 500
wallet out of sync Huh
last block 143000


The whole Swing network seems to be stuck at block 143000 for over 13 hours already at the time I'm posting this.

See Swing blockchain explorer:
https://chainz.cryptoid.info/swing/



legendary
Activity: 3542
Merit: 1548
Get loan in just five minutes goo.gl/8WMW6n
hero member
Activity: 896
Merit: 504
i need a dump.... come on guys.. sell some coins.

I love this coin
legendary
Activity: 1036
Merit: 1001
Syscoin- Changing the way people do business.
Thanks guys  Grin

Today I'm very busy.

I need to finish up the final round of applications for funding in a startup corporation I'm involved with. Once I get past this I'll try to do some more work with Swing.

Again, thank you all for your support.  Grin

Welcome back bro!
sr. member
Activity: 1274
Merit: 263
Thanks guys  Grin

Today I'm very busy.

I need to finish up the final round of applications for funding in a startup corporation I'm involved with. Once I get past this I'll try to do some more work with Swing.

Again, thank you all for your support.  Grin

Welcome back murderouskirk  Cheesy

Swing need a good news to swing
hero member
Activity: 938
Merit: 1002
Thanks guys  Grin

Today I'm very busy.

I need to finish up the final round of applications for funding in a startup corporation I'm involved with. Once I get past this I'll try to do some more work with Swing.

Again, thank you all for your support.  Grin
sr. member
Activity: 547
Merit: 250
legendary
Activity: 1834
Merit: 1006
Welcome back murderouskirk  Smiley

Now the big days for SWING.
hero member
Activity: 938
Merit: 1002
Omg what a relief. I'll work on fixing the rep tomorrow.
hero member
Activity: 938
Merit: 1002
-----BEGIN BITCOIN SIGNED MESSAGE-----
This is murderouskirk posting from murderouskirk. Altcoin4Life has returned my account! 11:44PM EST 1/20/2016 - \o/ Hooray!
-----BEGIN SIGNATURE-----
1E6soVzn7Z5NGguwD9sZfXkVmn8a51Cg71
H/tljcNY6VUWgEy7UB0S3m+hH24CNXCgnGByl81j/Oi6DFNJWGS7Y7Mfxr/9I66xLugx4kkpcxBieWvDDrPYbqc=
-----END BITCOIN SIGNED MESSAGE-----

Location of addy: https://bitcointalksearch.org/topic/m.12788990

hero member
Activity: 938
Merit: 1002
hero member
Activity: 560
Merit: 500
Still waiting on the return guys. Will let you all know if / when I get it.

HI

I HAVE NOW SENT A PM TO SWINGDEV WITH THE PASSWORD FOR MURDEROUSKIRK.

PLEASE CAN SWINGDEV CONFIRM THEY HAVE SECURED IT ASAP.

THANKS
ALTCOIN4LIFE
hero member
Activity: 560
Merit: 500
Still waiting on the return guys. Will let you all know if / when I get it.

Hi Swingdev

Thanks for your post.

THIS IS TO LET YOU KNOW THAT I WILL ONLY GIVE YOUR PASSWORD AND ACCOUNT BACK BY PM TO SWINGDEV ACCOUNT AS THIS IS THE ACCOUNT THAT PROVIDED THE SIGNED MESSAGE.

YOU REQUESTED I SHOULD EMAIL IT, BUT I AM NOT GOING TO DO THAT.

YOU WILL NOW RECEIVE THE ACCOUNT BACK BY PM TO SWINGDEV.


I agree with you that you have no control over others leaving me negative or even neutral trust.

TO THE USERS SAYING WHO LEFT ME BAD FEEDBACK AND SAID I LIED ABOUT THE AMOUNT LOST, YES THIS WAS A MISTAKE, I WAS SIMPLY REFERENCING THE AMOUNT I LOST ORIGINALLY TO MURDEROUSKIRK SCAM.  THIS WAS NOT MY INTENTION TO SAY THAT YOU PERSONALLY SCAMMED ME OF 0.13 BTC, I WILL REMOVE THIS REFERENCE.


FINALLY SWINGDEV, ONCE YOU HAVE RECEIVED THE PM, PLEASE CHANGE THE EMAIL AND THE PASSWORD (PLEASE CHOOSE A LONG SECURE NEW PASSWORD) OF MURDEROUSKIRK ACCOUNT ASAP.

FINALLY PLEASE MAKE A NEW SIGNED MESSAGE FROM THE ACCOUNT SAYING IT HAS BEEN RETURNED BACK TO THE ORIGINAL OWNER FROM ME, PLEASE POST IT HERE.

YOU WILL RECEIVE A PM WITHIN 24 HOURS. PLEASE POST HERE CONFIRMING ACCOUNT HAS BEEN GIVEN BACK.



Many Thanks
Altcoin4life
Pages:
Jump to: