Dice
The Dice Antara Module allows for a decentralized dice
game on a blockchain. The dice
module is essentially a simple, but fully functional example of decentralized software.
It is also useful as a demonstration to show how Antara-based modules can leverage provably random entropy to enable blockchain-enforced real-time gameplay.
The Dice Module is a simple gambling game, where one node creates a "house" contract, with seed funds and other parameters, and other users place bets within the indicated parameters. Winners and losers are determined through blockchain technology. This technology includes on-chain, consensus based, provably random entropy that derives from the activity of both the "house" and the users.
The "house" node should be running the dicestatus method at a regular frequency. This method resolves unfinished bets and generates new entropy utxos for the "house" contract.
To create a "house" contract, use dicefund to initiate the contract, and then add several utxos to the fund with diceaddfunds.
Once the contract is created and funded, users can place a bet using dicebet.
Anyone can execute a dicefinish RPC after the contract's time expires. This prevents the "house" node from cheating by going offline.
diceaddfunds name fundingtxid amount
The diceaddfunds
method adds funds to the desired dice
contract.
Only the owner of the dice
contract is able to add funds.
The method returns a hex value which must then be broadcast using the sendrawtransaction method.
Name | Type | Description |
---|---|---|
name | (string) | the name of the user's dice contract |
fundingtxid | (string) | the txid of the transaction that created and funded this contract |
amount | (number) | the amount of funds you want to add to your contract from your wallet |
Name | Type | Description |
---|---|---|
result: | (string) | whether the command succeeded |
hex: | (string) | a raw transaction in hex-encoded format; you must broadcast this transaction to complete the command |
Step 1: Create a raw transaction hex value for adding funds
./komodo-cli -ac_name=HELLOWORLD diceaddfunds MYDICECONTRACT ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7 10
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"diceaddfunds", "params":["MYDICECONTRACT" ,"ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7" ,"10"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Step 2: Send the raw transaction / broadcast the hex value
./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Step 3: Decode the raw transaction (optional to check if the values are sane)
./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["0100000001646b59153d05ed0cb2b241dbbc42cd86df446ea43db8a66c68fdc2462e1bc6850000000049483045022100bdbf75970d7f708c4a5637d703b0a055e65a2eab0e71f6435604281d5981143d022008942029da09aa09bd0c9358b8169528e596968150e85d15c143c6961bf2b39501ffffffff0400ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1027000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacf0aed71218090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6454b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffcebd22d4e75f4939198938b49036f71c3a0e00d20ca05237147aaed0d85cd50ff29000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
diceaddress (pubkey)
The diceaddress
method takes either your pubkey or a pubkey that you provide and returns the smart-contract address for the dice
smart contract.
Name | Type | Description |
---|---|---|
pubkey | (string, optional) | the pubkey of the requested info; by default it is the pubkey used to launch the chain |
Name | Type | Description |
---|---|---|
result | (string) | whether the diceaddress method was successful |
DiceCCaddress | (string) | taking the dice contract's EVAL code as a modifier, this is the public address that corresponds to the dice contract's privkey |
Dicemarker | (string) | the unmodified public address generated from the dice contract's privkey |
DiceCCassets | (string) | the internal address; this value is not related to the usage of the Dice Antara module |
GatewaysPubkey | (string) | the global pubkey for this Gateways Antara module |
myCCaddress | (string) | taking the dice contract's EVAL code as a modifier, this is the Antara address from the pubkey of the user |
myaddress | (string) | the public address of the pubkey used to launch the chain |
For the non-default pubkey.
./komodo-cli -ac_name=HELLOWORLD diceaddress 03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"diceaddress", "params":["03fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abc"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
dicebet name fundingtxid amount odds
The dicebet
method places a bet on the indicated dice
contract.
The method returns a hex value which must then be broadcast using the sendrawtransaction method.
Name | Type | Description |
---|---|---|
name | (string) | the name of the dice contract for which the user desires to place a bet |
fundingtxid | (string) | the txid of the transaction that created and funded this contract |
amount | (number) | the amount the user desires to place as a bet |
odds | (number) | specify the user's odds |
Name | Type | Description |
---|---|---|
"result" | (string) | whether the dicebet command executed successfully |
"hex" | (string) | the data of the user's transaction, in a raw hex-encoded format; broadcast this using sendrawtransaction |
Step 1: Set your parameters to create a raw transaction and get the hex value
./komodo-cli -ac_name=HELLOWORLD dicebet KMDDice ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7 7 7
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicebet", "params":["KMDDice" ,"ebfcff20fa5ab7bebf14b778e74bd6b34b02f100ff75e4cb611190f160ae4cf7" ,"7" ,"7"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Step 2: Send/broadcast the raw transaction hex
./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Step 3: Decode raw transaction (optional to check if the values are sane)
./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000378c9b0720ac4ffda232bd8ebc1ebf10d78efe23daf59ad887439baf72a3ffd03000000007b4c79a276a072a26ba067a5658021039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94e8140fe35ae062eb8239b1eec5407c71e27531f281dc369b55c3d3c235a87f6c10b3d4e7a029a6420e4fa076bd1d3da013287a17973fb6684bc487335ce176e7488d3a100af038001e6a10001ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0200000049483045022100f934f292e5ef9b3c605b83381abec1d99c7119d35a3833e40e65d788191ea51402207e925062602bb603f7109e3f36009563952741e666210195686de27b61515cc801ffffffff0b2261be0d143f42b833bcdf6e95582d4071f7d7d1d03eb1de0893eb7dc563ef0300000048473044022020aa8c2d6dc9727ce32f34ae704eb374b7cf87f43250a2d10072fad266f6602e02201fce01ae5c550438f2a512ab13f4c40d411d7726f32046e989b9747af33fd4e101ffffffff0500ca9a3b00000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc0027b92900000000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc1727000000000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcacc91265bf17090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000006d6a4c6ae6424b4d444469636500f74cae60f1901161cbe475ff00f1024bb3d64be778b714bfbeb75afa20fffceb6b2540dd22241ca6e72fe32c1cd1d2a9528140cad290f1599041e06589040067000000000000000000000000000000000000000000000000000000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
dicefinish name fundingtxid bettxid
The dicefinish
method rebroadcasts a bet that was previously broadcast.
If the returned hex
value is 0
the bet is finished.
If the returned hex
value is not 0
, the hex
value should be broadcast with sendrawtransaction. If the bet has not finished or is stuck, the hex
will have a value.
Name | Type | Description |
---|---|---|
name | (string) | the name of the dice contract |
fundingtxid | (string) | the txid of the transaction that created and funded this contract |
bettxid | (string) | the txid of the bet for which finish status is requested |
Name | Type | Description |
---|---|---|
result | (string) | whether the command executed successfully |
hex | (string) | if the contract is already finished, the resulting hex is 0; if the contract is not finished, the value of hex will be a rawtransaction that the user can broadcast to let the blockchain automatically declare a winner and close the bet |
Command:
./komodo-cli -ac_name=HELLOWORLD dicefinish DICE3 4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicefinish", "params":["DICE3" ,"4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e" ,"d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
dicefund name funds minbet maxbet maxodds timeoutblocks
The dicefund
method creates and funds a dice contract.
The method returns a hex value which must then be broadcast using the sendrawtransaction method.
Ideally, the dice creator node should be online throughout the contract's life, to determine winning bid
or losing bid
.
If the dice creator node is offline after the timeoutblocks
period completes, the system will automatically declare the bet's winner and payout winning funds.
Typically, the creator should set the timeoutblocks
property to a longer period. This prevents the house from losing funds if the house's node unexpectedly experiences downtime.
The maxodds
property must be between 1 and 9999.
Name | Type | Description |
---|---|---|
name | (string) | the name of the user's dice contract |
funds | (number) | the amount of funds with which the user desires to start |
minbet | (number) | the minimum amount allowed for a bet |
maxbet | (number) | the maximum amount allowed for a bet |
maxodds | (number) | the largest odds an end-user can use for betting |
timeoutblocks | (number) | the number of blocks before the contract times out and pays the automatically declared winner |
Name | Type | Description |
---|---|---|
result | (string) | whether the command executed successfully |
hex | (string) | the data of the transaction in raw hex-encoded format; broadcast this using the sendrawtransaction method |
Step 1: Create your customized Dice contract and get the hex value
./komodo-cli -ac_name=HELLOWORLD dicefund KMDDice 777777 0.777 7.77 777 7
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicefund", "params":["KMDDice" ,"777777" ,"0.777" ,"7.77" ,"777" ,"7"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Step 2: Send raw transaction / Broadcast the hex value
./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
Step 3: Decode raw transaction (optional to check if the values are sane)
./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["010000000a5890b79f42a2039d6b661cec3f0a748f8122b51427d2747d7cddb45e7c774988010000004847304402206544c1d0bb42da89d93e58526a28b3c80ef45dca516ecd11ee3fe7fc35a5261c02207f0b134ff5cdb840692a65eccd86fb2fc2a63afc6f1309a2ed9d054d1a076b1201ffffffff5b90bd88124ebd1a0988c612902234782b737b860189fb5871088d2d3aae2481020000004948304502210091972c641291022da6d49ab8d3790ccdbb0f563b385b89ac723fa688a6c84ee202207198c3d48ce1d9591fce6fb41192145c38f8312c7a78251f4231986070a3283a01ffffffff5bfb06fac51707a69414a1f908ac3f9eb3fca50f303c4ae960f94491e8dc7f5c0100000049483045022100ea0b49d902f844ef280b8621cdc5a5365a779a04a159ba30e00bd0b3eaf284da02205aece19ee807ce11b0ed7b74175df29dd2be4560361174664571a6a596a894fd01ffffffff5ca636731b8c28889248a0b434e3124f19518b2c4b4bbefd80af303329ae9471020000004847304402203eb318ae650753ab7cc2e9ea9b2cc2477add2fbd9e49e0ac1d7560f7e08ecbb002202d77d75ed2c1d3b53feda45c699374f74d1bf1065b46e3a24514dd072f2a9dcb01ffffffff5d5132ee6f33ba09b4bcfb84beddfcbdf58888ea7f221cc8078a96865e1e0ea10000000049483045022100e3cc5062becc979fc347a9ccde6af8ebba39c0d88105c9a35c89876207fafb0202204f631d063911e4526958f6629a847cca832d845a86adcae248625fd45b03e7d001ffffffff5e626ec0b20cd783ee0bf52aa33189796ddd4649d31b64fdee10b6daecbd079200000000494830450221009f3c17ccc73f28d9ba1d80c149890f56c6aafa576e152eb776082d12d54548eb022053f3b87eee04d9f5ef9f961d79433ec76b0f0e4a2288104212db01f6d2d7d1f801ffffffff5eb56cd4df0702b06debcf36de8309432b8140daa0a2544159ff68bbb96ed2050000000048473044022029bbf3fa5dea810d70ea9ef9b81b5ee72c3b3ec7d59faae4ca9658ed723ef683022060226d854ff44aebeba36bfda9e664185be0999ce7ee8b7b053f67642bd8c64101ffffffff603757f4b8370432cf30b12abdbb93b888e7707cd4321851f926779ee126e24402000000484730440220717994adac8b009a0f110438cef1e226d6674494e774813fad044b340c38052002202852c11fcc5bb1f3aa39e3dbbf00aa0d2b808c1c0769fbd692201cf10e96644b01ffffffff62347ddc97606a28457514a53b16d7fd9534c3c12d3f890cf72536f130737bae020000004847304402202dcf8a066fc56dae83f2259f902707aff7484251666c5b01a2e71e909fe859630220306a4149afce43dc343e103cdf4926ae9bf9f9a7a6eed9bf235efe04e619daea01ffffffff63686994d134931e0b43809f6d9ab73f7053d9aaa143987c56083345eddb5ec60100000048473044022066b3aadd3f2545c953f7389a062831736eda6c01f9df20e56b107d87fa6bfe8d02204357d85e1ab484c779fac5eab5d01fd39f5caf1ecde499873de34ac5e204b7ab01ffffffff0400112e08bd460000302ea22c80200095ece5eee67e1f313e7ba2d156c7617106cd52b75c93ed3fb110ff3fba6e998103120c008203000401cc10270000000000002321039d966927cfdadab3ee6c56da63c21f17ea753dde4b3dfd41487103e24b27e94eac100b47751c020000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000000000002c6a2ae6464b4d444469636500a09ba104000000004014502e000000000903000000000000070000000000000000000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
diceinfo fundingtxid
The diceinfo
method looks up information about the specific dice
contract referred by the relevant fundingtxid
.
A fundingtxid
is the txid of the transaction that created and funded the relevant contract.
Use the dicelist method to discover a list of available fundingtxid
hashes on the Smart Chain.
Name | Type | Description |
---|---|---|
fundingtxid | (string) | the txid of the transaction that created and funded this contract |
Name | Type | Description |
---|---|---|
"result" | (string) | whether the command executed successfully |
"fundingtxid" | (string) | the txid of the transaction that created and funded this contract |
"name" | (string) | the name of the dice contract |
"sbits" | (number) | a 64-bit int binary encoding of the first 8 characters of the name property |
"minbet" | (number) | the minimum bet amount this contract accepts |
"maxbet" | (number) | the maximum bet amount this contract accepts |
"maxodds" | (number) | the maximum odds the contract accepts |
"timeoutblocks" | (number) | the number of blocks before the contract allows an automatically declared winner and the bet closes |
"funding" | (number) | the current amount of funds in the contract |
Command:
./komodo-cli -ac_name=HELLOWORLD diceinfo 0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"diceinfo", "params":["0d6e82af9959caec14d7af42fd67db68a45bcd23c755457ebf192a52d62c599c"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
dicelist
The dicelist
method displays the total list of fundingtxid
's of all dice
contracts available on the Smart Chain.
A fundingtxid
is the txid of the transaction that created and funded the relevant contract.
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
fundingtxid | (string) | the txid of the transaction that created and funded the relevant contract |
Command:
./komodo-cli -ac_name=HELLOWORLD dicelist
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicelist", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/
dicestatus name fundingtxid bettxid
The dicestatus
method prints the status of a dicebet
and returns whether the bettxid
received a winning or losing result.
Name | Type | Description |
---|---|---|
name | (string) | the name of the dice contract |
fundingtxid | (string) | the txid of the transaction that created and funded this contract |
bettxid | (string) | the bettxid, the result of which is desired |
Name | Type | Description |
---|---|---|
result | (string) | whether the command executed successfully |
status | (string) | the result of the bet for the relevant bettxid |
Command:
./komodo-cli -ac_name=AT1 dicestatus DICE3 4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343
You can find your rpcuser
, rpcpassword
, and rpcport
in the coin's .conf file.
Command:
curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"dicestatus", "params":["DICE3" ,"4132ca8e8d46df9f8a8cbe83c99794497e06bbd190bd71f4abcdedf84e90952e" ,"d54335073e549cd75a050fd4d6ba5939307cda7096ba0f3da779fb7d07e46343"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/