Crypto Academy Week 13 - Homework Post for [@Sapwood]--Bandwidth & Energy (Tron)

in SteemitCryptoAcademy3 years ago (edited)

I am delighted to once again participate in this week's lecture by professor @sapwood. This week's lecture on Bandwidth and Energy(Tron) is very insightful as usual and I commend professor @sapwood for sharing this knowledge with us.

tron.png

Generally, transactions made on blockchains attract transaction fees which in the case of Tron Blockchain is referred to as resources that entail Bandwidth and Energy.
Bandwidth is consumed for ordinary transactions and smart contracts require both Bandwidth and Energy as mentioned in the lecture.

3blue.png

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

For this tutorial, I would be using the Tronlink extension in my browser.

  • Click on the Dapps button on the top right corner of the Tronlink interface after logging in.

  • Scroll through the list of Dapps and select Tronscan. Tronscan would be opened in a new tab of the browser

  • Wallet would be connected automatically on the Tronscan page. You can transfer, vote, freeze, or record a token once your wallet is connected without having to log in first.

image.png


blue.png

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

Once you've connected your wallet to Tronscan, click on the ">" button next to the TRX address to open up your profile follow the steps below to freeze TRX for Bandwidth

Steps:

  • Click on Obtain under the Resources window.

image.png

  • From the pop-up menu which appears, select TRON Power and Bandwidth, enter the amount of TRX you wish to freeze, check the box to confirm, and click on Freeze to confirm

  • Click on Approve in the popup window to complete the transaction


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

Freezing TRX for Energy follows the same procedure as freezing TRX for Bandwidth. The only difference is that, in this instance, you ought to select TRON Power and Energy under the Obtain window

Steps:

  • Click on Obtain under the Resources window.
  • From the pop-up menu which appears, select TRON Power and Energy, enter the amount of TRX you wish to freeze, check the box to confirm, and click on Freeze to confirm
  • Click on Approve in the popup window to complete the transaction

image.png

image.png


blue.png

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)

Transactions that consume Bandwidth only

As mentioned in the lecture, only regular transactions consume only Bandwidth. Transactions such as transferring, freezing, and unfreezing of tokens require only Bandwidth to process.

Transactions under the TRX&TRC10 Transfers tab usually consume only Bandwidth as a resource.

To view the TRX&TRC10 Transfers :

  • Go to Tronscan
  • In the search field, enter your Tron Wallet Address.
  • Click on TRANSFERS and select TRX&TRC10 Transfers tab
  • Click on the Hash value of any transaction to view the details

image.png

image.png

image.png

Observation

  • Hash- 7ea6becec8dd756bb3f3e4547885949d0cc62cac36cdb8e2c72e23b975d90cb2

  • Total Consumption of Bandwidth- 287

  • Consumption of frozen/free bandwidth: 0 Bandwidth

  • Burn 0.04018 TRX for bandwidth: 287 Bandwidth

I received 0.208406 TRX from TQhZ7W1RudxFdzJMw6FvMnujPxrS6sFfmj as steem reward for a post.
Though no resource was consumed from my end, 0.04018 TRX of the sender's TRX was burned to accommodate for the insufficient Bandwidth by the user.


Transactions that Bandwidth and Energy

TRC20&TRC721 Transfer transactions require both Bandwidth and Energy as resources. TRC-20 is related to smart contracts and as mentioned in the lecture, smart contracts consume both resources for validation of transactions.

To view the TRC20&TRC721 Transfers :

  • Go to Tronscan
  • In the search field, enter your Tron Wallet Address.
  • Click on TRANSFERS and select TRC20&TRC721 Transfers tab
  • Click on the Hash value of any transaction to view the details

image.png

image.png

Observation

  • Hash- 92af96fb32358607eca262726ba8dc711160dcc2fdd7871b5e2e77aa543131fa

  • Consumption of Bandwidth- 345

  • TRX burned to accommodate Bandwidth - 0.0483 TRX

  • Consumption of Energy- 13,516

  • TRX burned to accommodate Energy- 1.89224 TRX

  • Method of calling- Transfer


blue.png

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

  • Go to Tronscan

  • In the search field, enter your Tron Wallet Address.

image.png


  • Click on TRANSFERS and select either TRX&TRC10 Transfers or TRC20&TRC721 Transfer tab and click on the Hash value of any transaction to view the details

Repayment Transaction

The transaction displayed above marks the repayment of my borrowed asset in JustLend. I repaid 5 USDJ.

Details

Txn Hash- adf58ab15bd1a0990016c87b5872ac418488ef5bd255ce55654567cf16e52b32

