Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: Come-from-Beyond on November 25, 2013, 06:01:20 PM



Title: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 06:01:20 PM
1st Nxt Slot Machine

How it works:

1. Send from 10 to 1000 NXT to [DELETED]
2. Wait for 1 confirmation
3. Look at the last 3 digits of the block id that confirmed the bet
http://s16.postimg.org/jliiegtfp/luckynumber.png
4. If 2 of these digits are the same then you get 3x amount back. If all 3 digits are the same then you get 10x! If you lose you'll get 1 NXT.

Winnings are paid from [DELETED] every 2 minutes.

House can run out of money, so before making a bet check that http://88.198.210.245:7876/?request=getBalance&account=3994117300242888518 shows at least "1000000" in "unconfirmedBalance"!

DISABLED


Title: Re: 1st Nxt Slot Machine!
Post by: kylie.v on November 25, 2013, 06:20:16 PM
Tried it oute

Sent about 12 transactions ..no luck :/


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 06:21:09 PM
Tried it oute

Sent about 12 transactions ..no luck :/

As the 1st player u get all ur coins back. I'll send them in a min.


Title: Re: 1st Nxt Slot Machine!
Post by: kylie.v on November 25, 2013, 06:25:29 PM
Thank you :) still willing to test my luck


Title: Re: 1st Nxt Slot Machine!
Post by: klee on November 25, 2013, 06:35:42 PM
Nice to have something to gamble with Nxt!
 I wil try it  ;D


Title: Re: 1st Nxt Slot Machine!
Post by: eid on November 25, 2013, 06:46:37 PM




House can run out of money......


ROFL, good one.  :D


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 08:00:08 PM
but i am facing the same problem here, you can't put workload on this, as soon you do, the client freeze.

What do u mean "the same"? I see nothing about API problems in this thread. Check that u work with 0.2.7 version.


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 08:34:35 PM
same in context to freeze. don't know how often i restarted a freezed client the last 24h.

test it yourself, traverse (getBlock) from genesis block (2680262203532249785) up to the current one on your local machine and see what happen.
just one connection with 1.000 repetitive request and your node is gone. this workload is normally nothing and every node should handle this easily.

My gambling service doesn't store any data. Every 2 minutes it scans the whole blockchain and sends winnings. It even sets deadline to 1 minute, so usualy it take several times to send a transaction, coz it expires before confirmation. Make sure u use the recent version which is 0.2.9 (https://dl.dropboxusercontent.com/u/67242472/Nxt.zip).


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 08:46:04 PM
For those who may be interested here is the source code of my Slot Machine:

Code:
// (c) 2013 Come-from-Beyond

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;

public final class Tri {

public static void main(String[] args) {

while (true) {

System.out.println("Time = " + System.currentTimeMillis());

try {

Thread.sleep(120000);

} catch (final Exception e) {

return;

}

try {

final ArrayList<Bet> bets = new ArrayList<>();
final HashSet<String> payments = new HashSet<>();

String block = "2680262203532249785"; // This is the genesis block id

while (true) {

String blockData = sendRequest("getBlock&block=" + block);

int i = blockData.indexOf("\"transactions\":[");
String transactions = blockData.substring(i + 16, blockData.indexOf("]", i));
while (transactions.length() > 0) {

final String transaction = transactions.substring(1, transactions.indexOf("\"", 1));
final String transactionData = sendRequest("getTransaction&transaction=" + transaction);

// Beginning of the game logic
i = transactionData.indexOf("\"sender\":\"");
final String sender = transactionData.substring(i + 10, transactionData.indexOf("\"", i + 10));
i = transactionData.indexOf("\"recipient\":\"");
final String recipient = transactionData.substring(i + 13, transactionData.indexOf("\"", i + 13));

if (recipient.equals("4427320429393039971")) {

i = transactionData.indexOf("\"amount\":");
final int amount = Integer.parseInt(transactionData.substring(i + 9, transactionData.indexOf(",", i + 9)));

if (amount >= 10 && amount <= 1000) {

bets.add(new Bet(block, transaction, amount, sender));

}

} else if (sender.equals("3994117300242888518")) {

i = transactionData.indexOf("\"referencedTransaction\":\"");
final String referencedTransaction = transactionData.substring(i + 25, transactionData.indexOf("\"", i + 25));
payments.add(referencedTransaction);

}
// End of the game logic

if (transaction.length() + 3 > transactions.length()) {

break;

}
transactions = transactions.substring(transaction.length() + 3);

}

i = blockData.indexOf("\"nextBlock\":\"");
if (i < 0) {

break;

}
block = blockData.substring(i + 13, blockData.indexOf("\"", i + 13));

}

// Beginning of the game logic
for (final Bet bet : bets) {

if (!payments.contains(bet.transaction)) {

final String request = "sendMoney&secretPhrase=REMOVED&recipient=" + bet.sender + "&amount=" + getAmount(bet) + "&fee=1&deadline=1&referencedTransaction=" + bet.transaction;
System.out.println(request);
System.out.println(sendRequest(request));

}

}
// End of the game logic

} catch (final Exception e) {

System.out.println(e.toString());

}

}

}

public static int getAmount(final Bet bet) {

final String digits = bet.block.substring(bet.block.length() - 3);
final int digit0 = Integer.parseInt("" + digits.charAt(0));
final int digit1 = Integer.parseInt("" + digits.charAt(1));
final int digit2 = Integer.parseInt("" + digits.charAt(2));

if (digit0 == digit1 && digit0 == digit2) {

return bet.amount * 10;

}

if (digit0 == digit1 || digit0 == digit2 || digit1 == digit2) {

return bet.amount * 3;

}

return 1;

}

public static String sendRequest(final String request) throws Exception {

final HttpURLConnection connection = (HttpURLConnection)(new URL("http://localhost:7876/?request=" + request)).openConnection();
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final String response = reader.readLine();
reader.close();
connection.disconnect();

return response;

}

public static final class Bet {

final String block;
final String transaction;
final int amount;
final String sender;

public Bet(final String block, final String transaction, final int amount, final String sender) {

this.block = block;
this.transaction = transaction;
this.amount = amount;
this.sender = sender;

}

}

}

