Welcome to use the Wallet-CLI.
If you need any help, please join the Telegram
git clone https://github.com/tronprotocol/wallet-cli.git
net {
type = mainnet
# type = testnet
}
fullnode = {
ip.list = [
"fullnode ip : port"
]
}
soliditynode = {
// the IPs in this list can only be totally set to solidity or pBFT.
ip.list = [
"ip : solidity port" // default solidity
]
# ip.list = [
# "ip : pBFT port" // or pBFT
# ]
} // NOTE: solidity node is optional
blockNumberStartToScan = 22690588 // NOTE: this field is optional
-
connect to fullNode and solidityNode
Take a look at: java-tron deployment Run both fullNode and solidity node in either your local PC or remote server.
NOTE: These nodes would consume a lot of memory and CPU. Please be aware if you do not use wallet, just kill them.
-
compile and run web wallet
$ cd wallet-cli $ ./gradlew build $ cd build/libs $ java -jar wallet-cli.jar
Wallet-cli connect to java-tron via gRPC protocol, which can be deployed locally or remotely. Check Run a web Wallet section.
We can configure java-tron node IP and port in src/main/resources/config.conf
, so that wallet-cli server can successfully talk to java-tron nodes.
Following is a list of Tron Wallet-cli commands: For more information on a specific command, just type the command on terminal when you start your Wallet.
Type any one of the listed commands, to display how-to tips.
After the funds are frozen, the corresponding number of shares and bandwidth will be obtained. Shares can be used for voting and bandwidth can be used for trading. The rules for the use and calculation of share and bandwidth are described later in this article.
Freeze operation is as follows:
> freezeBalance [OwnerAddress] frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH, 1 ENERGY] [receiverAddress]
OwnerAddress
The address of the account that initiated the transaction, optional, default is the address of the login account.
frozen_balance
The amount of frozen funds, the unit is Sun. The minimum value is 1000000 Sun(1TRX).
frozen_duration
Freeze time, this value is currently only allowed for 3 days.
For example:
> freezeBalance 100000000 3 1 address
After the freeze operation, frozen funds will be transferred from Account Balance to Frozen, You can view frozen funds from your account information. After being unfrozen, it is transferred back to Balance by Frozen, and the frozen funds cannot be used for trading.
When more share or bandwidth is needed temporarily, additional funds may be frozen to obtain additional share and bandwidth. The unfrozen time is postponed until 3 days after the last freeze operation
After the freezing time expires, funds can be unfroze.
Unfreeze operation is as follows:
> unfreezeBalance [OwnerAddress] ResourceCode(0 BANDWIDTH, 1 CPU) [receiverAddress]
Voting requires share. Share can be obtained by freezing funds.
- The share calculation method is: 1 unit of share can be obtained for every 1TRX frozen.
- After unfreezing, previous vote will expire. You can avoid the invalidation of the vote by re-freezing and voting.
NOTE The Tron Network only records the status of your last vote, which means that each of your votes will overwrite all previous voting results.
For example:
> freezeBalance 100000000 3 1 address # Freeze 10TRX and acquire 10 units of shares
> votewitness 123455 witness1 4 witness2 6 # Cast 4 votes for witness1 and 6 votes for witness2 at the same time
> votewitness 123455 witness1 10 # Voted 10 votes for witness1
The final result of the above command was 10 votes for witness1 and 0 vote for witness2.
After voting for the witness, you will receive the rewards. The witness has the right to decide the ratio of brokerage. The default ratio is 20%, and the witness can adjust it.
By default, if a witness is rewarded, he will receive 20% of the whole rewards, and 80% of the rewards will be distributed to his voters.
View the ratio of brokerage of the witness.
> getbrokerage OwnerAddress
OwnerAddress
The address of the witness's account, it is a base58check type address.
Query unclaimed reward.
> getreward OwnerAddress
OwnerAddress
The address of the voter's account, it is a base58check type address.
Update the ratio of brokerage, this command is usually used by a witness account.
> updateBrokerage OwnerAddress brokerage
OwnerAddress
The address of the witness's account, it is a base58check type address.
brokerage
The ratio of brokerage you want to update to, the limit of it: 0-100.
For example:
> getbrokerage TZ7U1WVBRLZ2umjizxqz3XfearEHhXKX7h
> getreward TNfu3u8jo1LDWerHGbzs2Pv88Biqd85wEY
> updateBrokerage TZ7U1WVBRLZ2umjizxqz3XfearEHhXKX7h 30
The bandwidth calculation rule is:
constant * FrozenFunds * days
Assuming freeze 1TRX(1_000_000 Sun), 3 days, bandwidth obtained = 1 * 1_000_000 * 3 = 3_000_000.
All contracts consume bandwidth, including transferring, transferring of assets, voting, freezing, etc. Querying does not consume bandwidth. Each contract needs to consume 100_000 bandwidth.
If a contract exceeds a certain time (10s), this operation does not consume bandwidth.
When the unfreezing operation occurs, the bandwidth is not cleared. The next time the freeze is performed, the newly added bandwidth is accumulated.
After each block is produced, the block award is sent to the account's allowance, and a withdraw operation is allowed every 24 hours from allowance to balance. The funds in allowance cannot be locked or traded.
Applying to become a witness account needs to consume 100_000TRX. This part of the funds will be burned directly.
It is not allowed to create accounts directly. You can only create accounts by transferring funds to non-existing accounts. Transferring to a non-existent account has minimum restriction amount of 1TRX.
$ cd wallet-cli
$ ./gradlew build
$ ./gradlew run
> RegisterWallet 123456 (password = 123456)
> login 123456
> getAddress
address = TRfwwLDpr4excH4V4QzghLEsdYwkapTxnm' # backup it!
> BackupWallet 123456
priKey = 075725cf903fc1f6d6267b8076fc2c6adece0cfd18626c33427d9b2504ea3cef' # backup it!!! (BackupWallet2Base64 option)
> getbalance
Balance = 0
> AssetIssue TestTRX TRX 75000000000000000 1 1 2 "2019-10-02 15:10:00" "2020-07-11" "just for test121212" www.test.com 100 100000 10000 10 10000 1
> getaccount TRfwwLDpr4excH4V4QzghLEsdYwkapTxnm
(Print balance: 9999900000
"assetV2": [
{
"key": "1000001",
"value": 74999999999980000
}
],)
# (cost trx 1000 trx for assetIssue)
# (You can query the trx balance and other asset balances for any account )
> TransferAsset TWzrEZYtwzkAxXJ8PatVrGuoSNsexejRiM 1000001 10000
Each account can only issue ONE TRC10 token.
> AssetIssue [OwnerAddress] AssetName AbbrName TotalSupply TrxNum AssetNum Precision StartDate EndDate Description Url FreeNetLimitPerAccount PublicFreeNetLimit FrozenAmount0 FrozenDays0 [...] FrozenAmountN FrozenDaysN
OwnerAddress (optional)
The address of the account which initiated the transaction. Default: the address of the login account.
AssetName
The name of the issued TRC10 token
AbbrName
The abbreviation of TRC10 token
TotalSupply
TotalSupply = Account Balance of Issuer + All Frozen Token Amount TotalSupply: Total Issuing Amount Account Balance Of Issuer: At the time of issuance All Frozen Token Amount: Before asset transfer and the issuance
TrxNum, AssetNum
These two parameters determine the exchange rate when the token is issued. Exchange Rate = TrxNum / AssetNum AssetNum: Unit in base unit of the issued token TrxNum: Unit in SUN (0.000001 TRX)
Precision
Precision to how many decimal places
FreeNetLimitPerAccount
The maximum amount of bandwidth each account is allowed to use. Token issuers can freeze TRX to obtain bandwidth (TransferAssetContract only)
PublicFreeNetLimit
The maximum total amount of bandwidth which is allowed to use for all accounts. Token issuers can freeze TRX to obtain bandwidth (TransferAssetContract only)
StartDate, EndDate
The start and end date of token issuance. Within this period time, other users can participate in token issuance.
FrozenAmount0 FrozenDays0
Amount and days of token freeze. FrozenAmount0: Must be bigger than 0 FrozenDays0: Must between 1 and 3653.
Example:
> AssetIssue TestTRX TRX 75000000000000000 1 1 2 "2019-10-02 15:10:00" "2020-07-11" "just for test121212" www.test.com 100 100000 10000 10 10000 1
> GetAssetIssueByAccount TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ # View published information
{
"assetIssue": [
{
"owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"name": "TestTRX",
"abbr": "TRX",
"total_supply": 75000000000000000,
"frozen_supply": [
{
"frozen_amount": 10000,
"frozen_days": 1
},
{
"frozen_amount": 10000,
"frozen_days": 10
}
],
"trx_num": 1,
"precision": 2,
"num": 1,
"start_time": 1570000200000,
"end_time": 1594396800000,
"description": "just for test121212",
"url": "www.test.com",
"free_asset_net_limit": 100,
"public_free_asset_net_limit": 100000,
"id": "1000001"
}
]
}
> UpdateAsset [OwnerAddress] newLimit newPublicLimit description url
Specific meaning of the parameters is the same as that of AssetIssue.
Example:
> UpdateAsset 1000 1000000 "change description" www.changetest.com
> GetAssetIssueByAccount TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ # View the modified information
{
"assetIssue": [
{
"owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"name": "TestTRX",
"abbr": "TRX",
"total_supply": 75000000000000000,
"frozen_supply": [
{
"frozen_amount": 10000,
"frozen_days": 1
},
{
"frozen_amount": 10000,
"frozen_days": 10
}
],
"trx_num": 1,
"precision": 2,
"num": 1,
"start_time": 1570000200000,
"end_time": 1594396800000,
"description": "change description",
"url": "www.changetest.com",
"free_asset_net_limit": 1000,
"public_free_asset_net_limit": 1000000,
"id": "1000001"
}
]
}
> TransferAsset [OwnerAddress] ToAddress AssertID Amount
OwnerAddress (optional)
The address of the account which initiated the transaction. Default: the address of the login account.
ToAddress
Address of the target account
AssertName
TRC10 token ID Example: 1000001
Amount
The number of TRC10 token to transfer
Example:
> TransferAsset TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz 1000001 1000
> getaccount TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz # View target account information after the transfer
address: TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz
assetV2
{
id: 1000001
balance: 1000
latest_asset_operation_timeV2: null
free_asset_net_usageV2: 0
}
> ParticipateAssetIssue [OwnerAddress] ToAddress AssetID Amount
OwnerAddress (optional)
The address of the account which initiated the transaction. Default: the address of the login account.
ToAddress
Account address of TRC10 issuers
AssertName
TRC10 token ID Example: 1000001
Amount
The number of TRC10 token to transfers
The participation process must happen during the release of TRC10, otherwise an error may occur.
Example:
< 236F div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="> ParticipateAssetIssue TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ 1000001 1000 > getaccount TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW # View remaining balance address: TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW assetV2 { id: 1000001 balance: 1000 latest_asset_operation_timeV2: null free_asset_net_usageV2: 0 }">> ParticipateAssetIssue TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ 1000001 1000 > getaccount TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW # View remaining balance address: TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW assetV2 { id: 1000001 balance: 1000 latest_asset_operation_timeV2: null free_asset_net_usageV2: 0 }