Miki



Offline



Activity: 70

Merit: 10







MemberActivity: 70Merit: 10 Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 12:49:48 PM #23041 Quote from: smooth on April 15, 2015, 10:09:04 PM Quote from: Miki on April 15, 2015, 09:36:23 PM Quote from: osensei on April 15, 2015, 07:05:06 PM Quote from: Miki on April 15, 2015, 04:16:38 PM Quote from: GreekBitcoin on April 15, 2015, 04:12:52 PM

I have noticed that too. Apparently there are wrong calculations...Which pool do you guys consider to be the best one right now?



Best pool by far is monero.crypto-pool.fr.

Best pool by far is monero.crypto-pool.fr.

No one denies that's the largest pool, but largest doesn't mean best. On smaller pools your payments will be less frequent, but bigger. On the long run you should be getting more or less the same amount of XMR from each pool (it's also been said that you would be getting a little more from smaller pools, but I don't have the theory to back it up). But most importantly, if you avoid largest pools you will be helping to the decentralization by spreading the network's hash power.



You should look for a good pool with low latency in your location. Just make sure to ping the mining server address and not the web server, as they may not be in the same location. Also, if your mining software supports it, you should add a backup pool just in case your main pool becomes unavailable.

No one denies that's the largest pool, but largest doesn't mean best. On smaller pools your payments will be less frequent, but bigger. On the long run you should be getting more or less the same amount of XMR from each pool (it's also been said that you would be getting a little more from smaller pools, but I don't have the theory to back it up). But most importantly, if you avoid largest pools you will be helping to the decentralization by spreading the network's hash power.You should look for a good pool with low latency in your location. Just make sure to ping the mining server address and not the web server, as they may not be in the same location. Also, if your mining software supports it, you should add a backup pool just in case your main pool becomes unavailable.

Avoid small pools , difficulty oscillates by 10-30% during the day, if you mine at a small pool and it hits no blocks during the low diff period than you are at a loss.

Avoid small pools , difficulty oscillates by 10-30% during the day, if you mine at a small pool and it hits no blocks during the low diff period than you are at a loss.

And if it does hit a block during a low-dificulty period you get a bit extra. Over several days it largely balances out.



Quote Mine at a pool that hits a block every 10-15mins



A few blocks per day is plenty imo. The most important factor for a pool is reliability and that you have low latency. Bigger payouts is helpful because it will reduce your transaction fees when you try to spend.



One suggestion I remember from a while back that was pretty good is to mine in such a way that you get part of at least 50 blocks. That depends not only on the pool hash rate (or your own hash rate if solo mining) but also your time horizon.





And if it does hit a block during a low-dificulty period you get a bit extra. Over several days it largely balances out.A few blocks per day is plenty imo. The most important factor for a pool is reliability and that you have low latency. Bigger payouts is helpful because it will reduce your transaction fees when you try to spend.One suggestion I remember from a while back that was pretty good is to mine in such a way that you get part of at least 50 blocks. That depends not only on the pool hash rate (or your own hash rate if solo mining) but also your time horizon.

Wrong. The difficulty keeps increasing, you don't get a second chance when you don't hit a block during the low-diff period. Wrong. The difficulty keeps increasing, you don't get a second chance when you don't hit a block during the low-diff period.

GreekBitcoin



Offline



Activity: 1428

Merit: 1001





getmonero.org







LegendaryActivity: 1428Merit: 1001getmonero.org Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 02:39:17 PM #23043 Monero Status

A friend of mine made an android widget and app.











App and Widget for the Monero cryptocurrency, with stats from all exchanges.

Google Store: https://play.google.com/store/apps/details?id=tr.monerostatus



----------------------------------------------------------------



Simple widget and app for the Monero(XMR) cryptocurrency



----------------------------------------------------------------



Supported exchanges: poloniex.com, bittrex.com, bter.com, hitbtc.com, melotic.com, shapeshift.io

Supported fiat currencies: AUD, BRL, CAD, CHF, CNY, EUR, GBP, IDR, ILS, MXN, NOK, NZD, PLN, RON, RUB, SEK, SGD, USD and ZAR



Monero Widget features (both in 2x1 and 2x2 formats):

30 minute fixed refresh rate, tap refresh sign to instantly refresh

Tap Monero logo to launch App in the chosen currency

Price in BTC from chosen exchange, color coded for recent change

Price in chosed currency from coinmarketcap.com

24 hour total volume in chosed currency from coinmarketcap.com

Approximate hashrate in Mh/s from moneroblocks.eu



Monero Widget features (only in 2x2):

Calculated price for your XMR assets

Calculated mined value per day from your hashrate

Market capitalization in the chosen currency



App features:

All the widget information and capabilities

Left side drawer for navigation (Swipe right from the side or press app icon to open)

Trial fullscreen button, please report bugs

Tap the refresh icon to refresh, long press to enter continuous refresh mode; exit by tapping again

Exchange specific 24 hour volume from chosen exchange

Total market capitalization, 24 hour percentage change and ranking from coinmarketcap.com

Total coins in existence, block height and difficulty from moneroblocks.eu

Calculate prices for your amount of XMR

Calculate XMR mined per day and their value for your hashrate

Market-Order Depth graph drawing data from all enabled exchanges, plus their total (combined) market depth

XMR markets for other cryptocurrencies by exchanges that offer them

Enable the exchanges you want in the graph by tapping on their names in the drawer

Change the graph's viewed range with pinch in/pinch out gestures



Coinmarketcap data retrieved through



Using the GraphView library from



Donations welcome Many thanks to those that have already donated!

Code: 41pUDMUG956cAc8DAkMekSZ9ThrKbicVTRZbnjs7K2zjTf4ue1UrGcN7D9BLX39uh2RPVeQaZEP2H91XBvqRJJJYUmQKXjM ----------------------------------------------------------------



Updates

Changed to moneroblocks.eu from chainradar.com (chainradar has a pretty restrictive api usage limit)

Added Shapeshift.io as an exchange (one can see it that way )

Added RamerDouglasPeucker smoothing to the market depth graph, dependant on zoom level

Unexpected bug fixes!



And please make feature requests or tell us about bugs! It really helps!