It uses only Nxt blockchain, no need to store anything locally.

Pay attention that it uses "referencedTransaction". If a betting transaction cancelled due to blockchain reorganization, then the transaction that pays winning will be cancelled as well.


Title: Re: 1st Nxt Slot Machine!
Post by: nexern on November 25, 2013, 09:08:02 PM
thanks for sharing.

looks like i am to many hours in front of my computer. my previous post was for the nxt main thread, not for your game thread.
have to reduce my browser-tabs.

from your source (i am not a java coder) i can see you are parsing the blockchain file directly?
are there any specs about the internal storage format?


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 09:09:42 PM
thanks for sharing.

looks like i am to many hours in front of my computer. my previous post was for the nxt main thread, not for your game thread.
have to reduce my browser-tabs.

from your source (i am not a java coder) i can see you are parsing the blockchain file directly?
are there any specs about the internal storage format?

No, I don't parse the file. I use HTTP API and get JSON data back. Then I just parse JSON by myself, without a JSON library.


Title: Re: 1st Nxt Slot Machine!
Post by: nexern on November 25, 2013, 09:17:23 PM
ok, thanks, will update to 0.2.9 and test again.


Title: Re: 1st Nxt Slot Machine!
Post by: bahamapascal on November 25, 2013, 09:51:48 PM
Hmmm, send 12 nxt, but did not even get one singel nxt back


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 09:58:41 PM
Hmmm, send 12 nxt, but did not even get one singel nxt back

Ur bet lost, my script is trying to send 1 NXT but it's connected only to a few nodes and mining nodes don't see it. This is a great possibility to investigate what happens, so I don't restart the client. Eventually u'll get this coin anyway.


Title: Re: 1st Nxt Slot Machine!
Post by: bahamapascal on November 25, 2013, 10:15:09 PM
Hmmm, send 12 nxt, but did not even get one singel nxt back

Ur bet lost, my script is trying to send 1 NXT but it's connected only to a few nodes and mining nodes don't see it. This is a great possibility to investigate what happens, so I don't restart the client. Eventually u'll get this coin anyway.

OK, cool....I donīt worry about the loss, just wantet to let you know ;)


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 25, 2013, 10:44:15 PM
I will leave the script working for the night. If it crashes I'll launch it next morning and u'll get ur winnings. U can easily check if u won by looking at the last 3 digits of the block id.


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 11:23:39 AM
well atleast the 1 coin comes back if you lose.


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 11:31:20 AM
and, i lost many.
BUT
then i sent a 10, it had a 99 in there, and it paid me 30.

So the scrypt works.
But I am not quite sure about the chances of winning.


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 11:39:43 AM
and, i lost many.
BUT
then i sent a 10, it had a 99 in there, and it paid me 30.

