Author

Topic: NXT :: descendant of Bitcoin - Updated Information - page 761. (Read 2761642 times)

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
Is double precision floating point really so unreliable?

This is peoples *money* you are dealing with James so I think you should not be so cavalier and actually understand how things work (or pay someone else to do the job *properly*).

If you take such shortcuts then your code will just end up as "junk" down the track.

I am sure there is some equivalent C code around and the code I wrote there could be reduced (as a lot of functionality it has you wouldn't need).
legendary
Activity: 1176
Merit: 1134
I just dont want to have to deal with converting everything to int math for now.

This is something better to be done "sooner than later" - I gave you a link to code (check back a couple of posts) that does the job (and has had years of "testing in the field") - feel free to use it.

Is there something in C? Its C++ and also a lot of code, almost doubles the size of the gateway code. Is double precision floating point really so unreliable?
legendary
Activity: 1176
Merit: 1134
Would it be possible to use int64_t from the stdint.h library to represent amounts instead of floating point?

Indeed James you should *never* use binary floating point types for *money* please use an int64_t as suggested.

If you're interested take a look at https://github.com/ciyam/ciyam/blob/master/src/numeric.cpp (an example of how to do "decimal" using a 64 bit integer as a mantissa).


The amounts in the gateway_AM packets are advisory and just for sanity checks. I am relying on what the bitcoind returns. With 8 digits fraction the smallest unit, a double will always map to the exact value, doesnt it?

I dont understand the big issue. The only thing that seems to be a problem is that cumulative balances the gateways keep would drift due to noise over time, but I am able to resync by tallying up the unspent outputs at anytime.

Do I really have stop using doubles? I am worried about all the scaling that I will have to do in order to trade the wide valuation range of all the cryptos. As it is, the low valued cryptos that are near 1 satoshi cant even trade against BTC due to the smallest increment being 50% change in price. I think there is more value to people to be able to get smaller spreads for the low value cryptos and if they lose 1 over time due to floating point noise, they are still much better off.

If there is a solid reason to change to int64_t, I will, but I am not using 32 bit floats, I am using 64 bit double precision.

James
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
I just dont want to have to deal with converting everything to int math for now.

This is something better to be done "sooner than later" - I gave you a link to code (check back a couple of posts) that does the job (and has had years of "testing in the field") - feel free to use it.
legendary
Activity: 1176
Merit: 1134
Code:

struct gateway_info  // this struct is very incomplete, still a work in progress
{
    double balance,deposits,withdrawals,tbd __attribute__ ((packed));
   ...
};

struct gateway_AM
{
    ...
    double amount __attribute__ ((packed));
    double unspent __attribute__ ((packed));
    double change __attribute__ ((packed));
    ...
};


Would it be possible to use int64_t from the stdint.h library to represent amounts instead of floating point?
Eventually, but for single deposit and withdrawals, using double wont lose any satoshi or even dogtoshi. I would only be a cumulative drift in gateway balance totals. I just dont want to have to deal with converting everything to int math for now.
full member
Activity: 266
Merit: 100
NXT is the future


My NXT is dancing the Limbo again between my account and bter Grin




Has anybody had any luck with bter NXT deposits the last 24 hours?


Is this crypto world?

5000 EURO lost due MTgox

87000 NXT lost due transaction to bter

newbie
Activity: 10
Merit: 0
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
Would it be possible to use int64_t from the stdint.h library to represent amounts instead of floating point?

Indeed James you should *never* use binary floating point types for *money* please use an int64_t as suggested.

If you're interested take a look at https://github.com/ciyam/ciyam/blob/master/src/numeric.cpp (an example of how to do "decimal" using a 64 bit integer as a mantissa).
sr. member
Activity: 396
Merit: 250

Total: Fee earned 784334 NXT   :     82000 NXT more than in 11th Feb 
                                                      (is that increase possible? - otherwise some data error).


Cumulative % of
fee earned, starting from TOP1
        20.8
        34.3
        44.6
        53.4
        57.8
        61.9



TOP's share is smaller than earlier.
In mining/forging the distribution is now:
4 accounts have mined 53.4% (less than before),
28 accounts have mined 88% (less),
and 98 accounts 97.9% (less) and
590 (more) accounts has forged 100%   i.e. 590 accounts has got some fees.


Something has made the distribution "better" ...   Smiley




don't forget small accounts possibly don't bother to forge.

And my forging competition is promoting small accounts to forge! We have 3 successful forges with roughly 10k nxt  Grin

We got 4, but I didn't enter because someone else forged with 3 Nxt less than me. I earned myself a whole 2 Nxt forging that block though!  Grin
full member
Activity: 199
Merit: 101
There will implement a coloredcoin on the top of Nxt.
full member
Activity: 153
Merit: 100
I bought a level on the bitscraper project for Nxt.
http://www.bitscraper.pw/p/blog-page.html

We are on Level 25. If you want to donate my Nxt address is in my signature.
sr. member
Activity: 490
Merit: 250
I don't really come from outer space.
Code:

struct gateway_info  // this struct is very incomplete, still a work in progress
{
    double balance,deposits,withdrawals,tbd __attribute__ ((packed));
   ...
};

struct gateway_AM
{
    ...
    double amount __attribute__ ((packed));
    double unspent __attribute__ ((packed));
    double change __attribute__ ((packed));
    ...
};


Would it be possible to use int64_t from the stdint.h library to represent amounts instead of floating point?
full member
Activity: 168
Merit: 100
In Bitcointalk, the main Bitcoin forum, several users are organizing to sue jointly to Mt Gox and claim their money. In Japan demands joint work differently, so it really will be several individual complaints on the same matter. The demand itself organizer recommends that stakeholders have caught at least $ 10,000 in Mt Gox to be viable. It also recommends having the money in dollars rather than  Bitcoin because is clearer recovery process in case of bankruptcy of the company.

This may be the reason for the recent sell Bitcoin anywhere.
legendary
Activity: 1176
Merit: 1134
Could someone write client side code to test the multisig gateway? It can be command line, nothing fancy, just as long as its not Windows Smiley

Initially, all gateway requests are done via AM, so you just need to fill out the gateway_AM structure and send the AM to the issuer NXT account 18232225178877143084

For deposits gatewayid needs to be 0 for now, withdrawals can be sent to 0, 1 or 2
coinid is 1 for DOGE
#define GATEWAY_SIG 0xdadafeed

// API funcids
#define GET_COINDEPOSIT_ADDRESS 'g' // set NXTaddr, only gateway 0 for now
#define BIND_DEPOSIT_ADDRESS 'b' // result of GET_COINDEPOSIT_ADDRESS

#define NOTIFY_PENDING_DEPOSIT 'n' // set NXTaddr, coinaddr and amount, only gateway 0 for now
#define MONEY_DEPOSITED 'd' // gateway response after it is confirmed, swept to multisig

#define WITHDRAWAL_REQUEST 'w' // set NXTaddr, coinaddr, txid and amount AFTER transferring coin asset back
#define MONEY_SENT 'm' // gateway response after it verifies you transferred asset back and will match the amount you redeemed.

First you need to get a deposit address by sending a GET_COINDEPOSIT_ADDRESS gateway_AM to gateway.0, the next block you should find a BIND_DEPOSIT_ADDRESS AM sent to 18232225178877143084 with your deposit address. You can reuse, or get new ones. Not much anonymity by getting new ones, since it is all public info. NXTcash for anonymity.

Now just send DOGE to your deposit address and send a NOTIFY_PENDING_DEPOSIT with the amount. When the gateway gets it, your NXT acct will get the coin asset.
....

....
To withdraw, just transfer the coin asset back to  18232225178877143084 and send a WITHDRAWAL_REQUEST AM. The gateways will do a multisig payment and post MONEY_SENT AM after its on its way.


Code:

struct gateway_info  // this struct is very incomplete, still a work in progress
{
    double balance,deposits,withdrawals,tbd __attribute__ ((packed));
    int bind_requests,addresses_bound,deposit_txids,pending_sweeps,verified_deposits __attribute__ ((packed));
    int withdrawal_requests,moneysent,pending_withdrawals,failed_withdrawals __attribute__ ((packed));
    int rawbroadcasts,pending_redemptions __attribute__ ((packed));
};

struct gateway_AM
{
    unsigned int sig __attribute__ ((packed));
    int funcid __attribute__ ((packed));
    int gatewayid __attribute__ ((packed));
    int coinid __attribute__ ((packed));
    double amount __attribute__ ((packed));
    double unspent __attribute__ ((packed));
    double change __attribute__ ((packed));
    char NXTaddr[32],coinaddr[32];
    union { char txid[128]; char rawtransaction[288]; };
    union { char inputs[512]; };
    struct gateway_info info;
};


Once there is client side code for this, it can easily be integrated into any GUI so we can have crypto gateways built into NXT GUIs. Any feedback is much appreciated. The .01 NXT resolution in AE is an issue for low value things like DOGE, but since its testnet, I will ignore this for now.

It would really help if somebody other than me worked on this. A lot of money could flow through this code. Want to be sure its super solid.

James
sr. member
Activity: 644
Merit: 250
Does anyone else find the NEM vs Nxt thing really interesting?  It's like communism vs the free market.

NEM is like a malevolent dictatorship.  Now they are just pulling peoples' stakes if they don't like what you say.

How can someone pulling of a stake when there is nothing to give yet? There is no single NEM in the market yet.

The community felt that you were not interested anymore so they pulled your name out of the list.

The community has been very nice to you to and asked to you personally if you are really interested in NEM or not.

But there is still no good answer from you. You are making it very hard for yourself and the community.

Everyone is welcome. Just say yes to NEM  Wink

https://bitcointalksearch.org/topic/m.5276278
member
Activity: 80
Merit: 10
Does anyone else find the NEM vs Nxt thing really interesting?  It's like communism vs the free market.

NEM is like a malevolent dictatorship.  Now they are just pulling peoples' stakes if they don't like what you say.

How can someone pulling of a stake when there is nothing to give yet? There is no single NEM in the market yet.

The community felt that you were not interested anymore so they pulled your name out of the list.

The community has been very nice to you to and asked to you personally if you are really interested in NEM or not.

But there is still no good answer from you. You are making it very hard for yourself and the community.

Everyone is welcome. Just say yes to NEM  Wink
legendary
Activity: 1176
Merit: 1134
I am getting close to an alpha release of the automated multisig gateway. I was hoping there was somebody here who is both familiar with gateway software and C, who could review my code.

I will be setting up three servers doing automated multisig for DOGE trading directly into NXT AE testnet. It will be real DOGE, but test assets, so just test it with small amounts. Since losing a few hundred DOGE isnt a disaster, I will be testing the basics myself.

The code is only two days old, so I have concentrated on just getting it working. Assuming people want to use it for real, I will keep improving it. Adding any coin that is a bitcoin fork should be a matter of changing a single #define file. At some point, it could probably do gateway services for many coins at the same time.

James

What about using the DOGE testnet?  You'd have to mine on the testnet to get DOGE, but the difficulty would be low so it would accumulate quickly.

I will gladly tip anybody willing to test enough real DOGE to test with. I think it will the first time a mainnet crypto is traded on a testnet Dex
sr. member
Activity: 490
Merit: 250
I don't really come from outer space.
I am getting close to an alpha release of the automated multisig gateway. I was hoping there was somebody here who is both familiar with gateway software and C, who could review my code.

I will be setting up three servers doing automated multisig for DOGE trading directly into NXT AE testnet. It will be real DOGE, but test assets, so just test it with small amounts. Since losing a few hundred DOGE isnt a disaster, I will be testing the basics myself.

The code is only two days old, so I have concentrated on just getting it working. Assuming people want to use it for real, I will keep improving it. Adding any coin that is a bitcoin fork should be a matter of changing a single #define file. At some point, it could probably do gateway services for many coins at the same time.

James

What about using the DOGE testnet?  You'd have to mine on the testnet to get DOGE, but the difficulty would be low so it would accumulate quickly.

Edit: here's a DOGE testnet faucet: http://testdoge.lionservers.de/

That testnet faucet also has a DOGE testnet how-to: http://testdoge.lionservers.de/howto/
member
Activity: 112
Merit: 10
Nxt-e.com supports multiple languages supports (English French and  Chinese), German, Russian, Japanese, or the other language volunteers please contact us, thanks.
full member
Activity: 232
Merit: 100
Does anyone else find the NEM vs Nxt thing really interesting?  It's like communism vs the free market.

NEM is like a malevolent dictatorship.  Now they are just pulling peoples' stakes if they don't like what you say.

You can cry on my shoulder. I can feel your pain Smiley
Jump to: