This project provides a simple implementation for transferring TRC20 tokens on the TRON blockchain using Go.
- Transfer TRC20 tokens between TRON addresses
- Sign transactions with a private key
- Broadcast signed transactions to the TRON network
.
├── go.mod
├── go.sum
├── main.go
├── readme.md
└── trc20/
└── trc20.go
-
Install dependencies:
go mod tidy -
Configure transfer parameters in
main.go:client := trc20.NewClient("https://nile.trongrid.io") err := client.TransferTRC20Token(trc20.TransferTRC20Input{ HexPrivateKey: "<YOUR_PRIVATE_KEY_HEX>", FromAddress: "<YOUR_FROM_ADDRESS>", ToAddress: "<RECIPIENT_ADDRESS>", ContractAddr: "<TRC20_CONTRACT_ADDRESS>", Amount: 10, // Amount to transfer Decimals: 6, // Token decimals })
-
Run the transfer:
go run main.go
- Ensure your account has enough TRX to pay for transaction fees.
- Use the correct TRC20 contract address and decimals for your token.
MIT