Tron Station


This page aims to simulate calculator from https://tronstation.io/.


Bandwidth

Bandwidth is used to transport transaction over the network, it is calculated by byte size. Daily free 5000 bandwiths is available to your address.

Energy

This is a special resource used to process smart contracts on the TRON network. Smart contracts consume Energy in addition to Bandwidth. According to TRON’s official document, 1 Energy represents 1 microsecond passed while executing smart contracts.

The Consumption Process
  1. Consume the energy gained by the contract creator from freezing TRX, according to the consume_user_resource_percent ratio set in the contract. If that energy is not enough, continue consuming the contract creator's remaining energy. Any remaining energy shortage is provided by the contract caller.
  2. Contract caller consumption process: (First consume the Energy acquired by the caller via freezing TRX, to ensure the contract can be executed normally, and the insufficient part is offset by destroying the TRX).
  3. If the contract creator does not freeze TRX for the Energy resource, all consumption is required by the caller.

Both Above

  • You can freeze TRX to gain any one of resource above but not both and TRON POWER will be rewarded in addition to the resource (1 TRX : 1 TRON POWER).
  • TRX will be burn if shortage of resource encounter.


Energy By Burning TRX:

<?php 

include_once "../libraries/vendor/autoload.php";
include_once("html_iframe_header.php");
include_once("tron_utils.php");

define("TRX_TO_SUN",'1000000');
define("SUN_TO_TRX", '0.000001');

$supportChains = ['main'=>"Tron Mainnet", 'shasta'=>"Shasta Testnet"];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
		
		if (!is_numeric($_POST['input'])) {
			throw new Exception("Please fill in numeric.");
		}
		
		if ($_POST['chain'] == 'main') {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
        } else {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
        }
		
		$tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
		
		$chainParams = $tron->getManager()->request("wallet/getchainparameters", [], "get");
		
		$value = getChainParamValue($chainParams['chainParameter'], $key = "getEnergyFee");
		
		if ($value === false) {
			throw new Exception("'{$key}' not found in response from wallet/getchainparameters");
		}
		
		$trxPerEnergy = bcmul($value, SUN_TO_TRX, 6);
		$energyPerTrx = bcdiv("1", $trxPerEnergy, 6);
		
		
    ?>
	<div class="alert alert-success">
		<p>
		1 TRX equals to <?php echo $energyPerTrx?> Energy<br/>
		1 Energy equals to <?php echo $trxPerEnergy?> TRX
		</p>
		<p>
			<?php
			if ($_POST['unit'] == 'TRX') {
				echo "<b>" . $_POST['input'] . " TRX equals to ".bcmul($_POST['input'], $energyPerTrx , 6)." Energy</b>";
			} else {
				echo "<b>" . $_POST['input'] . " Energy equals to ".bcmul($_POST['input'], $trxPerEnergy , 6)." TRX</b>";
			}
			?>
		</p>
	</div>
<?php 
    } catch (Exception $e) {
        $errmsg .= "Problem found. " . $e->getMessage();

    }
} 

if ($errmsg) {
?>
    <div class="alert alert-danger">
        <strong>Error!</strong> <?php echo $errmsg?>
    </div>
<?php
}
?>
<form action='' method='post'>
	
	<div class="form-group">
		<label for="chain">Chain:</label>
		<select id="chain" name="chain" class="form-control" >
			<?php
			foreach($supportChains as $k=>$v) {
				echo "<option value='{$k}'".($k == $_POST['chain'] ? " selected": "").">{$v}</option>";
			}
			?>
		</select>
	</div>
	
   <div class="form-group">
		<label for="input">TRX or Energy:</label>
		
		<div class="input-group mb-3">
			<input class="form-control" type='text' name='input' id='input' value='<?php echo $_POST['input']?>'>
			<div class="input-group-append">
				<span class="input-group-text">
					<select name="unit">
						<option value="TRX"<?Php echo $_POST['unit'] == 'TRX' ? " selected" : ""?>>TRX</option>
						<option value="energy"<?Php echo $_POST['unit'] == 'energy' ? " selected" : ""?>>Energy</option>
					</select>
				</span>
			</div>
		</div>
	</div>
	
    <input type='submit' class="btn btn-success btn-block"/>
</form>
<?php
include_once("html_iframe_footer.php");

Bandwidth By Burning TRX:

<?php 

include_once "../libraries/vendor/autoload.php";
include_once("html_iframe_header.php");
include_once("tron_utils.php");

define("TRX_TO_SUN",'1000000');
define("SUN_TO_TRX", '0.000001');

