# Generating Signed Transaction

Install the npm library [here](🔗) or download the [utils](🔗) and the [lib](🔗) folders into your project to use natively.

Alternatively, you can use [API Signature and Broadcast Flow](🔗) to generate a signed transaction.

## Creating a Transaction

Import [transactionBuilder](🔗) and [crypto](🔗) into your JavaScript file.



This function from the imported transactionBuilder file will create the Transaction Object.



The parameters for this function are:

ValueData TypeDescription
tokenStringThe asset you want to send in your transaction. Example: "TRX"
fromStringThe address that you want to send from in your transaction. Example: "TDCMWoSbAfcegQqNUaRNjGhY4tAbdCmdwi"
toStringThe address that you want to send to in your transaction. Example: "TQ6pM81JDC2GhrUoNYtZGvPc7SvyqcemEu"
amountIntegerThe amount you want to spend of the specified token. If you want to send "TRX", make sure you multiply this value by 1000000. Example: If you want to send 2 TRX, use 2000000

The buildTransferTransaction specified above will return the value of buildTransferContract, which is the function that creates the Transaction Object.



## Signing the Transaction

This function from the imported crypto file will sign the Transaction Object.



The parameters for this function are:

ValueData TypeDescription
priKeyBytesByte Array. You can also use a String due the function converting the value to byte array if needed.The private key of the account.
TransactionTransaction ObjectThe bundled transaction to be sent.

After successfully running these functions, you will have a signed transaction that can be broadcasted to the TRON blockchain.

## Full Code Example



# Transaction Success

The following table details how to check if a transaction is successful.

(Script tags will be stripped)