(This update should have fixed some user's problems. If not please contact us!) A friend of mine made an android widget and app.App and Widget for the Monero cryptocurrency, with stats from all exchanges.----------------------------------------------------------------Simple widget and app for the Monero(XMR) cryptocurrency----------------------------------------------------------------Supported exchanges: poloniex.com, bittrex.com, bter.com, hitbtc.com, melotic.com, shapeshift.ioSupported fiat currencies: AUD, BRL, CAD, CHF, CNY, EUR, GBP, IDR, ILS, MXN, NOK, NZD, PLN, RON, RUB, SEK, SGD, USD and ZARMonero Widget features (both in 2x1 and 2x2 formats):30 minute fixed refresh rate, tap refresh sign to instantly refreshTap Monero logo to launch App in the chosen currencyPrice in BTC from chosen exchange, color coded for recent changePrice in chosed currency from coinmarketcap.com24 hour total volume in chosed currency from coinmarketcap.comApproximate hashrate in Mh/s from moneroblocks.euMonero Widget features (only in 2x2):Calculated price for your XMR assetsCalculated mined value per day from your hashrateMarket capitalization in the chosen currencyApp features:All the widget information and capabilitiesLeft side drawer for navigation (Swipe right from the side or press app icon to open)Trial fullscreen button, please report bugsTap the refresh icon to refresh, long press to enter continuous refresh mode; exit by tapping againExchange specific 24 hour volume from chosen exchangeTotal market capitalization, 24 hour percentage change and ranking from coinmarketcap.comTotal coins in existence, block height and difficulty from moneroblocks.euCalculate prices for your amount of XMRCalculate XMR mined per day and their value for your hashrateMarket-Order Depth graph drawing data from all enabled exchanges, plus their total (combined) market depthXMR markets for other cryptocurrencies by exchanges that offer themEnable the exchanges you want in the graph by tapping on their names in the drawerChange the graph's viewed range with pinch in/pinch out gesturesCoinmarketcap data retrieved through http://coinmarketcap.northpole.ro/ JSON APIUsing the GraphView library from http://android-graphview.org/ , licenced under the LGPLDonations welcomeMany thanks to those that have already donated!----------------------------------------------------------------Changed to moneroblocks.eu from chainradar.com (chainradar has a pretty restrictive api usage limit)Added Shapeshift.io as an exchange (one can see it that wayAdded RamerDouglasPeucker smoothing to the market depth graph, dependant on zoom levelUnexpected bug fixes!Andmake feature requests or tell us about bugs! It really helps!(This update should have fixed some user's problems. If not please contact us!)

dEBRUYNE



Offline



Activity: 2086

Merit: 1131







LegendaryActivity: 2086Merit: 1131 Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 04:39:17 PM #23046 Quote from: nakaone on April 16, 2015, 04:23:47 PM Quote from: GingerAle on April 16, 2015, 04:05:52 PM

Why can't we just raise funds for these items, in a similar way that funds were raised for the above 2 items?





well partly due to some game-theoretic problems and freeridinng and partly due to the reason that someone has to step up and organize the stuff.



If you manage to organize all the stuff let me know and I send you 20xmr

well partly due to some game-theoretic problems and freeridinng and partly due to the reason that someone has to step up and organize the stuff.If you manage to organize all the stuff let me know and I send you 20xmr

I would be happy to donate as well and it seems like a great incentive. Aligning it with Monero's birthday would be great too. However, there are some implications, some design goals have lot of interdependency (or are worked on together), so it's hard to set them out apart (I guess fluffypony could give a more extensive argument on this one).



PS: There is already a system in place for this. I don't know when it's going live though, but it will probably be after all the DB work is finished.



Quote from: fluffypony on March 23, 2015, 08:48:59 AM Quote from: Anon136 on March 23, 2015, 12:00:29 AM you guys are always pointing out how the project is basically unfunded and you do great work under those conditions no doubt. but i just want to do what i can to help with this situation for 2 reasons, for the good of monero, but also because you guys should be compensated for the work you do. and the thing is, i just dont think that panhandling is ever going to get you the sort of consistent and appropriate compensation you should be getting, and monero should be getting.



We've been working on adding some needed functionality to the forum, and our next major task we're going to tackle is the funding system. The idea is:



1. Users / developers / anyone will pitch an idea in the



2. After some discussion it will be moved by one of the administrators (currently the Core Team only, but that would change in future) to the



3. Developers (including the core team, and initially probably only the core team for simplicity) will pitch against each of these open tasks. Later on I would expect that there would be more people / teams pitching against tasks, and the most competent / available / reasonably priced will be the one the community will veer towards.



4. Once the developer / team has been selected to complete the task it moves to the



5. Funding will be to a core team controlled address with a payment ID for that particular project/task, and there will be a funding progress bar. This information will be mirrored over to a funding page on the website that shows the funding progress per project/task.



6. When funding reaches 70% (for smaller tasks) or 30% (for larger and longer tasks) it goes into the



7. Funds are dispensed by the core team on a regular basis and only if there is actual progress / commits / whatever, so it doesn't go into a black hole.



Advantages of this approach:



- the core team's oversight role can eventually be replaced by a group selected from the community at large, so as not to have a stranglehold over things



- the core team's escrow role can eventually be replaced by a multi-sig system (2-of-3) where the signatories are the core team, the oversight group, and the recipient, so the recipient can't spend those raised funds without the involvement of one of the other 2 signatories



- this isn't limited to dev tasks, and things like "fly David Latapie to speak at a conference" or lobbying or PR or advertising can all have tasks created and funded



- funding is direct and specific to tasks instead of going into a big black hole and hoping for the best



We expect this system will still take us another short while before we can put it live, but we're already crunching away at the functionality for it (and this also further emphasises why the forum couldn't just be SMF with a theme;) )

