Ruzihm / coin-chance

An open source crypto currency play-and-invest gambling site
GNU Affero General Public License v3.0
35 stars 23 forks source link

Account issues #9

Closed fedaykinofdune closed 10 years ago

fedaykinofdune commented 10 years ago

It's working somewhat, it's properly reflecting the balance, but won't allow a bet. I had transferred a bit of coin out of my pool to the game and it showed up, and for the sake of testing i found which account is mine and i did a "move" command from "" to "myaccount" and it did indeed update my available balance.. The weird thing is that the coin doesn't stay in the account, it immediately transfers to the main "" account, I'm guessing you designed it that way to pool the funds for betting. But it just won't allow bets, the buttons aren't clickable. No error messages, though. The only thing I see is it says Profit can't exceed max profit (0). Maybe I'm doing something wrong..Dunno! Any suggestions?

fedaykinofdune commented 10 years ago

Ok, quick update, on the site's page it's reflecting the balance I should have, but in the console it's showing a balance of 0.. I did a little testing with a seperate account, send a few coins to it, it showed the balance, but I tried to withdraw, using the address of my "main" site account and it wouldn't withdraw, so I check the console, it's reflecting zero balance for any account that logs in, and a listaccounts on the coin daemon shows every account as empty, but the main "" account.. So it's transferring all funds immediately out of user's accounts to the main account, surely that's why it's not allowing betting. I'm trying to learn node.js stuff but it's coming to me slowly, so I'm not much help with bug fixes. Surely it's not a hard fix though. I appreciate all your hard work on this, so close to being ready for full scale gaming!

Ruzihm commented 10 years ago

When you deposit money into your account, the server credits the user's account in the database and then moves the coins into the main account on the That part is intended, as you guessed, and the reason for that is because when a bet occurs or anything else that would cause a change in a user's balance, it's faster to do all of the account balance changes in the database than to use the JSON interface every time. Search "subsume" in the code to see where that bit is happening.

Now as for the reason maxbet is 0 is there have been 0 invested coins. In order to increase the max bet, you need to deposit money and then invest it.

Invested money grows when users lose bets and it decreases when users win bets. The invested money is where the winnings are taken from. If one user (you, for instance) is providing 100% of the house's total investments, then you gain 100% of the money lost on bets and you also are the one paying users 100% of their winnings. On the other hand, if you're only providing 5% you only win 5% of user's bet losses and pay only 5% of their winnings.

The more coins are invested, the larger the amount a user can win on a single bet. Starting out, there won't be a lot to win because the house's pool is small but as more users invest money, the potential for winnings will increase. Basically, investors share both the risk and the winnings of the site (minus the HOUSE_CUT)

Let me know if that makes it work!

fedaykinofdune commented 10 years ago

Oh god, well that makes a heck of a lot more sense! About to give it another shot. I'll just send the coins in the main account minus what's credited to my account back to myself and invest it, then see where we're at! Thanks!

On Sat, May 17, 2014 at 10:19 PM, Richard Van Tassel < notifications@github.com> wrote:

When you deposit money into your account, the server credits the user's account in the database and then moves the coins into the main account on the That part is intended, as you guessed, and the reason for that is because when a bet occurs or anything else that would cause a change in a user's balance, it's faster to do all of the account balance changes in the database than to use the JSON interface every time. Search "subsume" in the code to see where that bit is happening.

Now as for the reason maxbet is 0 is there have been 0 invested coins. In order to increase the max bet, you need to deposit money _and then_invest it.

Invested money grows when users lose bets and it decreases when users win bets. The invested money is where the winnings are taken from. If one user (you, for instance) is providing 100% of the house's total investments, then you gain 100% of the money lost on bets and you also are the one paying users 100% of their winnings. On the other hand, if you're only providing 5% you only win 5% of user's bet losses and pay only 5% of their winnings.

The more coins are invested, the larger the amount a user can win on a single bet. Starting out, there won't be a lot to win because the house's pool is small but as more users invest money, the potential for winnings will increase. Basically, investors share both the risk and the winnings of the site (minus the HOUSE_CUT)

Let me know if that makes it work!

— Reply to this email directly or view it on GitHubhttps://github.com/Ruzihm/coin-chance/issues/9#issuecomment-43430362 .

fedaykinofdune commented 10 years ago

It works! Thanks!!

On Sat, May 17, 2014 at 11:49 PM, Kerry Box fedaykinofdune@gmail.comwrote:

Oh god, well that makes a heck of a lot more sense! About to give it another shot. I'll just send the coins in the main account minus what's credited to my account back to myself and invest it, then see where we're at! Thanks!

On Sat, May 17, 2014 at 10:19 PM, Richard Van Tassel < notifications@github.com> wrote:

When you deposit money into your account, the server credits the user's account in the database and then moves the coins into the main account on the That part is intended, as you guessed, and the reason for that is because when a bet occurs or anything else that would cause a change in a user's balance, it's faster to do all of the account balance changes in the database than to use the JSON interface every time. Search "subsume" in the code to see where that bit is happening.

