Welcome to KMDICE docs’s documentation!

Here we will show how to get KMDICE installed and ready to be played.

Installing KMDICE on Ubuntu/Debian

Requirements

Currently, you will need:

  • Linux (easiest with a Debian-based distribution)
  • 64-bit
  • 4GB of free memory

Get Started

Log in as the user to your system, and issue these commands to make sure your Linux machine is up to date.

sudo apt-get update
sudo apt-get upgrade  (and say Y when it wants to upgrade stuff)

Install the dependency packages:

sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate vim software-properties-common curl libcurl4-gnutls-dev cmake clang`

Installing Komodo

cd ~
git clone https://github.com/jl777/komodo
cd komodo
git checkout jl777
./zcutil/fetch-params.sh -j8``  uses 8 threads - replace 8 with number of threads you want to use or `nproc` variable
./zcutil/build.sh -j$(nproc)

This can take some time.

Now you can start KMDICE daemon to sync with the network

cd ~
cd komodo
./src/komodod -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 &

You might see some outputs in terminal where you started KMDICE daemon.

Activating CC in KMDICE

To play KMDICE you need to run the daemon with the -pubkey= parameter.

First, you need to get a new address

./komodo-cli -ac_name=KMDICE getnewaddress

Second you need to validate the address to get the pubkey

./komodo-cli -ac_name=KMDICE validateaddress <ADDRESS>

And lastly, after you copy the pubkey from the output of validateaddress you can now stop the daemon and restart it with the `-pubkey=` parameter.

./komodo-cli -ac_name=KMDICE stop
./src/komodod -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -pubkey=<YOUR PUBKEY> &

Now you will be able to play the game using dicebet.

Installing KMDICE on OSX

Requirements

Packages are installed through homebrew, make sure to install it:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now install the dependency packages:

brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake
brew install gcc@6
brew install binutils
brew install protobuf
brew install coreutils
brew install wget
brew install nanomsg

or

brew tap discoteq/discoteq; brew install flock autoconf autogen automake gcc6 binutils protobuf coreutils wget nanomsg

Clone the Komodo repository

git clone https://github.com/KomodoPlatform/komodo

Get the proving keys:

cd komodo
./zcutil/fetch-params.sh

And now build Komodo

git checkout dev
./zcutil/build-mac.sh

Run Komodo

If the build went well, run KMDICE:

cd ~/komodo/src
./komodod -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 &

Get PUBKEY to use Crypto Conditions Dice Game:

./komodo-cli -ac_name=KMDICE getnewaddress

This command should print a new KMDICE address, copy that address and validate it:

./komodo-cli -ac_name=KMDICE validateaddress <ADDRESS>

In the output of validateaddress you will see a field that says pubkey. You need to copy that pubkey and use it to run the daemon with it:

./komodo-cli -ac_name=KMDICE stop

Now restart the daemon using the -pubkey parameter:

./komodod -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -pubkey=<YOUR PUBKEY>

That is all, you should now be able to play dice game.

Installing KMDICE on Windows 64-bit systems

PLEASE FOLLOW THE VIDEO TUTORIAL: https://youtu.be/gfZZy8b222E

  1. First download komodo windows binaries and place the files in a new folder on the Desktop called kmd (‘C:\Users\YourUserName\Desktop\kmd’) .

Open a Command Prompt for the following steps.

  1. Next we’ll create the Komodo directory in the AppData directory.
mkdir "%HOMEPATH%\AppData\Roaming\komodo"
  1. Next we will create our komodo.conf file.
notepad “%HOMEPATH%\AppData\Roaming\Komodo\komodo.conf”

When Notepad opens, click Yes to create the komodo.conf file. Copy the information below and paste it into Notepad.

rpcuser=yourRpcUserName
rpcpassword=yourSecurePassword
daemon=1
rpcallowip=127.0.0.1
rpcbind=127.0.0.1
server=1
listen=1
addnode=5.9.102.210
addnode=78.47.196.146
addnode=178.63.69.164
addnode=88.198.65.74
addnode=5.9.122.241
addnode=144.76.94.38
txindex=1
maxconnections=1

After pasting, save and exit Notepad.

4. So now that you have created your komodo.conf file you are ready to download the zk-snark proving key and verifying key. While the keys are downloading let’s paste following command to create the directory for ZcashParams:

mkdir “%HOMEPATH%\AppData\Roaming\ZcashParams”

Once the keys have finished downloading, we’ll paste this command to move the keys to our newly created ZcashParams directory:

move “%HOMEPATH%\Downloads\sprout-proving.key” “%HOMEPATH%\AppData\Roaming\ZcashParams” && move “%HOMEPATH%\Downloads\sprout-verifying.key” “%HOMEPATH%\AppData\Roaming\ZcashParams”
  1. Now we can run KMDICE
"%HOMEPATH%\Desktop\kmd\komodod.exe -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 &"
  1. Komodod should start syncing. You can check progress by running
"%HOMEPATH%\Desktop\kmd\komodo-cli.exe" -ac_name=KMDICE getinfo
  1. To activate CC and be able to play KMDICE you need to get a newaddress
"%HOMEPATH%\Desktop\kmd\komodo-cli.exe" -ac_name=KMDICE getnewaddress
  1. Validate the new address with validateaddress:
"%HOMEPATH%\Desktop\kmd\komodo-cli.exe" -ac_name=KMDICE validateaddress <ADDRESS>

Copy the pubkey in the validateaddress output and then stop kmdice daemon

To stop komodod, run:
"%HOMEPATH%\Desktop\kmd\komodo-cli.exe" -ac_name=KMDICE stop
  1. Restart KMDICE daemon with -pubkey parameter:
%HOMEPATH%\Desktop\kmd\komodod.exe -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -pubkey=<YOURPUBKEY> &

Downloads:

  1. Windows Binaries: https://artifacts.supernet.org/latest/windows
  2. Zk-snark proving keys: https://z.cash/downloads/sprout-proving.key
  3. Verifying keys: https://z.cash/downloads/sprout-verifying.key

Install KMDICE using Agama Native Wallet

First step to get KMDICE running natively in Agama is to download latest Agama release:

Download Agama Wallet

After downloading Agama for your preferred OS, run it and select Activate Coin:

Agama-login

On the dialog box that pups up, start typing KMDICE and then select the Native Mode option, then press Activate Coin:

Agama-select-coin

Once the chain syncs completely you can jump to Receive screen in the wallet and look for the address that has KMDICE (if you dont, then deposit some KMDICE to an address) and then select copy pubkey:

Agama-copy-pubkey

Then in the upper right corner of the screen select to go to Settings:

Agama-settings

In settings, expand the App Config (config.json) section:

agama-config

Scroll down to the end of the App Config section and paste the pubkey you copied before into the Pubkey setting’s box, then press validate pubkey, then press save app config:

agama-config-pubkey

After this step you can now restart the app. When logging in again please select the option to use pubkey:

agama-use-pubkey

And that is all, now you will able to play KMDICE from any KMDICE GUI available.

How to start KMDICE chain and bet using CLI?

Requirements:

  1. Latest KMDICE install in dev branch
  2. Funds

Funds

There are 3 ways you can get KMDICE coins now.

  1. Mine KMDICE
  2. Atomic Swap using BarterDEX
  3. OTC trades in Komodo Discord

Get pubkey value

We need to get pubkey value for the smartaddress you are going to use the KMDICE wallet with. pubkey is needed for CC use. If you already know the pubkey of the address you are going to use, please skip to the [next section](start-kmdice-with-pubkey).

Step 1

Start the chain with the following command and wait for the daemon to sync.

./komodod -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 &

Step 2

Get a new address

./komodo-cli -ac_name=KMDICE getnewaddress

Step 3

use validateaddress command with the address you got to get the pubkey displayed

./komodo-cli -ac_name=KMDICE validateaddress RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92

This will display the following info from where you get the pubkey.

{
"isvalid": true,
"address": "RPCeZmqW4Aam52DFLmMraWtu5CuXPxqk92",
"scriptPubKey": "76a91498b5caa42ffe9868844c51ba6e085e5e7e92fc2588ac",
"segid": 13,
"ismine": true,
"iswatchonly": false,
"isscript": false,
"pubkey": "02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2",
"iscompressed": true,
"account": ""
}

Step 4

Stop the KMDICE chain with the following command. (Make sure to use this command every time you want to stop the chain. Otherwise, you risk corrupting database and have to rescan the blockchain again.)

./komodo-cli -ac_name=KMDICE stop

Start KMDICE with pubkey to Use Dice Game

Use the following command to start KMDICE with pubkey for address you are going to use. If you don’t have a pubkey, please follow the earlier steps.

./komodod -ac_name=KMDICE -pubkey=02f183a71e93dfa7672ce7212187e45eabcf4077fed575348504b20295751ab1a2 -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 &

How to bet?

Find the Diceplan you want to use.

./komodo-cli -ac_name=KMDICE dicelist

This will return you the following:

[
"5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f"
]

Get info for the diceplan

./komodo-cli -ac_name=KMDICE diceinfo 5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f

This will return the following:

{
"result": "success",
"fundingtxid": "5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f",
"name": "KMDICE",
"sbits": 76155294338379,
"minbet": "0.00100000",
"maxbet": "1000.00000000",
"maxodds": 1500,
"timeoutblocks": 600,
"funding": "10469598.73974446"
}

Now, you have all info needed to place bet. Make sure that you have KMDICE funds too.

Place a Bet

This is a 2 step process using CLI. First you need to use the dicebet command with required info. That will create a raw transaction HEX value which we need to brodcast to the network using sendrawtransaction API. This is the example command dicebet name fundingtxid amount odds

./komodo-cli -ac_name=KMDICE dicebet KMDICE 5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f 10 1

Output:

{
"result": "success",
"hex": "010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000"
}

Now we need to brodcast this transaction using the following command:

./komodo-cli -ac_name=KMDICE sendrawtransaction 010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000

This will output bettxid


694c309c86a928fde1919a86381f61670479c3ede85ea0574d08636cc406e798

Check your balance for the changes to reflect after the tx confirms.

Check Bet Status

You can check your bet status (win or loss) using the following command. Usage: dicestatus name fundingtxid bettxid

./komodo-cli -ac_name=KMDICE dicestatus KMDICE 5be49570c56d036abb08b6d084da93a8a86f58fc48db4a1086be95540d752d6f 694c309c86a928fde1919a86381f61670479c3ede85ea0574d08636cc406e798