In this workshop, we'll explore how to create decentralized Library. We will use the pre-written Tron smart contract and deploy it using TronBox, we can deploy contract on any Testnet or Mainnet.
This dApp uses Nuxt, but is out of scope for this workshop, so don't worry, we will only be focusing on the pieces that helps us build. In practice, any JS framework can be used.
Please refer to the following steps to deploy this DApp on Nile testnet
node -v
> v10.24.1
Download TronLink chrome extension
npm install -g tronbox
If there is no Tron account, please use TronLink to create a new Account. And then apply for some test coins of Nile testnet for testing. Please make sure the account has enough TRX. Get test coins
Now we have Setup installed properly, let’s grab the dApp template that we will use as the skeleton of our dApp. This template is a website built using Nuxt.js (don't worry if you don't know Nuxt.js, we are not focusing on this part).
Clone the template into your folder:
git clone https://github.com/TRON-Developer-Hub/decentralized-library
cd decentralized-library
npm install
Paste your account's private key to 'privateKey' in tronbox.js
Follow instructions to complete the smart contract code. If you only test the template code, please skip this step.
Compile contract:
tronbox compile
Deploy contract:
tronbox migrate --reset --network nile
On sucessfull deploy, copy the contract address
9. Paste your contract address to variable libraryContractAddress
on line 5 in utils.js.
Follow dapps to complete the DApp code. If you only test the template code, please skip this step.
cd dapp-ui
npm install
npm run dev