Now as for the reason maxbet is 0 is there have been 0 invested coins. In order to increase the max bet, you need to deposit money _and then_invest it.

Invested money grows when users lose bets and it decreases when users win bets. The invested money is where the winnings are taken from. If one user (you, for instance) is providing 100% of the house's total investments, then you gain 100% of the money lost on bets and you also are the one paying users 100% of their winnings. On the other hand, if you're only providing 5% you only win 5% of user's bet losses and pay only 5% of their winnings.

The more coins are invested, the larger the amount a user can win on a single bet. Starting out, there won't be a lot to win because the house's pool is small but as more users invest money, the potential for winnings will increase. Basically, investors share both the risk and the winnings of the site (minus the HOUSE_CUT)

Let me know if that makes it work!

— Reply to this email directly or view it on GitHubhttps://github.com/Ruzihm/coin-chance/issues/9#issuecomment-43430362 .

fedaykinofdune commented 10 years ago

After a user invested a large amount and then tried to divest, this happened:

/var/www/8chance/node_modules/bignumber.js/bignumber.js:443 throw error; ^ BigNumber Error: new BigNumber() number type has more than 15 significant digits: 243.9526080981127 at ifExceptionsThrow (/var/www/8chance/node_modules/bignumber.js/bignumber.js:440:21) at new BigNumber (/var/www/8chance/node_modules/bignumber.js/bignumber.js:250:13) at BigNumber (/var/www/8chance/node_modules/bignumber.js/bignumber.js:104:20) at Socket. (/var/www/8chance/src/routes/sock.js:248:28) at Socket.EventEmitter.emit as $emit at SocketNamespace.handlePacket (/var/www/8chance/node_modules/socket.io/lib/namespace.js:335:22) at Manager.onClientMessage (/var/www/8chance/node_modules/socket.io/lib/manager.js:488:38) at WebSocket.Transport.onMessage (/var/www/8chance/node_modules/socket.io/lib/transport.js:387:20) at Parser. (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10) at Parser.EventEmitter.emit (events.js:95:17) at finish (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:288:16) at Parser.expectHandler (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15) at Parser.add (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24) at Parser.expect (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10) at Parser. (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:298:18) at Parser.add (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24) at Parser.expect (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10) at expectData (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:296:16) at Parser.opcodeHandlers.1 (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:313:9) at Parser.processPacket (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:533:8) at Parser.add (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24) at Socket. (/var/www/8chance/node_modules/socket.io/lib/transports/websocket/hybi-16.js:141:17) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746:14) at Socket.EventEmitter.emit (events.js:92:17) at emitReadable (_stream_readable.js:408:10) at emitReadable (_stream_readable.js:404:5) at readableAddChunk (_stream_readable.js:165:9) at Socket.Readable.push (_stream_readable.js:127:10) at TCP.onread (net.js:528:21)

Ruzihm commented 10 years ago

Thanks for the bug report!

Fixed in 0.3.4

Ruzihm commented 10 years ago

I'm going to be out of town for the week. I'll be sure to tackle any questions or problems when I get back.

fedaykinofdune commented 10 years ago

Alright, thanks! I think everything is working like it's supposed to for now!

On Mon, May 19, 2014 at 2:58 AM, Richard Van Tassel < notifications@github.com> wrote:

I'm going to be out of town for the week. I'll be sure to tackle any questions or problems when I get back.

— Reply to this email directly or view it on GitHubhttps://github.com/Ruzihm/coin-chance/issues/9#issuecomment-43474913 .

fedaykinofdune commented 10 years ago

By chance if you haven't left yet, one quick question. How do I handle a user that's forgotten his password or didn't set one and lost access to his account? The user in question has made a large investment. I could just transfer the coins to him via daemon but I imagine that's going to screw up bookkeeping.

On Mon, May 19, 2014 at 3:30 AM, Kerry Box fedaykinofdune@gmail.com wrote:

Alright, thanks! I think everything is working like it's supposed to for now!

On Mon, May 19, 2014 at 2:58 AM, Richard Van Tassel < notifications@github.com> wrote:

I'm going to be out of town for the week. I'll be sure to tackle any questions or problems when I get back.

— Reply to this email directly or view it on GitHubhttps://github.com/Ruzihm/coin-chance/issues/9#issuecomment-43474913 .

Ruzihm commented 10 years ago

You would have to access the database. I'll try to respond with more detailed instructions later but if you run the mongo command on your server you will get a database console. If you can find his accountSecret you can give him a url to his account as "BASE_URL/accountSecret"

If you are already logged in, a link to that url is in your username. I'll be sure to put some indication of that when I get back!

I will also start on an admin console as well.

Ruzihm commented 10 years ago

I'm available again and now working on the admin panel

fedaykinofdune commented 10 years ago

Sweet! I am getting ready to launch another site as well, so I'll be keeping an eye peeled for the update! Thanks for all your hard work, I will be doing my best to spread the word!

Ruzihm commented 10 years ago

So after looking around I couldn't find an admin ui I could use for a quick fix. I'll work on it eventually but in the mean time I think smog (https://github.com/wearefractal/smog) will work for you in the meantime.