TRON Developer Hub

The TRON Developer Hub

Welcome to the TRON developer hub. You'll find comprehensive guides and documentation to help you start working with TRON as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Transaction Management

Send Trx

tronWeb.transactionBuilder.sendTrx("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", 100, "TZDCUCy3Wn1HhJVseANdrhzqDYCTEue8xT");

Create an unsigned transaction.

Value
Des

to

Address to send TRX to.

amount

Amount of TRX to send.

from

Optional address that is transferring the Tokens.

Send Token

tronWeb.transactionBuilder.sendToken("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", 100, "WIN", "TCanwMYEkP1e6ZWSA2gdU6jDEm1TxWMYQF");

Creates an unsigned TRX transfer transaction.

Value
Description

to

Address to send TRX to.

amount

Amount of TRX to send.

tokenID

Name of the token, matching the exact capitalization.

from

Optional address that is transferring the Tokens.

Purchase Token

tronWeb.transactionBuilder.purchaseToken("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", 100, "WIN", "TCanwMYEkP1e6ZWSA2gdU6jDEm1TxWMYQF");

Creates an unsigned ICO token purchase transaction.

Value
Description

issuerAddress

Address that issued the Token.

tokenID

Name of the token, matching the exact capitalization.

amount

Amount of tokens to buy.

buyer

Optional address that is buying the tokens.

Freeze Balance

tronWeb.transactionBuilder.freezeBalance("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", 100, "WIN", "TCanwMYEkP1e6ZWSA2gdU6jDEm1TxWMYQF");

Creates an unsigned freeze TRX transaction.

Value
Description

address

Address of the owner.

amount

Amount of TRX to freeze.

duration

Length in Days to freeze TRX for. Minimum of 3 days.

resource

Resource that you're freezing TRX in order to obtain. Must be either "BANDWIDTH" or "ENERGY".

Unfreeze Balance

tronWeb.transactionBuilder.freezeBalance("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", 100, "WIN", "TCanwMYEkP1e6ZWSA2gdU6jDEm1TxWMYQF");

Creates an unsigned unfreeze TRX transaction. This will unfreeze ALL TRX for that resource and also remove all VOTES.

Value
Description

address

Address of the owner.

amount

Amount of TRX to freeze.

duration

Length in Days to freeze TRX for. Minimum of 3 days.

resource

Resource that you're freezing TRX in order to obtain. Must be either "BANDWIDTH" or "ENERGY".

Withdraw Block Rewards

tronWeb.transactionBuilder.withdrawBlockRewards("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m");

Creates an unsigned Super Representative award balance withdraw transaction.

Value
Description

address

Optional address to withdraw from.

Apply for Super Representives

tronWeb.transactionBuilder.applyForSR(address = this.tronWeb.defaultAddress.hex, url = 'google.com');

apply for SR for an address

value
Description

address

address for applying for SR, hex string format

url

website of SR

Vote

tronWeb.transactionBuilder.vote( votes = {srAddress : voteCount}, voterAddress = this.tronWeb.defaultAddress.hex);

vote for an SR

value
description

votes

dictionary of SR address : vote count key-value pair

voterAddress

voter address in HexString

Create Token

tronWeb.transactionBuilder.createToken(options = TOKEN_OPTIONS, issuerAddress = this.tronWeb.defaultAddress.hex);

create a token

value
description
example

options

token options

{
            name = false,
            abbreviation = false,
            description = false,
            url = false,
            totalSupply = 0,
            trxRatio = 1, // How much TRX will `tokenRatio` cost?
            tokenRatio = 1, // How many tokens will `trxRatio` afford?
            saleStart = Date.now(),
            saleEnd = false,            
            freeBandwidth = 0, // The creator's "donated" bandwidth for use by token holders
            freeBandwidthLimit = 0, // Out of `totalFreeBandwidth`, the amount each token holder get
            frozenAmount = 0,
            frozenDuration = 0
        }

What's Next

TRX Functions