Deploy a DApp
Last updated
Last updated
Let's use 5-10 minutes to deploy a complete game through ThunderCore that is easily accessible to your own friends and family -- accessible to anyone with internet access. We will release a simple coin toss game where players will receive twice as many bets if the coin is facing up. In the case of coins facing down, players will lose their bets, but still have a chance to double the bet.
To begin, we will obtain a wallet and gain access to the Thunder network. With either Metamask or TrustWallet pointed to the Thunder RPC, navigate HERE to play the game we will build in this tutorial!
To make your own version of the page, just check out the repo and follow the instructions in the readme.
At the end of those instructions, you should be able to access the game with either your mobile device through Metamask or any ThunderCore compatible mobile DApp browsers.
Now, let's get your game running on your own copy of the contract, so you can get started developing your own killer DApp!
First we will install all the dependencies.
If you haven't downloaded node.js, go to node.js download the version 8 or version 10. If you have downloaded it before but your version is incompatible, install it with nvm, and follow the instructions below.
Next grab your mnemonic or import your private key from metamask and create a file called .private-keys under “./smart-contracts ” or Trust Wallet and add it to the HDWallet in truffle-config.js
In the console, you will see the price you've paid for its deployment, the contract address, and additional stats. Well done! Your contract is now up and running ready to be used by anyone. If the contract address of DoubleOrNothing didn’t show up in the console after the migration ,you can check the contract address by typing the command below.
To make sure you've deployed doubleOrNothing smart contract successfully,you can double check the contract address and contract block number you've deployed lately.
We must now update our UI to use this contract address.
Find the .env file and change the REACT_APP_CONTRACT_ADDRESS to your new address which you got by the command DoubleOrNothing.address above.
Meanwhile, you can start by deploying on testnet , change 'REACT_APP_TT_USDT_CONTRACT(testnet)' to 0xB1Fb0b14Ffea209ABa1e62ff3F2F3DFD2eaa9FE0
, and comment out another REACT_APP_TT_USDT_CONTRACT address. If you’re not sure of the REACT_APP_TT_USDT_CONTRACT testnet or mainet address, check out on thundercore bridge.
Below are the specific steps we mentioned above.
First of all, click on the option above.Next, click the info symbol below.
You can see the TT-USDT ADDRESS ,which is REACT_APP_TT_USDT_CONTRACT=0xB1Fb0b14Ffea209ABa1e62ff3F2F3DFD2eaa9FE0
This will start a local server with your changes. If you want to deploy this to your webpage run:
Voila! In 5-10 seconds, your webpage will be running on your contract.Congratulations!
Add a Console to display an Error Message in the DApp's UI when running in the Wallet tab of TT Wallet to display any error messages for problems/errors encountered while interacting with the chain.
Example 1: TT20 Transactions
Example 2: DoubleOrNothing