Consumption of Bandwidth- 313

Consumption of Energy- 84,654

Energy usage from my frozen energy- 117 Energy

TRX burned to accommodate Energy- 11.83518 TRX

Method Calling: repayBorrow


blue.png

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

As explained in the lecture, the only way to prevent your TRX tokens from being burnt for Energy is to freeze up enough Energy required for that particular transaction.

Smart contracts utilize Energy in addition to Bandwidth since it is a form of business activity.
1 Energy = 1milliseconds, thus the longer the processing time of a smart contract transaction, the more Energy is consumed.

The total energy obtained by freezing TRX is dependent on the liquidity of the entire network and the total amount of the frozen TRX in Tron Network as mentioned in the lecture and calculated using the formula:

Energy obtained = (the TRX frozen for gaining Energy / the total TRX frozen for gaining Energy in the entire network) * total_energy_limit

You can always calculate the amount of energy to be obtained from freezing TRX by visiting TRON STATION.
It is also useful for calculating the amount of Bandwidth to be obtained and the amount of Energy gained by burning TRX

image.png

Screenshot from TRON STATION


blue.png

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)

Swapping TRX for USDT on JustSwap
There are two ways to swap tokens in Tronlink Wallet.

  • First and simple way is by clicking on Swap on the home interface of Tronlink Wallet

image.png

Another way is by:

  • Click on the Dapps button on the top right corner of the Tronlink interface. Scroll through the list of Dapps and select JustSwap. JustSwap would be opened in a new tab of the browser

  • Select TRX and USDT in the from and to sections respectively and enter the amount TRX to swap. I will swap TRX for 5 USDT in this tutorial
  • Click on swap and select authorization type and complete transaction

image.png

image.png

image.png


blue.png

JustSwap Transaction details on Tronscan

image.png

Hash- f77d143c1d387b9aaadcf2e6f44f0769ccb1ba78e697ad0b3ec919dde4716542

Consumption of Bandwidth- 350

Consumption of Energy - 55,377

Energy usage from my frozen energy- 451 Energy

TRX burned to accommodate Energy- 7.68964 TRX


JustLend Borrow Transaction details on Tronscan

image.png

Hash- 7878b35bcd1fab2ee703ad53da93882273be76a35c3b13b82d739a5a885f6390

Consumption of Bandwidth- 313

Consumption of Energy - 202,165

Energy usage from my frozen energy- 466 Energy

TRX burned to accommodate Energy- 28.23786 TRX

Comparison of JustSwap and JustLend(borrow) transaction

ValuesJustSwapJustLend
Tokens5 USDT5 USDJ
Energy55,377202,165
Bandwidth350313
TRX Burned7.6896428.23786

Observation
Borrowing on JustLend requires more Energy and Bandwidth as compared to swaping on JustSwap. Though the difference in amount of Bandwidth consumed in both cases are isn't huge, JustLend cumsumes 146788 more Energy to perform a borrow transaction of 5 USDJ to swapping 5 USDT on JustSwap.
This means, JustLend takes a longer processing time of 146,788 milliseconds than JustSwap.


blue.png

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

Ordinary Transfer
As mentioned earlier in my submission, ordinary transfer generally encompasses transferring, freezing, voting and claiming rewards and unfreezing transactions.

These transactions are grouped under the TRX&TRC10 Transfers section of TRANSFERS and consume only Bandwidth as resource for validating transactions

image.png

TRC&TRC10 Transfers


image.png

Example of Ordinary Transfer(Voting)


Smart-contract-operated transfer
These transactions are classsified under the TRC20&TRC721 Transfers section of TRANSFERS
They consume both Energy and Bandwidth as resources for transacting a business activity.

image.png

TRC20&TRC721 Transfers

image.png

Example of Triggered Smart Contract


Viewing Transaction types at TRANSACTIONS can also help distinguish between Smart Contract Transfers and Ordinary Transfers.

  • Go to Tronscan
  • In the search field, enter your Tron Wallet Address
  • Click on TRANSACTIONS tab

image.png

List of all Transactions

Basically, the only difference between Smart Contract transfer and Ordinary transfer is that the former consumes both Bandwidth and Energy while the latter consumes only Bandwidth for validating transactions.

It is relevant to note that, TRX will be burnt regardless of the fact that a transaction was unsuccessful. If a user has insufficient frozen resources and insufficient TRX to be burnt as resource for a particular transaction, the available TRX will still be burnt even though the transaction would fail.

blue.png

Thanks for you attention

cc:
@sapwood

Sort:  
Loading...

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63350.70
ETH 2595.60
USDT 1.00
SBD 2.85