So the scrypt works.
But I am not quite sure about the chances of winning.

Chance is 28% (27% for 3x and 1% for 10x)


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 11:42:09 AM
Lose 410... to win 30  hehe  gambling sure sucks!


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 11:43:42 AM
Lose 410... to win 30  hehe  gambling sure sucks!

Agree. But this helps to test how Nxt network works.


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 11:50:50 AM
Ok, did it again ... this time it was Block  2390!


hmmmm but no payout yet...


Title: Re: 1st Nxt Slot Machine!
Post by: klee on November 27, 2013, 12:07:26 PM
I just send 9nxt to test it - I got 3 confirmations but I can't find the block!


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 12:10:48 PM
I just send 9nxt to test it - I got 3 confirmations but I can't find the block!

U won't get anything anyway.

1. Send from 10 to 1000 NXT to 4427320429393039971


Title: Re: 1st Nxt Slot Machine!
Post by: klee on November 27, 2013, 12:11:41 PM
I just send 9nxt to test it - I got 3 confirmations but I can't find the block!

U won't get anything anyway.

1. Send from 10 to 1000 NXT to 4427320429393039971
Damn! lol

But where is the block anyway?


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 12:17:23 PM
Use http://87.230.14.1/nxt/nxt.cgi?action=1 to find ur transaction


Title: Re: 1st Nxt Slot Machine!
Post by: klee on November 27, 2013, 12:25:12 PM
Send 10 more and lost  :P


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 12:26:04 PM
Ok, did it again ... this time it was Block  2390!


hmmmm but no payout yet...

Sometimes it shows that the payment is being sent, and then it disappears.
is this because of the expiration time?


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 12:35:17 PM
Ok, did it again ... this time it was Block  2390!


hmmmm but no payout yet...

Sometimes it shows that the payment is being sent, and then it disappears.
is this because of the expiration time?

Yes, and the scipt can't send all payments at once. I see 300 NTX and 240 NXT pending.


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 12:38:46 PM
ok so I am winning some.
But none of them are paying out.
It looks like it trys, but if it does not complete within 1 minute  (which most dont)... then it does not send.

[But it seems to always be able to send the 1NXT  losing refund]

Block;   Bet Amount
2424     160
2416     80
2390     100


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 12:43:12 PM
ok so I am winning some.
But none of them are paying out.
It looks like it trys, but if it does not complete within 1 minute  (which most dont)... then it does not send.

[But it seems to always be able to send the 1NXT  losing refund]

Block;   Bet Amount
2424     160
2416     80
2390     100

It's just coincidence that it sends only 1 NXT. One of the winning payments already confirmed. Be patient plz, Nxt API seems to be working unstable.


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 12:55:45 PM
@ the guy who is martingaling right now:

Don't forget that only bets in the range from 10 to 1000 NXT are accepted!


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 12:59:49 PM
I am happy to be patient.

I am just trying to keep it busy. Help to find flaws etc.


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 01:11:39 PM
My Bet of 320 was in Block  2445...
Block 2446 = 777........  NOOOOO  (created only 4 seconds apart)

haha


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 01:13:33 PM
My Bet of 320 was in Block  2445...
Block 2446 = 777........  NOOOOO  (created only 4 seconds apart)

haha

Wow! U almost caught the luck!


Title: Re: 1st Nxt Slot Machine!
Post by: dr_yan_yan on November 27, 2013, 01:16:41 PM
its ok.
Block 2449... Bet = 999    ;D

( i was scared to actually bet 1000, just in case it needs to be LOWER than that figure)


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 27, 2013, 01:17:46 PM
its ok.
Block 2449... Bet = 999    ;D

( i was scared to actually bet 1000, just in case it needs to be LOWER than that figure)

1000 is allowed. But if u bet 1000 the block id would be different.

Edit: U won last bet in that martingale row, congrats! Don't forget to check I have enough money to pay (http://88.198.210.245:7876/?request=getBalance&account=3994117300242888518) before betting.


Title: Re: 1st Nxt Slot Machine!
Post by: inkadnb on November 28, 2013, 11:37:46 AM
Hmmm, send 12 nxt, but did not even get one singel nxt back

Ur bet lost, my script is trying to send 1 NXT but it's connected only to a few nodes and mining nodes don't see it. This is a great possibility to investigate what happens, so I don't restart the client. Eventually u'll get this coin anyway.

How do you know what is a "mining" node?


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 28, 2013, 11:41:44 AM
How do you know what is a "mining" node?

Any node with an unlocked account is a mining node.


Title: Re: 1st Nxt Slot Machine!
Post by: inkadnb on November 28, 2013, 12:18:59 PM
http://87.230.14.1/nxt/nxt.cgi?action=2000&tra=2291158848699347223

never got my 1 NXT back.


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on November 28, 2013, 12:29:06 PM
http://87.230.14.1/nxt/nxt.cgi?action=2000&tra=2291158848699347223

never got my 1 NXT back.

Sorry. The script crashes quite often, I've restarted it.


Title: Re: 1st Nxt Slot Machine!
Post by: Drexme on December 02, 2013, 05:08:45 PM
Is this up?


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on December 02, 2013, 05:18:22 PM
Is this up?

Now it's up. Hm, API disabled. It's down.

In a couple of days API should be enabled and all coins paid.


Title: Re: 1st Nxt Slot Machine!
Post by: Drexme on December 05, 2013, 06:31:39 AM
Is this up?

Now it's up. Hm, API disabled. It's down.

In a couple of days API should be enabled and all coins paid.
I sent 100 nxt 2 days ago. I haven't gotten any form of compensation
here is the transaction: http://87.230.14.1/nxt/nxt.cgi?action=2000&tra=3469769040151476974

Edited wrong link


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on December 05, 2013, 07:12:25 AM
Is this up?

Now it's up. Hm, API disabled. It's down.

In a couple of days API should be enabled and all coins paid.
I sent 100 nxt 2 days ago. I haven't gotten any form of compensation
here is the transaction: http://87.230.14.1/nxt/nxt.cgi?action=2000&tra=3469769040151476974

Edited wrong link

Sorry. API request to send money is disabled yet. Today I'm going to fix it and launch my payment script. I can't do it manually, coz interface doesn't allow to set referenced transaction. U'll get ur coins soon.


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on December 05, 2013, 08:50:08 AM
I launched the script. Please, let me know if u don't get all the payments within next 60 minutes.


Title: Re: 1st Nxt Slot Machine!
Post by: Drexme on December 05, 2013, 09:03:24 AM
I launched the script. Please, let me know if u don't get all the payments within next 60 minutes.
Recieved payment


Title: Re: 1st Nxt Slot Machine!
Post by: slavo on December 05, 2013, 09:12:29 PM
http://img11.hostingpics.net/pics/437849slotmachine.jpg (http://www.hostingpics.net/viewer.php?id=437849slotmachine.jpg)

Is this normal ? I understand shit sorry  ::)


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on December 05, 2013, 09:15:49 PM
Is this normal ? I understand shit sorry  ::)

I see big amounts sent to the slot machine. Re-read the OP again plz.


Title: Re: 1st Nxt Slot Machine!
Post by: slavo on December 05, 2013, 09:23:11 PM
Oh fuck, sorry  ;D


Title: Re: 1st Nxt Slot Machine!
Post by: slavo on December 06, 2013, 04:32:18 PM
So do I lose my coins ?  ;D


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on December 06, 2013, 05:53:20 PM
So do I lose my coins ?  ;D

If u sent amounts < 10 and > 1000 then yes. I would pay them back, but I don't want to create a precedent, sorry.


Title: Re: 1st Nxt Slot Machine!
Post by: slavo on December 06, 2013, 09:50:38 PM
i sent 7000+2500+6000+12500+25000+12500  :-*

i had a bug with the client, saying money sent but not showing transactions when i did this. I have desinstalled and reinstalled everything and it shows the transaction that's why.

This, and I am quite stoopid too so don't worry.


Title: Re: 1st Nxt Slot Machine!
Post by: Come-from-Beyond on December 06, 2013, 10:01:59 PM
i sent 7000+2500+6000+12500+25000+12500  :-*

i had a bug with the client, saying money sent but not showing transactions when i did this. I have desinstalled and reinstalled everything and it shows the transaction that's why.

This, and I am quite stoopid too so don't worry.

Ah, if that was a bug then I'll send u ur money back. A few mins plz, I'll prepare the transaction.

Edit: http://localhost:7874/nxt?requestType=getTransaction&transaction=10795958397222091185


Title: Re: 1st Nxt Slot Machine!
Post by: slavo on December 06, 2013, 10:07:16 PM
Thanks a lot.

Nxt is doing great.

U should maybe delete the adress in the op. Noobs can be tempted to not read that it's disabled and send more coins.

Cheers