Skip to content

A Go implementation for transferring TRC20 tokens on the TRON blockchain, featuring transaction creation, signing, and broadcasting with simple configuration.

Notifications You must be signed in to change notification settings

technitish9123/tron-transfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tron TRC20 Token Transfer in Go

This project provides a simple implementation for transferring TRC20 tokens on the TRON blockchain using Go.

Features

  • Transfer TRC20 tokens between TRON addresses
  • Sign transactions with a private key
  • Broadcast signed transactions to the TRON network

Project Structure

.
├── go.mod
├── go.sum
├── main.go
├── readme.md
└── trc20/
    └── trc20.go

Usage

  1. Install dependencies:

    go mod tidy
    
  2. 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
    })
  3. Run the transfer:

    go run main.go
    

Notes

  • Ensure your account has enough TRX to pay for transaction fees.
  • Use the correct TRC20 contract address and decimals for your token.

License

MIT

About

A Go implementation for transferring TRC20 tokens on the TRON blockchain, featuring transaction creation, signing, and broadcasting with simple configuration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages