Account
TRON uses an account model. The address is the unique identifier of an account, and a private key signature is required to operate an account. An account has many attributes, including TRX & TRC10 token balances, bandwidth, energy, Etc. An account can send transactions to increase or reduce its TRX or TRC10 token balances, deploy smart contracts, and trigger the smart contracts released by itself or others. All TRON accounts can apply to be Super Representatives or vote for the elected Super Representatives. Accounts are the basis of all activities on TRON.
Account Type
TRON has two account types::
- General account - that is to say, externally-owned account, controlled by anyone with the private key
- Contract account - a smart contract deployed on the TRON network and controlled by code. No one owns the private key of the contract accounts.
Both account types have the ability to::
- Receive, hold, and send TRX or tokens
- Interact with deployed smart contracts
Account & Key Pair
An account consists of a cryptographic pair of keys: a public key and a private key. The public key can be mapped to an address, while the private key is used to sign transactions. This key pair help prove that a transaction was actually signed by the sender and prevents forgeries.
This prevents malicious actors from broadcasting fake transactions because you can always verify the sender of a transaction.
For example, when Alice wants to send TRX from her account to Bob's, she needs to create a transaction and send it to the TRON network for verification. With the key pair, Alice can prove that she originally initiated the transaction request. Without the encryption mechanism, malicious actor Eve might be able to publicly broadcast a similar request, "send 5 TRX from Alice's account to Eve's account", while no one can validate whether or not the transaction is requested by Alice herself.
External Account Creation
TRON’s key pair generation algorithm is exactly the same as that of Ethereum, which uses the elliptic curve digital signature algorithm ECDSA-secp256k1. The process of key pair generation is: First, generate a random private key, which consists of 64 hexadecimal characters. Then, a public key is generated from the private key according to the Elliptic Curve Digital Signature Algorithm. Finally, take the last 20 bytes of the Keccak-256 result of the public key and add 41
in front of the Hex format address.
Account Address Format
In addition to the Hex format, the TRON network account address also has a Base58 format.
-
Hex
Compared with the TRON address in Hex format generated by the same private key and the Ethereum address, except for the first 41, everything else is exactly the same.418840E6C55B9ADA326D211D818C34A994AECED808
Note: The TRON address in Hex format removes the leading
41
to get the Ethereum address. -
Base58
A Base58 address can be obtained from the base check calculation of a Hex address. All Base58 addresses begin with T. For example:TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL
Example of Hex and Base58 format conversion using tronweb:
tronWeb.address.toHex("TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL") > "418840E6C55B9ADA326D211D818C34A994AECED808" tronWeb.address.fromHex("418840E6C55B9ADA326D211D818C34A994AECED808") > "TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL"
Ways to Create Accounts
Users can create an account in the following ways. That is to generate a private key and the corresponding address.
-
Create an account offline using the command line wallet wallet-cli
wallet> GenerateAddress { "address": "TU6JdEDQGPus64LTMksvnxF2cv4FQrXPCa", "privateKey": "b1ba1db577a36421924a87026cda27523851c6e88123d0a0a1def9a974376176" }
-
Create an account offline using the SDK, take TronWeb as an example:
tronWeb.createAccount() > address: { base58: "TDpBe64DqirkKWj6HWuR1pWgmnhw2wDacE" hex: "412A2B9F7641D0750C1E822D0E49EF765C8106524B" privateKey: "427139B43028A492E2705BCC9C64172392B8DB59F3BA1AEDAE41C88924960091" publicKey:"0404B604296010A55D40000B798EE8454ECCC1F8900E70B1ADF47C9887625D8BAE3866351A6FA0B5370623268410D33D345F63344121455849C9C28F9389ED9731" }
-
Create a private key and an address using the wallet application
Account Activation
Newly created accounts do not exist on the chain and need to be activated before they can be found via API queries or on the chain explorer. Accounts can be activated in the following two ways:
- Send any amount of TRX or TRC-10 tokens from an existing account to the new account;
- Call Java-tron's
wallet/createaccount
API to create a transaction from an existing account, then sign the transaction and broadcast it to the TRON network.
An account creation fee of 1 TRX is charged to activate a new account. Besides that, If the sender of the above two transactions has enough Bandwidth obtained by staking TRX, then creating an account will only consume bandwidth, otherwise, 0.1 TRX will be burned to pay for the bandwidth.
Alternatively, transferring TRX or TRC-10 tokens to an inactive account address in a smart contract can also complete the activation of the account. In addition to the bandwidth and energy consumed by normal contract calls, this way will only consume an additional 25,000 energy, and will not consume the 1 TRX account creation fee and the 0.1 TRX bandwidth fee.
Contract Account
When the smart contract is deployed to the TRON network, the corresponding contract account address is returned, which is calculated from the ID of the deployed contract transaction and the sender's account address. The format of the contract account address is the same as that of external accounts: hex or Base58. For example,
Base58: TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
Hex: 41A614F803B6FD780986A42C78EC9C7F77E6DED13C
Updated 4 months ago