Post
Topic
Board Announcements (Altcoins)
Re: [ANN] [KMDICE] [dPoW] KMDice - First minable decentralized dice game.
by
siulynotb
on 02/12/2018, 13:36:43 UTC
For anyone interested in playing dice from command line in a automated way i share this script that will repeat a bet with the parameters specified when executed.

You will need to sync the KMDICE chain and start it using the -pubkey= parameter. Once the chain is synced you can create a file called ./dicebet give executable privilege and run it with the parameters ./dicebet amount odds

example:
Code:
$ ./dicebet 0.1 5


Code:
#!/bin/bash

while true; do
sleep 2
echo "KMDICE"

cd ~/komodo/src
getinfo=$(./komodo-cli -ac_name=KMDICE getinfo)
balance=$(echo $getinfo | jq -r '.balance')
echo 'Wallet balance:' $balance
entropy=$(./komodo-cli -ac_name=KMDICE diceinfo 5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f)
entropytx=$(echo $entropy | jq -r '.entropytxs')
echo 'Entropy txs available:' $entropytx
bet=$(./komodo-cli -ac_name=KMDICE dicebet KMDICE 5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f  $1 $2)
bet_hex=$(echo $bet | jq -r '.hex')
bet_txid=$(./komodo-cli -ac_name=KMDICE sendrawtransaction $bet_hex)
echo $bet_txid
echo $bet_txid >> ~/bets.txt
        echo "$bet_txid" > ~/bettxid.txt
echo "Waiting bet tx to confirm"
while true; do
bet_status=$(komodo-cli -ac_name=KMDICE dicestatus KMDICE 5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f $bet_txid)
betStatus_result=$(echo $bet_status | jq -r '.status')
betAmount_result=$(echo $bet_status | jq -r '.won')
if [[ ! $betStatus_result =~ "bet still pending" ]]; then
break
fi
sleep .5
done
if [ "$betAmount_result" != "null" ]; then echo $betAmount_result
fi
echo $betStatus_result
echo $betStatus_result >> ~/bets.txt
done


If someone is interested in knowing more, dont hesitate to ask.

A complete wallet plus dice game gui is in the works and we hope to have it available for public use on Q1 2019. Thanks for your attention and support.