Skip to content

Commit 8353ae4

Browse files
committed
new release 4.7.7
1 parent fff5075 commit 8353ae4

File tree

7 files changed

+67
-244
lines changed

7 files changed

+67
-244
lines changed

docs/contracts/compiler.md

Lines changed: 4 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -13,141 +13,12 @@ Support the build, deploy, transplant, etc. for solidity language written smart
1313
[https://developers.tron.network/reference/what-is-tronbox](https://developers.tron.network/reference/what-is-tronbox)
1414

1515
<h3> 3. TronWeb </h3>
16-
Provide http api service for the usage of smart contract.
17-
[https://developers.tron.network/docs/tronweb-1](https://developers.tron.network/docs/tronweb-1)
16+
Provide javascript api for the usage of smart contract.
17+
[https://tronweb.network/docu/docs/intro/](https://tronweb.network/docu/docs/intro/)
1818

1919
<h3> 4. TronGrid </h3>
2020
Provide smart contract event query service.
2121
[https://developers.tron.network/docs/trongrid](https://developers.tron.network/docs/trongrid)
2222

23-
## Development
24-
25-
First you can use TronStudio to write, build and debug the smart contract. After you finish the development of the contract, you can copy it to [SimpleWebCompiler](https://github.com/tronprotocol/tron-demo/tree/master/SmartContractTools/SimpleWebCompiler) to compile to get ABI and ByteCode. We provide a simple data read/write smart contract code example to demonstrate:
26-
27-
```text
28-
pragma solidity ^0.4.0;
29-
contract DataStore {
30-
31-
mapping(uint256 => uint256) data;
32-
33-
function set(uint256 key, uint256 value) public {
34-
data[key] = value;
35-
}
36-
37-
function get(uint256 key) view public returns (uint256 value) {
38-
value = data[key];
39-
}
40-
}
41-
```
42-
43-
** Start a Private Net **
44-
45-
Make sure the fullnode code has been deployed locally, you can check if 'Produce block successfully' log appears in FullNode/logs/tron.log
46-
47-
** Develop a Smart Contract **
48-
49-
Copy the code example above to remix to debug.
50-
51-
** Compile in SimpleWebCompiler for ABI and ByteCode **
52-
53-
Copy the code example above to SimpleWebCompiler to get ABI and ByteCode.
54-
Because TRON's compiler is a little different from Ethereum, so you can not get ABI and ByteCode by using Remix. But it will soon be supported.
55-
56-
** Using Wallet-cli to Deploy **
57-
58-
Download Wallet-Cli and build
59-
60-
```text
61-
shell
62-
# download source code
63-
git clone https://github.com/tronprotocol/wallet-cli
64-
cd wallet-cli
65-
# build
66-
./gradlew build
67-
cd build/libs
68-
```
69-
70-
Note: You need to change the node ip and port in config.conf
71-
72-
start wallet-cli
73-
74-
```text
75-
java -jar wallet-cli.jar
76-
```
77-
78-
after started, you can use command lines to operate:
79-
80-
```text
81-
importwallet
82-
<input your password twice for your account>
83-
<input your private key>
84-
login
85-
<input your password you set>
86-
getbalance
87-
```
88-
89-
deploy contract
90-
91-
```text
92-
Shell
93-
# contract deployment command
94-
DeployContract contractName ABI byteCode constructor params isHex fee_limit consume_user_resource_percent <value> <library:address,library:address,...>
95-
96-
# parameters
97-
contract_name: Contract name
98-
ABI: ABI from SimpleWebCompiler
99-
bytecode: ByteCode from SimpleWebCompiler
100-
constructor: When deploy contract, this will be called. If is needed, write as constructor(uint256,string). If not, just write #
101-
params: The parameters of the constructor, use ',' to split, like 1, "test", if no constructor, just write #
102-
fee_limit: The TRX consumption limit for the deployment, unit is SUN(1 SUN = 10^-6 TRX)
103-
consume_user_resource_percent: Consume user's resource percentage. It should be an integer between [0, 100]. if 0, means it does not consume user's resource until the developer's resource has been used up
104-
value: The amount of TRX transfer to the contract when deploy
105-
library: If the contract contains library, you need to specify the library address
106-
107-
# example
108-
deploycontract DataStore [{"constant":false,"inputs":[{"name":"key","type":"uint256"},{"name":"value","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"key","type":"uint256"}],"name":"get","outputs":[{"name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] 608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029 # # false 1000000 30 0
109-
If it is deployed successfully, it will return 'Deploy the contract successfully'
110-
```
111-
112-
get the contract address
113-
114-
```text
115-
Your smart contract address will be: <contract address>
116-
117-
# in this example
118-
Your smart contract address will be: TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6
119-
```
120-
121-
call the contract to store data, query data
122-
123-
```text
124-
Shell
125-
# call contract command
126-
triggercontract <contract_address> <method> <args> <is_hex> <fee_limit> <value>
127-
128-
# parameters
129-
contract_address: Contract address, like TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6
130-
method: The method called, like set(uint256,uint256) or fool(), use ',' to split the parameters. Do not leave space between parameters
131-
args: The parameters passed to the method called, use ',' to split the parameters. Do not leave space between parameters
132-
is_hex: whether the input parameters is Hex, false or true
133-
fee_limit: The TRX consumption limit for the trigger, unit is SUN(1 SUN = 10^-6 TRX)
134-
value: The amount of TRX transfer to the contract when trigger
135-
136-
# trigger example
137-
## set mapping 1->1
138-
triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256,uint256) 1,1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000
139-
140-
## get mapping key = 1
141-
triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 get(uint256) 1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000
142-
```
143-
144-
If the function called is constant or view, wallet-cli will return the result directly.
145-
If it contains library, before deploy the contract you need to deploy the library first. After you deploy library, you can get the library address, then fill the address in library:address,library:address,...
146-
147-
```text
148-
# for instance, using remix to get the bytecode of the contract, like:
149-
608060405234801561001057600080fd5b5061013f806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f75dac5a14610046575b600080fd5b34801561005257600080fd5b5061005b610071565b6040518082815260200191505060405180910390f35b600073<b>__browser/oneLibrary.sol.Math3__________<\b>634f2be91f6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156100d357600080fd5b505af41580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b81019080805190602001909291905050509050905600a165627a7a7230582052333e136f236d95e9d0b59c4490a39e25dd3a3dcdc16285820ee0a7508eb8690029
150-
```
151-
152-
The address of the library deployed before is: TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54
153-
When you deploy, you need to use browser/oneLibrary.sol.Math3:TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 as the parameter of deploycontract.
23+
<h3> 5. Trident-java </h3>
24+
Trident-java is a lightweight SDK that includes libraries for working with TRON system contracts and smart contracts.

docs/contracts/contract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Smart contract is a computerized transaction protocol that automatically implements its terms. Smart contract is the same as common contract, they all define the terms and rules related to the participants. Once the contract is started, it can runs in the way it is designed.
66

7-
TRON smart contract support Solidity language in (Ethereum). Currently recommend Solidity language version is 0.4.24 ~ 0.4.25. Write a smart contract, then build the smart contract and deploy it to TRON network. When the smart contract is triggered, the corresponding function will be executed automatically.
7+
TRON smart contract support Solidity language in (Ethereum). You can find the latest solidity version in the [Tron solidity repository](https://github.com/tronprotocol/solidity/releases). Write a smart contract, then build the smart contract and deploy it to TRON network. When the smart contract is triggered, the corresponding function will be executed automatically.
88

99
## Smart Contract Features
1010
TRON virtual machine is based on Ethereum solidity language, it also has TRON's own features.

docs/introduction/dpos.md

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -81,54 +81,8 @@ When a fork occurs, an honest witness would always choose to produce blocks on t
8181
To ensure the safe and efficient operation of the blockchain system, TRON sets up an incentive model to encourage more nodes to join the network, thereby expanding the scale of the network. Every time a block is generated by the TRON network, a block reward of 16 TRX will be awarded to the super representative who produced the block, and a voting reward of 160 TRX will be awarded to all super representatives and super partners (super representative candidates who ranking 28th~ 127th are also called super partners), and they share the voting rewards proportionally according to the number of votes they get. At the same time, super representatives and partners will also deduct the rewards according to their commission ratio, and distribute the remaining part to voters according to the voter voting ratio.
8282

8383
## Proposal-based parameter adjustment
84-
An important characteristic of DPoS is that any parameter adjustment can be proposed on the chain, and witnesses will decide whether to approve the proposal by starting a vote. The advantage of this method is that it avoids hard fork upgrades when adding new features. Currently, TRON supports the following parameter adjustments:
84+
An important characteristic of DPoS is that any parameter adjustment can be proposed on the chain, and witnesses will decide whether to approve the proposal by starting a vote. The advantage of this method is that it avoids hard fork upgrades when adding new features. For the current dynamic parameters and values ​​of the TRON network, as well as past proposals, please refer to [here](https://tronscan.org/#/sr/committee).
8585

86-
1. The interval between two maintenance periods
87-
88-
2. The TRX cost of applying to be a bookkeeper candidate
89-
90-
3. The TRX cost of account activation
91-
92-
4. The bandwidth cost for one byte in each transaction
93-
94-
5. The TRX cost of issuing tokens on TRON
95-
96-
6. The rewards for producing each block
97-
98-
7. The total amount of TRX that is proportionately awarded to the first 127th witnesses (including bookkeeper candidates) with the most votes
99-
100-
8. The TRX cost of account activation through system contract
101-
102-
9. The bandwidth cost for account activation
103-
104-
10. The exchange rate between Energy and Sun
105-
106-
11. The TRX cost for building a TRC-10 token-based decentralized trading pair
107-
108-
12. The maximum CPU time allowed for a single transaction execution
109-
110-
13. Whether to allow changes of account names
111-
112-
14. Whether to allow the issuance of assets with duplicate names
113-
114-
15. Whether to allow resource delegation
115-
116-
16. The upper limit for Energy in TRON blockchain
117-
118-
17. Whether to allow TRC-10 asset transfer in smart contracts
119-
120-
18. Whether to allow adjustment to Energy upper limit
121-
122-
19. Whether to allow multi-signature
123-
124-
20. The TRX cost of updating account access
125-
126-
21. The TRX cost of multi-signature transactions
127-
128-
22. Whether to verify block and transaction protobuf message
129-
130-
## Bandwidth and energy mechanism
131-
To be continued...
13286

13387
## Appendix: Reference Documentations
13488

docs/mechanism-algorithm/account.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Introduction
44

5-
TRON uses account model. An account's identity is address. It needs private key signature to operate an account. An account has many attributes, like TRX balance, tokens balance, bandwidth, etc. TRX and tokens can be transferred from account to account and it costs bandwidth. An account can also issue a smart contract, apply to become a super representative candidate, vote, etc. All TRON's activities are based on account.
5+
TRON uses the 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.
66

77
## How to Create an Account
88

docs/mechanism-algorithm/multi-signatures.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
## Background
44

5-
!!! note
6-
**Since v3.5** In the past version, the transactions created in one account can only be signed by one private key, an account can only be managed by one private key. Since V3.5, an account can be managed by several private keys, and the transactions created in one account can be signed by serval private keys.
5+
Multiple signature functions allow for permission grading, and each permission can correspond to multiple private keys. This makes it possible to achieve multi-person joint control of accounts. This guide walks the user through TRON's multi-signature implementation and design.
76

87
Reference: [TIP-16: Account Multi-signature](https://github.com/tronprotocol/TIPs/blob/master/tip-16.md)
98

@@ -58,7 +57,7 @@ message AccountPermissionUpdateContract {
5857
- `witness`: Witness permission (if is witness)
5958
- `actives`: Active permission
6059

61-
This will override the Original account permission.
60+
This will override the Original account permission. Therefore, if you only want to modify the owner permission, witness (if it is a witnss account) and active permission also need to be set
6261

6362
#### Permission
6463

@@ -305,17 +304,3 @@ Please refer to [HTTP API](../api/http.md) and [RPC API](../api/rpc.md) for more
305304
rpc GetTransactionSignWeight (Transaction) returns (TransactionSignWeight) {}
306305
```
307306

308-
## Others
309-
310-
Since V3.5, what is the change after a new account is created?
311-
312-
When to create a new account, an owner permission and active permission will be generated automatically. Owner permission only contains one key, the weight and threshold are both 1. Active permission also contains one key, the weight and threshold are both 1, and operations is "7fff1fc0033e0000000000000000000000000000000000000000000000000000", means it support the execution of all contracts except AccountPermissionUpdateContract.
313-
After V3.5, if there is a new system contract, the default operations value of the newly created account will change. The operations of existing accounts will not change.
314-
315-
Please refer to [wallet-cli](https://github.com/tronprotocol/wallet-cli/blob/master/README.md) to check the usage of multi-signature.
316-
317-
## Fees
318-
319-
If you update your account permission, the fee is 100 TRX.
320-
321-
If a transaction is signed by more than 1 account, the fee is 1 TRX.

docs/mechanism-algorithm/sr.md

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The final output above is: Vote 3 votes for witness1, 7 votes for witness2
2626

2727
### Witnesses Brokerage
2828

29-
The default ratio is 20%, which can be modified by the witnesses.
29+
The default ratio is 20%. Super representatives and super representative partners can query the brokerage ratio through the `wallet/getBrokerage` interface, and can also modify the brokerage ratio through the `wallet/updateBrokerage` interface.
3030

3131
If a witness get 20% of the reward, and the other 80% will be awarded to the voters. If the brokerage ratio is set to 100%, the rewards are all obtained by the witness; if set to 0, the rewards are all sent to the voters.
3232

@@ -70,54 +70,16 @@ Committee can modify the TRON network parameters, like transacton fees, block pr
7070

7171
Only SRs, Partners and Candidates can create a proposal.
7272

73-
The network parameters can be modified([min,max]).
74-
75-
{0,1}: 1 means 'allowed' or 'actived', 0 means 'disallow', 'disable' or 'no'.
76-
77-
| # | Command | Value |
78-
| ---- | ---- | ---- |
79-
| 0 | MaintenanceTimeInterval <br> (To modify the maintenance interval of SR) | 6 Hours <br> [3 * 27, 24 * 3600] s |
80-
| 1 | AccountUpgradeCost <br> (To modify the cost of applying for SR account) | 9999 TRX <br> [0, 100000000000] TRX |
81-
| 2 | CreateAccountFee <br> (To modify the account creation fee) | 0.1 TRX <br> [0, 100000000000] TRX |
82-
| 3 | TransactionFee <br> (To modify the amount of TRX used to gain extra bandwidth) | 1000 Sun/Byte <br> [0, 100000000000] TRX |
83-
| 4 | AssetIssueFee <br> (To modify asset issuance fee) | 1024 TRX <br> [0, 100000000000] TRX|
84-
| 5 | WitnessPayPerBlock <br> (To modify SR block generation reward) | 16 TRX <br> [0, 100000000000] TRX |
85-
| 6 | WitnessStandbyAllowance <br> (To modify the rewards given to the top 27 SRs and <br> the following 100 partners) | 115200 TRX <br> [0, 100000000000] TRX |
86-
| 7 | CreateNewAccountFeeInSystemContract <br> (To modify the cost of account creation) | 1 TRX |
87-
| 8 | CreateNewAccountBandwidthRate <br> (To modify the consumption of bandwidth of account creation) | 1&nbsp;Bandwidth/Byte |
88-
| 9 | AllowCreationOfContracts <br> (To activate the Virtual Machine (VM)) | 1 <br> {0, 1} |
89-
| 10 | RemoveThePowerOfTheGr <br> (To remove the GR Genesis votes) | 1 <br> {0, 1}|
90-
| 11 | EnergyFee <br> (To modify the fee of 1 energy) | 140 Sun <br> [0, 100000000000] TRX |
91-
| 12 | ExchangeCreateFee <br> (To modify the cost of trading pair creation) | 1024 TRX <br> [0, 100000000000] TRX |
92-
| 13 | MaxCpuTimeOfOneTx <br> (To modify the maximum execution time of one transaction) | 50 ms <br> [0, 1000] ms |
93-
| 14 | AllowUpdateAccountName <br> (To allow to change the account name) | 0 <br> {0, 1} |
94-
| 15 | AllowSameTokenName <br> (To allow the same token name) | 1 <br> {0, 1} |
95-
| 16 | AllowDelegateResource <br> (To allow resource delegation) | 1 <br> {0, 1} |
96-
| 18 | AllowTvmTransferTrc10 <br> (To allow the TRC-10 token transfer in smart contracts) | 1 <br> {0, 1} |
97-
| 19 | TotalEnergyCurrentLimit <br> (To modify current total energy limit) | 50000000000 |
98-
| 20 | AllowMultiSign <br> (To allow the initiation of multi-signature) | 1 <br> {0, 1} |
99-
| 21 | AllowAdaptiveEnergy <br> (To allow adaptive adjustment for total Energy) | 0 <br> {0, 1} |
100-
| 22 | UpdateAccountPermissionFee <br> (To modify the fee for updating account permission) | 100 TRX |
101-
| 23 | MultiSignFee <br> (To modify the fee for multi-signature) | 1 TRX |
102-
| 24 | AllowProtoFilterNum <br> (To enable protocol optimization) | 0 <br> {0, 1} |
103-
| 26 | AllowTvmConstantinople <br> (To support the new commands of Constantinople) | 1 <br> {0, 1} |
104-
| 27 | AllowShieldedTransaction <br> (To enable shielded transaction) | 0 <br> {0, 1} |
105-
| 28 | ShieldedTransactionFee <br> (To modify shielded transaction fee) | 10 TRX <br> [0, 10000] TRX |
106-
| 29 | AdaptiveResourceLimitMultiplier <br> (To modify the adaptive energy limit multiplier) | 1000 <br> [1, 10000] |
107-
| 30 | ChangeDelegation <br> (Propose to support the decentralized vote dividend) | 1 <br> {0, 1} |
108-
| 31 | Witness127PayPerBlock <br> (Propose to modify the block voting rewards given to <br> the top 27 SRs and the following 100 partners) | 160 TRX <br> [0, 100000000000] TRX |
109-
| 32 | AllowTvmSolidity059 <br> (To allow TVM to support solidity compiler 0.5.9) | 0 <br> {0, 1} |
110-
| 33 | AdaptiveResourceLimitTargetRatio <br> (To modify the target energy limit) | 10 <br> [1, 1000] |
73+
Please refer to [here](https://tronscan.org/#/sr/committee) for TRON network dynamic parameters and their values.
11174

11275
Example (Using wallet-cli):
11376

11477
```console
11578
> createproposal id value
116-
# id: the serial number (0 ~ 33)
79+
# id: the serial number
11780
# value: the parameter value
11881
```
11982

120-
Note: In TRON network, 1 TRX = 1_000_000 SUN
12183

12284
### 3. Vote for a Proposal
12385

0 commit comments

Comments
 (0)