$supportChains = ['main'=>"Tron Mainnet", 'shasta'=>"Shasta Testnet"];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
		
		if (!is_numeric($_POST['input'])) {
			throw new Exception("Please fill in numeric.");
		}
		
		if ($_POST['chain'] == 'main') {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
        } else {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
        }
		
		$tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
		
		$chainParams = $tron->getManager()->request("wallet/getchainparameters", [], "get");
		
		$value = getChainParamValue($chainParams['chainParameter'], $key = "getTransactionFee");
		
		if ($value === false) {
			throw new Exception("'{$key}' not found in response from wallet/getchainparameters");
		}
		
		
		$trxPerBandwidth = bcmul($value, SUN_TO_TRX, 6);
		
		$bandwidthPerTrx = bcdiv("1", $trxPerBandwidth, 6);
		
		
    ?>
	<div class="alert alert-success">
		<p>
		1 TRX equals to <?php echo $bandwidthPerTrx?> Bandwidth<br/>
		1 Bandwidth equals to <?php echo $trxPerBandwidth?> TRX
		</p>
		<p>
			<?php
			if ($_POST['unit'] == 'TRX') {
				echo "<b>" . $_POST['input'] . " TRX equals to ".bcmul($_POST['input'], $bandwidthPerTrx , 6)." Bandwidth</b>";
			} else {
				echo "<b>" . $_POST['input'] . " Bandwidth equals to ".bcmul($_POST['input'], $trxPerBandwidth , 6)." TRX</b>";
			}
			?>
		</p>
	</div>
<?php 
    } catch (Exception $e) {
        $errmsg .= "Problem found. " . $e->getMessage();

    }
} 

if ($errmsg) {
?>
    <div class="alert alert-danger">
        <strong>Error!</strong> <?php echo $errmsg?>
    </div>
<?php
}
?>
<form action='' method='post'>
	
	<div class="form-group">
		<label for="chain">Chain:</label>
		<select id="chain" name="chain" class="form-control" >
			<?php
			foreach($supportChains as $k=>$v) {
				echo "<option value='{$k}'".($k == $_POST['chain'] ? " selected": "").">{$v}</option>";
			}
			?>
		</select>
	</div>
	
   <div class="form-group">
		<label for="input">TRX or Bandwidth:</label>
		
		<div class="input-group mb-3">
			<input class="form-control" type='text' name='input' id='input' value='<?php echo $_POST['input']?>'>
			<div class="input-group-append">
				<span class="input-group-text">
					<select name="unit">
						<option value="TRX"<?Php echo $_POST['unit'] == 'TRX' ? " selected" : ""?>>TRX</option>
						<option value="Bandwidth"<?Php echo $_POST['unit'] == 'Bandwidth' ? " selected" : ""?>>Bandwidth</option>
					</select>
				</span>
			</div>
		</div>
	</div>
	
    <input type='submit' class="btn btn-success btn-block"/>
</form>
<?php
include_once("html_iframe_footer.php");

Energy By Freezing TRX:

<?php 

include_once "../libraries/vendor/autoload.php";
include_once("html_iframe_header.php");
include_once("tron_utils.php");

define("TRX_TO_SUN",'1000000');
define("SUN_TO_TRX", '0.000001');

$supportChains = ['main'=>"Tron Mainnet", 'shasta'=>"Shasta Testnet"];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
		
		if (!is_numeric($_POST['input'])) {
			throw new Exception("Please fill in numeric.");
		}
		
		if ($_POST['chain'] == 'main') {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
			
			$anyActivatedAddress = "TRta2KsGxUBadKEffZFirTQypjkAyzFsFx";
        } else {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
			
			$anyActivatedAddress = "TFBjcM5pVqokCX3KRxCZbEorRTw8ZHc2Pw";
        }
		
		$tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
		$networkResources = $tron->getAccountResources($anyActivatedAddress);
		
		$energyPerTrx = bcdiv($networkResources['TotalEnergyLimit'],$networkResources['TotalEnergyWeight'],6);
		$trxPerEnergy = bcdiv("1", $energyPerTrx, 6);
    ?>
	<div class="alert alert-success">
		<p>
		Total TRX Frozen For Gaining Energy: <b><?php echo $networkResources['TotalEnergyWeight']?></b><br/>
		Total energy current limit is <b><?php echo $networkResources['TotalEnergyLimit']?></b> Energy<br/>
		1 TRX equals to <?php echo $energyPerTrx?> Energy
		</p>
		<p>
			<?php
			if ($_POST['unit'] == 'TRX') {
				echo "<b>" . $_POST['input'] . " TRX equals to ".bcmul($_POST['input'], $energyPerTrx , 6)." Energy</b>";
			} else {
				echo "<b>" . $_POST['input'] . " Energy equals to ".bcmul($_POST['input'], $trxPerEnergy , 6)." TRX</b>";
			}
			?>
		</p>
	</div>
<?php 
    } catch (Exception $e) {
        $errmsg .= "Problem found. " . $e->getMessage();

    }
} 

if ($errmsg) {
?>
    <div class="alert alert-danger">
        <strong>Error!</strong> <?php echo $errmsg?>
    </div>
<?php
}
?>
<form action='' method='post'>
	
	<div class="form-group">
		<label for="chain">Chain:</label>
		<select id="chain" name="chain" class="form-control" >
			<?php
			foreach($supportChains as $k=>$v) {
				echo "<option value='{$k}'".($k == $_POST['chain'] ? " selected": "").">{$v}</option>";
			}
			?>
		</select>
	</div>
	
   <div class="form-group">
		<label for="input">TRX or Energy:</label>
		
		<div class="input-group mb-3">
			<input class="form-control" type='text' name='input' id='input' value='<?php echo $_POST['input']?>'>
			<div class="input-group-append">
				<span class="input-group-text">
					<select name="unit">
						<option value="TRX"<?Php echo $_POST['unit'] == 'TRX' ? " selected" : ""?>>TRX</option>
						<option value="energy"<?Php echo $_POST['unit'] == 'energy' ? " selected" : ""?>>Energy</option>
					</select>
				</span>
			</div>
		</div>
		<small>
		Energy obtained = TRX frozen for gaining Energy / total TRX frozen for gaining Energy in the entire network * total energy limit.
		</small>
	</div>
	
    <input type='submit' class="btn btn-success btn-block"/>
