Skip to content

Instantly share code, notes, and snippets.

@decent-dev
Last active February 21, 2018 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save decent-dev/d0d4213ed193b0c80dbb73083dea287a to your computer and use it in GitHub Desktop.
Save decent-dev/d0d4213ed193b0c80dbb73083dea287a to your computer and use it in GitHub Desktop.
Instructions to setup a local Rinkeby node and run Decent.bet's Sportsbook Testnet

Decent.bet Sportsbook Testnet Instructions

The decent.bet sportsbook runs on the Rinkeby test network. Users are given options to use Infura's mainnet nodes or their local Geth node.

You can access the testnet by visiting the following URL: https://sportsbook-testnet.decent.bet/

If you'd like to use your own local Geth node, follow the instructions below. Otherwise, skip to the usage instructions

Setting up a local Rinkeby node

  • Follow Step 1 from these instructions to download Geth.

  • To run geth with an open WS and RPC api, run the following in your terminal/command line

    geth --rinkeby --fast --rpc --rpcapi db,eth,net,web3,personal --ws --wsorigins "*" --wsapi "db,eth,net,web3,personal,web3" --cache=1024 --rpc --rpcport 8545 --rpccorsdomain "*" --rpcaddr "0.0.0.0"
    

    If this is your first run, wait for the initial sync to complete. It may take a few hours or more depending on your internet connection.

    Also read, this section of the previous instructions for security considerations when running a local node.

  • Once your node has synced, you will need to access it's console by running geth attach. You would need to do this in a separate terminal. Run the following command

    geth attach ipc:$HOME/.ethereum/rinkeby/geth.ipc
    

    You should now see the geth javascript console show up.

  • Generate private keys from the Sportsbook testnet login page by clicking on Generate Private key. Save the keys safely and use it solely for testing purposes. Import the keys into your running geth node by running the following commands in the geth console

    personal.importRawKey("<YOUR GENERATED PRIVATE KEY WITHOUT THE LEADING 0x>","<PASSWORD OF YOUR CHOICE>")
    

    This step is necessary to use your generated private key to sign/send transactions on the network.

  • Copy the address that is displayed in the output of the previous command or alternatively login to the sportsbook testnet and copy the private key's corresponding address by clicking on the address displayed on the top right of the page.

    Use this address to unlock your account on your running Geth node. Note This step has to be repeated anytime you restart your local node.

    personal.unlockAccount("<YOUR ADDRESS>", "<PASSWORD USED EARLIER>", 0)
    

    You should now be able to send transactions on Rinkeby from your local node using the logged in account.

  • You will now need Rinkeby ether to send transactions on the network, follow Step 4 from the previous instructions to claim your testnet ether.

Using the Sportsbook Testnet

Once you have your local node setup and imported your private keys/unlocked your accounts, you should be able to login to the platform and not see a "Not connected" error dialog. To use the sportsbook testnet, you will need to perform the following steps

  • Claim Faucet

    The faucet allows you to set your DBET balance to 10,000 DBETs with the click of a button which allows you to create multiple channels for testing purposes.

    Simply navigate to the top right of your screen and click on the claim faucet button. If you see an error message, please make sure you've imported/unlocked your logged in account within your local node and have ether in your account balance.

    You should see your balance update to 10,000 DBETs after the transaction gets confirmed on the network.

  • Deposit into the sportsbook

    Head over to the sportsbook page and click on the Deposit button. Enter the amount of DBETs you'd like to deposit into the sportsbook contract. Make sure that the amount is lesser or equal to your current DBET balance. You should see your session balance update after the transaction gets confirmed on the network.

  • Bet on games

    To bet on a game, scroll down the available games section to view games that are available for betting. Games are available for betting as long as the current time is lesser than the listed cut-off time.

    You can now view odds available for each game and place bets on them depending on the limits set for each game.

    There are 4 types of odds available on the sportsbook contract

    1. Spread
    2. Moneyline
    3. Totals
    4. Team totals

    The two types of limits available for bets are

    Max bet limits This is the total amount of DBETs you'd be allowed to bet on each game.

    Odd type limits This is the total amount of DBETs you'd be allowed to bet on different types of odds for each game.

    To place a bet you would need to bet within these limits and have enough DBETs in your session balance to cover the bet.

    After entering the amount of DBETs you'd like to bet on a game, you will be able to view the maximum amount of winnings based on a favorable outcome.

    Once you've reviewed the maximum winnings for your bet, click on Bet now to confirm and place your bet.

  • Claim bets for winning games

    After a game has ended and outcomes have been pushed to the Sportsbook contract, you will be able to claim winnings for successful bets. To claim your bets, scroll to the bottom of the page to view the Bets Placed section and click on the Claim Winnings button to claim your bets for games that you've bet the right outcome on.

NOTE

At the moment the testnet contract relies on mock times for games and not timestamps from blocks on the network. This means that the contract time has to be manually set by the decent.bet development team for the moment. In a contract iteration deployed sometime in the future, this will be toggled to rely on block timestamps after the first session is initialized on the platform.

For instructions to try out Decent.bet's Slots testnet, click here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment