Skip to main content

Tron API

A set of methods for obtaining public keys, signing messages, and transactions specific to the Tron network.

Networks

NetworkSymbolIDDescription
TronTRX1Tron is a blockchain platform founded in 2017 that focuses on building a decentralized internet. It supports decentralized applications (DApps), smart contracts, and uses the TRX cryptocurrency. Tron aims to enable direct and secure content sharing without relying on centralized platforms, utilizing features like delegated proof-of-stake (DPoS) consensus and strategic partnerships.
Testnet TronTRX2Tron has testnets like Shasta and Nile, allowing developers to test their applications and smart contracts in a simulated environment before deploying them on the live Tron blockchain. Testnets provide a risk-free space for experimentation and development.

Methods

GET_PUBLIC_KEY

Returns an HD node corresponding to the specified BIP32 path.

Request

tron.proto
message GetPublicKey {
uint32 network = 1;
Bip32Path path = 2;
}
  • network: Network identifier, see NETWORKS
  • path: BIP32 path of the key to obtain the HD node.

Response

tron.proto
message GetPublicKeyResult {
uint32 depth = 1;
uint32 index = 2;
bytes publicKey = 3;
bytes chainCode = 4;
uint32 fingerprint = 5;
}

SIGN_PERSONAL_MESSAGE

The EIP-191 signing function creates a signature by combining a prefix (or salt) with the actual message, forming data that is then signed with a private key. The function uses the prefix "\u0019TRON Signed Message:\n" when signing a message.

Request

tron.proto
message SignPersonalMessage {
uint32 network = 1;
Bip32Path path = 2;
bytes msg = 3;
}
  • network: Network identifier, see NETWORKS
  • path: BIP32 path of the key for signing the message
  • msg: Message to be signed.

Response

tron.proto
message ECDSASignResult {
uint32 v = 1;
bytes r = 2;
bytes s = 3;
}
  • v, r, s:: component of the ECDSA signature.

SIGN_TRANSACTION

The Tron transaction signing function uses the sender's private key to create a cryptographic signature, which is then embedded in the raw transaction. This raw transaction includes key components like the sender's address, recipient's address, amount (TRX), data, and other details. The signed raw transaction can be broadcast to the Tron network for execution and inclusion in the blockchain.

Request

tron.proto
message SignTransaction {
uint32 network = 1;
Bip32Path path = 2;
bytes rawTx = 3;
repeated TokenMetadata tokens = 4;
}
  • network: Network identifier, see NETWORKS
  • path: BIP32 path of the key for signing the message
  • rawTx: Tron transaction
  • tokens: list of TokenMetadata

Response

tron.proto
message ECDSASignResult {
uint32 v = 1;
bytes r = 2;
bytes s = 3;
}