Steemit Crypto Academy Week5 Assignment for @sapwood -- Bandwidth & Energy (Tron)

in SteemitCryptoAcademy3 years ago (edited)
Good day everyone, this is my solution to professor @sapwood homework for this week. The topic is on Energy and Bandwidth on the tron network. They are required for transactions and signing smart contracts.

In my previous assignment on JustLend, I used JustSwap and JustLend so my screenshots will be mostly from the transactions I did. I didn't use my Steemit integrated tron wallet. This is my Tron wallet address: TMszLSkc93TQdKCe2DAUmHEYd4H4kL4DqM


What is Bandwidth and Energy?

They are necessities for validating transactions withing the tron network. Similar to the ethereum blockchain where you pay gas fee, tron is an improvement whereby you are able to freeze any amount of tron and in exchange, get bandwidth and energy to actualize transactions. These frozen tron are not burnt but are cemented and becomes untradable for a number of days (72 hours minimum). Bandwidth is used for ordinary transactions while Energy is used for smart contracts transactions.

1. How do I connect my TronLink Wallet to Tronscan.org?(Screenshots needed)


  • I connected my TronLink wallet mobile app to Tronscan DApp. The Tronscan DApp is listed among the popular DAPP in the discover section of the TronLink wallet.

  • On clicking the Tronscan Icon in the popular DApp section, the Tronscan interface opened and my wallet was connected automatically. The successful connection was indicated by a "Wallet connected successfully" message.

  • To confirm wallet connection, I clicked on the menu button on the top right hand corner as shown in the image below.

  • I scrolled through the list of options provided by the menu to wallet. There, I could see my TronLinK wallet address which signified a successful connection to Tronscan.


2. How do I freeze TRX to obtain Bandwidth? (Screenshots needed)


Freezing of available tron is required to produce bandwidth which is used for ordinary transactions and transactions involving smart contracts. There is a daily supply of 5000 Bandwidth, however, one need to freeze bandwidth in order to sign transactions after one has exhausted his free daily bandwidth. Failure to freeze Tron for bandwidth will lead to Tron being burnt in process of signing transactions.

  • I have an initial 5000 free bandwidth, so to perform this task. I froze one tron. I clicked on the Freeze/Unfreeze button on my TronLink App.

  • The new interface that opened, I made sure the Freeze /Unfreeze button was set at freeze. And I also made sure the option of bandwidth was selected and not energy. I inputted 1 tron for the sake of this task. As at the time of doing this task, freezing 1 tron will give me two bandwidth which is equivalent to 1 vote. Then I clicked the freeze button.

  • To finalize this transaction, a confirm interface pooped up. This is an ordinary transaction. From the confirm interface, we can see that it will cost me 244 bandwidth to sign this transaction.

  • Back to the main interface of my TronLink wallet, we can see that my total bandwidth is now 5001. This is the initial 5000 daily free bandwidth with the new 1 bandwidth i got from freezing my tron

3. How do I freeze TRX to obtain Energy? (Screenshots needed)



Freezing tron in order to obtain Energy is required in signing smart contracts. If tron is not frozen, or enough quantity frozen, the users tron will be burnt. In a situation where there is not enough tron, the smart transaction will not be authenticated.

  • The steps to freezing Tron in order to obtain energy is similar to the steps taken to freeze Tron for bandwidth. I clicked on the Freeze/Unfreeze button in my TronLink wallet main interface. The Freezing interface popped up and I made sure the freeze/unfreeze button is set to freeze. I also made sure the Energy option is chosen and not the bandwidth button. I Inputed 5 Tron to be frozen for this task. In exchange, I'll get 151 energy which is equivalent to 5 vote. Then I clicked on the Freeze button.

  • A new authentication interface popped up and I clicked on the freeze button. This transaction cost me 247 bandwidth.

  • Now on my TronLink app main interface, The Bandwidth I acquired while freezing my tron is displayed.



4. What types of transaction consumes Bandwidth only and what types of transaction consume both Bandwidth & Energy? Example of both types of your own wallet? (Screenshots needed)


All transactions consume Bandwidth. These include ordinary transactions such as transfer, freezing and unfreezing of tron and transactions involving smart contracts. Example of a freeze transaction is shown below consuming 244 bandwidth.


This is a TronScan report of the same transaction. There's only a column for bandwidth usage.

