Bitcoin Forum
April 28, 2024, 12:23:07 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they believe that the creator of this topic displays some red flags which make them high-risk. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1] 2 3 »  All
  Print  
Author Topic: 1st Nxt Slot Machine!  (Read 4939 times)
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 06:01:20 PM
Last edit: December 06, 2013, 10:08:38 PM by Come-from-Beyond
 #1

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

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
In order to achieve higher forum ranks, you need both activity points and merit points.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714306987
Hero Member
*
Offline Offline

Posts: 1714306987

View Profile Personal Message (Offline)

Ignore
1714306987
Reply with quote  #2

1714306987
Report to moderator
1714306987
Hero Member
*
Offline Offline

Posts: 1714306987

View Profile Personal Message (Offline)

Ignore
1714306987
Reply with quote  #2

1714306987
Report to moderator
1714306987
Hero Member
*
Offline Offline

Posts: 1714306987

View Profile Personal Message (Offline)

Ignore
1714306987
Reply with quote  #2

1714306987
Report to moderator
kylie.v
Sr. Member
****
Offline Offline

Activity: 400
Merit: 250



View Profile
November 25, 2013, 06:20:16 PM
 #2

Tried it oute

Sent about 12 transactions ..no luck :/

█    █     ██    ███     ███    ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████     ███     ███    ██     █    █
. BREAKOUT STAKE.
  M U L T I C U R R E N C Y   S M A R T   C O N T R A C T S   +   S I D E C H A I N S
  A N N     |     W E B S I T E     |     T W I T T E R     |     G I T H U B    ★  C O I N S A L E   J U L Y  10  –  J U L Y  24  ★ 
.
█    █     ██    ███     ███    ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████     ███     ███    ██     █    █
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 06:21:09 PM
 #3

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.
kylie.v
Sr. Member
****
Offline Offline

Activity: 400
Merit: 250



View Profile
November 25, 2013, 06:25:29 PM
 #4

Thank you Smiley still willing to test my luck

█    █     ██    ███     ███    ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████     ███     ███    ██     █    █
. BREAKOUT STAKE.
  M U L T I C U R R E N C Y   S M A R T   C O N T R A C T S   +   S I D E C H A I N S
  A N N     |     W E B S I T E     |     T W I T T E R     |     G I T H U B    ★  C O I N S A L E   J U L Y  10  –  J U L Y  24  ★ 
.
█    █     ██    ███     ███    ████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████     ███     ███    ██     █    █
klee
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000



View Profile
November 25, 2013, 06:35:42 PM
 #5

Nice to have something to gamble with Nxt!
 I wil try it  Grin
eid
Hero Member
*****
Offline Offline

Activity: 616
Merit: 500


View Profile
November 25, 2013, 06:46:37 PM
 #6





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


ROFL, good one.  Cheesy
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 08:00:08 PM
 #7

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.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 08:34:35 PM
 #8

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).
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 08:46:04 PM
 #9

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.
nexern
Hero Member
*****
Offline Offline

Activity: 597
Merit: 500



View Profile
November 25, 2013, 09:08:02 PM
 #10

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?
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 09:09:42 PM
 #11

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.
nexern
Hero Member
*****
Offline Offline

Activity: 597
Merit: 500



View Profile
November 25, 2013, 09:17:23 PM
 #12

ok, thanks, will update to 0.2.9 and test again.
bahamapascal
Hero Member
*****
Offline Offline

Activity: 695
Merit: 500



View Profile
November 25, 2013, 09:51:48 PM
 #13

Hmmm, send 12 nxt, but did not even get one singel nxt back
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 09:58:41 PM
 #14

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.
bahamapascal
Hero Member
*****
Offline Offline

Activity: 695
Merit: 500



View Profile
November 25, 2013, 10:15:09 PM
 #15

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 Wink
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 25, 2013, 10:44:15 PM
 #16

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.
dr_yan_yan
Member
**
Offline Offline

Activity: 98
Merit: 10


View Profile
November 27, 2013, 11:23:39 AM
 #17

well atleast the 1 coin comes back if you lose.
dr_yan_yan
Member
**
Offline Offline

Activity: 98
Merit: 10


View Profile
November 27, 2013, 11:31:20 AM
 #18

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.
Come-from-Beyond (OP)
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
November 27, 2013, 11:39:43 AM
 #19

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)
dr_yan_yan
Member
**
Offline Offline

Activity: 98
Merit: 10


View Profile
November 27, 2013, 11:42:09 AM
 #20

Lose 410... to win 30  hehe  gambling sure sucks!
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!