Skip to content

Latest commit

 

History

History
203 lines (151 loc) · 7.72 KB

account.md

File metadata and controls

203 lines (151 loc) · 7.72 KB

Account commands

Query and update on-chain accounts, manage account metadata, and view local records.

How to create account

You can create accounts by transferring funds to non-existing accounts, or by initiating a transaction to create an account using the CreateAccount command. Either way the payer covers the cost of creating the account, which has two parts:

  • getCreateNewAccountFeeInSystemContract — always burned from the payer's TRX balance (1,000,000 SUN = 1 TRX on mainnet today).
  • The transaction's bandwidth — taken from the payer's staked bandwidth if there is enough of it (the free daily bandwidth does not count here). Only when staked bandwidth is insufficient does the chain burn getCreateAccountFee instead (100,000 SUN = 0.1 TRX on mainnet today).

So creating an account costs 1 TRX when the payer has enough staked bandwidth, and 1.1 TRX when it does not. Both parameters are proposal-adjustable; read them with getchainparameters instead of assuming fixed values.

CreateAccount

Create a new account with an inactive address. The payer covers the account-creation cost described above: getCreateNewAccountFeeInSystemContract (1 TRX on mainnet today), plus getCreateAccountFee (0.1 TRX) only if the payer lacks enough staked bandwidth.

> CreateAccount [OwnerAddress] Address

Example:

wallet> createaccount TDJ13zZzT3w91WMBm98gC3mwL7NbA6sQPA
{
	"raw_data":{
		"contract":[
			{
				"parameter":{
					"value":{
						"owner_address":"TQLaB7L8o3ikjRVcN7tTjMZsRYPJ23XZbd",
						"account_address":"TDJ13zZzT3w91WMBm98gC3mwL7NbA6sQPA"
					},
					"type_url":"type.googleapis.com/protocol.AccountCreateContract"
				},
				"type":"AccountCreateContract"
			}
		],
		"ref_block_bytes":"91a4",
		"ref_block_hash":"2bfcd3bb597f3d40",
		"expiration":1745333676000,
		"timestamp":1745333618318
	},
	"raw_data_hex":"0a0291a422082bfcd3bb597f3d4040e0cff9efe5325a6612640a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74437265617465436f6e7472616374122e0a15419d9c2bb5ee381a4396dd49ce42292e756b2e5e4b12154124764e4674179d4578cfc4c833c1ac1a09f6ce56708e8df6efe532"
}
Before sign transaction hex string is 0a84010a0291a422082bfcd3bb597f3d4040e0cff9efe5325a6612640a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74437265617465436f6e7472616374122e0a15419d9c2bb5ee381a4396dd49ce42292e756b2e5e4b12154124764e4674179d4578cfc4c833c1ac1a09f6ce56708e8df6efe532
Please confirm and input your permission id, if input y/Y means default 0, other non-numeric characters will cancel transaction.
y
Please choose your key for sign.

No.  Address                                    Name
1    TJEEKTmaVTYSpJAxahtyuofnDSpe2seajB         TJEEKTmaVTYSpJAxahtyuofnDSpe2seajB.json
2    TX1L9xonuUo1AHsjUZ3QzH8wCRmKm56Xew         TX1L9xonuUo1AHsjUZ3QzH8wCRmKm56Xew.json
3    TVuVqnJFuuDxN36bhEbgDQS7rNGA5dSJB7         TVuVqnJFuuDxN36bhEbgDQS7rNGA5dSJB7.json
4    TRvVXgqddDGYRMx3FWf2tpVxXQQXDZxJQe         Ledger-TRvVXgqddDGYRMx3FWf2tpVxXQQXDZxJQe.json
5    TYXFDtn86VPFKg4mkwMs45DKDcpAyqsada         TYXFDtn86VPFKg4mkwMs45DKDcpAyqsada.json
Please choose No. between 1 and 5, or enter search to search wallets
1
After sign transaction hex string is 0a84010a0291a422082bfcd3bb597f3d404083bd9cfae5325a6612640a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74437265617465436f6e7472616374122e0a15419d9c2bb5ee381a4396dd49ce42292e756b2e5e4b12154124764e4674179d4578cfc4c833c1ac1a09f6ce56708e8df6efe5321241ce53add4f75fe1838aa7e0a4e2411b3bbfce1d2164d68dac18507ed87e22ae503f65592a1161640834b3c0cef43c28f20b2d335120cc78b6f745a82ea95e451100
TxId is 26d6fcdfdc0018097ec4166eb140e19ebd597bea2212579d2f6d921b0ad6e56f
CreateAccount  successful !!

GenerateAddress

Generate an address and print out the address and private key.

GetAccount

Get account information based on an address.

> GetAccount Address

GetAccountById

Get account details through an account ID.

> GetAccountById accountId

GetAccountNet

Show the usage of bandwidth.

> GetAccountNet Address

GetAccountResource

Show the usage of bandwidth and energy.

> getAccountResource Address

GetAddress

Get the address of the current login account. Takes no parameters.

GetBalance

Get the balance of the current login account, or of Address when one is given.

> GetBalance [Address]

SetAccountId

Set a custom unique identifier (Account ID) for an account.

> SetAccountId [owner_address] account_id
> SetAccountId TEDapYSVvAZ3aYH7w8N9tMEEFKaNKUD5Bp 100

UpdateAccount

Modify the account name.

> UpdateAccount [owner_address] account_name
> UpdateAccount test-name

ViewBackupRecords

View backup records. You can configure the maximum number of records that maxRecords can retain in config.conf, excluding the number of buffer records.

wallet> ViewBackupRecords

=== View Backup Records ===
1. View all records
2. Filter by time range
Choose an option (1-2): 1

ViewTransactionHistory

View transaction history. You can configure the maximum number of records that maxRecords can retain in config.conf, excluding the number of buffer records.

wallet> ViewTransactionHistory
====================================
        TRANSACTION VIEWER
====================================

MAIN MENU:
1. View all transactions
2. Filter by time range
3. Help
4. Exit
Select option: 1

ShowReceivingQrCode

Display a receive-payment QR code for the current address. This command requires qrencode to be installed on the terminal in advance:

  • Debian/Ubuntu: sudo apt install qrencode
  • CentOS: sudo yum install qrencode
  • RHEL/Fedora: sudo dnf install qrencode
  • macOS: brew install qrencode
wallet> ShowReceivingQrCode 
█████████████████████████████████████
████ ▄▄▄▄▄ ██▄▀▀ ▄ ▀▄▀ ▀▀█ ▄▄▄▄▄ ████
████ █   █ █▄  ▀▄  ▀▄▀▀███ █   █ ████
████ █▄▄▄█ ██▀▄██▀▄▀▄▀ ▀██ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀ █ ▀ ▀ ▀ ▀ █▄▄▄▄▄▄▄████
████▄  █▄▄▄▄▄█  ██  ▀▀██▀  ██▀▄▀▀████
████▄█▀▄█▀▄▀▄▄█▀█▄█▀▄ █▀██▄ █▄▄ ▄████
████ █▄█▄ ▄▄▄██▀ ▀█▀▄██▄█▄▄ █ █ ▄████
████ ▄▀▄▀▄▄▀ ▄█▄ ▀ ▀█  █ ██▀▀█▄▄▄████
████▄█▀ ██▄██ ▄ ██ ██ █   ▄▄▄   ▄████
████▄▀▀ ▀█▄█▀▄▀▀█▄█▄█▀ ▀▄▀█ ▄▄▄ ▄████
████▄██▄█▄▄▄▀ ▄▀ ▀██  ▄▄ ▄▄▄  ▄▄▄████
████ ▄▄▄▄▄ █ █▀▄ ▀ █▄▀▄  █▄█ ▄█▄ ████
████ █   █ █▄▀▀ ██ ▄▄  █  ▄ ▄▄▄██████
████ █▄▄▄█ █ ▀█▀█▄█▄▀▀█▄ ▄█  ██▀▄████
████▄▄▄▄▄▄▄█▄▄██▄██ ▀▀▄▄▄▄█   ▀  ████
█████████████████████████████████████
TEDapYSVvAZ3aYH7w8N9tMEEFKaNKUD5Bp

See also

  • wallet — create / import / session management
  • chain-data — transaction and block queries
  • usdt — token balances and the address book