You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
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:
Copy file name to clipboardExpand all lines: docs/contracts/contract.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
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.
6
6
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.
8
8
9
9
## Smart Contract Features
10
10
TRON virtual machine is based on Ethereum solidity language, it also has TRON's own features.
Copy file name to clipboardExpand all lines: docs/introduction/dpos.md
+1-47Lines changed: 1 addition & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -81,54 +81,8 @@ When a fork occurs, an honest witness would always choose to produce blocks on t
81
81
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.
82
82
83
83
## 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).
85
85
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
Copy file name to clipboardExpand all lines: docs/mechanism-algorithm/account.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Introduction
4
4
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.
Copy file name to clipboardExpand all lines: docs/mechanism-algorithm/multi-signatures.md
+2-17Lines changed: 2 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,7 @@
2
2
3
3
## Background
4
4
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.
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
62
61
63
62
#### Permission
64
63
@@ -305,17 +304,3 @@ Please refer to [HTTP API](../api/http.md) and [RPC API](../api/rpc.md) for more
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.
Copy file name to clipboardExpand all lines: docs/mechanism-algorithm/sr.md
+3-41Lines changed: 3 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ The final output above is: Vote 3 votes for witness1, 7 votes for witness2
26
26
27
27
### Witnesses Brokerage
28
28
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.
30
30
31
31
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.
32
32
@@ -70,54 +70,16 @@ Committee can modify the TRON network parameters, like transacton fees, block pr
70
70
71
71
Only SRs, Partners and Candidates can create a proposal.
72
72
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 |
| 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 Bandwidth/Byte |
| 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.
0 commit comments