TRX dApp Deployment (How To Deploy a Tron App)

Intro do TRX dApp Development

If there is something we must be aware of, it is blockchain. The power of this changing our planet is happening constantly since its inception. The efficiency, and security along with the high level of trust blockchain technologies offer, make it a no-brainer once it is understood. The dApp will be one of those things offered which we will begin to see more of. As a developer learning this new tech is indispensable. The Tron project is a project which aims at decentralizing the web. It already garners more transactions than Bitcoin or Ethereum, here I attempt to explain how to deploy a dApp to Tron.

Setting Up Tron Link Account

The first thing you must do is download this here. ← That is Tron Link. Once you have installed that you will be asked to create a password for your wallet. Yes, that is correct, a real TRX Wallet which allows you to quickly send and receive Tron coins. Since we are here to develop, we next should switch over from the Mainnet and change to the Testnet (since that’s what Tron suggests us to do). In order to change from the TRX Mainet to the Testnet we can swiftly do this through the famous gear icon which opens up and shows us our current network. By clicking “Select Node” we change over to the Testnet.

Once you have switched to the Testnet you need to get your wallet address from the Accounts tab. Directly under the words “Default Account”, you should see a crazy looking string of characters. That is your wallet address. This is a public address you can give to people to send you Tron. (Or you can use to send TRX as a tip to someone you deem worthy (: as a matter of fact mine looks like this → TNAMy9MupTrweQC8nWomxfikLimesfd4QF

Now that you have located your wallet address you can request free test TRX coins. WooHoo! We are that much closer to fulfilling our dreams of becoming a Tron master. We can request Testnet TRX by following this awesome link here. Once you are there, simply add your wallet address and in the blink of an eye, see your TRX wallet go from 0 to power level 10,000!

Now that you have this real FAKE TRX coin you can get into the harder stuff, like learning the development tools. Of which, I am probably just a novice like you, but together, we can do this! Some command line stuff is coming up so be ready to google anything and everything you do not understand, or else you will be lost, and once that happens, it’s not good.

Downloading Tron Development Tools (TRX Link Demo Messages)

First of all, you definitely want to Git Clone this wonderful demo. Once you have cloned it to your machine, change directories into it.

Now, let us…

npm install -g tronbox

We now want to change the private key within tronbox.js to contain our private key which is located within our recently created wallet. If you go to the Accounts Tab and then go export, you will see your private key. Then within the tronbox.js file, you can easily paste that key where it goes.

Compiling Tronbox

Now within your command line run the beautiful command of

tronbox compile

This command will allow you to compile our recently downloaded smart contract TRXMessages.sol located within the contracts/ sub-directory.

After that, we can deploy our smart contract with…

tronbox migrate --reset --network shasta

Make sure to write down the address that the contracts were deployed to. It should be the base58 address for TRX messages. Also, if you get any errors around here, you should probably run

npm install

With that being said… open up the src folder, go to utils directory and open index.js

Update the contract address by pasting in the copied address we deployed to.

Now, we can finally run the command we love to run…

npm start

This should open up localhost:3000 and our first Tron dApp!!!

Congratulations official Tron Devs!

You have successfully deployed a Tron dApp onto the Tron Testnet.

Now come’s the funnest part, developing. For this, you will need to learn Solidity basics, of which I also have much to learn. If you want to get started right away and for free there is CryptoZombies. You can find some walkthrough while you go through those lessons at We Will Code.

The Inner Workings of a dApp, Learning Solidity

Now, with Tronbox installed, we are free to begin building our dApp. The folder structure is the last thing we will go through, then you guys and gals shall be free to experiment on your own and begin changing the world through the power of blockchain!

In our folder we see that there is a contracts directory, this is where all of our smart contracts will go.

Within the migrations folder, you will find our deploy scripts.

Our react and front-end stuff will go in the src folder.

That is basically where I will leave you to experiment and go crazy on your own. Hope everyone has found this helpful if so don’t forget…

;)

→ TNAMy9MupTrweQC8nWomxfikLimesfd4QF