</form>
<?php
include_once("html_iframe_footer.php");

Bandwidth By Freezing TRX:

<?php 

include_once "../libraries/vendor/autoload.php";
include_once("html_iframe_header.php");
include_once("tron_utils.php");

define("TRX_TO_SUN",'1000000');
define("SUN_TO_TRX", '0.000001');

$supportChains = ['main'=>"Tron Mainnet", 'shasta'=>"Shasta Testnet"];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    try {
		
		if (!is_numeric($_POST['input'])) {
			throw new Exception("Please fill in numeric.");
		}
		
		if ($_POST['chain'] == 'main') {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.trongrid.io');
			
			$anyActivatedAddress = "TRta2KsGxUBadKEffZFirTQypjkAyzFsFx";
        } else {
            $fullNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $solidityNode = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
            $eventServer = new \IEXBase\TronAPI\Provider\HttpProvider('https://api.shasta.trongrid.io');
			
			$anyActivatedAddress = "TFBjcM5pVqokCX3KRxCZbEorRTw8ZHc2Pw";
        }
		
		$tron = new \IEXBase\TronAPI\Tron($fullNode, $solidityNode, $eventServer);
		$networkResources = $tron->getAccountResources($anyActivatedAddress);
		
		$bandwidthPerTrx = bcdiv($networkResources['TotalNetLimit'],$networkResources['TotalNetWeight'],6);
		$trxPerBandwidth = bcdiv("1", $bandwidthPerTrx, 6);
    ?>
	<div class="alert alert-success">
		<p>
		Total TRX Frozen For Gaining Bandwidth: <b><?php echo $networkResources['TotalNetWeight']?></b><br/>
		Total bandwidth current limit is <b><?php echo $networkResources['TotalNetLimit']?></b> Bandwidth<br/>
		1 TRX equals to <?php echo $bandwidthPerTrx?> Bandwidth
		</p>
		<p>
			<?php
			if ($_POST['unit'] == 'TRX') {
				echo "<b>" . $_POST['input'] . " TRX equals to ".bcmul($_POST['input'], $bandwidthPerTrx , 6)." Bandwidth</b>";
			} else {
				echo "<b>" . $_POST['input'] . " Bandwidth equals to ".bcmul($_POST['input'], $trxPerBandwidth , 6)." TRX</b>";
			}
			?>
		</p>
	</div>
<?php 
    } catch (Exception $e) {
        $errmsg .= "Problem found. " . $e->getMessage();

    }
} 

if ($errmsg) {
?>
    <div class="alert alert-danger">
        <strong>Error!</strong> <?php echo $errmsg?>
    </div>
<?php
}
?>
<form action='' method='post'>
	
	<div class="form-group">
		<label for="chain">Chain:</label>
		<select id="chain" name="chain" class="form-control" >
			<?php
			foreach($supportChains as $k=>$v) {
				echo "<option value='{$k}'".($k == $_POST['chain'] ? " selected": "").">{$v}</option>";
			}
			?>
		</select>
	</div>
	
   <div class="form-group">
		<label for="input">TRX or Bandwidth:</label>
		
		<div class="input-group mb-3">
			<input class="form-control" type='text' name='input' id='input' value='<?php echo $_POST['input']?>'>
			<div class="input-group-append">
				<span class="input-group-text">
					<select name="unit">
						<option value="TRX"<?Php echo $_POST['unit'] == 'TRX' ? " selected" : ""?>>TRX</option>
						<option value="bandwidth"<?Php echo $_POST['unit'] == 'bandwidth' ? " selected" : ""?>>Bandwidth</option>
					</select>
				</span>
			</div>
		</div>
		<small>
		Bandwidth obtained = TRX frozen for gaining Bandwidth / total TRX frozen for gaining Bandwidth in the entire network * total bandwidth limit.
		</small>
	</div>
	
    <input type='submit' class="btn btn-success btn-block"/>
</form>
<?php
include_once("html_iframe_footer.php");








Tutorials
About Us
Contents have been open source in GITHUB. Please give me a ⭐ if you found this helpful :)
Community
Problem? Raise me a new issue.
Support Us
Buy me a coffee. so i can spend more nights for this :)

BTCSCHOOLS would like to present you with more pratical but little theory throughout our tutorials. Pages' content are constantly keep reviewed to avoid mistakes, but we cannot warrant correctness of all contents. While using this site, you agree to accept our terms of use, cookie & privacy policy. Copyright 2019 by BTCSCHOOLS. All Rights Reserved.