We've been working on adding some needed functionality to the forum, and our next major task we're going to tackle is the funding system. The idea is:1. Users / developers / anyone will pitch an idea in the Ideas section of the forum. This is already happening.2. After some discussion it will be moved by one of the administrators (currently the Core Team only, but that would change in future) to the Open Tasks section of the forum. No tasks have been moved as yet.3. Developers (including the core team, and initially probably only the core team for simplicity) will pitch against each of these open tasks. Later on I would expect that there would be more people / teams pitching against tasks, and the most competent / available / reasonably priced will be the one the community will veer towards.4. Once the developer / team has been selected to complete the task it moves to the Funding Required section of the forum, and it is opened for funding.5. Funding will be to a core team controlled address with a payment ID for that particular project/task, and there will be a funding progress bar. This information will be mirrored over to a funding page on the website that shows the funding progress per project/task.6. When funding reaches 70% (for smaller tasks) or 30% (for larger and longer tasks) it goes into the Work in Progress section and work begins.7. Funds are dispensed by the core team on a regular basis and only if there is actual progress / commits / whatever, so it doesn't go into a black hole.- the core team's oversight role can eventually be replaced by a group selected from the community at large, so as not to have a stranglehold over things- the core team's escrow role can eventually be replaced by a multi-sig system (2-of-3) where the signatories are the core team, the oversight group, and the recipient, so the recipient can't spend those raised funds without the involvement of one of the other 2 signatories- this isn't limited to dev tasks, and things like "fly David Latapie to speak at a conference" or lobbying or PR or advertising can all have tasks created and funded- funding is direct and specific to tasks instead of going into a big black hole and hoping for the bestWe expect this system will still take us another short while before we can put it live, but we're already crunching away at the functionality for it (and this also further emphasises why the forum couldn't just be SMF with a theme;) )

I personally hope this will be the way to go in the future, since it just gives so much more incentive to donate if you can donate to a specific "thing" you would like to see developed. Most people hesitate to donate, because it's currently more or less a blackbox to which you donate (no offence to the devs, but I think a system described above (by fluffypony and by GingerAle) would have a much bigger utility). I would be happy to donate as well and it seems like a great incentive. Aligning it with Monero's birthday would be great too. However, there are some implications, some design goals have lot of interdependency (or are worked on together), so it's hard to set them out apart (I guess fluffypony could give a more extensive argument on this one).PS: There is already a system in place for this. I don't know when it's going live though, but it will probably be after all the DB work is finished.I personally hope this will be the way to go in the future, since it just gives so much more incentive to donate if you can donate to a specific "thing" you would like to see developed. Most people hesitate to donate, because it's currently more or less a blackbox to which you donate (no offence to the devs, but I think a system described above (by fluffypony and by GingerAle) would have a much bigger utility). Privacy matters, use Monero - A true untraceable cryptocurrency

Why Monero matters? http://weuse.cash/2016/03/05/bitcoiners-hedge-your-position/

TheKoziTwo



Offline



Activity: 1549

Merit: 1021









LegendaryActivity: 1549Merit: 1021 Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 07:40:08 PM #23049 XMR Integration / DEMO



Finally done with this script. The idea is to make it easier for people to setup their own monero accepting website. A working demo can help with that!



This is a complete PHP integration of monero. Once setup you will have a working membership site with:



Login/Registration

Generation of payment id

Deposit of funds (automatically added to account after X confirmations)

Withdraw of funds (added to processing queue and processed automatically)

Admin Panel displaying current balances and other useful info (e.g status of daemon and wallet)

With some minor changes, you can add multiple cryptonote types of currencies/assets

The script comes with cron.php, which is the processing script. It can be setup to run forever in the background, or even as a cron job. Read the comment in cron.php for more info.

For install instructions simply open install.php



Download here:



Step by step install (install.php):





Login/Registration:





Account area:





Admin area:





There is no guide for how to setup daemon and simplewallet in "server mode". I have been working on a guide as well, but it's not posted anywhere yet, so I'll put some quick guidelines below:

Quote Introduction



With bitcoin, transactions are identified with a unique address. Monero uses payment id instead to identify transactions. This means that your XMR receiving address will be the same for all users, but payment_id will be unique. Users transferring money to your site need to specify both address and payment id



Setting up server



Bitcoin has both wallet and daemon in one and the same software. Monero has split these into two separate applications. You have bitmonerod which is the daemon and simplewallet which is the wallet. This requires us to connect to two different services.



Daemon (localhost:18081/rpc/)



You need to launch daemon in server mode, to do so run it with:

Code: ./bitmonerod --rpc-bind-ip 127.0.0.1 --rpc-bind-port 18081

Thats all. Once you have a daemon running, you can connect to it from one or even multiple wallets.



Wallet (localhost:18082/rpc/)

First of all create a wallet as usual (if you have not already done so):



Code: simplewallet --generate-new-wallet mywallet.dat

Enter a password (demo123), you dont need to write down the seed, but you may.



exit the wallet.



In order to perform operations usings the API, the wallet must run in rpc server mode, to do so, run it with the following param (make sure the daemon is already running first):



Code: ./simplewallet --wallet-file mywallet.dat --password demo123 --rpc-bind-port 18082

Another example, if you have bound the daemon to an IP/PORT and also wants to bind the simplewallet, this example below shows how:

Code: ./simplewallet --daemon-host 192.168.10.54 --daemon-port 18081 --wallet-file mywallet.dat --rpc-bind-ip 192.168.10.54 --rpc-bind-port 18082 --password demo123

Now you should be able to access the wallet outside of your localhost also.



IMPORTANT: When wallet is running in RPC mode its technically possible for hackers to empty your wallet if your port is open. You dont want that, so make sure 18082 is closed. With bitcoin, transactions are identified with a unique address. Monero uses payment id instead to identify transactions. This means that your XMR receiving address will be the same for all users, but payment_id will be unique. Users transferring money to your site need to specify both address and payment idBitcoin has both wallet and daemon in one and the same software. Monero has split these into two separate applications. You have bitmonerod which is the daemon and simplewallet which is the wallet. This requires us to connect to two different services.You need to launch daemon in server mode, to do so run it with:Thats all. Once you have a daemon running, you can connect to it from one or even multiple wallets.First of all create a wallet as usual (if you have not already done so):Enter a password (demo123), you dont need to write down the seed, but you may.exit the wallet.In order to perform operations usings the API, the wallet must run in rpc server mode, to do so, run it with the following param (make sure the daemon is already running first):Another example, if you have bound the daemon to an IP/PORT and also wants to bind the simplewallet, this example below shows how:Now you should be able to access the wallet outside of your localhost also.IMPORTANT: When wallet is running in RPC mode its technically possible for hackers to empty your wallet if your port is open. You dont want that, so make sure 18082 is closed. Finally done with this script.The idea is to make it easier for people to setup their own monero accepting website. A working demo can help with that!This is a complete PHP integration of monero. Once setup you will have a working membership site with:For install instructions simply open install.phpDownload here: https://github.com/TheKoziTwo/xmr-integration There is no guide for how to setup daemon and simplewallet in "server mode". I have been working on a guide as well, but it's not posted anywhere yet, so I'll put some quick guidelines below: Truth

Jojatekok



Offline



Activity: 264

Merit: 250







Sr. MemberActivity: 264Merit: 250 Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 07:47:36 PM #23052 Quote from: TheKoziTwo on April 16, 2015, 07:40:08 PM XMR Integration / DEMO



Finally done with this script. The idea is to make it easier for people to setup their own monero accepting website. A working demo can help with that!



This is a complete PHP integration of monero. Once setup you will have a working membership site with:



Login/Registration

Generation of payment id

Deposit of funds (automatically added to account after X confirmations)

Withdraw of funds (added to processing queue and processed automatically)

Admin Panel displaying current balances and other useful info (e.g status of daemon and wallet)

With some minor changes, you can add multiple cryptonote types of currencies/assets

The script comes with cron.php, which is the processing script. It can be setup to run forever in the background, or even as a cron job. Read the comment in cron.php for more info.

For install instructions simply open install.php



Download here:



Step by step install (install.php):





Login/Registration:





Account area:





Admin area:





There is no guide for how to setup daemon and simplewallet in "server mode". I have been working on a guide as well, but it's not posted anywhere yet, so I'll put some quick guidelines below:

Quote Introduction



With bitcoin, transactions are identified with a unique address. Monero uses payment id instead to identify transactions. This means that your XMR receiving address will be the same for all users, but payment_id will be unique. Users transferring money to your site need to specify both address and payment id



Setting up server



Bitcoin has both wallet and daemon in one and the same software. Monero has split these into two separate applications. You have bitmonerod which is the daemon and simplewallet which is the wallet. This requires us to connect to two different services.



Daemon (localhost:18081/rpc/)



You need to launch daemon in server mode, to do so run it with:

Code: ./bitmonerod --rpc-bind-ip 127.0.0.1 --rpc-bind-port 18081

Thats all. Once you have a daemon running, you can connect to it from one or even multiple wallets.



Wallet (localhost:18082/rpc/)

First of all create a wallet as usual (if you have not already done so):



Code: simplewallet --generate-new-wallet mywallet.dat

Enter a password (demo123), you dont need to write down the seed, but you may.



exit the wallet.



In order to perform operations usings the API, the wallet must run in rpc server mode, to do so, run it with the following param (make sure the daemon is already running first):



Code: ./simplewallet --wallet-file mywallet.dat --password demo123 --rpc-bind-port 18082

Another example, if you have bound the daemon to an IP/PORT and also wants to bind the simplewallet, this example below shows how:

Code: ./simplewallet --daemon-host 192.168.10.54 --daemon-port 18081 --wallet-file mywallet.dat --rpc-bind-ip 192.168.10.54 --rpc-bind-port 18082 --password demo123

Now you should be able to access the wallet outside of your localhost also.



IMPORTANT: When wallet is running in RPC mode its technically possible for hackers to empty your wallet if your port is open. You dont want that, so make sure 18082 is closed. With bitcoin, transactions are identified with a unique address. Monero uses payment id instead to identify transactions. This means that your XMR receiving address will be the same for all users, but payment_id will be unique. Users transferring money to your site need to specify both address and payment idBitcoin has both wallet and daemon in one and the same software. Monero has split these into two separate applications. You have bitmonerod which is the daemon and simplewallet which is the wallet. This requires us to connect to two different services.You need to launch daemon in server mode, to do so run it with:Thats all. Once you have a daemon running, you can connect to it from one or even multiple wallets.First of all create a wallet as usual (if you have not already done so):Enter a password (demo123), you dont need to write down the seed, but you may.exit the wallet.In order to perform operations usings the API, the wallet must run in rpc server mode, to do so, run it with the following param (make sure the daemon is already running first):Another example, if you have bound the daemon to an IP/PORT and also wants to bind the simplewallet, this example below shows how:Now you should be able to access the wallet outside of your localhost also.IMPORTANT: When wallet is running in RPC mode its technically possible for hackers to empty your wallet if your port is open. You dont want that, so make sure 18082 is closed.

Finally done with this script.The idea is to make it easier for people to setup their own monero accepting website. A working demo can help with that!This is a complete PHP integration of monero. Once setup you will have a working membership site with:For install instructions simply open install.phpDownload here: https://github.com/TheKoziTwo/xmr-integration There is no guide for how to setup daemon and simplewallet in "server mode". I have been working on a guide as well, but it's not posted anywhere yet, so I'll put some quick guidelines below:

Incredible news! Hopefully I'll be able to seek through your TX date retrieval mechanism, thus, I'd be able to implement that functionality into Monero API .NET, and then MoneroX. Incredible news! Hopefully I'll be able to seek through your TX date retrieval mechanism, thus, I'd be able to implement that functionality into Monero API .NET, and then MoneroX. Code: Monero (XMR): 47hK4gehaMrFTQCiV5FEmM54hpqTrdHudb9nUBG88NicBDpxH4TGuh3TmW84Dc6dpMiEiBLGvJCuT3xC3LNHctmx7mG8NLM

Bitcoin (BTC): 14wHehBtFt321WTV15khon8Juaxh9drnfJ

TheKoziTwo



Offline



Activity: 1549

Merit: 1021









LegendaryActivity: 1549Merit: 1021 Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 07:59:08 PM #23054



Float, Decimal, Integer ? Mathematics in PHP & MySQL



Floating point numbers are not accurate and should never be used for financial transactions.



A few examples of this:



Code: $a = '35';

$b = '-34.99';

echo ($a + $b);

Results in 0.009999999999998 instead of 0.01



Code: echo floor((0.1+0.7)*10);

Results in 7 instead of the expected answer 8



So were not able to use PHPs native operators for math calculations with decimals since those are treated as floats.



Then we have integer. A much more suited choice for financial transactions. One thing to keep in mind if choosing integer is the php limits. Those are for 32-bit build of PHP limited to integers in the range of -2147483648 to 2147483647 while 64-bit -9 223 372 036 854 775 808 to 9 223 372 036 854 775 807



Imagine you have 100k XMR. Since monero has up to 12 decimals, to store 1 monero we need a number like this: 10^12 = 1 000 000 000 000



Thats more than a 32-bit build can handle right there.



To store 100k XMR we would store:100000 * (10^12) = 100 000 000 000 000 000



Lets compare:

Code: 9 223 372 036 854 775 807 (64-bit limit)

100 000 000 000 000 000 (100k XMR)

Well, its still within the range, but if we increase it to 10 million XMR not even 64-bit can handle it.



Satoshi Nakamoto was pretty smart, he knew this. Thats probably why the limit is 21 million BTC. 1 Satoshi is the lowest unit of bitcoin, and 1 BTC = 100 000 000 Satoshi. Not only did he get it within the maximum integer value that can be stored. He also got it within the limit of floating point numbers, useful for languages like javascript, but thats another story (you can



21 000 000 * 100,000,000 = 2100000000000000



Comparing again:

Code: 9223372036854775807 (64-bit limit)

2147483647 (32-bit limit)

2100000000000000 (Max BTC)

As we can see, bitcoin fits within these ranges.



We want our application to be scalable, there is always a good chance were going to want to add another currency with its own unique rules at one point.



So monero cannot ultimately be stored as integer if we intend to preserve all the decimals. We could reduce the decimals to 8 like bitcoin. That will take care of it. But there is one unexplored alternative Id like to present first: decimals and arbitrary precision math.



If you enable an extension for PHP called bcmath you will be able to go beyond the limits of your system. With arbitrary precision mathematics youll have a binary calculator which supports numbers of any size and precision represented as strings.



By using BCMath, we can do calculations and know with certainty that the numbers are 100% correct at all times, with every single satoshi accounted for.



Not only that, but we get to store numbers like they are supposed to be stored in database. Just like they look. By using MySQL DECIMAL, we can store the smallest unit of monero as:



0.000000000001.



Let us repeat the examples we did for float with bcmath:



Code: $a = '35';

$b = '-34.99';

echo bcadd($a,$b);

Results in 0.01



Code: echo bc::floor(bcmul(bcadd('0.1','0.7'),'10'));

Results in 8



Large numbers is no problem at all, let us multiply the 64-bit max limit by itself:



Code: echo bcmul('9223372036854775807','9223372036854775807');

Results in 85070591730234615847396907784232501249



Check for yourself (if you can even find a calculator doing that! hint: Wolfram Alpha



Similarly small amounts:

Code: echo bcmul('0.000000000001','0.000000000001');

0.000000000000000000000001



But before you do that, make sure to set bcscale() to something high enough.



The script comes with a wrapper class for bc math, this will make it a tad easier to work with.



As for downsides to using bcmath:



You need to have the bcmath extension (very easy to install, WHM/cPanel servers has it as a tick box)

Not as fancy using functions to do operations as using + - * /, e.g bcadd(1,2) instead of 1+2

Some functions available for php that is not integrated in bcmath, example is the php function floor, however there are re-implementations for this (I have included some in the wrapper)

A bit slower (But no big deal!)

So all calculations in the script are done using bcmath, the numbers are treated like strings and stored as decimals in the database. Only when we transfer money out do we convert to integer, and we do that outside of php as well (in json, with parameter JSON_NUMERIC_CHECK)



Some may wonder why the integration is using bcmath, my explaination below:Floating point numbers are not accurate and should never be used for financial transactions.A few examples of this:Results ininstead ofResults ininstead of the expected answerSo were not able to use PHPs native operators for math calculations with decimals since those are treated as floats.Then we have integer. A much more suited choice for financial transactions. One thing to keep in mind if choosing integer is the php limits. Those are for 32-bit build of PHP limited to integers in the range oftowhile 64-bittoImagine you have 100k XMR. Since monero has up to 12 decimals, to store 1 monero we need a number like this: 10^12 =Thats more than a 32-bit build can handle right there.To store 100k XMR we would store:100000 * (10^12) =Lets compare:Well, its still within the range, but if we increase it to 10 million XMR not even 64-bit can handle it.Satoshi Nakamoto was pretty smart, he knew this. Thats probably why the limit is 21 million BTC. 1 Satoshi is the lowest unit of bitcoin, and 1 BTC = 100 000 000 Satoshi. Not only did he get it within the maximum integer value that can be stored. He also got it within the limit of floating point numbers, useful for languages like javascript, but thats another story (you can read more here 21 000 000 * 100,000,000 = 2100000000000000Comparing again:As we can see, bitcoin fits within these ranges.We want our application to be scalable, there is always a good chance were going to want to add another currency with its own unique rules at one point.So monero cannot ultimately be stored as integer if we intend to preserve all the decimals. We could reduce the decimals to 8 like bitcoin. That will take care of it. But there is one unexplored alternative Id like to present first: decimals and arbitrary precision math.If you enable an extension for PHP called bcmath you will be able to go beyond the limits of your system. With arbitrary precision mathematics youll have a binary calculator which supports numbers of any size and precision represented as strings.By using BCMath, we can do calculations and know with certainty that the numbers are 100% correct at all times, with every single satoshi accounted for.Not only that, but we get to store numbers like they are supposed to be stored in database. Just like they look. By using MySQL DECIMAL, we can store the smallest unit of monero as:0.000000000001.Let us repeat the examples we did for float with bcmath:Results inResults inLarge numbers is no problem at all, let us multiply the 64-bit max limit by itself:Results inCheck for yourself (if you can even find a calculator doing that!Similarly small amounts:But before you do that, make sure to setto something high enough.The script comes with a wrapper class for bc math, this will make it a tad easier to work with.As for downsides to using bcmath:So all calculations in the script are done using bcmath, the numbers are treated like strings and stored as decimals in the database. Only when we transfer money out do we convert to integer, and we do that outside of php as well (in json, with parameter JSON_NUMERIC_CHECK) Truth

smooth



Offline



Activity: 2534

Merit: 1167









LegendaryActivity: 2534Merit: 1167 Re: [XMR] Monero - A secure, private, untraceable cryptocurrency - 0.8.8.6 April 16, 2015, 09:04:21 PM

Last edit: April 17, 2015, 12:30:04 AM by smooth #23056 Quote from: TheKoziTwo on April 16, 2015, 07:59:08 PM So monero cannot ultimately be stored as integer if we intend to preserve all the decimals. We could reduce the decimals to 8 like bitcoin. That will take care of it. But there is one unexplored alternative I’d like to present first: decimals and arbitrary precision math.



Monero can be stored in a 64 bit unsigned integer. The total money supply has to fit in a 64 bit unsigned integer currently (as required by the base reward formula). This will be true until some time after the tail reward kicks in (roughly eight years). Even then, the amount allowed for any single transaction will still be constrained by a 64 bit unsigned integer.



Some languages don't natively support unsigned integers. It is possible to use signed integers as unsigned, but error prone. Operations such as addition work fine, but I/O, division, comparisons (and a few other operations) require some extra processing.



There is certainly nothing wrong with using string-based numbers for accounting though. That probably the most reliable approach, and suitable for nearly all cases where performance and a possible space penalty don't matter.



Very nice work on the integration utility. Congratulations on the release! Monerobe stored in a 64 bit unsigned integer. The total money supply has to fit in a 64 bit unsigned integer currently (as required by the base reward formula). This will be true until some time after the tail reward kicks in (roughly eight years). Even then, the amount allowed for any single transaction will still be constrained by a 64 bit unsigned integer.Some languages don't natively support unsigned integers. It is possible to use signed integers as unsigned, but error prone. Operations such as addition work fine, but I/O, division, comparisons (and a few other operations) require some extra processing.There is certainly nothing wrong with using string-based numbers for accounting though. That probably the most reliable approach, and suitable for nearly all cases where performance and a possible space penalty don't matter.Very nice work on the integration utility. Congratulations on the release!