Transaction Management

Send Trx

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

Create an unsigned transaction.

ValueDescription
toAddress to send TRX to.
amountAmount of TRX to send.
fromOptional address that is transferring the Tokens.

Send Token

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

Creates an unsigned Token transfer transaction.

ValueDescription
toAddress to send Token to.
amountAmount of Tokens to send.
tokenIDIf the function accepts a trc 10 token , the parameter is the id of the token
fromOptional address that is transferring the Tokens.

Purchase Token

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

Creates an unsigned ICO Token purchase transaction.

ValueDescription
issuerAddressAddress that issued the Token.
amountAmount of Tokens to buy.
tokenIDName of the Token, matching the exact capitalization.
buyerOptional address that is buying the Tokens.

Freeze Balance

tronWeb.transactionBuilder.freezeBalance(tronWeb.toSun(100), 3, "ENERGY", "TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", "TXPHCbmRmjyRPtDFS6ERTPqUPfJfQSzp2m");

Creates an unsigned freeze TRX transaction.

ValueDescriptionData Type
amountAmount of TRX (in SUN) to freeze.Integer
durationLength in Days to freeze TRX for. Minimum of 3 days.Integer
resourceResource that you're freezing TRX in order to obtain. Must be either "BANDWIDTH" or "ENERGY".String
address (optional)Address of the owner of the TRX to be frozen (defaults to caller's default address).String
receiverAddressAddress of other user receiving the resource.String

Unfreeze Balance

tronWeb.transactionBuilder.freezeBalance("ENERGY", "TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m", "TXPHCbmRmjyRPtDFS6ERTPqUPfJfQSzp2m");

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

ValueDescriptionInteger Type
resourceResource that you're freezing TRX in order to obtain. Must be either "BANDWIDTH" or "ENERGY".String
address (optional)Address of the owner of the TRX to be unfrozen (defaults to caller's default address).String
receiver addressAddress of user in which the resource is being removed from, due to unfreeze.String

Withdraw Block Rewards

tronWeb.transactionBuilder.withdrawBlockRewards("TXPHCzmAmjyERtWES6EXTYqUPfJfQSzp2m");

Creates an unsigned Super Representative award balance withdraw transaction.

ValueDescription
addressOptional 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

valueDescription
addressaddress for applying for SR, hex string format
urlwebsite of SR

Vote

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

vote for an SR

valuedescription
votesdictionary of SR address : vote count key-value pair
voterAddressvoter address in HexString

Create Token

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

create a token

valuedescriptionexample
optionstoken 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