This is another example of an ordinary transaction- Transfer of Tron from my wallet to another. The transfer consumed 268 bandwidth and no energy.


Transactions involving smart contracts make use of both energy and bandwidth. Examples include minting, using justswap, burrowing and lending on JustLend and performing transactions on Tron DApps, especially in games. Example below is minting of jTRX. In the transaction, 284 bandwidth and 80,377 energy was consumed. As as this time, I didn't have any tron frozen so 11.25 TRX was burnt to produce enough energy to sign the smart contract.


Another example I'll be giving is a smart contract where I repaid a loan I burrowed from JustLend. This transaction burnt 4 energy out of my my total energy gotten from freezing Tron. And also 313 bandwidth was used in processing this contract.


5. How do I check "how much Bandwidth and Energy are consumed in a particular transaction"?(Screenshots needed)


Checking how much Bandwidth and Energy consumed in a particular transaction can be done using TronScan.

  • I Inputed my TronLink Wallet address in the search box on TronScan, then click search
  • I click on the transaction button to show me all transactions I've used my account to do. Then I chose the TRC20 and TRC721 because these transactions have both energy and bandwidth consumption.

  • I click on one of the transaction to reveal its details. Now I can see the Bandwidth and Energy consumed in order to process this transaction. In this transaction, 345 bandwidth and 22,315 energy was used. 20 energy was used from my frozen tron energy while the remaining 22,295 energy was profuced from burning 3.1213 tron.

6. How do I avoid burning TRX to accommodate the Energy required for a transaction?

To avoid burning tron for a transaction, the simple thing to do is to freeze enough tron to produce enough energy needed the transaction one intend to do. The formular for calculating the amount of energy one would get for every tron you freeze is:

Energy obtained = (User's Frozen Tron to obtain energy / Total Tron frozen in network to obtain energy) * 100,000,000,000.

100,000,000,000 is the number of energy provided within 24 hours in the tron network.

I do advice to freeze a thousand tron, this will give 100 votes which can be used to process smart contracts.

7. Include the real example of your interaction with JustLend & Justswap? Indicate how a "swap"(in Justswap) function consumes different "Energy & Bandwidth" than a "borrow" function(in JustLend)? You can trade a small amount(as little as 1 USDT)? (Screenshots needed)


This first example is a swap transaction where I swapped 5 trx for 84.03 WBTT at the rate of 16.9606 WBTT/TRX. This screenshot is taken from the JustSwap interface.


This is the same transaction as recorded on Tron scan. The swap transaction consumed 350 bandwidth and 30,950 energy.

This second example is a burrow transaction where I burrowed 10 WBTT on JustLend.


This is the same transaction as recorded on Tronscan. The WBTT burrow transaction consumed 313 bandwidth and 200,812 energy.


Smart Contract TransactionBandwidthEnergy
Swap (JustSwap)35030,958
Burrow (JustLend)313200,812


Conclusion: The swap function as seen in the table above consumed more bandwidth but lesser energy than the burrow function.


8. Explore Tronscan(check your own wallet) to identify an "ordinary transfer" & a "Smart-contract-operated transfer"? Indicate the difference between the two?


  • I inputted my TronLinK wallet address in the search box of TronScan in order to view activities on my wallet.

  • I clicked on the transaction button in the TronScan interface. This loaded all transactions I've done on my wallet, then i randomly picked one of the transactions to check if it is an ordinary transfer or smart-contract operated transfer.

  • The transaction I I clicked on opened. The detail shows that it is a Tron freezing transaction which used 250 bandwidth. There is no detail about consuming Energy, hence this is an ordinary transactions.

  • Then I went back to click on another random transaction. It is a loan repay transaction I performed on TronLend. The detail opened as shown in the below screenshot. There's a column for bandwidth consumed and another for energy consumed. This shows that this transaction is a smart-contract operated transfer.

Conclusion:

Bandwidth and Energy are an essential part of the Tron network. When performing any transaction, a user should make sure he knows the kind of transaction he's doing and he has tye necessary resources. He must have enough because burning tron is not efficient. This assignment had helped me carefully analyse many of the transactions i did and help me understand better how to work with the tron network.

Thank you!

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.029
BTC 62938.05
ETH 2552.06
USDT 1.00
SBD 2.63