diff --git a/English_Documentation/Android_Wallet/Guide_to_Android_Wallet.md b/English_Documentation/Android_Wallet/Guide_to_Android_Wallet.md deleted file mode 100644 index bbef0933..00000000 --- a/English_Documentation/Android_Wallet/Guide_to_Android_Wallet.md +++ /dev/null @@ -1,160 +0,0 @@ -# Guide for Android - -## Introduction - -TRON Wallet is a multifunctional Android wallet for the TRON network. It gives you the possibility to interact quickly and easily with your account or to keep your TRX and other account data safe in a cold wallet setup. This app offers you one of the safest ways to protect your private data. The TRON Wallet, along with other TRON projects, is aimed to strengthen the community by establishing improved accessibility and communication for its users. - -### Features -Create Wallet -+ encrypts private information with a password -+ creates a private/public key pair -+ creates a 24 words recovery phrase (human readable private key recovery phrase) (BIP39) - -### Import Wallet -+ import with private key or 24 words recovery phrase -+ import public address only (watch only setup) - -### Wallet Functionalities -+ individual connection (connect to any node, e.g. private net) -+ check balance (TRX, tokens) -+ toggle market price view -+ check frozen amount -+ send TRX and tokens -+ receive using QR code -+ freeze TRX to get votes and bandwidth -+ submit votes for representatives -+ offline signing mechanism with QR code scanning -+ participate in token distributions -+ manually set your node connection - -### Block Explorer -+ see latest blocks -+ see latest transactions -+ see representative candidates -+ see connected nodes -+ see token distributions -+ see accounts -+ search filter - -### Wallet Setups - -Watch only setup -+ import only your public address -+ completely safe because no private information is accessible -+ you have a full overview of your account -+ creates unsigned transactions (used in combination with a cold wallet setup) - -Hot Wallet Setup -+ owns public and private key -+ a full overview of account -+ full access (sending, freezing, voting, ...) - -Cold Wallet Setup -+ minimalistic and safest wallet -+ owns public and private key -+ never connects to the internet (to be completely secure you should never connect your device to the internet) -+ signs transactions (from watch only setup) - -## Check information on blocks and recent transactions - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/区块和交易信息.png) - -## Check SR candidate information - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看SP候选信息.png) - -## Check node information - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看节点信息.png) - -## Participate in token offerings - + select the token you’d like to buy - + select quantity of purchase - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看token信息.png) - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/选择购买数量.png) - -## Check account information - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看账户信息.png) - -## Import wallet -+ import public address only (watch-only setup) -+ or import with private key or 24-word recovery phrase - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/倒入钱包/导入钱包.png) - -## Create account - -1. Cellphone screen display. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/1.桌面显示.png) -2. Account creation page in app. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/2.点击app之后的界面.jpg) -3. Tap CREATE WALLET. - + Cold wallet creation: toggle COLD WALLET SETUP, tick I AM AWARE OF THE RISKS and set the name and password. - + Hot wallet creation: don’t toggle COLD WALLET SETUP, tick I AM AWARE OF THE RISKS and set the name and password. - ![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/3.设置用户名和密码.png) -4. Tap GENERATE ADDRESS AND PRIVATE KEY and tap OK after reading the information page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/4.png) -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Wallet_for_Android/创建钱包账户/6.png) -5. Make sure to save your private key and 24-word recovery phrase. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/7.钱包创建好之后的页面%20now%20we%20see%20here%20is%20a%20public%20address%20%2Cprivate%20key%20and%2024%20words%20recovery%20phrase.jpg) -6. Tap continue and enter wallet page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/8.创建号钱包之后下滑页面找到continue按钮.jpg) - -## Voting - -Users can vote in hot wallet setup. - -1. Enter wallet page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/1.余额TP带宽显示界面.png) -2. Enter transfer page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/2.点击右侧的转账界面.png) -3. Select freeze and enter freeze page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/3.freeze页面.png) -4. Type in freeze amount. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/4.在freeze%20amount%20输入栏中键入希望冻结的TRX数量,然后点击freeze按钮,注,拥有多少冻结TRX就拥有多少投票权.jpg) -5. Enter your password,click send button and confirm the freeze. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/5.确认合约.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/6输入密码点击发送.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/7.发送成功.png) - -6. Return to balance page and click the vote button on the left-hand side. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/9.点击投票按钮.png) -7. Enter SR candidate page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/10.点击投票按钮之后进入超级代表候选人list页面,candidates一栏下显示的是所有待投票竞选的SR候选人.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/11.此为your%20votes页面下的显示情况,因为我们还没有对任何一个SR候选节点进行投票,所以列表中空空如也.png) -8. Select a SR candidate and enter the amount of votes. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/12.我们回到candidates一栏,任意选择一个SR候选人进行投票演示,以list中首个系节点为例,注,candidates%20list%20的排列是以票数多少为顺序.jpg) -9. Tap SUBMIT, enter the amount of votes and your password and submit votes. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/13.输入希望为此节点投出的票数.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/14.点击submit%20votes之后要求输入账户密码进行确认投票.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/16.png) -10. You can check your votes in the candidates tab and in the votes tab. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/17.为此候选人投过票后此候选人右侧显示你为其透过的票数.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/18.这个时候我们可以看到在your%20votes一栏中与投票前不同的是出现了我们为其投过票的SR候选人信息.jpg) - -## Initiate transfer - -1. Enter account page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转入/1.显示余额界面.png) - -2. Enter your address or scan QR-code to extract address. Enter the amount of TRX for transfer and tap SEND. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转入/3.点击右侧转账按钮后出现的界面(默认停留在send也就是转出TRX时的操作页面)可以通过在to一栏输入转入地址也可以点击右侧的二维码小标志,打开二维码扫描页面.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转入/4.点击receive后显示自己的钱包地址和二维码性质的地址,可供转出账户进行输入和scan,待转出账户操作完毕后,点击左上角返回箭头进行余额查看.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转出/6.输入希望转入的额度点击send.png) -3. Enter account password and tap SEND, and you will see the message of SENT SUCCESSFULLY. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转出/7.点击send之后需要输入账户密码进行确认.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转出/9.png) - -## Check history. - -1. Enter history page. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/历史记录/1.进入历史记录界面.png) - -2. Check each transaction information. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/历史记录/2.查看单笔交易信息.png) - -3. Check transaction information on Tronscan. -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/历史记录/3.tronscan上查看记录.png) diff --git a/English_Documentation/Frequently_Asked_Questions/Frequently_Asked_Questions_about_SR.md b/English_Documentation/Frequently_Asked_Questions/Frequently_Asked_Questions_about_SR.md deleted file mode 100644 index 4af526a3..00000000 --- a/English_Documentation/Frequently_Asked_Questions/Frequently_Asked_Questions_about_SR.md +++ /dev/null @@ -1,199 +0,0 @@ -Questions on the Full Node in private networks ------ -1. Q: Do I need to delete other addresses when replacing genesis.block.witnesses under config.conf with the address string given upon registration on https://tronscan.org/? - A: There is no need to delete. However, those address will be part of your network too, and useless if you don’ t have their private key. Att: Zion, Sun and Blackhole Accounts can not be deleted from genesis block config file, however you can change their addresses. - -2. Q: After replacing the seed.node.ip.list with the IP-address of my own public network and entering the command "java -jar java-tron.jar", how can I test if the deployment has been successful? Are there any testing interfaces or commands such as the "redis" command (which sends a ping to a server and gets a png back from the server) for a successfull deployment? - A: There is no default interface with java-tron. There are several ways to check if you have a successful deployment, as once your server is running you can send gRPC commands. First thing you will need to check is if the gRPC port is open: - - - netstat -tulnp| grep 50051 - - If the port is open, you can test your node using tronscan.org. Make sure your port and IP is open on internet. If you are using a private IP only, you will need to use other gRPC software - - ![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/FAQ/查询节点.png) - - You can also check if your node is running using the following terminal command: - - tail -f logs/tron.log |grep "MyheadBlockNumber" - - - -Questions on the Super Node in private networks ------ -1. Q: On a private network-environment, what relation exists between a Super Node and a FullNode? Is it preferred to deploy a Super Node over a FullNode? - A: A: On a private deployment, you will need at least one Super Node, no minimum requirements for FullNode. - -2. Q: As user voting determines Super Node selection in private networks, do I need to submit any application materials to the TRON foundation to be approved as a Super Node? - A: You don’ t need to submit material to TRON Foundation. - -3. Q: Why is data in private environments continuously synchronized and why is the journal still continuously updated to all other nodes? What is the difference between a private and a public environment then? - A: If this is related to the IP list-> A: On config.conf you need to update the seed.ip, if you use the same of the public network, and your computer is connected to the internet, it will attempt to connect to those nodes and the IP list will be saved in the DB, even if the connection fails. - If this is related to the Block and transactions -> A: On a private environment, you need to change p2p version and parent hash. If you use the same of mainnet or testnet, and your computer is connected to the internet. Your node will synchronize with public network. - - -Questions regarding operation in public networks ------ -1. Q: Which amount of memory is currently supported by the java software? - A: This will depend on your system environment: If you use 32-bit references, your heap is limited to 32 GB. If you are using 64-bit references, the size will be limited by your OS - Is a good practice to limit JVM heap size to fit inside one NUMA region (Around 1 TB on the bigger machines). If its JVM spans NUMA regions, GC will take much longer. - -2. Q: What performance does a processor need to have in order to run the node software? - A: At least 2 core CPUs are required to run a full node, at the minimum performance. If you are running on a private environment, with fewer transactions, then you will be fine with 4 CPU cores. So, the amount of network requests determines the CPU performance required to run the nodes. You will need to monitor your machine to decide the best requirements. In the PUBLIC NETWORK, TRON recommend at least 64CPU cores machine for a Super Representative to be approved. - - -3. Q: What ports should be opened to be externally accessible? - A: 18888 and 50051 are the two default ports. - -4. Q: What amount of data traffic can I expect? Will the data to be spread out to many hosts or will it be enough to just provide several nodes myself? - A: The network traffic will depend on the number of transactions. For a fast reference you could use the number of 200Bytes per transactions. Current network specification is 2000TPS (Transactions per seconds). - -5. Q: Upon successful token issuance, how do I change the status from “not started yet” to “participate”? - A: It is not possible to change the start date after you issue a token. You will need to wait for the time and date you have specified during creation. One can only change URL and Description after a token is created. - - -Questions regarding error occurrences/messages for Super Nodes ------ -1. Q: How can I interpret the following error message? - - 17:02:42.699 INFO [o.t.c.s.WitnessService] Try Produce Block
 17:02:42.699 INFO [o.t.c.s.WitnessService] Not sync
 - - A: This message means your node is not in sync with the network. To start produce blocks, you need to be in sync. Check your block height with the command: - - tail -f logs/tron.log |grep "MyheadBlockNumber" - -Questions regarding block generation by Super Nodes ------ -1. Q: Do Super Nodes produce blocks in rotation? What is the speed of block production? If there is no heartbeat message for 24 hours, will the node be removed from the list of Super Nodes? - A: Yes, Super Nodes produce blocks in rotation. Within current testing environment, one block is produced every 3 seconds. - -2. Q: If a Super Node cannot connect to the TRON network, how long will it take to be able to connect to the network again? - A: An SR's recovery depends only on it's connection speeds and it has nothing to do with the TRON network. - -3. Q: What’s the formula of the miss rate of Super Nodes’ block production? - A: “The number of blocks which supposedly should have been produced but aren't” will be taken into account. The number will keep accumulating and not be cleared. - -4. Q: Are the test version or the source code of Super Node server accessible now? - A: Yes, they are open-source and can be found at https://github.com/tronprotocol/java-tron. - -5. Q: How do I know if my test Super Node is running? - A: A: Run the following command: - - tail -f logs/tron.log |grep "Try Produce Block" - -6. Q: Based on this command: java -jar java-tron.jar -p yourself private key --witness -c yourself config.conf(Example:/data/java-tron/config.conf, how do I know that I am running a Super Node? - A: Run the following command: - - tail -f logs/tron.log |grep "Try Produce Block" - -7. Q: What are some command-line commands that can generate an address to be sent to TRON? Is web wallet the only way? - A: You can use Wallet CLI: https://github.com/tronprotocol/wallet-cli - -8. Q: If we want to test block production and other functions of the Super Node, do we need your votes to first become elected? - A: We will vote for you during your test trial. - -9. Q: How do we know if our own node has produced any blocks? - A: You can have this information using “https://tronscan.org/#/address/YOURADDRESS” - -10. Q: Will block production speed be 1 block / 5 seconds initially when the main-net launches? What is the expected timeline for this speed to reach 1 block / 3 seconds? - A: As soon as the main-net launches, the block production speed will be 1 block / 3 seconds. This will be updated to 1 block / 1 second in the future. - -11. Q: Is it within TRON’s plan to reduce the reward of TRX for block production by half? If yes, when? - A: The TRON Foundation is currently not planning to halve the TRX reward per block in the future. - -12. Q: If any of the 27 nodes malfunctions, will it be detected automatically and disqualified from elections? Will it remain as a Super Representative if such thing occur? If it won't, how and when it can regain the status? - A: An event of incompetency & missed block rates will be kept permanently and will be public. We expect voters to make a rational judgement by not voting for that particular SR in future voting cycles. - -Questions on the Super Representatives election ------ - -1. Q: Why I can't see any votes for my node at https://tronscan.org/#/network even though I’ve just submitted 2 million votes for it in the current voting round? - A: Results are updated every 6 hours, which will be announce only after this round of voting. - -2. Q: The amount of votes one holds is equivalent to the amount of his/her holding of TRX, so one vote can be made for one TRX, right? And the vote can be made to more than one Super Representative candidate? - A: A: Every TRX equals one vote can only be casted for one candidate. However, if you have more then one TP( or frozen TRX), you can spread the votes among all the candidates you want to. - -3. Q: Since TRX is required to obtain the right to vote, do we need to deposit a certain amount of TRX into Tronscan wallet?
 - A:Yes, you need to have TRX in order to be able to freeze them. But no, since your balance is held on the blockchain and not on Tronscan you can use any other wallet or means to freeze your TRX. - -4. Q: Is there a threshold for the daily election of 27 Super Representatives? Or is it encouraged to compete freely? - A: Free competition. Solicit the votes if you want them. Due to the existence of the GR system, an SR needs at least 100 million votes to replace a GR. There is no reward for GRs’ work. - -5. Q: Will TRX rewards be distributed evenly among these 27 Super Representatives or based on their hashrate? - A: As they produce blocks in rotation, the distribution of reward is irrelevant to hashrate. - -6. Q: If large mining operations run for the election, is hashrate exceeding 50% a possibility? - A: No. - -7. Q: What does the community support plan in the guidelines refer to? - A: it can be understood as the budget and attention to community development. - -8. Q: Does voting consume TRX? - A: Voting does not consume your TRX. - -9. Q: Does the status of Super Representatives only last for 24 hours? - A: No. The status of Super Representatives lasts for 6 hours. But if the results of the next election remains the same, the status will be maintained for another 6 hours. - -10. Q: Information on my node is not included in either of the two configuration nodes, namely build/resources/main/config.conf and build/resources/main/config.conf in the wallet. Is it still possible to discover my node and proceed to block production? - A: Set your own private key in the configuration file. With a successful vote a block will be produced. - -11. Q: How should I configurate my node after I’ve generated my private key? - A: Find localwitness within the configuration file and set your private key for the voting account. - -Others ------ -1. Q: Where can I find the file for RPC interface? - A: https://github.com/tronprotocol/documentation/tree/master/TRX - -2. Q: How do I specify the data storage directory when I activate my node? - A: Currently we can’t specify data storage directory yet. This function will be made possible in the upcoming version. - -3. Q: Can nodes serve as wallets? - A: There is a RPC interface for wallet on nodes, but no command can call the wallet directly. Wallets on full nodes can be used through the wallet-cli(commandline wallet) on another repo. - -4. Q: I don’t need to calculate my own address with the private key generated according to the file, do I? - A: You don’t have to worry about private key generation once you’ve successfully registered for an account. All you need to do is log in with you pin-code to access your address. - -5. Q: Is there a specific file to the calling of API like Bitcoin and Ethereum do? - A: Yes. It can be found in our Github documentation, please check https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md - -6. Q: Can Solidity Node and Full Node be employed on the same machine? Since we can’t specify data directory, will there be consequences to the two nodes’ sharing data? - A: You actually can specify data directory, config file parameter: db.directory = "database", and index.directory = "index". But you can also run FullNode.jar and SolidityNode.jar in different directories, and totally separate the data and log files. Remember to change the ports on config.conf, as two applications cant run on the same port. - -7. Q: Without Txid, how can we tell the users to inquire the transaction after our transfer? - A: You can use transaction hash as TXID. - -8. Q: Do Solidity Nodes synchronize blocks in accordance with Full Nodes? - A: Yes. - -9. Q: Is gateway for the connection to Solidity Nodes? - A: Solidity Nodes are set up for the storage of irrevocable blocks, a few blocks behind Full Nodes, so they are more suitable for the confirmation of transfer. You can connect to both Solidity Node and Full Node through gateway. - -10. Q: Listaccounts is a list of all addresses in the network? - A: For now, yes. But that may change, as it requires further discussion if the address base becomes enormous. - -11. Q:  How many decimal places are there for the balance? - A: Six. - -12. Q: Is the machines of the nodes in Beijing? Is the wall an issue? - A: Only 39.106.220.120 is in Beijing. The rest are in the US, Europe and Hong Kong. - -13. Q: Can token holders hold trx on tron.network for main-net conversion. If not what other wallets may be capable, or if only exchanges. - - A: No wallets are capable. Only exchanges. - -14. Q: In regards to TRON wallets, how many wallets are currently created. - - A: We already have wallet-cli, a web wallet and an iOS, android and chrome wallet. - -15. Q:Is 25Gbps a requirement or is 10Gbps satisfactory, or what is the threshold that is acceptable? - - A: There is no hard requirement for the network TRON Power(TP). The specification we gave is just an advice. - -16. Q: The people outside of the top 27 but in the top 100, are they ranked in order, 28-100 or is there an algorithm to just select who would be next if someone is voted out? - - A: For testnet we now just simply pick top 27 nodes with most votes. For mainnet and future testnet we may chose a different algorithm to add some randomness to part of the SR election. - -17. Q: Is a well formed technical plan all we need, or must we have the hardware before applying. - - A: The technical plan has two parts:1 before June 26 the first election & 2 after June 26 the first election. The second part just need the plan. For the first part you can only have the plan for now but only after you have hardware we can test your node and tell everyone "yes, they do have a test node."Applying to be a SR has no direct connection to qualifying a SR. diff --git a/English_Documentation/Glossary.md b/English_Documentation/Glossary.md deleted file mode 100644 index 75369403..00000000 --- a/English_Documentation/Glossary.md +++ /dev/null @@ -1,79 +0,0 @@ -# Glossary - -## Address -Account credentials on TRON's network are given by a key pair, which consists of a private key and a public key, the latter being derived from the former through an algorithm. The public key is usually used for session key encryption, signature verification and encrypting data that could be decrypted by a corresponding private key. -## Allowance -Block production rewards are sent to a sub-account. SRs can claim their reward on Tronscan. -## API -API is mainly used for the development of client terminals. With API support, token issuance platform can be designed by developers themselves. -## Application Layer -Developers are able to utilize interfaces for the realization of diverse DApps and customized wallets. -## Asset -In TRON's documents, asset is the same as token. -## Asset Issue -Issuing a token on the TRON Protocol can be done by anyone who has at least 1024 TRX in their account. -## Balance TRX -A TRX account shows the balance of TRX and other tokens and their USD equivalent. -## Bandwidth -To keep the network operating smoothly, TRON network only allows every account to initiate a limited number of transactions. To engage in transactions more frequently requires bandwidth points. Like TRON Power (TP), bandwidth points can be obtained through freezing TRX. Transactions are transmitted and stored in the network in byte arrays. Bandwidth points consumed in a transaction equals the size of its byte array. The ratio of "bandwidth points in an account / bandwidth capacity of TRON’s network" equals to the ratio of "frozen balance in an account / frozen balance on the entire network." -## Block -Blocks contains the digital records of your transactions. A complete block consists of the magic number, block size, blockheader, transaction counter and transactions. -## Blockheader -A blockheader is part of a block. It contains the hash of the previous block, the Merkle root, the timestamp, the difficulty and the nonce. -## CDN -CDN is short for Content Delivery Network. The main purpose of CDNs is to achieve faster and more stable transmission by serving content to end users through the nearest (geographical) server for their location. -## Cold Wallet -Cold wallet, also known as offline wallet, keeps the private key completely disconnected from any network. Cold wallets are usually installed on "cold" devices (computers or mobile phones staying offline) to ensure the security of TRX private key. Private keys are kept away from the network by utilizing QR codes for payment. -## Consensus -The consensus mechanism verifies and confirms transactions very swiftly through voting by special nodes. If several uninterested nodes can reach consensus on a transaction, we can deduce that the entire network can also reach consensus. -## Core Layer -Smart contract module, account management module and consensus module are three modules of the core layer. It’s TRON’s vision to base its functions on a stacked virtual machine and optimized instruction set. -## DApp -Decentralized application, Service that operates without a central trusted party. An application that enables direct interaction/agreements/communication between end users and/or resources without a middleman. -## Freeze -Freezing a certain amount of TRX earns users Tron Power to vote and bandwidth points for transactions and smart contract running. The number of bandwidth points equals the amount of TRX frozen*frozen duration (days). Frozen TRX cannot be traded or used for transfer. -## Frozen account -Unfrozen TRX re-enters circulation and can be traded. -## Google Protobuf -Independent from language-neutral, platform-neutral mechanism, ProtoBuf is a flexible and efficient means of data structuralization which can be used for communication protocols and data storage. It is faster, simpler and more compact. You can customize your own data structure of ProtoBuf and use a ProtoBuf compiler to generate source code in mainstream programming languages like C++, Java and Python to easily easily converted between object and code. -## GRPC -GRPC is a language-neutral, platform-neutral open-source RPC system, with which apps in the client end can directly invoke another app on a different device like local one. It facilitates the creation of DApps and decentralized services. Like many other RPC systems, gPRC is based on the following concepts: define a service and designate a way including the parameters and return type for it to be invoked remotely; deploy such an interface on server and run a gRPC server to process client end invoke; install a stub on the client end to allow remote invoke. -## Hot Wallet -Hot wallet, also known as online wallet, allows user's private key to be used while online, thus it could be susceptible to potential vulnerabilities or interception by malicious actors. -## JDK -JDK is the Java SDK used for Java applications on mobile devices and embedded systems. It is the core of Java development, comprising the Java application environment (JVM+Java class library) and Java tools. -## KhaosDB -TRON has a KhaosDB in the full-node memory that can store all the new fork chains generated within a certain period of time and supports witnesses to switch their own active chain swiftly into a new main chain. -## Level DB -Level DB will be initially adopted with the primary goal to meet the requirements of fast R/W and rapid development. After launching the main net, TRON will upgrade its database to an entirely customized one catered to its very own needs. -## Private Testnet -Private testnet: its developers configure their ID and server IP according to TRON's deployment configuration file to participate in testing. Only readily deployed developers are allowed access. -## Public Testnet -Public testnet: it is similar to TRON's mainnet launched on May 31, which everyone can visit and use. -## RPC -Remote Procedure Call. -## Scalability -Scalability is a feature of the TRON Protocol. It is the capability of a system, network, or process to handle a growing amount of work, or its potential to be enlarged to accommodate that growth. -## Storage layer -The tech team of TRON designed a unique distributed storage protocol consisting of block storage and state storage. The notion of graph database was introduced into the design of the storage layer to better meet the need for diversified data storage in the real world. -## Sun -Sun, abbreviated as S, replaced drop as the smallest unit of TRX. -## Super Representative -The 27 Super Representatives are the bookkeepers on TRON network. They are responsible for the verification and packing of all transaction data broadcasted on the network, similar to witness in DPOS systems. Information of the SRs are posted on TRON network for public access. The most convenient way to check out the list of SRs and their information is by using [TRON’s Blockchain explorer](https://tronscan.org/#/). -## Throughput -High throughput is a feature of TRON mainnet. It is also known as TPS, namely the maximum transaction capacity in a second. -## Timestamp -The approximate of block production time is recorded as Unix timestamp, which is the number of milliseconds that have elapsed since 00:00:00 UTC (1 Jan 1970). -## TKC -Token configuration. -## Token(Asset) -In TRON's documents, asset is the same as token. -## Transaction -Transaction refers to the process of token transfer between different accounts. -## Transaction Broadcasting -Transaction information is verified by nodes and broadcasted in the blockchain network. -## TRON Power -TRON Power (TP) can be obtained from balance freezing. All users in TRON's network are entitled to vote for Super Representatives they approve of. To vote, TP is needed, the amount of which is determined by the amount of frozen asset. Calculation of TP: 1 frozen TRX equals to 1 TP. When users unfreeze all frozen balance, they also lose their TPs, which invalidates their votes for the current voting round. To prevent invalid votes, users can refreeze balance. -##TVM(TRON Virtual Machine) -TRON Virtual Machine (TVM), is a lightweight, Turing complete virtual machine developed for Tron’s ecosystem, aimed at providing millions of global developers with custom-built blockchain system which is efficient, convenient, stable, secure and scalable. - \ No newline at end of file diff --git a/English_Documentation/Procedures_of_transaction_signature_generation.md b/English_Documentation/Procedures_of_transaction_signature_generation.md deleted file mode 100644 index a51fcbdf..00000000 --- a/English_Documentation/Procedures_of_transaction_signature_generation.md +++ /dev/null @@ -1,49 +0,0 @@ -# I.a Signing Steps for GRPC -1. Convert the transaction’s raw data to byte[]. -2. Hash the raw data using sha256. This gives you the Transaction ID. -3. Sign the results of sha256 with the private key. -4. Add the signed result to transaction. - -# I.b Signing Steps -1. Use the transaction ID included in the return data of an http request. -3. Sign the transaction ID with the private key. -4. Add the signed result to transaction. - - -# II. Signature algorithm -1. ECDSA algorithm, SECP256K. - -2. Example of signature data -``` - priKey:::8e812436a0e3323166e1f0e8ba79e19e217b2c4a53c970d4cca0cfb1078979df - pubKey::04a5bb3b28466f578e6e93fbfd5f75cee1ae86033aa4bbea690e3312c087181eb366f9a1d1d6a437a9bf9fc65ec853b9fd60fa322be3997c47144eb20da658b3d1 - hash:::159817a085f113d099d3d93c051410e9bfe043cc5c20e43aa9a083bf73660145 - r:::38b7dac5ee932ac1bf2bc62c05b792cd93c3b4af61dc02dbb4b93dacb758123f - s:::08bf123eabe77480787d664ca280dc1f20d9205725320658c39c6c143fd5642d - v:::0 - - Note: the signed result should be 65 byte in size—r 32 bytes, s 32 bytes and v 1 byte. -``` - -3. Signature verification - -When a full node receives the transaction, it will verify the signature, comparing an address calculated with hash, r, s and v with the address of the contract. Signature is successfully verified if the two addresses match. - -# III. Example of code -```java - public static Transaction sign(Transaction transaction, ECKey myKey) { - - Transaction.Builder transactionBuilderSigned = transaction.toBuilder(); - byte[] hash = sha256(transaction.getRawData().toByteArray()); - List listContract = transaction.getRawData().getContractList(); - - for (int i = 0; i < listContract.size(); i++) { - - ECDSASignature signature = myKey.sign(hash); - ByteString bsSign = ByteString.copyFrom(signature.toByteArray()); - //Each contract may be signed with a different private key in the future. - transactionBuilderSigned.addSignature( bsSign ); -   - } -``` - diff --git a/English_Documentation/Set_Up_Test_Environment/How_to_build_a_node.md b/English_Documentation/Set_Up_Test_Environment/How_to_build_a_node.md deleted file mode 100644 index 914c790e..00000000 --- a/English_Documentation/Set_Up_Test_Environment/How_to_build_a_node.md +++ /dev/null @@ -1,401 +0,0 @@ -# How to Build a Node - -## Prepare dependencies - -* JDK 1.8 (JDK 1.9+ are not supported yet) -* On Linux Ubuntu system (e.g. Ubuntu 16.04.4 LTS), ensure that the machine has [__Oracle JDK 8__](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04), instead of having __Open JDK 8__ in the system. If you are building the source code by using __Open JDK 8__, you will get [__Build Failed__](https://github.com/tronprotocol/java-tron/issues/337) result. - -## Getting the code - -* Use Git from the Terminal, see the [Setting up Git](https://help.github.com/articles/set-up-git/) and [Fork a Repo](https://help.github.com/articles/fork-a-repo/) articles. -* develop branch: the newnest code -* master branch: more stable than develop. -In the shell command, type: -```bash -git clone https://github.com/tronprotocol/java-tron.git -git checkout -t origin/master -``` - -* For Mac, you can also install **[GitHub for Mac](https://desktop.github.com/)** then **[fork and clone our repository](https://guides.github.com/activities/forking/)**. - -* If you'd rather not use Git, [Download the lastest source code file on our release page](https://github.com/tronprotocol/java-tron/releases) - -## Building from source code - -* Build in the Terminal - -```bash -cd java-tron -./gradlew build -``` - -* Build an executable JAR - -```bash -./gradlew clean shadowJar -``` - -* Build in [IntelliJ IDEA](https://www.jetbrains.com/idea/) (community version is enough): - - 1. Start IntelliJ. Select `File` -> `Open`, then locate to the java-tron folder which you have git cloned to your local drive. Then click `Open` button on the right bottom. - 2. Check on `Use auto-import` on the `Import Project from Gradle` dialog. Select JDK 1.8 in the `Gradle JVM` option. Then click `OK`. - 3. IntelliJ will open the project and start gradle syncing, which will take several minutes, depending on your network connection and your IntelliJ configuration. - 4. After the syncing finished, select `Gradle` -> `Tasks` -> `build`, and then double click `build` option. - -# Running - -## Running a Private Testnet - -### How to run a full node - -* You should modify the config.conf - 1. genesis.block.witnesses replace to yourself address - 2. seed.node ip.list replace to yourself ip list - -* In the Terminal - -```bash -./gradlew run -``` - -* Use the executable JAR - -```bash -cd build/libs -java -jar java-tron.jar -``` - -* In IntelliJ IDEA - 1. After the building finishes, locate `FullNode` in the project structure view panel, which is on the path `java-tron/src/main/java/org.tron/program/FullNode`. - 2. Select `FullNode`, right click on it, and select `Run 'FullNode.main()'`, then `FullNode` starts running. - -### How to run a SR Node -* use master branch -* You should modify the config.conf - 1. genesis.block.witnesses replace to yourself address - 2. seed.node.ip.list replace to yourself ip list - 3. the first Super Node start, needSyncCheck should be set false - 4. set p2pversion to 61 - -* Use the executable JAR(Recommended way) - -```bash -cd build/libs -java -jar java-tron.jar -p yourself private key --witness -c yourself config.conf(Example:/data/java-tron/config.conf) -Example: -java -jar java-tron.jar -p 650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812 --witness -c /data/java-tron/config.conf - -``` - -* In the Terminal - in the config.conf localwitness add yourself private key -```bash -./gradlew run -Pwitness=true -``` - -
-Show Output - -```bash -> ./gradlew run -Pwitness=true - -> Task :generateProto UP-TO-DATE -Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead. - -> Task :run -20:39:22.749 INFO [o.t.c.c.a.Args] private.key = 63e62a71ed39e30bac7223097a173924aad5855959de517ff2987b0e0ec89f1a -20:39:22.816 WARN [o.t.c.c.a.Args] localwitness size must be one, get the first one -20:39:22.832 INFO [o.t.p.FullNode] Here is the help message.output-directory/ -三月 22, 2018 8:39:23 下午 org.tron.core.services.RpcApiService start -信息: Server started, listening on 50051 -20:39:23.706 INFO [o.t.c.o.n.GossipLocalNode] listener message -20:39:23.712 INFO [o.t.c.o.n.GossipLocalNode] sync group = a41d27f10194c53703be90c6f8735bb66ffc53aa10ea9024d92dbe7324b1aee3 -20:39:23.716 INFO [o.t.c.s.WitnessService] Sleep : 1296 ms,next time:2018-03-22T20:39:25.000+08:00 -20:39:23.734 WARN [i.s.t.BootstrapFactory] Env doesn't support epoll transport -20:39:23.746 INFO [i.s.t.TransportImpl] Bound to: 192.168.10.163:7080 -20:39:23.803 INFO [o.t.c.n.n.NodeImpl] other peer is nil, please wait ... -20:39:25.019 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:25.067+08:00] -20:39:25.019 INFO [o.t.c.s.WitnessService] ScheduledWitness[448d53b2df0cd78158f6f0aecdf60c1c10b15413],slot[1946] -20:39:25.021 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:25.021 INFO [o.t.c.s.WitnessService] Sleep : 4979 ms,next time:2018-03-22T20:39:30.000+08:00 -20:39:30.003 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:30.052+08:00] -20:39:30.003 INFO [o.t.c.s.WitnessService] ScheduledWitness[6c22c1af7bfbb2b0e07148ecba27b56f81a54fcf],slot[1947] -20:39:30.003 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:30.003 INFO [o.t.c.s.WitnessService] Sleep : 4997 ms,next time:2018-03-22T20:39:35.000+08:00 -20:39:33.803 INFO [o.t.c.n.n.NodeImpl] other peer is nil, please wait ... -20:39:35.005 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:35.054+08:00] -20:39:35.005 INFO [o.t.c.s.WitnessService] ScheduledWitness[48e447ec869216de76cfeeadf0db37a3d1c8246d],slot[1948] -20:39:35.005 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:35.005 INFO [o.t.c.s.WitnessService] Sleep : 4995 ms,next time:2018-03-22T20:39:40.000+08:00 -20:39:40.005 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:40.055+08:00] -20:39:40.010 INFO [o.t.c.d.Manager] postponedTrxCount[0],TrxLeft[0] -20:39:40.022 INFO [o.t.c.d.DynamicPropertiesStore] update latest block header id = fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2 -20:39:40.022 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 97, 116, 101, 115, 116, 95, 98, 108, 111, 99, 107, 95, 104, 101, 97, 100, 101, 114, 95, 104, 97, 115, 104], BytesCapsule is org.tron.core.capsule.BytesCapsule@2ce0e954 -20:39:40.023 INFO [o.t.c.d.DynamicPropertiesStore] update latest block header number = 140 -20:39:40.024 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 97, 116, 101, 115, 116, 95, 98, 108, 111, 99, 107, 95, 104, 101, 97, 100, 101, 114, 95, 110, 117, 109, 98, 101, 114], BytesCapsule is org.tron.core.capsule.BytesCapsule@83924ab -20:39:40.024 INFO [o.t.c.d.DynamicPropertiesStore] update latest block header timestamp = 1521722380001 -20:39:40.024 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 97, 116, 101, 115, 116, 95, 98, 108, 111, 99, 107, 95, 104, 101, 97, 100, 101, 114, 95, 116, 105, 109, 101, 115, 116, 97, 109, 112], BytesCapsule is org.tron.core.capsule.BytesCapsule@ca6a6f8 -20:39:40.024 INFO [o.t.c.d.Manager] updateWitnessSchedule number:140,HeadBlockTimeStamp:1521722380001 -20:39:40.025 WARN [o.t.c.u.RandomGenerator] index[-3] is out of range[0,3],skip -20:39:40.070 INFO [o.t.c.d.TronStoreWithRevoking] Address is [73, 72, -62, -24, -89, 86, -39, 67, 112, 55, -36, -40, -57, -32, -57, 61, 86, 12, -93, -115], AccountCapsule is account_name: "Sun" -address: "IH\302\350\247V\331Cp7\334\330\307\340\307=V\f\243\215" -balance: 9223372036854775387 - -20:39:40.081 INFO [o.t.c.d.TronStoreWithRevoking] Address is [41, -97, 61, -72, 10, 36, -78, 10, 37, 75, -119, -50, 99, -99, 89, 19, 47, 21, 127, 19], AccountCapsule is type: AssetIssue -address: ")\237=\270\n$\262\n%K\211\316c\235Y\023/\025\177\023" -balance: 420 - -20:39:40.082 INFO [o.t.c.d.TronStoreWithRevoking] Address is [76, 65, 84, 69, 83, 84, 95, 83, 79, 76, 73, 68, 73, 70, 73, 69, 68, 95, 66, 76, 79, 67, 75, 95, 78, 85, 77], BytesCapsule is org.tron.core.capsule.BytesCapsule@ec1439 -20:39:40.083 INFO [o.t.c.d.Manager] there is account List size is 8 -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 448d53b2df0cd78158f6f0aecdf60c1c10b15413 -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 548794500882809695a8a687866e76d4271a146a -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 48e447ec869216de76cfeeadf0db37a3d1c8246d -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 55ddae14564f82d5b94c7a131b5fcfd31ad6515a -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is 6c22c1af7bfbb2b0e07148ecba27b56f81a54fcf -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is 299f3db80a24b20a254b89ce639d59132f157f13 -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is abd4b9367799eaa3197fecb144eb71de1e049150 -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is 4948c2e8a756d9437037dcd8c7e0c73d560ca38d -20:39:40.085 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 34, -63, -81, 123, -5, -78, -80, -32, 113, 72, -20, -70, 39, -75, 111, -127, -91, 79, -49], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@4cb4f7fb -20:39:40.086 INFO [o.t.c.d.TronStoreWithRevoking] Address is [41, -97, 61, -72, 10, 36, -78, 10, 37, 75, -119, -50, 99, -99, 89, 19, 47, 21, 127, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@7be2474a -20:39:40.086 INFO [o.t.c.d.TronStoreWithRevoking] Address is [72, -28, 71, -20, -122, -110, 22, -34, 118, -49, -18, -83, -16, -37, 55, -93, -47, -56, 36, 109], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@3e375891 -20:39:40.086 INFO [o.t.c.d.TronStoreWithRevoking] Address is [68, -115, 83, -78, -33, 12, -41, -127, 88, -10, -16, -82, -51, -10, 12, 28, 16, -79, 84, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@55d77b83 -20:39:40.090 INFO [o.t.c.d.Manager] countWitnessMap size is 0 -20:39:40.091 INFO [o.t.c.d.TronStoreWithRevoking] Address is [41, -97, 61, -72, 10, 36, -78, 10, 37, 75, -119, -50, 99, -99, 89, 19, 47, 21, 127, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@310dd876 -20:39:40.092 INFO [o.t.c.d.TronStoreWithRevoking] Address is [72, -28, 71, -20, -122, -110, 22, -34, 118, -49, -18, -83, -16, -37, 55, -93, -47, -56, 36, 109], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@151b42bc -20:39:40.092 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 34, -63, -81, 123, -5, -78, -80, -32, 113, 72, -20, -70, 39, -75, 111, -127, -91, 79, -49], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@2d0388aa -20:39:40.092 INFO [o.t.c.d.TronStoreWithRevoking] Address is [68, -115, 83, -78, -33, 12, -41, -127, 88, -10, -16, -82, -51, -10, 12, 28, 16, -79, 84, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@478a55e7 -20:39:40.101 INFO [o.t.c.d.TronStoreWithRevoking] Address is [-3, 48, -95, 97, 96, 113, 95, 60, -95, -91, -68, -83, 24, -24, 25, -111, -51, 111, 71, 38, 90, 113, -127, 91, -46, -55, 67, 18, -101, 37, -116, -46], BlockCapsule is BlockCapsule{blockId=fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2, num=140, parentId=dadeff07c32d342b941cfa97ba82870958615e7ae73fffeaf3c6a334d81fe3bd, generatedByMyself=true} -20:39:40.102 INFO [o.t.c.d.Manager] save block: BlockCapsule{blockId=fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2, num=140, parentId=dadeff07c32d342b941cfa97ba82870958615e7ae73fffeaf3c6a334d81fe3bd, generatedByMyself=true} -20:39:40.102 INFO [o.t.c.s.WitnessService] Block is generated successfully, Its Id is fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2,number140 -20:39:40.102 INFO [o.t.c.n.n.NodeImpl] Ready to broadcast a block, Its hash is fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2 -20:39:40.107 INFO [o.t.c.s.WitnessService] Produced -20:39:40.107 INFO [o.t.c.s.WitnessService] Sleep : 4893 ms,next time:2018-03-22T20:39:45.000+08:00 -20:39:43.805 INFO [o.t.c.n.n.NodeImpl] other peer is nil, please wait ... -20:39:45.002 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T20:39:45.001+08:00],now[2018-03-22T20:39:45.052+08:00] -20:39:45.003 INFO [o.t.c.s.WitnessService] ScheduledWitness[48e447ec869216de76cfeeadf0db37a3d1c8246d],slot[1] -20:39:45.003 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:45.003 INFO [o.t.c.s.WitnessService] Sleep : 4997 ms,next time:2018-03-22T20:39:50.000+08:00 -20:39:50.002 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T20:39:45.001+08:00],now[2018-03-22T20:39:50.052+08:00] -20:39:50.003 INFO [o.t.c.s.WitnessService] ScheduledWitness[6c22c1af7bfbb2b0e07148ecba27b56f81a54fcf],slot[2] -20:39:50.003 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:50.003 INFO [o.t.c.s.WitnessService] Sleep : 4997 ms,next time:2018-03-22T20:39:55.000+08:00 - -``` - -
- -* In IntelliJ IDEA - -
- - -Open the configuration panel: - - - -![](docs/images/program_configure.png) - -
- -
- - -In the `Program arguments` option, fill in `--witness`: - - - -![](docs/images/set_witness_param.jpeg) - -
- -Then, run `FullNode::main()` again. - -### Running multi-nodes - -To run TRON on more than one node, you need to specify several seed nodes' IPs in `config.conf` in `seed.node.ip.list`: -For private testnet, the IPs are allocated by yourself. - -## Running a local node and connecting to the public testnet - -* Ensure that the version number is consistent with the version number of the test network. If it is not consistent, Please modify the node.p2p.version in the config.conf file, and delete the out-directory directory (if it exists) - -### Running a Full Node - -* In the Terminal - -```bash -./gradlew run -``` - -* Use the executable JAR - -```bash -cd build/libs -java -jar java-tron.jar -``` - -It is almost the same as that does in the private testnet, except that the IPs in the `config.conf` are officially declared by TRON. - -### Running a SR Node - -* Use the executable JAR(Recommended way) - -```bash -cd build/libs -java -jar java-tron.jar -p yourself private key --witness -c yourself config.conf(Example:/data/java-tron/config.conf) -Example: -java -jar java-tron.jar -p 650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812 --witness -c /data/java-tron/config.conf - -``` - -It is almost the same as that does in the private testnet, except that the IPs in the `config.conf` are officially declared by TRON. - -
-Correct output - -```bash - -20:43:18.138 INFO [main] [o.t.p.FullNode](FullNode.java:21) Full node running. -20:43:18.486 INFO [main] [o.t.c.c.a.Args](Args.java:429) Bind address wasn't set, Punching to identify it... -20:43:18.493 INFO [main] [o.t.c.c.a.Args](Args.java:433) UDP local bound to: 10.0.8.146 -20:43:18.495 INFO [main] [o.t.c.c.a.Args](Args.java:448) External IP wasn't set, using checkip.amazonaws.com to identify it... -20:43:19.450 INFO [main] [o.t.c.c.a.Args](Args.java:461) External address identified: 47.74.147.87 -20:43:19.599 INFO [main] [o.s.c.a.AnnotationConfigApplicationContext](AbstractApplicationContext.java:573) Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@124c278f: startup date [Fri Apr 27 20:43:19 CST 2018]; root of context hierarchy -20:43:19.972 INFO [main] [o.s.b.f.a.AutowiredAnnotationBeanPostProcessor](AutowiredAnnotationBeanPostProcessor.java:153) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring -20:43:20.380 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:244) update latest block header timestamp = 0 -20:43:20.383 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:252) update latest block header number = 0 -20:43:20.393 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:260) update latest block header id = 00 -20:43:20.394 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:265) update state flag = 0 -20:43:20.559 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.567 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.568 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.568 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.569 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.596 INFO [main] [o.t.c.d.Manager](Manager.java:300) create genesis block -20:43:20.607 INFO [main] [o.t.c.d.Manager](Manager.java:306) save block: BlockCapsule -[ hash=00000000000000007b7a4241e41e57a9d4ca98217af86b8f3f6ac93f2bf11716 -number=0 -parentId=0000000000000000000000000000000000000000000000000000000000000000 -witness address= -generated by myself=true -generate time=1970-01-01 08:00:00.0 -merkle root=b5d2071118f2a33ac0ec377d947aabb4a8a3ddbe36d1a01cdbc38f58863de7c0 -txs size=5 -tx: {0:TransactionCapsule -[ hash=33d5385f666b0411a2e5829f57d26d7bf0a80b92865f732bd918a2b821bd14be -contract list:{ [0] type: TransferContract -from address=[B@7fe7c640 -to address=[B@4c4748bf -transfer amount=10000000000000000 -} -] -1:TransactionCapsule -[ hash=df936c9c026ee969781db8a20a2644c7b29688199a342047ce96b4d8bc79b32c -contract list:{ [0] type: TransferContract -from address=[B@7ce97ee5 -to address=[B@32c8e539 -transfer amount=15000000000000000 -} -] -2:TransactionCapsule -[ hash=96d505f8496585dab8e8300dfead6f395ab94f150861ffec3679314e257a0888 -contract list:{ [0] type: TransferContract -from address=[B@73dce0e6 -to address=[B@5a85c92 -transfer amount=10000000000000000 -} -] -3:TransactionCapsule -[ hash=950fece7e1a1a70cac971b68c3aadbd14163465aa079bf4d51d1ce5820d7f02d -contract list:{ [0] type: TransferContract -from address=[B@32811494 -to address=[B@4795ded0 -transfer amount=-9223372036854775808 -} -] -4:TransactionCapsule -[ hash=43dbd16a80393835f2bda8c71dc8ede389900425f3a328c16366c63a975ddb26 -contract list:{ [0] type: TransferContract -from address=[B@2eced48b -to address=[B@47c4ecdc -transfer amount=15000000000000000 -} -] -}] -20:43:20.607 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:252) update latest block header number = 0 -20:43:20.609 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:260) update latest block header id = 00000000000000007b7a4241e41e57a9d4ca98217af86b8f3f6ac93f2bf11716 -20:43:20.609 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:244) update latest block header timestamp = 0 -20:43:20.631 INFO [main] [o.t.c.w.WitnessController](WitnessController.java:64) initWits shuffled addresses:a055ddae14564f82d5b94c7a131b5fcfd31ad6515a -20:43:20.814 INFO [main] [o.t.c.c.a.Args](Args.java:415) New nodeID generated: d5294e129edcb5c648af927bf9b66d61ae11b356dca0b193d85a7c8771b0e8b211e603e3608542bf521456ff1371ad7a2400b6126bc0b1f872af7f479c55afe9 -20:43:20.815 INFO [main] [o.t.c.c.a.Args](Args.java:416) Generated nodeID and its private key stored in output-directory/database/nodeId.properties -20:43:20.861 INFO [main] [NodeManager](NodeManager.java:96) homeNode : Node{ host='47.74.147.87', port=18888, id=d5294e129edcb5c648af927bf9b66d61ae11b356dca0b193d85a7c8771b0e8b211e603e3608542bf521456ff1371ad7a2400b6126bc0b1f872af7f479c55afe9} -20:43:20.861 INFO [main] [NodeManager](NodeManager.java:97) bootNodes : size= 11 -20:43:21.054 INFO [PeerServerThread] [PeerServer](PeerServer.java:86) TCP listener started, bind port 18888 -20:43:21.073 INFO [main] [o.t.p.FullNode](FullNode.java:47) ******** application shutdown ******** -20:43:21.090 WARN [main] [o.t.c.s.WitnessService](WitnessService.java:268) WitnessCapsule[[B@620aa4ea] is not in witnessStore -20:43:21.146 WARN [PeerServerThread] [i.n.b.ServerBootstrap](Slf4JLogger.java:146) Unknown channel option 'SO_KEEPALIVE' for channel '[id: 0xfbdea61d]' -20:43:21.182 INFO [UDPListener] [UDPListener](UDPListener.java:104) Discovery UDPListener started, bind port 18888 -20:43:21.183 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:159) Reading Node statistics from PeersStore: 0 nodes. -20:43:21.227 INFO [main] [o.t.c.s.RpcApiService](RpcApiService.java:100) Server started, listening on 50051 -20:43:21.233 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.16.55:18888, id=791191e1], size=1 -20:43:21.234 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.18.49:18888, id=e82c773d], size=2 -20:43:21.234 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 18.188.111.53:18888, id=96db4efd], size=3 -20:43:21.235 INFO [main] [o.t.c.n.n.NodeImpl](NodeImpl.java:595) other peer is nil, please wait ... -20:43:21.235 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 54.219.41.56:18888, id=a9f6b900], size=4 -20:43:21.235 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 35.169.113.187:18888, id=80c10f5e], size=5 -20:43:21.236 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 34.214.241.188:18888, id=df0b9f01], size=6 -20:43:21.236 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.146.147:18888, id=976440e3], size=7 -20:43:21.237 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.144.25:18888, id=e22a29e9], size=8 -20:43:21.238 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.91.246.252:18888, id=c1dbf350], size=9 -20:43:21.241 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.91.216.69:18888, id=07cc3858], size=10 -20:43:21.241 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 39.106.220.120:18888, id=e9c9ffda], size=11 -20:43:21.278 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 39.106.220.120:18888, id=e9c9ffda] new Node{ host='39.106.220.120', port=18888, id=ffaba569088f7497e60c5d4b9a9c110151f09be6e17e448e92086cb8336e1602aa42abd59a6dd0fdbdcfd78bb9360e3574866ae5a624dd8445d4906f0245c75d}, size =11 -20:43:21.285 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.91.246.252:18888, id=c1dbf350] new Node{ host='47.91.246.252', port=18888, id=aed3688f52718c895d3181eb8223f6556f0689f6515862fb08e70200b5970aae7f6c97fc304946630db595c3f9d75a5e056496045e536dc55a1a143ccc49925d}, size =11 -20:43:21.287 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.91.216.69:18888, id=07cc3858] new Node{ host='47.91.216.69', port=18888, id=b45aa0d92931e47cb6a3d3ef5f8fd3ba88c74413d7ea539175d1466bff875900e15390a52599b504830d6cb7e7e2d9c68412e23434dbced7b13230914af2276e}, size =11 -20:43:21.435 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.16.55:18888, id=791191e1] new Node{ host='47.254.16.55', port=18888, id=1a70d710248c6832b5bce762bd8dd09e0bb401a3e57c360db7d502c6e80b023226f0540635a72c6f1589d134568d4dc2fe1e9ff49a66601d924d28fdc12303a9}, size =11 -20:43:21.445 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.18.49:18888, id=e82c773d] new Node{ host='47.254.18.49', port=18888, id=28da8efcc5f2d7c7ddc74487b99ef232fe4a97c2eb6b8bcc32edc97d1d4ef357eb8d2347e824ff898fe7936efae70f0b29861dec8c22923a40998230cf1db08f}, size =11 -20:43:21.454 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 34.214.241.188:18888, id=df0b9f01] new Node{ host='34.214.241.188', port=18888, id=7380f11f7b1ed4a715c41131ffb66234cef21d83973aef89f75d3cea7036b221dea1acbf580e8df4a315845faf25e94d3ffc3c02507f687931ebac9725f59961}, size =11 -20:43:21.480 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 18.188.111.53:18888, id=96db4efd] new Node{ host='18.188.111.53', port=18888, id=23de133437c136b856b2a6906ff21fb6fe74736efc0496a8f7850460a9a600ee6f02d79d7ca15954f69b36411e36e96ec70c5a1c0d4891db0ffb70db19503a23}, size =11 -20:43:21.503 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 35.169.113.187:18888, id=80c10f5e] new Node{ host='35.169.113.187', port=18888, id=156dc977b34fa77a1377e5c4f9e2862f34b2c5309f9d86220b5dd4200383f4fb1859c3de90a8acecf9d91edff697a8f0a59346a239e3d5e269aed0b0186c8bc5}, size =11 -20:43:21.533 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.144.25:18888, id=e22a29e9] new Node{ host='47.254.144.25', port=18888, id=273eb89021d9741f0ff47c99c4e03d88776606acf39c970d7549512baf8444166883016e3c0859f7df3042fcfebf52b0af3d6cb216145b677eba10c6161c0cbc}, size =11 -20:43:21.543 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.146.147:18888, id=976440e3] new Node{ host='47.254.146.147', port=18888, id=1868f20b346420dcc1826551cc1427df36313f21fb077ba714210beb270b05a865516d53a734ccdd00468e23d21f1beef6c12299e7a4eda40408bf242ba6a2f8}, size =11 -20:43:21.729 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:141) Try Produce Block -20:43:21.792 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:107) Not sync -20:43:22.047 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:10846, id=d456c5af], size=12 -20:43:22.048 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:10846, id=d456c5af], size=13 -20:43:22.048 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:23018, id=d456c5af], size=14 -20:43:22.049 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 139.162.177.66:18888, id=d689b030], size=15 -20:43:22.049 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 168.235.68.117:18888, id=d04f7fa0], size=16 -20:43:22.049 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 185.101.157.48:18888, id=d00a272a], size=17 -20:43:22.050 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 89.201.166.70:18888, id=d2af1da8], size=18 -20:43:22.050 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.27.171.102:18888, id=c2dbea82], size=19 -20:43:22.051 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 35.197.108.225:18888, id=cb71adfc], size=20 -20:43:22.051 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 128.1.44.16:18888, id=c042b706], size=21 -20:43:22.052 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:43966, id=c6efd4d7], size=22 -20:43:22.053 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:43966, id=c6efd4d7], size=23 -20:43:22.053 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:48162, id=c1958356], size=24 -20:43:22.054 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 127.0.0.1:18888, id=ffaba569], size=25 -20:43:22.054 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 114.247.223.59:65036, id=fb716ca2], size=26 -20:43:22.169 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:15869, id=d80bda91], size=27 -20:43:22.169 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 83.87.113.32:18888, id=f093814a], size=28 -20:43:22.170 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 217.198.124.133:18888, id=e3c811ee], size=29 -20:43:22.170 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 142.227.120.102:18888, id=f49bc300], size=30 -20:43:22.171 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:34900, id=932a6b9d], size=31 -20:43:22.266 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 54.95.77.190:18888, id=d07f46e2], size=32 -20:43:22.266 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 23.239.19.106:18888, id=d3753c48], size=33 -20:43:22.267 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:42096, id=d92bec47], size=34 -20:43:22.267 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 173.14.84.113:26307, id=d95e9fe1], size=35 -20:43:22.267 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 195.224.160.13:54631, id=d9a14e17], size=36 -20:43:22.268 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 114.247.223.59:43160, id=dc87d741], size=37 -20:43:22.268 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:42096, id=d92bec47], size=38 -20:43:22.268 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 68.101.240.4:1024, id=dbb7c4a1], size=39 -20:43:22.269 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.93.9.236:18888, id=d850df83], size=40 -20:43:22.269 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:15837, id=d80bda91], size=41 -20:43:22.269 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 31.146.78.129:1024, id=c2b1d172], size=42 -20:43:22.270 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 95.137.168.179:28228, id=c2b1d172], size=43 -20:43:22.295 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:141) Try Produce Block -20:43:22.296 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:107) Not sync - -``` - -Then observe whether block synchronization success,If synchronization successfully explains the success of the super node \ No newline at end of file diff --git a/English_Documentation/TRON_Accelerator.md b/English_Documentation/TRON_Accelerator.md deleted file mode 100644 index 5d5a1878..00000000 --- a/English_Documentation/TRON_Accelerator.md +++ /dev/null @@ -1,54 +0,0 @@ -# TRON Accelerator(Deprecated) - -## Please note this project does not interact with current TRON Accelerator online DApp competition starts from Dec 1st to Jan 5th. - -#### Introduction - -To show support for the community and expand TRON’s ecosystem, TRON will offer developers USD$100,000 loans to help resolve budget shortage and support subsequent R&D and operations. - -#### Loan Amount & Disbursement - -Loan Amount: USD$100,000 - -Disbursement: Within 6 – 24 hours - -Disbursement Method: Once eligibility for TRON Accelerator is verified, applicants will receive the equivalent of USD$100,000 in digital assets from the TRON Foundation. After funds are disbursed, TRON will publicize information on participating projects and funding flows on official TRON channels. - -#### Repayment - -There are currently two repayment methods: - -+ If the developer’s project completes a new round of financing, the loan of USD$100,000 will be converted to its equivalent in equity, at 80% of the company’s new valuation amount. [USD$100,000 / (0.80 x New Valuation)] -+ Loans provided through TRON Accelerator will be interest-free for the first 18 months. The developer shall repay the principal balance of USD$100,000 within 18 months, either in USD or mainstream digital asset equivalent at the time of repayment. - -By setting up TRON Accelerator, TRON aims to expand and strengthen its network ecosystem, instead of seeking short-term commercial gains. If projects fail due to force majeure, the developer does not need to repay the principal balance. - -#### Application Requirements - -+ Developer submits application to the TRON Foundation. Application must include product description and project achievements (including but not limited to product links and APKs). - -+ Applicant must verify software ownership. - -+ Applications that only provide a project plan and description will not receive a response. - -+ Upon approval, qualified applicants will receive funds totaling USD$100,000 in convertible debt. - -+ Evaluation standards: The product should be in the demo stage or beyond. Developers should demonstrate rigorous work ethic and the desire for a long-term partnership with TRON to build a community-centric ecosystem. - -+ Funding usage policy: Funding must be used to support further project development or operations for the applicant. - -#### Eligible Projects - -The scope of eligible projects includes but is not limited to the following blockchain-based developments: - -+ DApps—finance, payment, gaming, currency, IoT, energy management, social media, communications - -+ High quality utility applications for search, conversion, development assistance, etc. - -*Projects must be TRON related. - -#### How to Apply - -1. Developers should submit applications to the TRON Foundation (loan@tron.network) with their project description and product achievements (including but not limited to product link or APKs). - -2. We will reach out to developers who pass our assessment. Fund disbursement of USD$100,000 in direct convertible loans will be completed in a timely fashion. diff --git a/English_Documentation/TRON_BUG-BOUNTY_Program/TRON_BUG-BOUNTY_Program.md b/English_Documentation/TRON_BUG-BOUNTY_Program/TRON_BUG-BOUNTY_Program.md deleted file mode 100644 index 9def7718..00000000 --- a/English_Documentation/TRON_BUG-BOUNTY_Program/TRON_BUG-BOUNTY_Program.md +++ /dev/null @@ -1,3 +0,0 @@ -# Tron bug bounty has moved to HackerOne - -https://hackerone.com/tronfoundation diff --git a/English_Documentation/TRON_Blockchain_Explorer/Guide_for_Tronscan_Wallet.md b/English_Documentation/TRON_Blockchain_Explorer/Guide_for_Tronscan_Wallet.md deleted file mode 100644 index 359412bb..00000000 --- a/English_Documentation/TRON_Blockchain_Explorer/Guide_for_Tronscan_Wallet.md +++ /dev/null @@ -1,31 +0,0 @@ -# Guide for Tronscan Wallet - -## 1. Open Tronscan and create/log in to wallet. - - https://tronscan.org/#/ - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png) - -## 2. Enter your password. - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png) - -## 3. Download encrypted key. (Your password encrypts the private key and both are needed to access your wallet.) - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png) - -## 4. Save your private key by copying it to a local file or printing a paper wallet. - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png) - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png) - -## 5. You’ll be able to enter the account management page once you are successfully registered. - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png) - -## 6. Notes: - -Private key means access to your account, so please store your private key securely to prevent loss or leaking. - -Address (public key) is used for transfers, thus it can be given to others. \ No newline at end of file diff --git a/English_Documentation/TRON_Blockchain_Explorer/Guide_to_Blockchain_Explorer.md b/English_Documentation/TRON_Blockchain_Explorer/Guide_to_Blockchain_Explorer.md deleted file mode 100644 index 5178211b..00000000 --- a/English_Documentation/TRON_Blockchain_Explorer/Guide_to_Blockchain_Explorer.md +++ /dev/null @@ -1,163 +0,0 @@ -# Guide to Blockchain explorer - -Use the block explorer at https://tronscan.org. - -## Blockchain module - -### Block search - -Information on all blocks—from the genesis block to all current blocks—can be found on this page, including block height, its previous block and the corresponding byte size. You can also use the search bar to check block height and SR nodes. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查看区块.png) - -### Transaction search - -You can search for transaction records on this page. Information on the sender and the recipient’s address, the amount of TRX transferred, block height of transaction record, corresponding Hash and production time can all be found. You can also use the search bar to look for a specific transaction by Hash. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查询账户.png) - -### Check address/transaction statistics - -On the statistics page, we can see figures of the top 25 TRX holders, TRX transferred in the past hour, transactions in the past hour and the trend of average block size. 'The Tronscan will continue to create more data visualizations for the users' convenience. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查询账户.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查看地址交易统计数据.png) - -### Check block Live - -Block Live is a special feature of Tronscan, with which users can check the real-time transaction records, votes, token issuance and participation, and nodes. We can also use filters to view only our desired contents. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查看区块直播.png) - -### Check node information - -This page shows the number of nodes and the country with most nodes. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/节点信息/数量与分布.png) - -This page shows the geographical distribution of TRON’s nodes. From the density of nodes in different regions, users can have a straightforward impression of where they are located. With the embedded Google map, users can zoom in and out of the map to know about the specific details. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/节点信息/地图分布.png) - -This page shows the following information on the nodes: IP address, hostname, block height, GPRC, GPRC m/s and time of the last update. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/节点信息/节点信息.png) - -## Check SR and SR candidate information - -Users can check out the Super Representative list which includes information on the last block, number of blocks produced, number of blocks missed, productivity and votes. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/SP和SP候选信息/SP信息.png) -![](https://github.com/ybhgenius/Documentation/blob/master/images/Blockchain-Explorer/SP和SP候选信息/SP候选信息.png) - -Users can also check out corresponding links to find out more about the SRs. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/SP和SP候选信息/查看详细信息.png) - -## Tokens - -Users can participate in token offerings, get information through token overview or create their own tokens. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/三大模块.png) - -To participate in token offerings, click on PARTICIPATE and enter an amount to TRX to purchase a certain type of token. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/参与代币.png) - -Users can also view information on all tokens, including their name, total supply, total amount issued and the registration date. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/代币概览.png) - -Users can also create their own tokens. Click on CREATE to enter the token creation page, fill in token details, click ISSUE TOKEN and their own token can be successfully issued. - -Token creation is very simple in TRON ecosystem. Just set up the required parameters and you are done. The parameters are as follows: - -+ Token name -+ Total supply -+ Token description -+ Website URL: to provide users with more information on the token they are purchasing. -+ Token exchange rate with TRX. -+ Participation period: during the participation period, users can exchange TRX for tokens. - -A one-time service charge of 1024 TRX is required to create token. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/创建代币1.png) -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/创建代币2.png) - -## View latest TRX market information - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/市场资讯/市场资讯.png) - -## Votes - -### 1. Open TRON blockchain explorer to sign in or create wallet. - - https://tronscan.org/#/ - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png) - -### 2. Enter password. (The password encrypts your private key. You will need the password and the private key to unlock your wallet.) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png) - -### 3. Download encrypted key - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png) - -### 4. Save your private key by copying the string to a local file or by printing. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png) - -### 5. You will be able to enter your account page after successful account creation. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png) - -### 6. You can only vote when you have TRX. You can request 10,000 TRX to vote on the bottom of the page. You may request TRX 10 times per account. After successful request, you can check your balance in your WALLET. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png) - -### 7. Freeze TRX prior to voting for SR candidates. - -+ Click FREEZE in your account. -+ Enter the amount of TRX you’d like to freeze. -+ Check “I confirm to freeze ***TRX for a least of 3 days.” -+ Click FREEZE BALANCE to freeze TRX. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png) - -**Freezing Note** - -Only TRX can be frozen. Freezing TRX enables two additional features: get Tron Power and bandwidth. With TPs, users can vote for SR candidates. When TRX is unfrozen, previous votes will lose effect, which can be avoided by refreezing TRX. Bandwidth points will not be cleared when TRX is unfrozen. New bandwidth points will be accumulated upon the next TRX freeze. - -### 8. To vote for SR candidates, find VOTEs in the navigation bar and click START VOTING. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png) - -### 9. Select a Super Representative and enter the voting page. Enter an amount of votes and click SUBMIT VOTES to cast your votes. You will be shown a notice for successful submission. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png) - -### 10. Reset your votes for a given SR candidate by clicking RESET. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png) - -**Voting Note** - -Enter an amount of votes to vote for an SR candidate. Voting requires TPs, which can be obtained through freezing TRX at 1 TRX for 1 TP. 1 TP equals 1 vote. When TRX is unfrozen, previous votes will lose effect, which can be avoided by refreezing TRX. Your vote will be successful as long as the number of votes casted is no more than the amount of TPs owned. You can cast as many votes as you like for an SR candidate. A successful vote submission costs 10^5 bandwidth points, unless it is 10s or more away from the previous contract (vote, transfer or TRX freeze). If TPs are insufficient for your submitted vote, you will be notified of insufficient frozen TRX. Only the latest vote submission counts (the last vote will overwrite all previous votes). - -**Voting rules:** -+ The maximal votes a user can cast should be no more than his/her holding of TRX. -+ Each user can vote for multiple candidates for multiple times. -+ The SR list is updated once every 6 hours. -+ Voting does not cost any TRX. - - diff --git a/English_Documentation/TRON_Blockchain_Explorer/Guide_to_voting_on_the_new_blockchain_explorer.md b/English_Documentation/TRON_Blockchain_Explorer/Guide_to_voting_on_the_new_blockchain_explorer.md deleted file mode 100644 index 7557895a..00000000 --- a/English_Documentation/TRON_Blockchain_Explorer/Guide_to_voting_on_the_new_blockchain_explorer.md +++ /dev/null @@ -1,75 +0,0 @@ -# Guide for voting on the new block explorer - -## 1. Open TRON block explorer and log in to your wallet. - - https://tronscan.org/#/ - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png) - -## 2. Enter your password. (Password will encrypt private key. Both password and private key are needed to log in to your wallet.) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png) - -## 3. Download encrypted private key. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png) - -## 4. Save your private key (by copy-paste or printing). - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png) - -## 5. Enter the account page upon successful log-in. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png) - -## 6. Only users with TRX are allowed to vote. Request of free testing TRX is only supported on the testnet at https://test.tronscan.org/#/. 10,000TRX can be claimed at the bottom of the account page to vote and only one claim can be made by every account. Once TRX is successfully claimed, account balance can be viewed in WALLET. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png) - -## 7. A certain amount of TRX has to be frozen in order to vote for Super Representatives. - -+ To freeze balance, click the FREEZE button in ACCOUNT. -+ Enter the amount of TRX you’d like to freeze. -+ Check the box to confirm freezing ****TRX for at least 3 days. -+ Click FREEZE BALANCE to complete your freeze. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png) - -**Note** - -Only TRX can be frozen. Two things can be obtained through balance freezing: TRON Power(TP) and bandwidth. TRON Power(TP) are used for voting. In the event of unfrozen balance, votes previously casted will no longer be valid, which can be prevented by refreezing balance. Bandwidth Points will not be cleared when balance unfreezes, instead, new bandwidth points will be accumulated at the next freeze. - -## 8. To vote for Super Representatives, click on VOTES in the navigation bar to enter voting page and then click START VOTING. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png) - -## 9. Select Super Representative to vote. - -On the voting page enter the amount of votes, click on "submit votes" to submit your vote. Now you will be notified if your submission was successful. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png) - -## 10. Click on the "reset" button to reset the amount of votes entered for the current Super Representative. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png) - -**Note** - -Once you have submitted the amount of votes, the vote is complete. Voting requires TRON Power(TP), which can be obtained by freezing TRX. You will receive 1 TRON Power(TP) for each frozen TRX. You will get 1 vote for each TRON Power(TP). Previous votes will no longer be valid when TRX is unfrozen. Voting will be successful as long as total votes casted do not exceed total TRON Power(TP). There is no limit to the number of votes casted for a single Super Representative. If your TRON Power(TP) balance is insufficient, the user will be alerted on insufficient frozen balance. Only the last vote will be recorded, meaning that the last vote replaces all previous voting records. - -**Voting Guidelines** -+ The maximum votes a user has must be no more than his/her holding of frozen TRX. -+ Every user can vote for multiple candidates for multiple times. -+ The Super Representative list is updated every 6 hours. -+ No TRX will be consumed for voting. - - - diff --git a/English_Documentation/TRON_Blockchain_Explorer/How_to_apply_for_SR_candidate.md b/English_Documentation/TRON_Blockchain_Explorer/How_to_apply_for_SR_candidate.md deleted file mode 100644 index 58cca797..00000000 --- a/English_Documentation/TRON_Blockchain_Explorer/How_to_apply_for_SR_candidate.md +++ /dev/null @@ -1,17 +0,0 @@ -# How to apply for SR candidate. - -+ Open TRON Blockchain explorer: https://tronscan.org - -+ Click "Account" button. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/竞选超级代表/点击账户.jpg) - -+ Click "APPLY TO BE A SUPER REPRESENTATIVE CANDIDATE" button. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/竞选超级代表/申请成为超级代表候选.jpg) - -+ Write your personal website address and check information below website address. - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/竞选超级代表/填写网站地址并勾选.jpg) - -Note:9999 TRX will be paid when users apply to be a SR candidate. \ No newline at end of file diff --git a/English_Documentation/TRON_Blockchain_Explorer/Tronscan_Super_Representative_Template.md b/English_Documentation/TRON_Blockchain_Explorer/Tronscan_Super_Representative_Template.md deleted file mode 100644 index 78a48a49..00000000 --- a/English_Documentation/TRON_Blockchain_Explorer/Tronscan_Super_Representative_Template.md +++ /dev/null @@ -1,65 +0,0 @@ -## Intro - -Tronscan provides a way for Super Representatives to publish their information right where the voters are, on Tronscan! - -Super Representatives can use this template to build a static page which will be shown on Tronscan. The link will be placed in the voting overview page right next to the name of SR. - -The Super Representatives can manage their own content by editing files in the Github repository. - -## How to use - -__This guide assumes that you already have an account with Super Representative (candidate) status.__ - -### Step 1: Copy/Fork the template on Github - -* Go to https://github.com/tronscan/tronsr-template -* Fork the repository -![](https://raw.githubusercontent.com/tronscan/docs/master/images/fork-repo.png) - -After forking the repository you will be navigated to your own `tronsr-template` version of the repository where you can make changes. - -## Step 2: Fill in the template - -The template can now be modified by editing files on Github. - -* Click the file you want to edit -![](https://raw.githubusercontent.com/tronscan/docs/master/images/github-open-file.png) -* Open edit mode -![](https://raw.githubusercontent.com/tronscan/docs/master/images/github-edit-file.png) -* Add some information to the file -![](https://raw.githubusercontent.com/tronscan/docs/master/images/edit-team-intro.png) - -Files are written in markdown format. An excellent intro can be found at https://guides.github.com/features/mastering-markdown/ - -* Update the logo.png and banner.png -![](https://raw.githubusercontent.com/tronscan/docs/master/images/github-upload-files.png) -Then click on "choose your files" and make sure the logo or banner you want to upload is named `logo.png` or `banner.jpg` to overwrite the placeholder images. - -After you filled in the template it can now be published on https://tronscan.org - -## Step 3: Publish to Tronscan - -* Navigate to https://tronscan.org -* Login to your account. In this example it shows using the private key, but you may use any login method. -![](https://raw.githubusercontent.com/tronscan/docs/master/images/login-with-private-key.png) -* Open account and make sure the "Representative" label is visible -![](https://raw.githubusercontent.com/tronscan/docs/master/images/open-account.png) -* Scroll to the bottom and click "Set Github Link" -![](https://raw.githubusercontent.com/tronscan/docs/master/images/set-github-link.png) -* Enter your Github username and then press "Link Github" -![](https://raw.githubusercontent.com/tronscan/docs/master/images/input-username.png) -* View your new Page! -![](https://raw.githubusercontent.com/tronscan/docs/master/images/view-page.png) - -## Example - -The example shows which files are presented where. Whenever the files on Github are modified the page will instantly be updated - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/example-page.png) - -## FAQ - -* __I've modified a file but the changes aren't visible on tronscan.org?__ - Contents from the repository are served using the Github CDN which uses aggressive caching, therefore, it may take a few minutes before the changes are reflected on tronscan.org. -* __Why are HTML elements visible on Github but not on tronscan.org?__ - Tronscan.org will sanitize all HTML tags for security reasons, only standard markdown tags are allowed. \ No newline at end of file diff --git a/English_Documentation/TRON_Blockchain_Explorer/What_is_a_Super_Representative.md b/English_Documentation/TRON_Blockchain_Explorer/What_is_a_Super_Representative.md deleted file mode 100644 index 50a69f47..00000000 --- a/English_Documentation/TRON_Blockchain_Explorer/What_is_a_Super_Representative.md +++ /dev/null @@ -1,24 +0,0 @@ -# What is Super Representative - -## Token holders in the TRON community fall into the following categories: - -1. Token holder: Individual holding any amount of TRX. -2. Super Representative candidates: 127 individuals elected through voting by the entire token holder community. Votes are updated once every 6 hours. -3. Super Representatives: top 27 individuals among the 127 candidates, voted once every 6 hours. Super Representatives play a key role in governing the TRON community by ensuring basic functions, e.g. block generation and bookkeeping, and obtain corresponding earnings. - -## Rewards - -1. Candidate reward: 127 candidates updated once every 6 hours will share 115200 TRX. The reward will be split in accordance to the votes each candidate receives. Each year, Total reward of candidates will be 168192,000 TRX each year -2. Super Representative reward: The TRON Protocol network will generate one block every 3 seconds, with each block awarding 32 TRX to super representatives. A total of 336,384,000 TRX will be awarded annually to twenty-seven super representatives. -3. There will be no inflation on the TRON network before January 1, 2021, and the TRON Foundation will award all block rewards and candidate rewards prior to that date. - -## Super Representative - -+ Users can get SR information from TRON blockchain explorer, the detailed information shown as below:** - - + The account address of the delegate. - + The total votes that the delegate received. - + The url of personal website. - + The total of blocks produced by the delegate. - + The total missed blocks of delegate. - diff --git a/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md b/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md deleted file mode 100644 index e8af6813..00000000 --- a/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md +++ /dev/null @@ -1,30 +0,0 @@ -# Tron event subscribe support -## 1. Background -TRON has implemented the event subscription mechanism to support developer community, we have finished the testing. The featured will be released on version 3.5 of Java-tron. Developers could start experiencing right now, although it's still in beta stage. - - -## 2. New features -1. Supporting event plug-ins, kafka & mongodb plug-ins have been released, developers can also customize their own plug-ins according to their own needs. - -2. Supporting subscription of chain data, such as block, transaction, contract log, contract event and so on. For transaction events, developers can get information such as internal transactions, contract info and so on; for contract events, developers could configure the contract addresses list or contract topic list to receive the specified events, and event subscription has a very low latency. The deployed fullnode can receive event information immediately after the contract is executed. - -3. Event query service tron-eventquery, online Event query service provided. Developers can query trigger information in the last seven days through https, and the query address is https://api.tronex.io. - -## 3. github project -- [java-tron](https://github.com/tronprotocol/java-tron) develop branch (Now it's still in 3.5 beta) -- [eventplugin](https://github.com/tronprotocol/event-plugin) master branch -- [tron-eventquery](https://github.com/tronprotocol/tron-eventquery) master branch - -## 4. event subscribe -- https://github.com/tronprotocol/TIPs/issues/12 - -## 5. event plugin -- kafka plugin: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/eventplugin_deploy.md - -- mongodb plugin: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/mongodb_deploy.md - -## 6. tron-eventquery -### Deploy -- https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/tron-eventquery_deploy.md -### Http API -- https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md diff --git a/English_Documentation/TRON_Event_Subscribe/eventplugin_deploy.md b/English_Documentation/TRON_Event_Subscribe/eventplugin_deploy.md deleted file mode 100644 index 21769006..00000000 --- a/English_Documentation/TRON_Event_Subscribe/eventplugin_deploy.md +++ /dev/null @@ -1,150 +0,0 @@ -## Tron event subscribe plugin -This is an implementation of Tron event subscribe model. - -- api module defines IPluginEventListener, a protocol between Java-tron and event plugin. -- app module is an example for loading plugin, developers could use it for debugging. -- kafkaplugin module is the implementation for kafka, it implements IPluginEventListener, it receives events subscribed from Java-tron and relay events to kafka server. -- mongodbplugin module is the implementation for mongodb. - -### Setup/Build -- git clone https://github.com/tronprotocol/event-plugin.git -- cd eventplugin -- ./gradlew build - -Currently, we support two kinds of event plugins, kafka and mongodb. The build command will produced plugin-kafka-1.0.0.zip, plugin-mongodb-1.0.0.zip, which are located in the **eventplugin/build/plugins/** directory. - -Edit config.conf of Java-tron, add the following fileds: -event.subscribe = -{ - path= "/Users/tron/sourcecode/eventplugin/build/plugins/plugin-kafka-1.0.0..zip" // absolute path of event plugin - server = "127.0.0.1:9092" // target server address to receive event triggers - dbconfig="" //dbname|username|passwordformongodb plugin - - topics = [ - { - triggerName = "block" - enable = false - topic = "block" - }, - { - triggerName = "transaction" - enable = false - topic = "transaction" - }, - { - triggerName = "contractevent" - enable = true - topic = "contractevent" - }, - { - triggerName = "contractlog" - enable = true - topic = "contractlog" - } - ] -} - -- **path**: is the absolute path of "plugin-kafka-1.0.0.zip" or "plugin-mongodb-1.0.0.zip" -- **server**: Kafka server address or mongodb server address -- **dbconfig**: this is mongodb configuration, assign it to "" for kafka plugin -- **topics**: each event type maps to one Kafka topic, we support four event types subscribing, block, transaction, contract log and contract event. -- **triggerName**: the trigger type, the value can't be modified. -- **enable**: plugin can receive nothing if the value is false. -- **topic**: the value is the kafka topic or mongodb collection to receive events. Make sure it has been created and Kafka process is running - -### Install Kafka -**Note**: - -Make sure the version of Kafka is the same as the version set in build.gradleof eventplugin project.(The specified version is: kafka_2.10-0.10.2.2) - -#### On Mac: - -> - brew install kafka - -#### On Linux: - -> - cd /usr/local -> -> - wget http://archive.apache.org/dist/kafka/0.10.2.2/kafka_2.10-0.10.2.2.tgz -> -> - tar -xzvf kafka_2.10-0.10.2.2.tgz -> -> - mv kafka_2.10-0.10.2.2 kafka - -edit /etc/profile, add "export PATH=$PATH:/usr/local/kafka/bin" to end of /etc/profile - -> source /etc/profile - -### Run Kafka -#### On Mac: - -> zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & - -> kafka-server-start /usr/local/etc/kafka/server.properties - -#### On Linux: - -> zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties -> & - -Sleep about 3 seconds - -> kafka-server-start.sh /usr/local/kafka/config/server.properties & - -Create topics to receive events, the topic is defined in config.conf -#### On Mac: -- kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic block -- kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic transaction -- kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractlog -- kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractevent - -#### On Linux: -- kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic block -- kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic transaction -- kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractlog -- kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic contractevent - -### Kafka consumer -#### On Mac: -- kafka-console-consumer --bootstrap-server localhost:9092 --topic block -- kafka-console-consumer --bootstrap-server localhost:9092 --topic transaction -- kafka-console-consumer --bootstrap-server localhost:9092 --topic contractlog -- kafka-console-consumer --bootstrap-server localhost:9092 --topic contractevent - -#### On Linux: -- kafka-console-consumer.sh --zookeeper localhost:2181 --topic block -- kafka-console-consumer.sh --zookeeper localhost:2181 --topic transaction -- kafka-console-consumer.sh --zookeeper localhost:2181 --topic contractlog -- kafka-console-consumer.sh --zookeeper localhost:2181 --topic contractevent - -### Load plugin in Java-tron -add--estocommand line, for example: - -> java -jar FullNode.jar -p privatekey -c config.conf --es - -Check plugin logs: - -> tail -f logs/tron.log |grep -i eventplugin - -For example, if plugin is loaded, you will see the output like this - -> [o.t.c.l.EventPluginLoader](EventPluginLoader.java:194) 'your plugin -> path/plugin-kafka-1.0.0.zip' loaded - -If there is no kafka or mongodb related exception, the plugin is loaded successfully. Otherwise please check whether your configuration is correct. - -**Note**: We should make sure kafka or mongodb is launched successfully before launching FullNode, and the configuration is configured correctly, otherwise eventplugin will not work. - -### Event filter -which is defined in config.conf, the path is: event.subscribe - -filter = { - fromblock = "" // the value could be "", "earliest" or a specified block number as the beginning of the queried range - toblock = "" // the value could be "", "latest" or a specified block number as end of the queried range - contractAddress = [ - "TVkNuE1BYxECWq85d8UR9zsv6WppBns9iH" // contract address you want to subscribe, if it's set to "", you will receive contract logs/events with any contract address. - ] - - contractTopic = [ - "f0f1e23ddce8a520eaa7502e02fa767cb24152e9a86a4bf02529637c4e57504b" // contract topic you want to subscribe, if it's set to "", you will receive contract logs/events with any contract topic. - ] - } \ No newline at end of file diff --git a/English_Documentation/TRON_Event_Subscribe/mongodb_deploy.md b/English_Documentation/TRON_Event_Subscribe/mongodb_deploy.md deleted file mode 100644 index abbad188..00000000 --- a/English_Documentation/TRON_Event_Subscribe/mongodb_deploy.md +++ /dev/null @@ -1,70 +0,0 @@ -## Suggested Configuration -- CPU/ RAM: 16Core / 32G -- DISK: 500G -- System: CentOS 64 - -## Download and install MongoDB -The version of MongoDB is **4.0.4**, below is the command: - -- cd /home/java-tron -- curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.4.tgz -- tar zxvf mongodb-linux-x86_64-4.0.4.tgz -- mv mongodb-linux-x86_64-4.0.4 mongodb - -### Set environment -- export MONGOPATH=/home/java-tron/mongodb/ -- export PATH=$PATH:$MONGOPATH/bin - -### Create mongodb config -The path is : /etc/mongodb/mgdb.conf - -- cd /etc/mongodb -- touch mgdb.conf - -Create data&log folder for mongodb -Create data, log subfolder in mongodb directory, and add their absolute path to mgdb.conf - -#### Example: -- dbpath=/home/java-tron/mongodb/data -- logpath=/home/java-tron/mongodb/log/mongodb.log -- port=27017 -- logappend=true -- fork=true -- bind_ip=0.0.0.0 -- auth=true -- wiredTigerCacheSizeGB=2 - -#### Note: -- bind_ip must be configured to 0.0.0.0,otherwise remote connection will be refused. -- wiredTigerCacheSizeGB, must be configured to prevent OOM - -## Launch MongoDB - - mongod --config /etc/mongodb/mgdb.conf -### Create admin account: -- mongo -- use admin -- db.createUser({user:"root",pwd:"admin",roles:[{role:"root",db:"admin"}]}) - -### Create eventlog and its owner account -- db.auth("root", "admin") -- use eventlog -- db.createUser({user:"tron",pwd:"123456",roles:[{role:"dbOwner",db:"eventlog"}]}) - -> database: eventlog,username:tron, password: 123456 - -### Firewall rule: -- iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 27017 -j ACCEPT - -#### Remote connection via mongo: -- mongo 47.90.245.68:27017 -- use eventlog -- db.auth("tron", "123456") -- show collections -- db.block.find() - -#### Query block trigger data: -- db.block.find({blockNumber: {$lt: 1000}}); // return records whose blockNumber less than1000 - -#### Set database index to speedup query: -cd /{projectPath} -sh insertIndex.sh diff --git a/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md b/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md deleted file mode 100644 index 497557ad..00000000 --- a/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md +++ /dev/null @@ -1,172 +0,0 @@ -# Tron Event Query Service -## What is the main HTTP service? -baseUrl: https://api.tronex.io - -## Main HTTP Service -Function: get transaction list -``` -subpath: $baseUrl/transactions - -parameters -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -start: start page, default is 1 -block: start block number, default is 0 - -Example: https://api.tronex.io/transactions?limit=1&sort=-timeStamp&start=2&block=0 -``` - -Function: get transaction by hash -``` -subpath: $baseUrl/transactions/{hash} - -parameters -hash: transaction id - -Example: https://api.tronex.io/9a4f096700672d7420889cd76570ea47bfe9ef815bb2137b0d4c71b3d23309e9 -``` -Function: get transfers list -``` -subpath: $baseUrl/transfers - -parameters -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -start: start page, default is 1 -from: from address, default is "" -to: to address, default is "" -token: tokenName, default is "" - -Example: https://api.tronex.io/transfers?token=trx&limit=1&sort=timeStamp&start=2&block=0&from=TJ7yJNWS8RmvpXcAyXBhvFDfGpV9ZYc3vt&to=TAEcoD8J7P5QjWT32r31gat8L7Sga2qUy8 -``` -Function: get transfers by transactionId -``` -subpath: $baseUrl/transfers/{hash} - -parameters -hash: transfer hash - -Example: https://api.tronex.io/transfers/70d655a17e04d6b6b7ee5d53e7f37655974f4e71b0edd6bcb311915a151a4700 -``` -Function: get events list -``` -subpath: $baseUrl/events - -parameters -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -since: start time of event occurrence, timeStamp >= since will be shown -start: start page, default is 1 -block: block number, block number >= block will be shown - -Example: https://api.tronex.io/events?limit=1&sort=timeStamp&since=0&block=0&start=0 -``` -Function: get events by transactionId -``` -subpath: $baseUrl/events/transaction/{transactionId} - -parameters -transactionId - -Example: https://api.tronex.io/events/transaction/cd402e64cad7e69c086649401f6427f5852239f41f51a100abfc7beaa8aa0f9c -``` -Function: get events by contract address -``` -subpath: $baseUrl/events/{contractAddress} - -parameters -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -since: start time of event occurrence, timeStamp >= since will be shown -block: block number, block number >= block will be shown -contractAddress: contract address -start: start page, default is 1 - -Example: https://api.tronex.io/events/TMYcx6eoRXnePKT1jVn25ZNeMNJ6828HWk?limit=1&sort=-timeStamp&since=0&block=0&start=4 -``` -Function: get events by contract address and event name -``` -subpath: $baseUrl/events/contract/{contractAddress}/{eventName} - -parameters -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -since: start time of event occurrence, timeStamp >= since will be shown -contract`Address`: contract address -start: start page, default is 1 -eventName: event name - -Example: https://api.tronex.io/events/contract/TMYcx6eoRXnePKT1jVn25ZNeMNJ6828HWk/Bet?limit=1&sort=timeStamp&since=1&start=0 -``` -Function: get events by contract address, event name and block number -``` -subpath: $baseUrl/events/contract/{contractAddress}/{eventName}/{blockNumber} - -parameters -contractAddress: contract address -blockNumber: block number, block number >= block will be shown -eventName: event name - - -Example: https://api.tronex.io/events/contract/TMYcx6eoRXnePKT1jVn25ZNeMNJ6828HWk/Bet/4835773 -``` -Function: get events by timeStamp -``` -subpath: $baseUrl/events/timestamp - -parameters -since: start time of event occurrence, timeStamp >= since will be shown -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -start: start page, default is 1 -contract: contract address - - -Example: https://api.tronex.io/events/timestamp?since=1544483426749&limit=1&start=1&sort=timeStamp -``` -Function: get confirm events list -``` -subpath: $baseUrl/events/confirmed - -parameters -since: start time of event occurrence, timeStamp >= since will be shown -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -start: start page, default is 1 - -Note: if developers wants to check whether this event is confirmed or not, they could check the blocknumber is small than the solidified block number(get from url https://api.tronex.io/blocks/latestblockNum). If it is smaller than block number, it is conformed - -Example: https://api.tronex.io/events/confirmed?since=1544483426749&limit=1&start=1&sort=timeStamp -``` -Function: get block by block hash -``` -subpath: $baseUrl/blocks/{hash} - -parameters -hash: block hash - - -Example: https://api.tronex.io/blocks/000000000049c11f15d4e91e988bc950fa9f194d2cb2e04cda76675dbb349009 -``` -Function: get block list -``` -subpath: $baseUrl/blocks - -parameters -limit: each page size, default is 25 -sort: sort Field, default is sort by timeStamp descending order -start: start page, default is 1 -block: block number, block number >= block will be shown - - -Example: https://api.tronex.io/blocks?limit=1&sort=timeStamp&start=0&block=0 -``` -Function: get latest solidified block number -``` -subpath: $baseUrl/blocks/latestSolidifiedBlockNumber - -parameters -none - -Example: https://api.tronex.io/blocks/latestSolidifiedBlockNumber -``` diff --git a/English_Documentation/TRON_Event_Subscribe/tron-eventquery_deploy.md b/English_Documentation/TRON_Event_Subscribe/tron-eventquery_deploy.md deleted file mode 100644 index 8f10176f..00000000 --- a/English_Documentation/TRON_Event_Subscribe/tron-eventquery_deploy.md +++ /dev/null @@ -1,32 +0,0 @@ -### Tron Event Query Service -TronEventQuery is implemented with Tron's new event subscribe model. It uses same query interface with Tron-Grid. Users can also subscribe block trigger, transaction trigger, contract log trigger, and contract event trigger. TronEvent is independent of a particular branch of java-tron, the new event subscribes model will be released on version 3.5 of java-tron. - -For more information of tron event subscribe model, please refer to https://github.com/tronprotocol/TIPs/issues/12. - -## Download sourcecode -git clone https://github.com/tronprotocol/tron-eventquery.git -cd troneventquery - -## Build -- mvn package - -After the build command is executed successfully, troneventquery jar to release will be generated under troneventquery/target directory. - -Configuration of mongodb "config.conf" should be created for storing mongodb configuration, such as database name, username, password, and so on. We provided an example in sourcecode, which is " troneventquery/config.conf ". Replace with your specified configuration if needed. - -**Note**: -Make sure the relative path of config.conf and troneventquery jar. The config.conf 's path is the parent of troneventquery jar. - - - mongo.host=IP - - mongo.port=27017 - - mongo.dbname=eventlog - - mongo.username=tron - - mongo.password=123456 - - mongo.connectionsPerHost=8 - - mongo.threadsAllowedToBlockForConnectionMultiplier=4 - -Any configuration could be modified except **mongo.dbname**, "**eventlog**" is the specified database name for event subscribe. - -## Run -- troneventquery/deploy.sh is used to deploy troneventquery -- troneventquery/insertIndex.sh is used to setup mongodb index to speedup query. \ No newline at end of file diff --git a/English_Documentation/TRON_Introduction/Community.md b/English_Documentation/TRON_Introduction/Community.md deleted file mode 100644 index 181e7b62..00000000 --- a/English_Documentation/TRON_Introduction/Community.md +++ /dev/null @@ -1,92 +0,0 @@ -# Community - -TRON community is driven by principles of sharing, equality, freedom of speech and personal expression where community members support each other. The community social system provides all supporters and participants with more accessible and comprehensive resources and information on the projects of TRON. All participants will have full freedom without any restrictions to express their talents, suggest new ideas and opinions and discuss about different topics (subjects), as long as they follow the community rules and are actively engaged in community development at all levels. - -## Reddit - -To host its supporters and developers, TRON [reddit](https://www.reddit.com/r/Tronix/) is the dream venue for brainstorming and the exchange of ideas. With a firm belief in the freedom of speech, as a non-profit community, TRON accommodates all perspectives, with the aim for all participants to achieve progress through sharing. - -Current Official Subreddits: - -+ [/r/TRXTrading](https://www.reddit.com/r/TRXTrading/) – TRON trading, price and market. -+ [/r/tronsupport](https://www.reddit.com/r/tronsupport/)– Support for any TRON-related questions. - -## Slack - -Keeping in touch with outstanding contributors on Github, the tech team of TRON communicates with and finds itself deeply inspired by developers on [slack](https://tronfoundation.slack.com/messages/C6DKKSU8G/details/). The platform makes it easier for developers to discuss and solve technical problems together with the tech team of TRON in a timely fashion. Join us on Slack at our invitation or by your own request. We also welcome developers making a remarkable contribution to be a part of the TRON team. - -## Gitter Rooms - -Log in to gitter with your github account to participate in TRON’s discussions. Accessible Gitter channels revolve around the topic of a certain database. Please select a suitable channel and topic and maintain the relevance of your posts. - -[java-tron](https://github.com/tronprotocol/java-tron) – about full node, the launch of mainnet, testnet. -[wallet-web](https://github.com/tronprotocol/wallet-web) – blockchain explorer and web wallet developed by community. -[wallet-cli](https://github.com/tronprotocol/wallet-cli) – blockchain explorer and web wallet developed by TRON team. - -## TRON Forum - -http://tronsr.org/ - -## TRON Foundation - -Forging ahead with the development of new technologies and applications jointly with all developers, TRON Foundation is devoted to the healthy development of TRON ecosystem. - -TRON Foundation open to the community - -[Official Website](https://tron.network/en.html) -[Twitter](https://twitter.com/tronfoundation) -[Facebook](https://www.facebook.com/TronFoundation) -[Slack](https://tronfoundation.slack.com) -[CoinMarketCap](https://coinmarketcap.com/currencies/tron/) -[Github](https://github.com/tronprotocol) -[Telegram](https://t.me/tronnetworkEN) -[E-mail](service@tron.network) - -Other community platforms for international usership. - -[TRON SOUTH KOREA]( https://t.me/tronnetworkKR) -[TRON RUSSIA](https://t.me/tronnetworkRU) -[TRON SPAIN](https://t.me/tronnetworkES) -[TRON ARABIC](https://t.me/tronnetworkAR) - -## Contributors - -We would like to express our deepest gratitude to the following participants who have made great contributions to the community: - -TRON Github Contributor: - -[Roy van Kaathoven](https://github.com/Rovak) -[seanrobbins](https://github.com/seanrobbins) -[AhnSinYong](https://github.com/AhnSinYong) -[Jean-Philippe Quéméner](https://github.com/JohnnyQQQQ) -[sdargutev](https://github.com/sdargutev) -[ryukato](https://github.com/ryukato) -[farukonder](https://github.com/farukonder) -[nguyentruongtho](https://github.com/nguyentruongtho) -[Blake Jackson](https://github.com/blaketastic2) -[ruchern](https://github.com/ruchern) -[jun-Sogang](https://github.com/jun-Sogang) -[colbywhite](https://github.com/colbywhite) -[svenanders](https://github.com/svenanders) -[jromero](https://github.com/jromero) -[jungrammer](https://github.com/jungrammer) -[Eyesonly88](https://github.com/Eyesonly88) -[wailo](https://github.com/wailo) -[xiaolin](https://github.com/xiaolin) -[styk-tv](https://github.com/styk-tv) -[khuezy](https://github.com/khuezy) -[jackforest2014](https://github.com/jackforest2014) -[Yangdaidai](https://github.com/Yangdaidai) -[James Michael DuPont](https://github.com/h4ck3rm1k3) -[Kamil Zieliński](https://github.com/KamilZielinski) -[Wendy Sanarwanto](https://github.com/WendySanarwanto) - -Translation Contributor: - -[fbsobreira](https://crowdin.com/profile/fbsobreira) -[PiterSpain](https://crowdin.com/profile/PiterSpain) -[Dev Obs](https://crowdin.com/profile/devobs1) -[johnsavadkuhi](https://crowdin.com/profile/johnsavadkuhi) -[JYW](https://crowdin.com/profile/JYW) -[J4ck1986](https://crowdin.com/profile/J4ck1986) -[Felix](https://crowdin.com/profile/FlxGut) \ No newline at end of file diff --git a/English_Documentation/TRON_Introduction/One_Page.md b/English_Documentation/TRON_Introduction/One_Page.md deleted file mode 100644 index bf739aea..00000000 --- a/English_Documentation/TRON_Introduction/One_Page.md +++ /dev/null @@ -1,57 +0,0 @@ -# TRON - -## What is TRON? - -TRON is an ambitious project dedicated to the establishment of a truly decentralized Internet and its infrastructure. The TRON Protocol, one of the largest blockchain based operating systems in the world, offers base public blockchain support of high throughput, high scalability and high availability for all decentralized applications in the TRON ecosystem. - -## Key Features - -+ High Throughput - -Under TRON consensus, a limited number of nodes of high calculation performance are selected by users as network witnesses, achieving high throughput by keeping the TPS of the entire network on an acceptable level. With its exclusive consensus, TRON has surpassed Bitcoin and Ethereum in terms of TPS. - -High TPS guarantees low calculation delay, speeding up transactions to parallel the velocity of existing payment systems such as VISA and SWIFT, which makes daily payment a possibility. - -+ Scalability - -Applications are given a wider variety of ways to be deployed in TRON because of its scalability and highly effective smart contract. - -Thanks to the high efficiency and infinite possibilities of the smart contract, TRON possesses great scalability, allowing for a wide variety of applications to be deployed in TRON. - -The marriage of an excellent database structure and the account system simplifies the actualization of complex designs and models, which brings convenience to project development and supports high TPS. Existing applications, websites and operating services can be transferred to TRON network, which allows them to better rival against existing institutions by benefiting from the large user base of the TRON network. -+ High Availability - -TRON is keen on building a decentralized consensus mechanism. The network structure, user assets and intrinsic values will become more reliable with a higher degree of decentralization. Even so, the consensus mechanism of TRON is much more energy-efficient compared with the POW mode. - -+ Low Cost - -TRON adopts a design with low calculation cost, which makes it easier for different apps on TRON to expand its user base and more commercially competitive . - -+ User-friendly - -TRON is committed to building utility blockchain products with thorough research on users’ demands and expectations. - -## Core Design - -+ Unique Consensus - -Under TRON’s improved POS consensus, several elected nodes, which share equal rights and deployed by global users themselves, cooperate to accomplish calculation tasks. -High-performance, decentralized/distributed nodes are spontaneously chosen by TRON holders who have interest in individual and community prosperity and wealth. - -+ Smart Contract with High Efficiency - -It will be fulfilled in the following ways: - - + TRON supports JAVA development—a programming language that has mature development communities, supports multiple scenarios and is highly effective. - + High-efficiency consensus mechanism - + TRON embraces excellent database structure and account system to help users with the conversion from complex conceptions and models into utility applications. - -## The Future of TRON - -We aim to build a TRON ecosystem that everyone can participate in and benefit from, with the TRON network along with its many advantages as the cornerstone of our effort. - -+ TRON and its wide variety of affiliated DAPPs not only render users reduced costs, but also improved convenience in daily life and financial return. -+ By deploying their DAPPs on TRON, developers can expand their scope of business and bring publicity to their values and beliefs. -+ Witnesses supports the functioning of TRON network and gain remuneration for their effort. - -Whether a user, developer or TRON’ selected witness, each and every one of us devotes ourselves to the construction and prosperity of TRON’s ecosystem and be rewarded for our commitment. diff --git a/English_Documentation/TRON_Introduction/TRON_Brochure.md b/English_Documentation/TRON_Introduction/TRON_Brochure.md deleted file mode 100644 index 245ec425..00000000 --- a/English_Documentation/TRON_Introduction/TRON_Brochure.md +++ /dev/null @@ -1,130 +0,0 @@ -# TRON - -## Architecture - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Architecture.png) - -TRON adopts a 3-layer architecture comprised of storage layer, core layer and application layer. - -+ Storage Layer - - The tech team of TRON designed a unique distributed storage protocol consisting of block storage and state storage. - The notion of graph database was introduced into the design of the storage layer to better meet the need for diversified data storage in the real world. - -+ Core Layer - - Smart contract module, account management module and consensus module are three modules of the core layer. It’s TRON’s vision to base its functions on a stacked virtual machine and optimized instruction set. - In order to better serve the development of DApps, Java is designated as the language for smart contracts, which is to be further supplemented by other high-level programming languages. - In addition, innovations are made to TRON’s consensus on the basis of DPOS to fulfill its special needs. - -+ Application Layer - - Developers can utilize interfaces for the realization of diverse DApps and customized wallets. - The protocol of TRON adheres in entirety to Google Protobuf, intrinsically supporting multi-language extension. - -## Consensus - -+ Improved Consensus Mechanism based on DPOS - - High energy consumption, low efficiency and low TPS are always an issue with POW consensus, which is completely opposite from TRON’s values and design. Under the guidance of our architectural philosophy, we have chosen to adopt the POS mechanism as the basis of TRON consensus. Having gained knowledge on constructive ideas in the blockchain community through research, we made improvements to the DPOS mechanism to meet up with our demands, thereby coming up with the TRON consensus. - -+ Basic Rules of the Consensus Mechanism - - + Coin holders are to vote for nodes in accordance with their holding of coins with a ballot. And nodes are elected to become what are known as witnesses based on the result of the votes and certain other rules, which tries, to its utmost capacity, to strike a balance between speed of block production and the number of witnesses. - + Meanwhile, compensation will be made to unelected nodes, voters for both elected nodes and unelected nodes, in order to encourage them to run for future elections. - + Witnesses will produce valid blocks successively based on specific distribution rules and success to do so results in the highest reward. - + The vast majority of witnesses are chosen through votes and the rest are selected with an equal chance under a certain algorithm. - -## Storage Structure - -+ KhaosDB - - TRON has a KhaosDB in the full-node memory that can store all the new fork chains generated within a certain period of time and supports witnesses to switch their own active chain swiftly into a new main chain. - -+ Level DB - - Level DB will be initially adopted with the primary goal to meet the requirements of fast R/W and rapid development. After launching the main net, TRON will upgrade its database to an entirely customized one catered to its very own needs. - -## Token Module - -+ Configuration - - Users can customize their own token through TKC (token configuration) functions. - Customizable parameters include, but are not exclusive to, token name, abbreviation, LOGO, total capitalization, exchange rate of TRX, starting date, expiring date, attenuation coefficient, controlled inflation model, inflation period, description, etc. - Users can chose to stay with the default parameters of the system if it’s their option to not customize their own. - -+ Issue/Deployment - - Users can issue their tokens after setting up the parameters (manually customized or system default). - System comes with operations and functions, and that allow issuers to deploy digital token, which has already been validated and customized. (Customized and validated tokens can proceed to function and operation setup for deployment.) - Customized token is deployed once witnesses successfully validate, and can be freely circulated on TRON network. (Once validated by the witness, customized token is successfully deployed, which enters into online circulation.) - -+ API - - API is mainly used for the development of client terminals. With API support, token issuance platform can be designed by developers themselves. - -## Smart Contract/ Virtual Machine - -The smart contract module of TRON allows users to customize contracts to their own needs. -TRON is home to its own virtual machine, on which Smart contract operates, allowing for developers to customize for diverse and complex functions. - -## Third Party Applications - -+ Token Deployment Platform - - Third party developers are granted access to TRON’s network for the development of their own platforms. With the use of TRON’s token module, users of these platforms could also customize their own tokens. - -+ Wallet - - With the wallet, users can view their holding of TRX as well as other assets, or initiate or take transactions. - -+ Blockchain Explorer - - Blockchain explorer is used for the viewing of block records, list of nodes, node deploymeng and real-time operation of TRON. - -## ERC20 Token Migration - -Before the launch of TRON’s main net, the migration from ERC20 to TRX, the official token of TRON, will be initiated by TRON foundation. The migration exchange rate is 1:1. The specificities of migration entails further clarification, to which may involve revision might be made before official execution. - -##Community Plan - -The community is always an integral part of any blockchain project, so it is our hope to evoke the members’ passion for full participation in TRON’s construction. This is a belief that we have unwaveringly held since the very inception of our project. - -There are numerous ways for TRON’s community members to be a part of the project, for instance, through participation in core programming tasks or third-party development through APIs to be opened up by TRON. Furthermore, a wide variety of competitions open to all users will be held for LOGO design, essay writing, poster design, competitive programming, etc. - -+ Providing Code Types - - + feat: A new feature - + fix: A bug fix - + docs: Files of revision - + perf: A code change that improves performance - + refactor: A code change that neither fixes a bug nor adds a feature - + style: A change in text format (excessive blank space, format proofreading, missing punctuation marks, etc.) - + test: Addition of missing tests or correction to existing tests - -+ Reward Plan - - We would like to offer reward to all those who have contributed to the progression and development of TRON’s network and community. A special committee is set up by TRON to conduct close assessment on all participants’ contribution, based on the result of which TRX tokens, gifts, and other forms of reward are offered. - - -## Protocol - -TRON adheres to the Google Protobuf protocol, which covers multiple aspects such as accounts, blocks and transfers. - -There are 3 types of accounts: basic account, asset release account, and contract account. Each of those three types has six properties: name, type, address, balance, voting and related asset. - -A basic account can apply to be a witness, which possesses other attributes and parameters including voting statistics, public key, URL, history performance, etc. - -A block typically consists of several transactions and a blockheader, which is comprised of basic block information like timestamp, root of Merkle tree, parent hash, signature, to name just a few. - -There are eight categories of contract transaction: account creation contract, transfer contract, asset transfer contract, asset voting contract, witness voting contract, witness creation contract, asset issuance contract and deployment contract. - -Each transaction contains several TXInputs, TXOutputs and other properties. - -Signature is required for input, transaction and block header. - -Inventory, protocol involved in transfers, is mainly used to inform recipient nodes of transmitted data. - -Please find in the appendix the detailed protocol. The specificities of the protocol is subject to change with program upgrading, so please always make reference to the latest version available. - - diff --git a/English_Documentation/TRON_Programming_Contest/Standard_of_Evaluation_for_TRON_Programming_Contest.md b/English_Documentation/TRON_Programming_Contest/Standard_of_Evaluation_for_TRON_Programming_Contest.md deleted file mode 100644 index e68c6438..00000000 --- a/English_Documentation/TRON_Programming_Contest/Standard_of_Evaluation_for_TRON_Programming_Contest.md +++ /dev/null @@ -1,109 +0,0 @@ - -# Standard of Evaluation for TRON Programming Contest - - -We will score projects submitted for the programming contest based on the following criteria. This score is highly associated with the final outcome of the contest. - -* __Basic criteria:__ - -1. Originality: - - The submitted project must be the original creation of the applicant. We will not tolerate plagiarism. - -2. Compatibility: - - The project/product should be applicable to TRON's mainnet. - -3. Voting function for wallet projects: - - For wallet projects, whether the submitted wallet supports witness voting is directly linked to chances of winning. - -4. Offline signature for Windows/iOS/Android-based wallets: - - Wallet projects for Windows/iOS/Android platforms must support offline signature. It's also preferable for wallets for Mac to support offline signature. - - -* __Bonus criteria:__ - -1. The spirit of competition: - - There is no severe violation of competition guidelines or departure from the spirit of fair competition. - -2. Engagement: - - Make sure to be fully communicative with TRON. We will assess your engagement based on our interaction through email and Slack. - -3. Functionality: - - Completeness of product functions or is it lacking essential functions. Whether the product is user-friendly. - -4. Innovation: - - How innovative and unique the project is. - -5. Extension: - - Whether the project promises potentials for future development. - - -### Evaluation Form - - ------------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Individual/Team
Name
Basic criteriaBonus criteria
OriginalityCompatibilityWitness voting
(wallets)
Offline signature
(wallets for Windows
/iOS/Android)
Spirit of competitionEngagementFunctionalityInnovationextension
- - -Notes to the evaluation form: -1. Applicants' chances of winning are directly tied to your score for the basic criteria. -2. There is a better chance of winning if submitted projects score high points for the bonus criteria. diff --git a/English_Documentation/TRON_Programming_Contest/The_First_TRON_Programming_Contest.md b/English_Documentation/TRON_Programming_Contest/The_First_TRON_Programming_Contest.md deleted file mode 100644 index 5c2001a9..00000000 --- a/English_Documentation/TRON_Programming_Contest/The_First_TRON_Programming_Contest.md +++ /dev/null @@ -1,121 +0,0 @@ -# TRON Programming Contest - -**April 17-June 5, 2018** - -Be enchanted by blockchain technology -Let minds spark their utmost brilliance -Revolutionize in cooperation and competition -Take home $1,000,000 for your excellence in programming - -**Tron Developer Programming Competition is a programming carnival dedicated to global community members and developers, based on the blockchain technology with the key feature of decentralization.** - -Tron offers to global developers and community members a world-class platform of blockchain development and a valuable opportunity to exchange ideas. Participants are also encouraged to develop third-party apps compatible with Tron’s main net and to contribute to the construction and the flourish of Tron’s ecosystem. - -First-place prizes will be offered to designers of the five applications like the wallet based on Windows, Mac, iOS/Android platform, wallet embedded with Google Chrome and blockchain explorer. - -## Rules of Contest - -1, Application begins on April 17, 2018. Submission of application as well as code ends at 23:59 (GMT+8) on May 31, 2018. - -2, Developers can apply and participate individually or in team. - -3, Each team/individual participant can sign up for 5 sub-contests. - -4, All development must be based on TRON blockchain technology and should be one of the following five applications compatible with TRON’s main net: - -+ Wallet based on Windows (including off-line signature function and voting function) -+ Wallet based on Mac (Off-line signature function is optional but a plus and voting function is necessary.) -+ Wallet based on iOS/Android (including off-line signature function and voting function) -+ Wallet embedded with Google Chrome (including voting function) -+ Blockchain Explorer - - -For files of relevant code and technological support please refer to: https://github.com/tronprotocol. - -5, Developers are free to exchange ideas or team up in community. The recommended platform is the official Slack of Tron, https://tronfoundation.slack.com/, and official forum of TRON, http://tronsr.org/. - -6, Please submit your project from April 17-May 31, 2018. Failure to make your submission is regarded as voluntary withdrawal from the contest. - -7, Submitted work must include an operable program and code. - -## Prizes - -The reward pool is $1,000,000. - -First-place winners for the following five applications will take home a reward of $180,000-280,000: - -+ Wallet based on Windows (including off-line signature function): $180,000 -+ Wallet based on Mac (off-line signature function is optional but a plus): $180,000
 -+ Wallet based on iOS/Android (including off-line signature function): $180,000
 -+ Wallet embedded with Google Chrome: $180,000 -+ Blockchain Explorer: $280,000. - - -The developer of any product we deem to be complete will receive a $100,000 TRON Accelerator. For more information please refer to -https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Accelerator.md - -## Timeline - -April 17, 2018—Start of application - -May 31, 2018—End of project submission - -June 5, 2018—Announcement of rewards - -Reward will be delivered within 1 month to the announcement. - -## Judges - -Justin Sun: CEO of TRON - -Lucien Chen: CTO of TRON - -Marcus Zhao: Director of Technology, TRON - -## Application
 Procedure - -+ Step 1. Please submit your application to program@tron.network by May 31, 2018. Please name the subject in the format of “Application_Individual/Team name_Participating project” (e.g. “Application_TRON team_blockchain explorer”), or the email will be categorized as spam, leading to an unsuccessful application. - - **Application Form** - - |Type|Information| - |---|---| - |Individual/Team Name*| - |Country*| - |Name of Contact Person*| - |E-mail*| - |Phone(include country code)*| - |Project Name*| - |Project Type(single option)*|( ) Wallet based on Windows; ( ) Wallet based on Mac; ( ) Wallet based on iOS/Android; ( ) Wallet embedded with Google Chrome; ( )Blockchain Explorer;| - - Attention: item with * is required. - -+ Step 2. Applicants will receive a confirmation email upon successful application: - - You have successfully signed up for TRON Programming Contest. Please submit your project to program@tron.network by 23:59 on May 31, 2018 (GMT+8). Submission after the deadline is considered as unsuccessful. Thank you for your participation! - -## Project Submission - -+ Step 1. Please submit your project, along with your application form, to program@tron.network by May 31, 2018 (GMT+8). Please name the subject of the email in the format of “Project submission_Individual/Team name_Participating project”(e.g. “Project submission_TRON team_Blockchain explorer”), or the email will be categorized as spam, leading to an unsuccessful submission. - - **Submission Form** - - |Type|Information| - |---|---| - |Individual/Team Name*| - |Country*| - |Name of Contact Person*| - |E-mail*| - |Phone*(include country code)| - |Project Name*| - |Project Type*(single option)|( ) Wallet based on Windows; ( ) Wallet based on Mac; ( ) Wallet based on iOS/Android; ( ) Wallet embedded with Google Chrome; ( )Blockchain Explorer;| - |Project Description*(In the form of link,installation package,etc.)|Please send installation package or other related forms in the attachment. | - |Github*| - |Video Introduction| - |Name of Attachment| - - Attention: item with * is required. - -+ Step 2. Applicants will receive a confirmation email upon successful project submission: - - You have successfully submitted your project. We will evaluate the submitted project carefully. Announcement of the results of TRON Programming Contest will be made on June 5, 2018. Thank you for your participation! diff --git a/English_Documentation/TRON_Protocol/CreateAccount_Update.MD b/English_Documentation/TRON_Protocol/CreateAccount_Update.MD deleted file mode 100755 index 8c8da5fe..00000000 --- a/English_Documentation/TRON_Protocol/CreateAccount_Update.MD +++ /dev/null @@ -1,9 +0,0 @@ -# Create an account - -You can register a random offline key pair (including the address and private key), but this key pair will not be recorded by the TRON network. To make this key pair an account in the TRON network, you need to call one of the following three apis with an account already existing in the TRON network: - -- Directly call the Create Account api -- Transfer TRX to the new address -- Transfer any kind of token to the new address - -After the transaction is confirmed by the network, you can query the information of the account that matches the address in the TRON network. Creating an account burns 0.1 TRX from the creator, or consumes the bandwidth acquired by freezing. **【Note】** After Odyssey 3.0 goes online, with the confirmation of the committee, creating an account will burn 0.1 TRX from the creator without consuming bandwidth. diff --git a/English_Documentation/TRON_Protocol/Freezing&Voting_Update.MD b/English_Documentation/TRON_Protocol/Freezing&Voting_Update.MD deleted file mode 100755 index e80285bb..00000000 --- a/English_Documentation/TRON_Protocol/Freezing&Voting_Update.MD +++ /dev/null @@ -1,51 +0,0 @@ -# Freeze/release funds - -## Why do we freeze funds? - -There are two reasons for setting up a mechanism for freezing funds: - -+ To prevent malicious spam transactions from blocking the network and slowing down transaction confirmation; -+ To prevent malicious votes. - -## Freeze/release mechanism - -When the funds are frozen, you will gain an equivalent amount of TRON power (TP), bandwidth points, and CPU resources. -**Note that** you need to choose either to gain bandwidth points (the default choice) or CPU resources when the funds are frozen. TP can be used to vote; bandwidth points and CPU resources for transactions. The usages and calculating methods of the above three will be stated later. - -The frozen funds will enter your frozen account and cannot be used for trading. - -If you need more TP or bandwidth temporarily, you can top up frozen funds to get additional TP and bandwidth. As a result, you can only release the funds 3 days after the last freeze operation. - -+ The freeze command is as follows: - - Freezebalance password amount time - amount: frozen funds, unit: sun. The minimum amount is 1,000,000 sun, which is 1TRX - time: frozen duration, the time between when the funds are frozen and when they are released is 3 days. - - -+ For example: - - `freezebalance password 10_000_000 3` - -+ The release command is as follows: - - `unfreezebalance password` - -# Vote - -Every account in the TRON network enjoys the right to vote and you can vote for the Super Representatives (SRs) after your own heart. You need TP to vote and the amount of TP depends on your frozen funds. - -TP calculating method: 1 unit of TP for every frozen TRX. - -After the release, you don't have any frozen assets and lose all TP accordingly. As a result, all votes become invalid. To prevent this from happening, you can refreeze to vote. - -Note that the TRON network only records your last vote, which means that every new vote will negate all previous votes. - -+ For example: - - freezebalance password 10,000,000 3 // 10TRX frozen and 10 unit of TP gained - votewitness password witness1 4 witness2 6 // 4 votes for witness 1 and 6 votes for witness 2 at the same time - votewitness password witness1 3 witness2 7 // 3 votes for witness 1 and 7 votes for witness 2 at the same time - - -The final result of the comand is 3 votes for witness 1 and 7 votes for witness 2. diff --git a/English_Documentation/TRON_Protocol/Mechanism_Introduction.md b/English_Documentation/TRON_Protocol/Mechanism_Introduction.md deleted file mode 100644 index c2870713..00000000 --- a/English_Documentation/TRON_Protocol/Mechanism_Introduction.md +++ /dev/null @@ -1,124 +0,0 @@ -## Account creation - -You can generate an offline keypair, which includes an address and a private key, that will not be recorded by TRON. - -In order to create a wallet using this private key, you will need to invoke one of the following three APIs: - -+ directly invoke account creation API -+ transfer TRX to the address -+ transfer tokens to the address - -Once the transaction is confirmed, you can find corresponding information of the account in TRON network. - -## Guidelines for Super Representative application - -All willing users can apply to become Super Representatives, but to prevent malicious attacks, we have set up a threshold for admittance—to run for Super Representative, 9999 TRX in the applicants’ account will be burnt. After successful application, users can run for Super Representatives. - -## Freezing/unfreezing balance - -### Why tokens are frozen? - -The balance freezing mechanism is set up out of two considerations: -+ To prevent malicious spam transactions from clogging the network and causing delayed transaction confirmation. -+ To prevent malicious voting. - -### Freeze/unfreeze mechanism - -Once the balance is frozen, the user will receive a proportionate amount of TRON Power(TP) and bandwidth. TRON Power(TP) represents voting power whereas bandwidth points are used to pay for transactions. Their usage and means of calculation will be introduced in following sections. - -Frozen assets are held in your frozen account and cannot be used for trading. - -The fixed frozen duration is 3 days, after which you can unfreeze your balance any time you like manually. Balance unfrozen will be transferred back into your current account. - -More TP and bandwidth points can be obtained by freezing more balance. The balance can be unfrozen after 3 days from the latest freezing. - -+ The freezing command is as follows: - -``` -freezebalance password amount time -amount: the unit of frozen balance is sun. The minimum balance frozen is 1,000,000 sun, or 1 TRX. -time: frozen duration lasting from date of freeze and date to unfreeze is 3 days. -``` - -+ e.g. - - `freezebalance password 10_000_000 3` - -+ Unfreezing command: - - `unfreezebalance password` - -## Block-production reward for Super Representatives - -Each time a Super Representative finishes block production, reward will be sent to the subaccount in the superledger. Super Representatives can check but not directly make use of this asset. A withdrawal can be made once every 24 hours, transferring the reward from the subaccount to the Super Representative’s account. - -## Super Representative Election - -Every account in TRON’s network is entitled to vote for the Super Representatives they support. Voting requires TP, which is determined by users’ current amount of frozen balance. - -Calculation of TP: 1 TP for 1 frozen TRX. - -Once you unfreeze your balance, an equivalent amount of TP is also lost, meaning that previous votes casted may no longer be valid. You can refreeze your balance to regain validity of votes. - -Note: TRON network only keeps record of the latest votes, meaning that every new allocation of votes you make will replace all previous records. - -+ e.g. - -``` -freezebalance password 10_000_000 3 // 10 TP for 10 frozen TRX -votewitness password witness1 4 witness2 6 //4 votes for witness1 and 6 votes for witness2 -vote witness password witness1 3 witness2 7 // 3 votes for witness1 and 7 votes for witness2 -``` -The final result of the above commands is 3 votes for witness1 and 7 votes for witness2. - -## Bandwidth Points - -Having too many transactions will clog our network like Ethereum and may incur delays on transaction confirmation. To keep the network operating smoothly, TRON network grants every account a free pool of `Bandwidth` for free transactions every 24 hours. To engage in transactions more frequently requires freezing TRX for additional bandwidth, or paying the fee in TRX. - -1. Definition of bandwidth points -Transactions are transmitted and stored in the network in byte arrays. Bandwidth points consumed in a transaction equals the size of its byte array. -If the length of a byte array is 200 then the transaction consumes 200 bandwidth points. -2. Calculation of bandwidth points -Bandwidth points are the number of usable bytes for an account per day. -Within a given period of time, the entire network could only handle a fixed amount of bandwidth. -The ratio of bandwidth points in an account to the bandwidth capacity of TRON’s network equals the ratio of frozen balance in an account to frozen balance on the entire network. -e.g If frozen asset on the entire network totals 1,000,000 TRX and one given account froze 1,000 TRX, or 0.1% of total TRX frozen, then the account can perform about 300 transactions per day. -Note: Since the amount of frozen asset on the entire network and for a certain account are subject to change, bandwidth points held by an account isn’t always fixed. -3. Complimentary bandwidth points -There are 5000 bandwidth points for free per account per day. When an account hasn’t frozen any balance, or when its bandwidth points have run out, complimentary bandwidth points can be used. -Each transaction in Tron’ network is about 200 bytes, so each account enjoys about 25 transactions for free each day. -4. Token transfer -For transactions of token transfer, bandwidth points will first be charged from the token issuer. -When issuing tokens, the issuer can configure a limit to maximum bandwidth consumption, namely the maximal bandwidth points which can be charged from him/her for a token holder’s token transfers within 24 hours and the maximal total of bandwidth points. -These two parameters can be configured through updateAsset interface. -5. Consumption of bandwidth points -Aside from inquiries, any other type of transaction consumes bandwidth points. The bandwidth consumption procedure is as follows: - + If the transaction isn’t a token transfer, skip to step 2. If the transaction is a token transfer, TRON will try to charge bandwidth points from the token issuer. If the issuer does not have sufficient bandwidth points or the charge is beyond the issuer’s maximal threshold, go to step 2. - + Charge bandwidth points from the initiator. If bandwidth points are insufficient: - (1) If the transaction creates a new account, skip to step 4. - (2) If the transaction does not create a new account, go to step 3. - + Charge free bandwidth points from the initiator. If there is insufficient free bandwidth points, go to step 4. - + TRX will be charged from and the transaction initiator and burnt. - (1) For a normal transfer, it costs about 0.002 TRX. - (2) If a new account is created by the transaction, it costs about 0.1 TRX. - Note: When balance unfreezes, bandwidth points will be cleared since there is no more frozen TRX. -6. Account creation - -Complimentary bandwidth points cannot be used for account creation. Bandwidth points gained from balance freezing or 0.1 TRX is needed. - -Users can create account by directly invoking account creation API, TRX transfer and token transfer. - -## Token issuance - -In TRON’s network, every account is capable of issuing tokens at the expense of 1024 TRX. Users can lock their tokens in separately. - -To issue token, issuer needs to set up token name, total capitalization, exchange rate to TRX, circulation duration, description, website, maximum bandwidth consumption per account, total bandwidth consumption and token freeze. - -+ e.g. - -`assetissue password abc 1000000 1 1 2018-5-31 2018-6-30 abcdef a.com 1000 1000000 200000 180 300000 365 ` - -Tokens named abc are issued with the above command, with a capitalization totaling 1 million. The exchange rate of abc to TRX is 1:1. The duration of circulation is May 31-June 30, 2018. It is described as abcdef. The provided website is a.com. - -A maximum of 1000 bandwidth points can be charged from the issuer’s account per account per day. A maximum of 1,000,000 bandwidth points can be charged from the issuer’s account for all token holders’ transactions each day. in total capitalization, 200,000 tokens are locked for 180 days and 300,000 tokens are locked for 365 days. - diff --git a/English_Documentation/TRON_Protocol/SuperRepresentative_Update.MD b/English_Documentation/TRON_Protocol/SuperRepresentative_Update.MD deleted file mode 100755 index 532be42b..00000000 --- a/English_Documentation/TRON_Protocol/SuperRepresentative_Update.MD +++ /dev/null @@ -1,80 +0,0 @@ -# Super Representative - -## Rules for Super Representative (SR) Application - -Every account in the TRON network can apply and have the opportunity to become a SR. Every one can vote for SR candidates. The 27 candidates with the most votes will become SRs with the right to generate blocks. The votes are counted every 6 hours and the SRs will change accordingly. - -To prevent malicious attack, there is a cost to become a SR candidate. When applying, 9999 TRX will be burned from the applicant's account. Once successful, you can join the SR election. - -## SR election - -You need TRON Power (TP) to vote and the amount of TP depends on your current frozen assets. TP is calculated in the following way: 1 TP for 1 frozen TRX. - -Every account in the TRON network has the right to vote for your own SRs - -After the release, you don't have any frozen assets and lose all TP accordingly. As a result, all votes become invalid. To prevent this from happening, you can refreeze to vote. - -Note that the TRON network only records your most recent vote, which means that every new vote will negate all previous votes. - -+ For example: - - freezebalance password 10,000,000 3 // 10TRX frozen and 10 unit of TP gained - votewitness password witness1 4 witness2 6 // 4 votes for witness 1 and 6 votes for witness 2 at the same time - votewitness password witness1 3 witness2 7 // 3 votes for witness 1 and 7 votes for witness 2 at the same time - - -The final result of the command is 3 votes for witness 1 and 7 votes for witness 2. - -## Rewards - -1. Rewards for SRs. Every 6 hours, the top 127 SR candidates with the most votes will be rewarded with 115,200 TRX. The reward will be given to each one according to the votes he/she receives. A total amount of 168,192,000 TRX will be given out every year. - -2. Block generation rewards. New blocks are generated every 3 seconds in the TRON network and SRs will receive 32 TRX for every block generated. A total amount of 336,384,000 TRX will be given out. - -+ After generating a block, the rewards will go directly into the SR's sub account. SRs cannot use them right away but they can look up. The rewards can be withdrawn every 24 hours, from the sub account directly to the SR's account. -+ The TRON Foundation will provide rewards for block generation and SRs before January 1, 2021. The TRON network will not issue additional TRX. - -# Committee - -### What is the committee? - -The committee is used to modify Tron network dynamic parameters, such as block generation rewards, transaction fees, etc. The committee consists of the current 27 SRs. Each SR has the right to propose and to vote on proposals. When a proposal receives 18 votes or more, it is approved and its network parameters will be modified in the next maintenance period. - -### Create proposal - -Only the SR corresponding accounts have the right to propose and other accounts do not. The network dynamic parameters allowed to be modified and their numbers are as follows ( [min,max] ): - -+ 0: MAINTENANCE_TIME_INTERVAL, [3 * 27* 1000 , 24 * 3600 * 1000] //Modify the maintenance interval, currently 6*3600 * 1000ms -+ 1: ACCOUNT_UPGRADE_COST, [0,100 000 000 000 000 000] //Modify the cost of upgrading to SR account, currently 9999 Sun -+ 2: CREATE_ACCOUNT_FEE, [0,100 000 000 000 000 000] // Modify the account creation fee, currently 100_000 Sun -+ 3: TRANSACTION_FEE, [0,100 000 000 000 000 000] // Modify the amount of TRX used to gain extra bandwidth, currently 10 Sun/byte -+ 4: ASSET_ISSUE_FEE, [0,100 000 000 000 000 000] // Modify asset issuance fee, currently 1024_000_000 Sun -+ 5: WITNESS_PAY_PER_BLOCK, [0,100 000 000 000 000 000] // Modify SR block generation reward, currently 32_000_000 Sun -+ 6: WITNESS_STANDBY_ALLOWANCE, [0,100 000 000 000 000 000] // Modify the rewards given to the top 127 SR candidates, 115_200_000_000 Sun -+ 7: CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT, []// Modify the cost of account creation, currently 0 Sun -+ 8: CREATE_NEW_ACCOUNT_BANDWIDTH_RATE, // Use proposals 7 and 8 together to modify the resources or TRX consumption of account creation. -+ 9: ALLOW_CREATION_OF_CONTRACTS, // used to open virtual machines (VMs) -+ 10: REMOVE_THE_POWER_OF_THE_GR // remove the initial GR votes -+ 11: ENERGY_FEE, [0,100 000 000 000 000 000] //sun -+ 12: EXCHANGE_CREATE_FEE, [0,100 000 000 000 000 000] //sun -+ 13: MAX_CPU_TIME_OF_ONE_TX, [0, 1000] //ms - -+ API: `createproposal id0 value0 ... idN valueN -id0_N: Parameter number -value0_N: new parameter value ` - -Note: In the Tron network, 1 TRX = 1000_000 Sun. - -### Vote on proposals - -An proposal only supports votes that are in favor. Those who do not vote show their disagreement. The proposal is valid for 3 days after it is created. Afterwards, if the proposal does not receive enough votes, it becomes invalid. The favorable votes can be cancelled. - -+ API: `deleteProposal proposalId -id: The proposal ID increases as time goes on after it is proposed ` is_or_not_add_approval: Approve or cancel approval - -### Cancel proposals - -The proposer can cancel the proposal before it takes effect. - -+ API: `deleteProposal proposalId -id: The proposal ID increases as time goes on after it is proposed ` diff --git a/English_Documentation/TRON_Protocol/TRON_CostModel_Update.MD b/English_Documentation/TRON_Protocol/TRON_CostModel_Update.MD deleted file mode 100755 index d4c1b0d6..00000000 --- a/English_Documentation/TRON_Protocol/TRON_CostModel_Update.MD +++ /dev/null @@ -1,88 +0,0 @@ -# TRON cost model - -There are 3 types of resources in the TRON network: bandwidth, CPU, and storage. Thanks to TRON's unique memory model, the storage is almost infinite. But too many unnecessary transactions consumes a lot of bandwidth and CPU resources, causing system congestion and affecting normal transactions confirmation. In order to maintain the relative fairness of the transactions, Bandwidth Points and Energy are introduced. Bandwidth consumes Bandwidth Points and CPU consumes Energy. -**Note** - -- Normal transactions only consume Bandwidth Points; -- Smart contracts consume Bandwidth Points as well as Energy. - -## 1. Bandwidth Points - -Transactions are transmitted and stored in the network as byte arrays. The Bandwidth Points consumed by a transaction = Bandwidth Points * Bandwidth Points rate. The current rate = 1. - -If the byte array length of a transaction is 200, then the transaction needs to consume 200 Bandwidth Points. - -**Note** since the total frozen funds in the network and the frozen funds of accounts may change at any time, the Bandwidth Points owned by accounts are not fixed. - -### Sources of Bandwidth Points - -Bandwidth Points can be gained in two ways: - -- One way is by freezing the TRX. The quota = the TRX frozen for gaining Bandwidth Points / the total TRX frozen in the network for gaining Bandwidth Points * 43_200_000_000, which is the equally-divided fixed Bandwidth Points quota for all users based on the frozen TRX. - -- The other way is the fixed 5,000 free TRX quota for each account. - -### Bandwith Points consumption - -Except enquiry, any other transactions consume Bandwidth Points. - -There is another exception. If the target account did not exist in a transfer, normal or token issuance, a new account will be created and the transfer can be done. In this case, only Bandwidth Points consumed by account creation will be deducted. Transfer will not take up extra Bandwidth Points. - -### Bandwidth Points Calculating methods - -Bandwidth Points are the total number of bytes an account can use in a day. The bandwidth that the entire network can process during a certain period of time is fixed. - -If a transaction requires a new account, the Bandwidth Points are consumed as follows: - - 1. Try to consume the Bandwidth Points that the transaction initiator has frozen to gain. If the initiator does not have enough Bandwidth Points, then go to the next step. - - 2. Try to consume the TRX of the transaction initiator, which means burning 0.1TRX. - - -If the transaction is a token issuance transfer, the Bandwidth Points are consumed as follows: - - 1. First, verify whether the total free Bandwidth Points of the issued token asset are sufficient; Next, verify whether the remaining free Bandwidth Points of the transfer initiator are sufficient; Third, whether the remaining Bandwidth Points the token issuers have frozen to gain are sufficient. - If any of these three requirements is met, then the Bandwidth Points will be deducted from the token issuer. If not, then go to the next step. - - 2. Try to consume the Bandwidth Points obtained by the transaction initiator through frozen assets. If the points are not enough, then go to the next step. - - 3. Try to consume the free Bandwidth Points of the transaction initiator. If they are not enough, then go to the next step. - - 4. Try to consume the TRX of the transaction initiator, the number of bytes in the transaction * 10 sun. - - -If it is a normal transaction, Bandwidth Points are consumed as follows: - - 1. Try to consume the Bandwidth Points that the transaction initiator gained through frozen assets. If the Points are not enough, then go to the next step. - - 2. Try to consume the free Bandwidth Points of the transaction initiator. If they are not enough, then go to the next step. - - 3. Try to consume the TRX of the transaction initiator, the number of bytes in the transaction * 10 sun. - - -## 2. Energy - -The creation and operation of a smart contract consume CPU resources. It takes time for smart contracts to operate in virtual machines (VMs), and the time consumed in the system is calculated in microseconds. CPU resources are consumed in energy, which means 1Energy == 1 microsecond. If a contract takes 100 microseconds to execute in a VM, it needs to consume 100 Energy. The total CPU resources provided by the TRON network are 50_000_000_000 Energy within 24 hours. - -### Gaining Energy - -Energy can only be obtained by freezing the TRX. Energy obtained = the TRX frozen for gaining Energy / the total TRX frozen for gaining Energy in the entire network * 50_000_000_000, which is the equally-divided fixed Energy for all users based on the frozen TRX. - -For example, suppose the total amount of TRX frozen for gaining Energy is 1000_000_000 TRX in the current network, and one account freezes 1000 TRX, which is one millionth of the total and equals 32400 microseconds. If executing a contract takes 324 microseconds, then the user can trigger the contract 100 times. - -**Note** - -- Since the total frozen funds in the network and the frozen funds of accounts may change at any time, the CPU resources owned by accounts are not fixed. -- One cannot get both Bandwidth Points and Energy when freezing funds. If you freeze TRX to get bandwidth, then your Energy will not change. - -### Energy consumption - -The creation and execution of smart contracts consume Energy, and other normal transactions do not consume Energy. - -### Energy calculating methods - -Energy is consumed as follows: - - 1. Try to consume the Energy that the transaction initiator gained through frozen assets. If it is not enough, then deduct and return the rest. If it is not enough, then deduct whatever it has and go to the next step. - - 2. Try to consume the TRX of the transaction initiator, the number of TRX = Energy needed * 100 sun. diff --git a/English_Documentation/TRON_Protocol/TRON_DEX_Update.MD b/English_Documentation/TRON_Protocol/TRON_DEX_Update.MD deleted file mode 100755 index 90599e21..00000000 --- a/English_Documentation/TRON_Protocol/TRON_DEX_Update.MD +++ /dev/null @@ -1,67 +0,0 @@ -# TRON decentralized exchange - -### 1. What is a trading pair (Exchange) - -The TRON network natively supports decentralized exchanges. A decentralized exchange consists of multiple trading pairs. A trading pair (Exchange) is an Exchange Market between token and token, or between token and TRX. Any account can create a trading pair between any tokens, even if the same pair already exists in the TRON network. Trading and price fluctuations of the trading pairs follow the Bancor Protocol. The TRON network stipulates that the weights of the two tokens in all trading pairs are equal, so the ratio of their balance is the price between them. For example, let's say a trading pair contains two tokens, ABC and DEF. ABC has a balance of 10 million and DEF has a balance of 1 million. Since their weights are equal, 10 ABC = 1 DEF — that is, the price of ABC to DEF is 10ABC/DEF. - -### 2. Create a trading pair - -Any account can create a trading pair between any tokens. The fee for creating a trading pair is 1024 TRX, which will be burned by the TRON network. -Creating a trading pair is equivalent to injecting the original capital for the trading pair, so the creator must have the original balance of the trading pair in his account. When the creation is successful, the balance of the two tokens is immediately deducted from the account. -The contract for creating a trading pair is ExchangeCreateContract, which has 4 parameters: - -- first_token_id, the id of the first token -- first_token_balance, the balance of the first token -- second_token_id, the id of the second token -- second_token_balance, balance of the second token - -The token id is obtained by the name of the token. For details, see the documentation on token issuance. If the trading pair contains TRX, use "_" to indicate the id of TRX. Note that the unit of TRX is sun, which is 10-6 TRX. -Example: `ExchangeCreate abc 10000000 _ 1000000000000 ` The transaction will create a trading pair between abc and TRX. The initial balance is 10000000 abc and 1000000000000 sun (1000000TRX) respectively. If the creator does not have enough abc and TRX, the trading pair creation will fail; otherwise, the appropriate amount of abc and TRX is deducted immediately from the account of the creator,which means that the trading pair is created successfully and you can start trading. - -### 3. Trading - -Any account can conduct trading in any trading pair. The trading volume and the trading price are in full compliance with the Bancor Protocol. That is to say, when an account is trading, the object of the trading is exchange. The trading is instant, without the need to make/take orders; as long as there are enough tokens, the trading will be successful. -The trading contract is ExchangeTransactionContract, which has 3 parameters: - - - exchange_id, the id of the trading pair: the TRON network will give each trading pair a unique id based on the order of the time when the pair was created - - token_id, the id of the token to be sold - - quant, the amount of the token to be sold - - -Example: -We are trading in the abc/TRX trading pair that we just created: assuming the id of the trading pair is 1, the abc balance in the current pair is 10000000, the TRX balance is 1000000, if you want to spend 100 TRX to buy abc, then -`ExchangeTransaction 1 _ 100 ` -where "_" represents TRX, that is, 100 TRX are sold to the trading pair. If successful, the trading will add 100 TRX to the trading pair and calculate the reduced amount of abc based on the Bancor protocol. The number of abc and TRX in the account of the creator will increase and decrease accordingly. - -### 4. Capital Injection (Inject) - -When a trading pair has a small balance of one of the tokens, just a small trading volume will cause a significant price fluctuation, which interferes with normal trading. To avoid this, the creator of the trading pair may choose to inject capital to the trading pair. Only the creator of a trading pair can inject capital to the pair. There is no processing fee for capital injection. -A designated token and a specific amount of injection are required in this process. The TRON network will automatically calculate the amount of the other token according to the ratio of the two tokens in the current trading pair, so as to ensure that the ratio of the two tokens and the price in the trading pair remain the same before and after the capital injection. -Same as creating a trading pair, capital injection requires the creator to have enough balance for both tokens. -The contract for capital injection is ExchangeInjectContract, which has three parameters: - - - exchange_id, the id of the trading pair - - token_id, the id of the token to receive the capital injection - - quant, the amount of the token to receive the capital injection - - -Example: -We are injecting capital in the abc/TRX trading pair that we just created: assuming the id of the trading pair is 1 (the first trading pair in the TRON network), the abc balance in the current pair is 10000000, the TRX balance is 1000000, if you want to increase abc by 10%, then `ExchangeInject 1 abc 1000000` -If successful, the trading will add 1000000 abc to the trading pair, as well as 100000 TRX. The amount of abc and TRX in the account of the trading pair creator will increase and decrease accordingly. - -### 5. Withdrawal of capital (withdraw) - -All assets in a trading pair belong to the creator. The creator can withdraw at any time to redeem the token in the trading pair back to his own account. Only the creator can withdraw from the trading pair. No processing fee is required for withdrawal. -Like capital injection, the withdrawal requires a designated token and a specific amount of withdrawal. The TRON network will automatically calculate the amount of capital withdrawn from the other token according to the ratio of the two tokens in the current trading pair, thus ensuring that the ratio of the two tokens and the price in the trading pair remain the same before and after the withdrawal. -[Risk Warning] The price will not change before and after the withdrawal, but the price fluctuation will be greater -The contract for withdrawal is ExchangeWithdrawContract, which has 3 parameters: - - - exchange_id, the id of the trading pair - - token_id, the id of the token to perform the withdrawal - - quant, the amount of the token to perform the withdrawal - - -Example: -We are withdrawing capital in the abc/TRX trading pair that we just created: assuming the id of the trading pair is 1, the abc balance in the current pair is 10000000, the TRX balance is 1000000, if you want to redeem 10% of the abc, then -`ExchangeWithdraw 1 abc 1000000` -If successful, the trading will reduce 1000000 abc, as well as 100000 TRX in the trading pair. The amount of abc and TRX in the account of the trading pair creator will increase accordingly. diff --git a/English_Documentation/TRON_Protocol/TRON_Protobuf_Protocol_document.md b/English_Documentation/TRON_Protocol/TRON_Protobuf_Protocol_document.md deleted file mode 100644 index 51c2796c..00000000 --- a/English_Documentation/TRON_Protocol/TRON_Protobuf_Protocol_document.md +++ /dev/null @@ -1,973 +0,0 @@ - -# Protobuf protocol - -## The protocol of TRON is defined by Google Protobuf and contains a range of layers, from account, block to transfer. - -+ There are 3 types of account—basic account, asset release account and contract account, and attributes included in each account are name, types, address, balance and related asset. -+ A basic account is able to apply to be a validation node, which has serval parameters, including extra attributes, public key, URL, voting statistics, history performance, etc. - - There are three different `Account types`: `Normal`, `AssetIssue`, `Contract`. - - enum AccountType {
 - Normal = 0;
 - AssetIssue = 1;
 - Contract = 2; - 
} - - An `Account` contains 7 parameters: - `account_name`: the name for this account – e.g. “_BillsAccount_”. - `type`: what type of this account is – e.g. _0_ stands for type `Normal`. - `balance`: balance of this account – e.g. _4213312_. - `votes`: received votes on this account – e.g. _{(“0x1b7w…9xj3”,323), (“0x8djq…j12m”,88),…,(“0x82nd…mx6i”,10001)}_. - `asset`: other assets except TRX in this account – e.g. _{<“WishToken”,66666>,<”Dogie”,233>}_. - `latest_operation_time`: the latest operation time of this account. - - // Account
 - message Account {
 - message Vote {
 - bytes vote_address = 1;
 - int64 vote_count = 2;
 }
 - bytes accout_name = 1;
 - AccountType type = 2;
 - bytes address = 3;
 - int64 balance = 4;
 - repeated Vote votes = 5;
 - map asset = 6; - int64 latest_operation_time = 10;
 - } - - A `Witness` contains 8 parameters: - `address`: the address of this witness – e.g. “_0xu82h…7237_”. - `voteCount`: number of received votes on this witness – e.g. _234234_. - `pubKey`: the public key for this witness – e.g. “_0xu82h…7237_”. - `url`: the url for this witness – e.g. “_https://www.noonetrust.com_”. - `totalProduced`: the number of blocks this witness produced – e.g. _2434_. - `totalMissed`: the number of blocks this witness missed – e.g. _7_. - `latestBlockNum`: the latest height of block – e.g. _4522_. - `isjobs`: a bool flag. - - // Witness
 - message Witness{
 - bytes address = 1;
 - int64 voteCount = 2;
 - bytes pubKey = 3;
 - string url = 4;
 - int64 totalProduced = 5;
 - int64 totalMissed = 6;
 - int64 latestBlockNum = 7;
 - bool isJobs = 9; - } - -+ A block typically contains transaction data and a blockheader, which is a list of basic block information, including timestamp, signature, parent hash, root of Merkle tree and so on. - - A block contains `transactions` and a `block_header`. - `transactions`: transaction data of this block. - `block_header`: one part of a block. - - // block - 
message Block {
 - repeated Transaction transactions = 1;
 - BlockHeader block_header = 2;
 - } - - A `BlockHeader` contains `raw_data` and `witness_signature`. - `raw_data`: a `raw` message. - `witness_signature`: signature for this block header from witness node. - - A message `raw` contains 6 parameters: - `timestamp`: timestamp of this message – e.g. _14356325_. - `txTrieRoot`: the root of Merkle Tree in this block – e.g. “_7dacsa…3ed_.” - `parentHash`: the hash of last block – e.g. “_7dacsa…3ed_.” - `number`: the height of this block – e.g. _13534657_. - `witness_id`: the id of witness which packed this block – e.g. “_0xu82h…7237_”. - `witness_address`: the address of the witness packed this block – e.g. “_0xu82h…7237_”. - - message BlockHeader {
 - message raw {
 - int64 timestamp = 1;
 - bytes txTrieRoot = 2;
 - bytes parentHash = 3;
 - //bytes nonce = 5;
 - //bytes difficulty = 6;
 - uint64 number = 7;
 - uint64 witness_id = 8;
 - bytes witness_address = 9;
 - }
 - raw raw_data = 1;
 - bytes witness_signature = 2;
 - } - - message `ChainInventory` contains `BlockId` and `remain_num`. - `BlockId`: the identification of block. - `remain_num`:the remaining number of blocks in the synchronizing process. - - A `BlockId` contains 2 parameters: - `hash`: the hash of block. - `number`: the height of block. - - message ChainInventory { - message BlockId { - bytes hash = 1; - int64 number = 2; - } - repeated BlockId ids = 1; - int64 remain_num = 2; - } - -+ Transaction contracts mainly includes account create contract, account update contract transfer contract, transfer asset contract, vote asset contract, vote witness contract, witness creation contract, witness update contract, asset issue contract, participate asset issue contract and deploy contract. - - An `AccountCreateContract` contains 3 parameters: - `type`: What type this account is – e.g. _0_ stands for `Normal`. - `account_name`: the name for this account – e.g.”_Billsaccount_”. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - - message AccountCreateContract {
 - AccountType type = 1;
 - bytes account_name = 2;
 - bytes owner_address = 3;
 - } - - A `AccountUpdateContract` contains 2 paremeters: - `account_name`: the name for this account – e.g.”_Billsaccount_”. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - - message AccountUpdateContract { - bytes account_name = 1; - bytes owner_address = 2; - } - - A `TransferContract` contains 3 parameters: - `amount`: the amount of TRX – e.g. _12534_. - `to_address`: the receiver address – e.g. “_0xu82h…7237_”. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - - message TransferContract {
 - bytes owner_address = 1;
 - bytes to_address = 2;
 - int64 amount = 3; - } - - A `TransferAssetContract` contains 4 parameters: - `asset_name`: the name for asset – e.g.”_Billsaccount_”. - `to_address`: the receiver address – e.g. “_0xu82h…7237_”. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - `amount`: the amount of target asset - e.g._12353_. - - message TransferAssetContract {
 - bytes asset_name = 1;
 - bytes owner_address = 2;
 - bytes to_address = 3;
 - int64 amount = 4;
 - } - - A `VoteAssetContract` contains 4 parameters: - `vote_address`: the voted address of the asset. - `support`: is the votes supportive or not – e.g. _true_. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - `count`: the count number of votes- e.g. _2324234_. - - message VoteAssetContract {
 - bytes owner_address = 1;
 - repeated bytes vote_address = 2;
 - bool support = 3;
 - int32 count = 5;
 - } - - A `VoteWitnessContract` contains 4 parameters: - `vote_address`: the addresses of those who voted. - `support`: is the votes supportive or not - e.g. _true_. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - `count`: - e.g. the count number of vote – e.g. _32632_. - - message VoteWitnessContract {
 - bytes owner_address = 1;
 - repeated bytes vote_address = 2;
 - bool support = 3;
 - int32 count = 5; - 
} - - A `WitnessCreateContract` contains 3 parameters: - `private_key`: the private key of contract– e.g. “_0xu82h…7237_”. - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - `url`: the url for the witness – e.g. “_https://www.noonetrust.com_”. - - message WitnessCreateContract {
 - bytes owner_address = 1;
 - bytes private_key = 2;
 - bytes url = 12;
 - } - - A `WitnessUpdateContract` contains 2 parameters: - `owner_address`: the address of contract owner – e.g. “_0xu82h…7237_”. - `update_url`: the url for the witness – e.g. “_https://www.noonetrust.com_”. - - message WitnessUpdateContract { - bytes owner_address = 1; - bytes update_url = 12; - } - - An `AssetIssueContract` contains 11 parameters: - `owner_address`: the address for contract owner – e.g. “_0xu82h…7237_”. - `name`: the name for this contract – e.g. “Billscontract”. - `total_supply`: the maximum supply of this asset – e.g. _1000000000_. - `trx_num`: the number of TRONIX – e.g._232241_. - `num`: number of corresponding asset. - `start_time`: the starting date of this contract – e.g._20170312_. - `end_time`: the expiring date of this contract – e.g. _20170512_. - `decay_ratio`: decay ratio. - `vote_score`: the vote score of this contract received – e.g. _12343_. - `description`: the description of this contract – e.g.”_trondada_”. - `url`: the url of this contract – e.g. “_https://www.noonetrust.com_”. - - message AssetIssueContract {
 - bytes owner_address = 1;
 - bytes name = 2;
 - int64 total_supply = 4;
 - int32 trx_num = 6;
 - int32 num = 8;
 - int64 start_time = 9;
 - int64 end_time = 10;
 - int32 decay_ratio = 15;
 - int32 vote_score = 16;
 - bytes description = 20;
 - bytes url = 21;
 - } - - A `ParticipateAssetIssueContract` contains 4 parameters: - `owner_address`: the address for contract owner – e.g. “_0xu82h…7237_”. - `to_address`: the receiver address – e.g. “_0xu82h…7237_”. - `asset_name`: the name of target asset. - `amount`: the amount of suns. - - message ParticipateAssetIssueContract { - bytes owner_address = 1; - bytes to_address = 2; - bytes asset_name = 3; - int64 amount = 4; - } - - A `DeployContract` contains 2 parameters: - `script`: the script of this contract. - `owner_address`: the address for contract owner – e.g. “_0xu82h…7237_”. - - message DeployContract {
 - bytes owner_address = 1;
 - bytes script = 2; - 
} t - -+ Each transaction contains several TXInputs, TXOutputs and other related qualities. -Input, transaction and block header all require signature. - - message `Transaction` contains `raw_data` and `signature`. - `raw_data`: message `raw`. - `signature`: signatures form all input nodes. - - `raw` contains 8 parameters: - `type`: the transaction type of `raw` message. - `vin`: input values. - `vout`: output values. - `expiration`: the expiration date of transaction – e.g._20170312_. - `data`: data. - `contract`: contracts in this transaction. - `scripts`:scripts in the transaction. - `timestamp`: timestamp of this raw data – e.g. _14356325_. - - message `Contract` contains `type` and `parameter`. - `type`: what type of the message contract. - `parameter`: It can be any form. - - There are 8 different of contract types: `AccountCreateContract`, `TransferContract`, `TransferAssetContract`, `VoteAssetContract`, `VoteWitnessContract`,`WitnessCreateContract`, `AssetIssueContract` and `DeployContract`. - `TransactionType` have two types: `UtxoType` and `ContractType`. - - message Transaction {
 - enum TranscationType {
 - UtxoType = 0;
 - ContractType = 1;
 - }
 - message Contract {
 - enum ContractType {
 - AccountCreateContract = 0;
 - TransferContract = 1;
 - TransferAssetContract = 2;
 - VoteAssetContract = 3;
 - VoteWitnessContract = 4;
 - WitnessCreateContract = 5;
 - AssetIssueContract = 6;
 - DeployContract = 7;
 - WitnessUpdateContract = 8; - ParticipateAssetIssueContract = 9 - }
 - ContractType type = 1;
 - google.protobuf.Any parameter = 2;
 - }
 - message raw {
 - TranscationType type = 2;
 - repeated TXInput vin = 5;
 - repeated TXOutput vout = 7;
 - int64 expiration = 8;
 - bytes data = 10;
 - repeated Contract contract = 11;
 - bytes scripts = 16;
 - int64 timestamp = 17; - }
 - raw raw_data = 1;
 - repeated bytes signature = 5; - 
} - - message `TXOutputs` contains `outputs`. - `outputs`: an array of `TXOutput`. - - message TXOutputs {
 - repeated TXOutput outputs = 1;
 - } - - message `TXOutput` contains `value` and `pubKeyHash`. - `value`: output value. - `pubKeyHash`: Hash of public key - - message TXOutput {
 - int64 value = 1;
 - bytes pubKeyHash = 2;
 - } - - message `TXInput` contains `raw_data` and `signature`. - `raw_data`: a message `raw`. - `signature`: signature for this `TXInput`. - - message `raw` contains `txID`, `vout` and `pubKey`. - `txID`: transaction ID. - `vout`: value of last output. - `pubKey`: public key. - - message TXInput {
 - message raw {
 - bytes txID = 1;
 - int64 vout = 2;
 - bytes pubKey = 3;
 - }
 - raw raw_data = 1;
 - bytes signature = 4; - 
} - message `Result` contains `fee` and `ret`. - `ret`: the state of transaction. - `fee`: the fee for transaction.(Not used) - - `code` is the enumerator that defines `ret` property and can be 2 types:`SUCCESS` and `FAILED`. - - message Result { - enum code { - SUCESS = 0; - FAILED = 1; - } - int64 fee = 1; - code ret = 2; - } - - message `TransactionInfo`contains`id`、`fee`、`blockNumber` and `blockTimeStamp`。 - - `id`:transaction ID. - `fee`: transaction fee - `blockNumber`:the height of the block where the transaction is located. - `blockTimeStamp`:the timestamp of block. - - message TransactionInfo {
 - bytes id = 1; - int64 fee = 2; - int64 blockNumber = 3; - int64 blockTimeStamp = 4; - } - - -+ Inventory is mainly used to inform peer nodes the list of items. - - `Inventory` contains `type` and `ids`. - `type`: what type this `Inventory` is. – e.g. _0_ stands for `TRX`. - `ids`: ID of things in this `Inventory`. - - Two `Inventory` types: `TRX` and `BLOCK`. - `TRX`: transaction. - `BLOCK`: block. - - // Inventory
 - message Inventory {
 - enum InventoryType {
 - TRX = 0;
 - BLOCK = 1;
 - }
 - InventoryType type = 1;
 - repeated bytes ids = 2;
 - } - - message `Items` contains 4 parameters: - `type`: type of items – e.g. _1_ stands for `TRX`. - `blocks`: blocks in `Items` if there is any. - `block_headers`: block headers if there is any. - `transactions`: transactions if there is any. - - `Items` have four types: `ERR`, `TRX`, `BLOCK` and `BLOCKHEADER`. - `ERR`: error. - `TRX`: transaction. - `BLOCK`: block. - `BLOCKHEADER`: block header. - - message Items {
 - enum ItemType {
 - ERR = 0;
 - TRX = 1;
 - BLOCK = 2;
 - BLOCKHEADER = 3;
 - }
 - ItemType type = 1;
 - repeated Block blocks = 2;
 - repeated BlockHeader - block_headers = 3;
 - repeated Transaction transactions = 4; - } - - `InventoryItems` contains `type` and `items`. - `type`: what type of inventory. - `items`: the list of inventory. - - message InventoryItems {
 - int32 type = 1;
 - repeated bytes items = 2; - 
} - - message `BlockInventory` contains `type`. - `type`: what type of inventory. - - There are 3 types:`SYNC`, `ADVTISE`, `FETCH`. - - // Inventory - message BlockInventory { - enum Type { - SYNC = 0; - ADVTISE = 1; - FETCH = 2; - } - - message `BlockId` contains `ids` and `type`. - `ids`: the identification of block. - `type`: what type of the block. - - `ids` contains 2 parameters: - `hash`: the hash of block. - `number`: the height of block. - - message BlockId { - bytes hash = 1; - int64 number = 2; - } - repeated BlockId ids = 1; - Type type = 2; - } - - `ReasonCode`: the type of reason. - - `ReasonCode` contains 15 types of disconnect reasons: - `REQUESTED` - `TCP_ERROR` - `BAD_PROTOCOL` - `USELESS_PEER` - `TOO_MANY_PEERS` - `DUPLICATE_PEER` - `INCOMPATIBLE_PROTOCOL` - `NULL_IDENTITY` - `PEER_QUITING` - `UNEXPECTED_IDENTITY` - `LOCAL_IDENTITY` - `PING_TIMEOUT` - `USER_REASON` - `RESET` - `UNKNOWN` - - enum ReasonCode { - REQUESTED = 0; - TCP_ERROR = 1; - BAD_PROTOCOL = 2; - USELESS_PEER = 3; - TOO_MANY_PEERS = 4; - DUPLICATE_PEER = 5; - INCOMPATIBLE_PROTOCOL = 6; - NULL_IDENTITY = 7; - PEER_QUITING = 8; - UNEXPECTED_IDENTITY = 9; - LOCAL_IDENTITY = 10; - PING_TIMEOUT = 11; - USER_REASON = 12; - RESET = 16; - UNKNOWN = 255; - } - - message `DisconnectMessage` contains `reason`: - `DisconnectMessage`: the message when disconnection occurs. - `reason`: the reason for disconnecting. - - message `HelloMessage` contains 3 parameters: - `HelloMessage`: the message for building connection. - `from`: the nodes that request for building connection. - `version`: the version when connection is built. - - - -+ Wallet Service RPC and blockchain explorer - - `Wallet` service contains several RPCs. - __`GetBalance`__ : - `GetBlance` takes a parameter of Account, and returns an `Account` object. - __`CreateTransaction`__ : - `CreateTransaction` takes a parameter of TransferContract, and returns an `Transaction` object. - __`BroadcastTransaction`__ : - `BroadcastTransaction` takes a parameter of Transaction, and returns an `Return` object. - __`CreateAccount`__ : - `CreateAccount` takes a parameter of AccountCreateContract, and returns an `Transaction` object. - __`CreateAssetIssue`__ : - `CreateAssetIssue` takes a parameter of AssetIssueContract, and returns an `Transaction` object. - __`UpdateAccount`__: - `UpdateAccount` takes a parameter of AccountUpdateContract, and returns an `Transaction` object. - __`VoteWitnessAccount`__: - `VoteWitnessAccount` takes a parameter of VoteWitnessContract, and returns an `Transaction` object. - __`WitnessList`__: - `WitnessList` takes a parameter of WitnessUpdateContract, and returns an `WitnessList` object. - __`UpdateWitness`__: - `UpdateWitness` takes a parameter of WitnessUpdateContract, and returns an `Transaction` object. - __`CreateWitness`__: - `CreateWitness` takes a parameter of WitnessCreateContract, and returns an `Transaction` object. - __`TransferAsset`__: - `TransferAsset` takes a parameter of TransferAssetContract, and returns an `Transaction` object. - __`ParticipateAssetIssue`__: - `ParticipateAssetIssue` takes a parameter of ParticipateAssetIssueContract, and returns an `Transaction` object. - __`ListNodes`__: - `ListNodes` takes a parameter of EmptyMessage, and returns an `NodeList` object. - __`GetAssetIssueList`__: - `GetAssetIssueList` takes a parameter of EmptyMessage, and returns an `GetIssueList` object. - __`GetAssetIssueByAccount`__: - `GetAssetIssueByAccount` takes a parameter of Account, and returns an `AssetIssueList` object. - __`GetAssetIssueByName`__: - `GetAssetIssueByName` takes a parameter of BytesMessage, and returns an `AssetIssueContract` object. - __`GetNowBlock`__: - `GetNowBlock` takes a parameter of EmptyMessage, and returns an `Block` object. - __`GetBlockByNum`__: - `GetBlockByNum` takes a parameter of NumberMessage, and returns an `Block` object. - __`TotalTransaction`__: - `TotalTransaction` takes a parameter of EmptyMessage, and returns an `NumberMessage` object. - __`GenerateAddress`__ - `GenerateAddress` takes a parameter of EmptyMessage and returns an `AddressPrKeyPairMessage` object. - - service Wallet { - returns (Account) { - option (google.api.http) = { - post: "/wallet/getaccount" - body: "*" - }; - - }; - - rpc CreateTransaction (TransferContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/createtransaction" - body: "*" - }; - }; - - rpc BroadcastTransaction (Transaction) returns (Return) { - option (google.api.http) = { - post: "/wallet/broadcasttransaction" - body: "*" - }; - }; - - rpc GetAccount (Account) - rpc ListAccounts (EmptyMessage) returns (AccountList) { - option (google.api.http) = { - post: "/wallet/listaccount" - body: "*" - }; - - }; - - rpc UpdateAccount (AccountUpdateContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/updateaccount" - body: "*" - }; - }; - - rpc CreateAccount (AccountCreateContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/createaccount" - body: "*" - }; - }; - - rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/votewitnessaccount" - body: "*" - }; - }; - - rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/createassetissue" - body: "*" - }; - }; - - rpc ListWitnesses (EmptyMessage) returns (WitnessList) { - option (google.api.http) = { - post: "/wallet/listwitnesses" - body: "*" - }; - }; - - rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/updatewitness" - body: "*" - }; - }; - - rpc CreateWitness (WitnessCreateContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/createwitness" - body: "*" - }; - }; - - rpc TransferAsset (TransferAssetContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/transferasset" - body: "*" - }; - } - - rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction) { - option (google.api.http) = { - post: "/wallet/participateassetissue" - body: "*" - }; - } - - rpc ListNodes (EmptyMessage) returns (NodeList) { - option (google.api.http) = { - post: "/wallet/listnodes" - body: "*" - }; - } - rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) { - option (google.api.http) = { - post: "/wallet/getassetissuelist" - body: "*" - }; - } - rpc GetPaginatedAssetIssueList (PaginatedMessage) returns (AssetIssueList) { - option (google.api.http) = { - post: "/wallet/getpaginatedassetissuelist" - body: "*" - }; - } - rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) { - option (google.api.http) = { - post: "/wallet/getassetissuebyaccount" - body: "*" - }; - } - rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) { - option (google.api.http) = { - post: "/wallet/getassetissuebyname" - body: "*" - }; - } - rpc GetNowBlock (EmptyMessage) returns (Block) { - option (google.api.http) = { - post: "/wallet/getnowblock" - body: "*" - }; - } - rpc GetBlockByNum (NumberMessage) returns (Block) { - option (google.api.http) = { - post: "/wallet/getblockbynum" - body: "*" - }; - } - rpc TotalTransaction (EmptyMessage) returns (NumberMessage) { - option (google.api.http) = { - post: "/wallet/totaltransaction" - body: "*" - }; - } - }; - rpc GetNextMaintenanceTime (EmptyMessage) returns (NumberMessage) { - option (google.api.http) = { - post: "/wallet/getnextmaintenancetime" - body: "*" - }; - } - }; - rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage){ - option (google.api.http) = { - post: "/wallet/generateaddress" - body: "*" - additional_bindings { - get: "/wallet/generateaddress" - } - }; - } - }; - - - - `WalletSolidity` service contains several RPCs. - __`GetAccount`__ : - `GetAccount` takes a parameter of Account, and returns an `Account` object. - __`ListWitness`__: - `LitWitness` takes a parameter of EmptyMessage, and returns `WitnessList` object. - __`ListNodes`__: - `ListNodes` takes a parameter of EmptyMessage, and returns `NodeList` object. - __`GetAssetIssueList`__: - `GetAssetIssueList` takes a parameter of EmptyMessage, and returns `AssetIssueList` object. - __`GetPaginatedAssetIssueList`__: - `GetPaginatedAssetIssueList` takes a parameter of PaginatedMessage, and returns `AssetIssueList` object. - __`GetAssetIssueListByTimeStamp`__: - `GetAssetIssueListByTimeStamp` takes a parameter of EmptyMessage, and returns `AsssetIssueList` object. - __`GetAssetIssueByAccount`__: - `GetAssetIssueByAccount` takes a parameter of `Account`, and returns `AssetIssueList` object. - _`GetAssetIssueByName`__: - `GetAssetIssueByName` takes a parameter of `BytesMessage`, and returns `AssetIssueContract` object. - __`GetNowBlock`__: - `GetNowBlock` takes a parameter of `EmptyMessage`, and returns `Block` object. - __`GetBlockByNum`__: - `GetBlockByNumber` takes a parameter of `NumberMessage`, and returns `Block` object. - __`TotalTransaction`__: - `TotalTransaction` takes a parameter of `EmptyMessage`, and returns `NumberMessage` object. - __`getTransactionById`__: - `getTransactionById` takes a parameter of `BytesMessage`, and returns `Transaction` object. - __`getTransactionInfoById`__: - `getTransactionInfoById` takes a parameter of `BytesMessage`, and returns `TransactionInfo` object. - __`getTransactionsByTimeStamp`__: - `getTransactionsByTimeStamp` takes a parameter of `TimeMessage`, and returns `TransactionList` object. - __`getTransactionsFromThis`__: - `getTransactionsFromThis` takes a parameter of `Account`, and returns `TransactionList` object. - __`getTransactionsToThis`__: - `getTransactionsToThis` takes a parameter of `Account`, and returns `NumberMessage` object. - __`GetTransactionInfoById`__: - `GetTransactionInfoById` takes a parameter of `BytesMessage` and returns `TransactionInfo` object. - __`GenerateAddress`__: - `GenerateAddress` takes a parameter of EmptyMessage and returns `AddressPrKeyPairMessage` object. - - service WalletSolidity { - - rpc GetAccount (Account) returns (Account) { - - }; - - rpc ListAccounts (EmptyMessage) returns (AccountList) { - - }; - - rpc ListWitnesses (EmptyMessage) returns (WitnessList) { - - }; - - rpc ListNodes (EmptyMessage) returns (NodeList) { - - } - rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) { - - } - rpc GetAssetIssueListByTimestamp (NumberMessage) returns (AssetIssueList) { - - } - rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) { - - } - rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) { - - } - rpc GetNowBlock (EmptyMessage) returns (Block) { - - } - rpc GetBlockByNum (NumberMessage) returns (Block) { - - } - Rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage){ - - } - - //Get transaction. - - rpc TotalTransaction (EmptyMessage) returns (NumberMessage) { - - } - rpc getTransactionById (BytesMessage) returns (Transaction) { - - } - rpc getTransactionsByTimestamp (TimeMessage) returns (TransactionList) { - - } - rpc getTransactionsFromThis (Account) returns (TransactionList) { - - } - rpc getTransactionsToThis (Account) returns (NumberMessage) { - - } - rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) { - - } - }; - - `AccountList`: the list of accounts in the blockchain explorer. - message `AccountList` contains one parameter: - `account`: - - message AccountList { - repeated Account accounts = 1; - } - - `WitnessList`: the list of witnesses in the blockchain explorer. - message `WitnessList` contains one parameter: - `witnesses`: - - message WitnessList { - repeated Witness witnesses = 1; - } - - `AssetIssueList`: the list of issue asset in the blockchain explorer. - message `AssetIssueList` contains one parameter: - `assetIssue`: - - message AssetIssueList { - repeated AssetIssueContract assetIssue = 1; - } - - `NodeList`: the list of nodes in the node distribution map. - message `NodeList` contains one parameter: - `nodes`: - - message NodeList { - repeated Node nodes = 1; - } - - `Address`: the address of nodes. - message `Address` contains 2 parameters: - `host`: the host of nodes. - `port`: the port number of nodes. - - message Address { - bytes host = 1; - int32 port = 2; - } - - message `Return` has only one parameter: - `result`: a bool flag. - - message `Return` {
 - bool result = 1; - 
} - -+ The message structure of UDP. - - `Endpoint`: the storage structure of nodes' information. - message `Endpoint` contains 3 parameters: - `address`: the address of nodes. - `port`: the port number. - `nodeId`:the ID of nodes. - - - message Endpoint { - bytes address = 1; - int32 port = 2; - bytes nodeId = 3; - } - - `PingMessage`: the message sent from one node to another in the connecting process. - message `PingMessage` contains 4 parameters: - `from`: which node does the message send from. - `to`: which node will the message send to. - `version`: version of the message sending node. - `timestamp`: the timestamp of message. - - message PingMessage { - Endpoint from = 1; - Endpoint to = 2; - int32 version = 3; - int64 timestamp = 4; - } - - `PongMessage`: the message implies that nodes are connected. - message `PongMessage` contains 3 parameters: - `from`: which node does the message send from. - `echo`: - `timestamp`: the timestamp of message. - - message PongMessage { - Endpoint from = 1; - int32 echo = 2; - int64 timestamp = 3; - } - - `FindNeighbours`: the message sent from one node to find another one. - message `FindNeighbours` contains 3 parameters: - `from`: which node does the message send from. - `targetId`: the ID of targeted node. - `timestamp`: the timestamp of message. - - message FindNeighbours { - Endpoint from = 1; - bytes targetId = 2; - int64 timestamp = 3; - } - - `FindNeighbour`: the message replied by the neighbour node. - message `Neighbours` contains 3 parameters: - `from`: which node does the message send from. - `neighbours`: the neighbour node. - `timestamp`: the timestamp of message. - - message Neighbours { - Endpoint from = 1; - repeated Endpoint neighbours = 2; - int64 timestamp = 3; - } - - `EasyTransferMessage`: TRX easy transfer message. - `passPhrase`: password. - `toAddress`: recipient address. - `amount`: amount of trx to transfer. - - message EasyTransferMessage{ - bytes passPhrase = 1; - bytes toAddress = 2; - int64 amount = 3; - } - - `EasyTransferResponse`: TRX easy transfer response message. - `transaction`: transaction created by transfer. - `result`: result of transaction broadcasting. - - message EasyTransferResponse{ - Transaction transaction = 1; - Return result = 2; - } - - - `TransactionSign`:the parameter of signature. - `transaction`: transaction to be signed. - `privateKey`: private key for signing. - - message TransactionSign { - Transaction transaction = 1; - bytes privateKey = 2; - } - - `AddressPrKeyPairMessage`: address and private key message. - `Address`: account address. - `privateKey`: account private key. - - message AddressPrKeyPairMessage { - string address = 1; - string privateKey = 2; - } - -# Please check detailed protocol document that may change with the iteration of the program at any time. Please refer to the latest version. diff --git a/English_Documentation/TRON_Protocol/TRON_Token_Update.MD b/English_Documentation/TRON_Protocol/TRON_Token_Update.MD deleted file mode 100755 index 54330d28..00000000 --- a/English_Documentation/TRON_Protocol/TRON_Token_Update.MD +++ /dev/null @@ -1,38 +0,0 @@ -# TRON Token - -### Token Issuance - -In the TRON network, each account can issue tokens with 1024 TRX in an easy and convenient way. Upon the issuance, multiple tokens can be locked. Token issuance will require a designated token name, total supply of the tokens, exchange rate, issuance period, description, URL, max bandwidth consumed per account, total bandwidth consumed and the amount of frozen tokens. - -+ For example: - -`assetissue password abc 1000000 1 1 2018-5-31 2018-6-30 abcdef a.com 1000 1000000 200000 180 300000 365` - -The above command issued a token named abc with a total supply of 1 million; the exchange rate of abc to TRX is 1:1; the issuance period is 2018-5-31 to 2018-6-30; the token is described as abcdef; its URL is a.com. Each account's daily token transfer consumes up to 1000 bandwidth points of their own, up to 1000000 bandwidth points for the entire network. 200000 tokens of the total supply will be locked for 180 days and 300000 of the total will be locked for 365 days. - -### Note: duplicate names of tokens - -Duplicate names of tokens are allowed. Tokens with duplicate names will be differentiated by the order field. The token created first will have an order of 0, the one created second will have an order of 1, and so on. - -+ Example: (part of the field omitted) - - Asset { - name = aaa; - order = 0; owner_address = address1; } - - Asset2 { - name = aaa; - order = 1; owner_address = address2; } - - Account { - asset[ { asset_name = aaa; - amount = 100; }, { asset_name = aaa_1; - amount = 100; } } - -There are two assets in the network with the name aaa: the first one has an order of 0, and the second one has an order of 1. - -If an account has both tokens, names of the tokens will be aaa and aaa_1 respectively. - -During token participation (using the ParticipateAssetIssue api), if the participating token is the second token, the input parameter needs to be aaa_1. Similarly, during token transfer (using TransferAsset api), if the participating token is the second token, the input parameter also needs to be aaa_1. During token querying (using GetAssetIssueByName api), if the participating token is the second token, the input parameter also needs to be aaa_1. - -If there is no asset with the same name in the network, the impacts of the order do not need to be taken into consideration. diff --git a/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md b/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md deleted file mode 100644 index 558baac7..00000000 --- a/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md +++ /dev/null @@ -1,466 +0,0 @@ -# TRON Wallet RPC-API - -## For the specific definition of API, please refer to the following link: -https://github.com/tronprotocol/java-tron/blob/develop/src/main/protos/api/api.proto - -## Frequently used APIs: -1. Get general info of the wallet (similar to bitcoin getinfo) -GetAccount -2. Get balance of an address (similar to bitcoin getbalance) -GetAccount -3. Create a new address (similar to bitcoin getnewaddress) -You can create an address at the local system. -And you can create a new address on blockchain by calling rpc api createAccount, TransferAsset or CreateTransaction (TransferContract) to make a transfer from an existing account to the new address. -4. Retrieve the list of transaction history by address (similar to bitcoin listtransactions) -GetTransactionsFromThis -GetTransactionsToThis -5. check address is valid or not (regex or API command) -+ Local check--- After decode58check at local, you can get a 21-byte byte array starting with 0x41 (mainnet) or 0xa0 (testnet). -+ If you want to verify whether an address exists on the blockchain, you can call GetAccount. - -## 1. Getting account information - -1.1 Interface statement -rpc GetAccount (Account) returns (Account) {}; -1.2 Nodes -Fullnode and soliditynode. -1.3 Parameters -Account: type in the address. -1.4 Returns -Account: returns all account information. -1.5 Functions -Query of balance list. Display of all asset information in account return. - -## 2. TRX transfer - -2.1 Interface statement -rpc CreateTransaction (TransferContract) returns (Transaction) {}; -2.2 Node -Fullnode. -2.3 Parameters -TransferContract: addresses of the sender and the recipient, and amount of transfer (in sun). -2.4 Returns -Transaction: returns transaction of transfer contract; request transaction after acquisition of wallet signature. -2.5 Function -Transfer. Creation of a transaction of transfer. - -## 3. Transaction broadcasting - -3.1 Interface statement -rpc BroadcastTransaction (Transaction) returns (Return) {}; -3.2 Node -Fullnode. -3.3 Parameters -Transaction: transaction signed by wallet. In TRON network, operations entailing change of blockchain status are sealed in the transaction. -3.4 Returns -Return: success or failure. Transaction will be initiated and returned with feedback before broadcasting takes place. Note: return of success doesn’t necessarily mean completion of transaction. -3.5 Function -Transfer, vote, issuance of token, or participation in token offering. Sending signed transaction information to node, and broadcasting it to the entire network after witness verification. - -## 4. Creating account - -4.1 Interface statement -rpc CreateAccount (AccountCreateContract) returns (Transaction){}; -4.2 Node -Fullnode. -4.3 Parameters -AccountCreateContract: account type and account address. -4.4 Returns -Transaction: returns transaction of account creation. Request broadcasting after obtaining wallet signature. -4.5 Function -Account creation. Creating an account (or opting otherwise) when registering a wallet. - -## 5. Account update -5.1 Interface statement -rpc UpdateAccount (AccountUpdateContract) returns (Transaction){}; -5.2 Node -Fullnode. -5.3 Parameters -AccountUpdateContract: account name and address. -5.4 Returns -Transaction: Returns transaction of account update. Request broadcasting after the transaction is signed by wallet. -5.5 Function -Account name update. - -# 6. Vote -6.1 Interface statement -rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction){}; -6.2 Node -Fullnode. -6.3 Parameters -VoteWitnessContract: voter address and list of candidates which includes candidate address and number of votes received. -6.4 Returns -Transaction: returns transaction of votes. Request broadcasting after the transaction is signed by wallet. -6.5 Function -Vote. Coin holders can only vote for Super Representative candidates, with no more votes than the amount of frozen balance (see also 25. Balance freeze). - -## 7. Token issuance -7.1 Interface statement -rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) {}; -7.2 Node -Fullnode. -7.3 Parameters -AssetIssueContract: issuer address, token name, total capitalization, exchange rate to TRX, starting date, expiry date, attenuation coefficient, votes, detailed description, url, maximum bandwidth consumption, total bandwidth consumption and frozen token. -7.4 Returns -Transaction: returns transaction of token issuance. Request for transaction broadcasting after the transaction is signed by wallet. -7.5 Function -Token issuance. All users can issue tokens at the cost of 1024 TRX. Following a successful issuance, users can exchange for tokens with TRX before the designated expiry date. -Sample: -`assetissue password abc 1000000 1 1 2018-5-31 2018-6-30 abcdef a.com 1000 1000000 200000 180 300000 365` -With the above command the token named abc is issued with a total capitalization of 1 million tokens at an exchange rate of 1:1 to trx. Its offering is from May 31-June 30, 2018. It is described as abcdef and can be found at a.com. -A maximum of 1000 bandwidth points can be charged from the issuer’s account per account per day. The maximum bandwidth points to be charged from the issuer per day is 1000,000. 200,000 tokens will be locked for 180 days while another 300,000 tokens will be locked for 365 days. - -## 8. Query of list of Super Representative candidates -8.1 Interface statement -rpc ListWitnesses (EmptyMessage) returns (WitnessList) {}; -8.2 Nodes -Fullnode and soliditynode. -8.3 Parameters -EmptyMessage: null. -8.4 Returns -WitnessList: list of witnesses including detailed information of the candidates. -8.5 Function -Query of all candidates prior to voting returning detailed information on each candidate for users’ reference. - -## 9. Application for Super Representative -9.1 Interface statement -rpc CreateWitness (WitnessCreateContract) returns (Transaction) {}; -9.2 Node -Fullnode. -9.3 Parameters -WitnessCreateContract: account address and Url. -9.4 Returns -Transaction: Returns a transaction of candidate application. Request broadcasting after the transaction is signed by wallet. -9.5 Function -All users with an account created on the blockchain can apply to become TRON’s Super Representative candidate. - -## 10. Information update of Super Representative candidates -10.1 Interface statement -rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) {}; -10.2 Node -Fullnode. -10.3 Parameters -WitnessUpdateContract: an account address and Url. -10.4 Returns -Transaction: returns transaction of SR application. Request broadcasting after the transaction is signed by wallet. -10.5 Function -Updating the url of SRs. - -## 11. Token transfer -11.1 Interface statement
rpc TransferAsset (TransferAssetContract) returns (Transaction){}; -11.2 Node -Fullnode. -11.3 Parameters -TransferAssetContract: token name, sender address, recipient address, and the amount of tokens. -11.4 Returns -Transaction: returns transaction of token transfer. Request broadcasting after the transaction is signed by wallet. -11.5 Function -Token transfer. Creates a transaction of token transfer. - -## 12. Participation in token offering -12.1 Interface statement -rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction){}; -12.2 Node -Fullnode. -12.3 Parameters -ParticipateAssetIssueContract: participant address, issuer address, token name, and amount of token (in sun). -12.4 Returns -Transaction: returns transaction of participation in token offering. Request broadcasting after the transaction is signed by wallet. -12.5 Function -Participation in token offering. - -## 13. Query of all nodes -13.1 Interface statement -rpc ListNodes (EmptyMessage) returns (NodeList) {}; -13.2 Nodes -Fullnode and soliditynode. -13.3 Parameters -EmptyMessage: null. -13.4 Returns -NodeList: returns a list of nodes, including their IPs and ports. -13.5 Function -Listing the IPs and ports of current nodes. - -## 14. Query list of all tokens -14.1 Interface statement -rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) {}; -14.2 Node -Fullnode and soliditynode. -14.3 Parameters -EmptyMessage: null. -14.4 Returns -AssetIssueList: AssetIssueContract list containing information on all issued tokens. -14.5 Function -Query list of all issued tokens. Display of all issued tokens for user’s reference. - -## 15. Query of tokens issued by a given account -15.1 Interface statement -rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) {}; -15.2 Nodes -Fullnode and soliditynode. -15.3 Parameters -Account: address. -15.4 Returns -AssetIssueList: AssetIssueContract list containing information on all issued tokens. -15.5 Function -Query of all tokens issued by a given account. - -## 16. Query of token information by token name -16.1 Interface statement -rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) {}; -16.2 Nodes -Fullnode and soliditynode. -16.3 Parameters -BytesMessage: token name. -16.4 Returns -AssetIssueContract: information on the token. -16.5 Function -Query of token information with the name. The exclusiveness of token name is ensured on TRON’s network. - -## 17. Query of current tokens by timestamp -17.1 Interface statement -rpc GetAssetIssueListByTimestamp (NumberMessage) returns (AssetIssueList){}; -17.2 Node -Soliditynode. -17.3 Parameters -NumberMessage: current timestamp (the number of milliseconds since 1970). -17.4 Returns -AssetIssueList: AssetIssueContract list including detailed information of the tokens. -17.5 Function -Query list of issued tokens by timestamList of issued tokens by timestamp. Display of current nodes for users’ reference. - -## 18. Get current block -18.1 Interface statement -rpc GetNowBlock (EmptyMessage) returns (Block) {}; -18.2 Nodes -Fullnode and soliditynode. -18.3 Parameters -EmptyMessage: null. -18.4 Returns -Block: information on current block. -18.5 Function -Inquire the latest block. - -## 19. Get block by block height -19.1 Interface statement -rpc GetBlockByNum (NumberMessage) returns (Block) {}; -19.2 Nodes -Fullnode and soliditynode. -19.3 Parameters -NumberMessage: block height. -19.4 Returns -Block: block information. -19.5 Function -Accessing the block at designated height, otherwise returning to the genesis block. - -## 20. Get total number of transactions -20.1 Interface statement -rpc TotalTransaction (EmptyMessage) returns (NumberMessage) {}; -20.2 Nodes -Fullnode and soliditynode. -20.3 Parameters -EmptyMessage: null. -20.4 Returns -NumberMessage: Total number of transactions. -20.5 Function -Inquiring the total number of transactions. - -## 21. Query of transaction by ID -21.1 Interface statement -rpc getTransactionById (BytesMessage) returns (Transaction) {}; -21.2 Node -Soliditynode. -21.3 Parameters -BytesMessage: transaction ID or Hash. -21.4 Returns -Transaction: Queried transaction. -21.5 Function -Query of transaction details by ID which is the Hash of transaction. - -## 22. Query of transaction by timestamp -22.1 Interface statement -rpc getTransactionsByTimestamp (TimeMessage) returns (TransactionList) {}; -22.2 Node -Soliditynode. -22.3 Parameters -TimeMessage: starting time and ending time. -22.4 Returns -TransactionList: transaction list. -22.5 Function -Query of transactions by starting and ending time. - -## 23. Query of transaction initiations by address -23.1 Interface statement -rpc getTransactionsFromThis (Account) returns (TransactionList) {}; -23.2 Node -Soliditynode. -23.3 Parameters -Account: initiator‘s account (address). -23.4 Returns -TransactionList: transaction list. -23.5 Function -Query of transaction initiations by account address. - -## 24. Query of transaction receptions by address -24.1 Interface statement -rpc getTransactionsToThis (Account) returns (NumberMessage) {}; -24.2 Node -Soliditynode. -24.3 Parameters -Account: Recipient account (address). -24.4 Returns -TransactionList: transaction list. -24.5 Function -Query of all transactions accepted by one given account. - -## 25. Freeze Balance -25.1 Interface statement -rpc FreezeBalance (FreezeBalanceContract) returns (Transaction) {}; -25.2 Node -Full Node. -25.3 Parameters -FreezeBalanceContract: address, amount of trx to freeze and frozen duration. Currently balance can only be frozen for 3 days. -25.4 Returns -Transaction: Return includes a transaction of balance. Request transaction broadcasting after signed by wallet. -25.5 Function -Two things can be gained through freezing balance: -a. Bandwidth Points. -b. Tron Power. - -## 26. Unfreeze Balance -26.1 Interface statement -rpc UnfreezeBalance (UnfreezeBalanceContract) returns (Transaction) {}; -26.2 Node -Full Node. -26.3 Parameters -UnfreezeBalanceContract: address. -26.4 Returns -Transaction: returns unfreeze TRX transaction. Request transaction broadcasting after signed by wallet. -26.5 Function -Balance can be unfrozen only 3 days after the latest freeze. Voting records will be cleared upon unfrozen balance, while bandwidth points won’t be. Frozen balance will not be automatically unfrozen after 3 days’ duration. - -## 27. Block-production reward redemption -27.1 Interface statement -rpc WithdrawBalance (WithdrawBalanceContract) returns (Transaction) {}; -27.2 Node -Full Node. -27.3 Parameters -WithdrawBalanceContract: address. -27.4 Returns -Transaction: returns withdraw TRX transaction. Request transaction broadcasting after signed by wallet. -27.5 Function -This interface is only accessible to Super Representatives. Super Representative can obtain reward after successful account keeping. Instead of saved to account balance, rewards will be held independently in account allowance, with 1 permitted withdrawal to account balance every 24 hours. - -## 28. Unfreeze balance -28.1 Interface statement -rpc UnfreezeAsset (UnfreezeAssetContract) returns (Transaction) {}; -28.2 Node -Fullnode. -28.3 Parameters -UnfreezeAssetContract: address. -28.4 Returns -Transaction: returns unfreeze token transaction; request broadcasting after the transaction is signed by wallet. -28.5 Function -Token issuers can unfreeze locked supply during issuance. - -## 29. Query of the next maintenance time -29.1 Interface statement -rpc GetNextMaintenanceTime (EmptyMessage) returns (NumberMessage) {}; -29.2 Node -Fullnode. -29.3 Parameters -EmptyMessage: no parameter needed. -29.4 Returns -NumberMessage: the next maintenance time. -29.5 Function -Get the next maintenance time. - -## 30. Query of transaction information -30.1 Interface statement -rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) {}; -30.2 Node -Soliditynode. -30.3 Parameters -BytesMessage: transaction ID -30.4 Returns -TransactionInfo: transaction information. -30.5 Function -Query of transaction fee, block location and the timestamp of the block. - -## 31. Query block by ID -31.1 Interface statement -rpc GetBlockById (BytesMessage) returns (Block) {}; -31.2 Node -Fullnode. -31.3 Parameter -BytesMessage: block ID. -31.4 Returns -Block: the block. -31.5 Function -Query of block by block ID. - -## 32. Token update -32.1 Interface statement -rpc UpdateAsset (UpdateAssetContract) returns (Transaction) {}; -32.2 Node -Fullnode. -32.3 Parameters -UpdateAssetContract: issuer address, token description, token url, maximum bandwidth consumption by each account and total bandwidth consumption. -32.4 Returns -Transaction: returns transaction; request broadcasting after the transaction is signed by wallet. -32.5 Function -Token update can only be initiated by the token issuer to update token description, url, maximum bandwidth consumption by each account and total bandwidth consumption. - -## 33. Paginated query of token list -33.1 Interface statement -rpc GetPaginatedAssetIssueList (PaginatedMessage) returns (AssetIssueList) {}; -33.2 Nodes -Fullnode and soliditynode. -33.3 Parameters -PaginatedMessage: starting index (0) and the number of tokens displayed on each page. -33.4 Returns -AssetIssueList: a paginated list of AssetIssueContract containing detailed information of tokens. -33.5 Function -Paginated list of tokens displaying tokens information for users’ reference. - -## 34. Transaction signing -34.1 Interface statement -rpc GetTransactionSign (TransactionSign) returns (Transaction) {}; -34.2 Node -Fullnode. -34.3 Parameters -TransactionSign: Transaction to be signed and the private key to sign with. -34.4 Returns -Transaction: transaction to be signed. - -## 35. Address and private key creation -35.1 Interface statement -rpc CreateAdresss (BytesMessage) returns (BytesMessage) {}; -35.2 Node -Fullnode. -35.3 Parameters -BytesMessage: Passphrase -35.4 Returns -BytesMessage: address. - -## 36. TRX easy transfer -36.1 Interface statement -rpc EasyTransfer (EasyTransferMessage) returns (EasyTransferResponse) {}; -36.2 Node -Fullnode. -36.3 Parameters -EasyTransferMessage: password for transfer, toAddress and the amount of tokens to transfer. -36.4 Returns -EasyTransferResponse: the transaction of a transfer and the result of broadcasting. - -## 37. Generate address and private key -37.1 Interface statement -rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) {}; -37.2 Nodes -FullNode and SolidityNode. -37.3 Parameters -EmptyMessage: null. -37.4 Returns -AddressPrKeyPairMessage: generate address and private key. -37.5 Function -Address and private key generation. Please invoke this API only on a trusted offline node to prevent private key leakage. diff --git a/English_Documentation/TRON_Protocol/TX_ContractTypes_Update.MD b/English_Documentation/TRON_Protocol/TX_ContractTypes_Update.MD deleted file mode 100755 index f4772acd..00000000 --- a/English_Documentation/TRON_Protocol/TX_ContractTypes_Update.MD +++ /dev/null @@ -1,389 +0,0 @@ -## Transaction Contract Types - -As the basic transaction unit on the TRON network, contracts exist in different forms. This document elaborates on each contract and the parameters. - -## Create account - -`AccountCreateContract`contains 3 parameters: -`owner_address`:contract holder address, for example: *“0xu82h…7237”*. -`account_address`: the account address to be created -`type`:account type, for example:*0* the type of account represented is`Normal` - - message AccountCreateContract { - bytes owner_address = 1; - bytes account_address = 2; - AccountType type = 3; - } - - -## Transfer - -or Translation `TransferContract`contains 3 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`to_address`: target account address. -`amount`:transfer amount; the unit is sun. - - message TransferContract { - bytes owner_address = 1; - bytes to_address = 2; - int64 amount = 3; - } - - -## Tokens issued by transfer - -`TransferContract`contains 4 parameters: -`asset_name`:name of the token issued -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*. -`to_address`: target account address. -`amount`:amount of tokens transferred. - - message TransferAssetContract { - bytes asset_name = 1; - bytes owner_address = 2; - bytes to_address = 3; - int64 amount = 4; - } - - -## Super node vote - -`VoteWitnessContract`contains 3 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`vote_address`: the super node candidate's address. -`vote_count`:votes for the super node candidate. -`votes`:the list of super node candidates -`support`:support or not. It should constantly be "true". This parameter has not been used so far. - - message VoteWitnessContract { - message Vote { - bytes vote_address = 1; - int64 vote_count = 2; - } - bytes owner_address = 1; - repeated Vote votes = 2; - bool support = 3; - } - - -## Create super node candidate - -`WitnessCreateContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*. -`url`:the URL of the Super Representative(SR) candidate. - - message WitnessCreateContract { - bytes owner_address = 1; - bytes url = 2; - } - - -## Issue tokens - -`AssetIssueContract`contains 17 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`name`:Name of the tokens issued, for example:*“SiCongcontract”*。 `abbr`:. -`total_supply`:the amount of tokens issued, for example:*100000000*。 -`frozen_supply`:the list of the amount and duration of frozen tokens -`trx_num`:the equivalent TRX amount, for example:*232241*。 -`num`: the equivalent custom amount of assets. -`start_time`:starting time, for example:*20170312*。 -`end_time`:finishing time, for example:*20170512*。 -`order`:When the asset_name is the same, the value of the order increases.The inital value is 0. -`vote_score`:contract rating, for example:*12343*。 -`description`:Token description, for example:*”trondada”*。 -`url`:the URL link of the token. -`free_asset_net_limit`:free available bandwidth for transferring this specific asset of each account. -`public_free_asset_net_limit`:free available bandwidth for transferring this specific asset of all accounts. -`public_free_asset_net_usage`:free bandwidth used by all acounts for transferring this specific asset. -`public_latest_free_net_time`:the amount of time used on free bandwidth when the token was most recently transferred - - message AssetIssueContract { - message FrozenSupply { - int64 frozen_amount = 1; - int64 frozen_days = 2; - } - bytes owner_address = 1; - bytes name = 2; - bytes abbr = 3; - int64 total_supply = 4; - repeated FrozenSupply frozen_supply = 5; - int32 trx_num = 6; - int32 num = 8; - int64 start_time = 9; - int64 end_time = 10; - int64 order = 11; // the order of tokens of the same name - int32 vote_score = 16; - bytes description = 20; - bytes url = 21; - int64 free_asset_net_limit = 22; - int64 public_free_asset_net_limit = 23; - int64 public_free_asset_net_usage = 24; - int64 public_latest_free_net_time = 25; - } - - -## Super node candidate URL update - -`WitnessUpdateContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`update_url`: the updated URL of the super node candidate - - message WitnessUpdateContract { - bytes owner_address = 1; - bytes update_url = 12; - } - - -## Purchase issued tokens - -`ParticipateAssetIssueContract`contains 4 parameters: -`owner_address`:the contract holder's address, for example *“0xu82h…7237”*。 -`to_address`:the address of the token issuer -`account_name`: name of the token issued, including name and order -`amount`:the amount of the TRX used to purchase issued tokens, the unit is sun. - - message ParticipateAssetIssueContract { - bytes owner_address = 1; - bytes to_address = 2; - bytes asset_name = 3; - int64 amount = 4; - } - - -## Account update - -`AccountUpdateContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`account_name`: name of the account, for example: *"SiCongsaccount”*。 - - // Update account name. Account name is not unique now. - message AccountUpdateContract { - bytes account_name = 1; - bytes owner_address = 2; - } - - -## Freeze assets - -`FreezeBalanceContract`contains 4 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`frozen_balance`:the amount of frozen assets -`frozen_duration`:the frozen duration -`resource`: specify the type of resources to gain when TRX is frozen - - message FreezeBalanceContract { - bytes owner_address = 1; - int64 frozen_balance = 2; - int64 frozen_duration = 3; - ResourceCode resource = 10; - } - - -## Release assets - -`UnfreezeBalanceContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`resource`: specify a type of resources to lose - - message UnfreezeBalanceContract { - bytes owner_address = 1; - ResourceCode resource = 10; - } - - -## Claim rewards - -`WithdrawBalanceContract`contains 1 parameter: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 - - message WithdrawBalanceContract { - bytes owner_address = 1; - } - - -## Release issued tokens - -`UnfreezeAssetContract`contains 3 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 - - message UnfreezeAssetContract { - bytes owner_address = 1; - } - - -## Assets update - -`UpdateAssetContract`contains 3 parameters: -`owner_address`:the contract holder's address, for example *“0xu82h…7237”*。 -`description`:description of the token. -`url`:URL. -`new_limit`:. -`new_public_limit`: . - - message UpdateAssetContract { - bytes owner_address = 1; - bytes description = 2; - bytes url = 3; - int64 new_limit = 4; - int64 new_public_limit = 5; - } - - -## Create proposal - -`ProposalCreateContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`parameters`: proposeal. - - message ProposalCreateContract { - bytes owner_address = 1; - map parameters = 2; - } - - -## Proposal Approval - -`ProposalApproveContract`contains 3 parameters: -`owner_address`:the contract holder's address, for example *“0xu82h…7237”*。 -`proposal_id`:the ID of the proposal -`is_add_approval`:approve or not. - - message ProposalApproveContract { - bytes owner_address = 1; - int64 proposal_id = 2; - bool is_add_approval = 3; // add or remove approval - } - - -## Delete proposal - -`ProposalDeleteContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`proposal_id`:the ID of the proposal. - - message ProposalDeleteContract { - bytes owner_address = 1; - int64 proposal_id = 2; - } - - -## Account setting - -`SetAccountIdContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`account_id`:Account ID. - - // Set account id if the account has no id. Account id is unique and case insensitive. - message SetAccountIdContract { - bytes account_id = 1; - bytes owner_address = 2; - } - - -## Create smart contract - -`CreateSmartContract`contains 2 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`new_contract`: smart contract - - message CreateSmartContract { - bytes owner_address = 1; - SmartContract new_contract = 2; - } - - -## Trigger smart contract - -`TriggerSmartContract`contains 4 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`contract_address`: contract address -`call_value`:TRX value. -`data`:contract parameters. - - message TriggerSmartContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 call_value = 3; - bytes data = 4; - } - - -## Update contract - -`UpdateSettingContract`contains 3 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`contract_address`:contract address -`consume_user_resource_percent`:The percentage of the resources consumed by the account which will be updated. - - message UpdateSettingContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 consume_user_resource_percent = 3; - } - - -## Create exchange - -`ExchangeCreateContract`contains 5 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`first_token_id`: the ID of the first type of token -`first_token_balance`: the balance of the first type of token -`second_token_id`:the ID of the second type of token -`second_token_balance`:the balance of the second type of token - - message ExchangeCreateContract { - bytes owner_address = 1; - bytes first_token_id = 2; - int64 first_token_balance = 3; - bytes second_token_id = 4; - int64 second_token_balance = 5; - } - - -## Finance an exchange - -`ExchangeInjectContract`contains 4 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`exchange_id`: the ID of the trading pair. -`token_id`:the ID of the financing token. -`quant`:the amount of the financing tokens. - - message ExchangeInjectContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - } - - -## Withdraw capital from an exchange - -`ExchangeWithdrawContract`contains 4 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`exchange_id`: the ID of the trading pair. -`token_id`:the ID of the withdrawing token. -`quant`:the amount of the withdrawing tokens. - - message ExchangeWithdrawContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - } - - -## Transactions at the exchanges - -`ExchangeTransactionContract`contains 4 parameters: -`owner_address`:the contract holder's address, for example: *“0xu82h…7237”*。 -`exchange_id`: the ID of the trading pair. -`token_id`:the ID of the token to be sold. -`quant`:the amount of the tokens to be sold. - - message ExchangeTransactionContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - } diff --git a/English_Documentation/TRON_Protocol/Tx_Introduction_Update.MD b/English_Documentation/TRON_Protocol/Tx_Introduction_Update.MD deleted file mode 100755 index b989e942..00000000 --- a/English_Documentation/TRON_Protocol/Tx_Introduction_Update.MD +++ /dev/null @@ -1,208 +0,0 @@ -# Transactions - -### Basic Structure of Transactions - -The TRON network accounts consist of three types: ordinary, token, and contract. - -- Ordinary account: Users can perform various basic operations. -- Token account: Used by ordinary accounts to issue tokens. Token accounts are currently un-used. -- Contract account: Smart contract accounts. Contract accounts are established by ordinary accounts and can be triggered under certain circumstances. - -Basic Structure of Accounts - - message Account { - /* frozen balance */ - message Frozen { - int64 frozen_balance = 1; // The amount of frozen balance in Sun - int64 expire_time = 2; // Expire Time - } - bytes account_name = 1; // Account Name - AccountType type = 2; // Account Type - // the create address - bytes address = 3; // Account Address - // the trx balance - int64 balance = 4; // Account TRX Balance - // the votes - repeated Vote votes = 5; // Number of votes of all super node candidates - // the other asset owned by this account - map asset = 6;// Name of other asset+order and the mapping list of remaining balance - // latest asset operation time - - // the frozen balance - repeated Frozen frozen = 7; // List of frozen TRX - // bandwidth, get from frozen - int64 net_usage = 8; // Usage of bandwidth points that are acquired by freezing TRX - - // Time to Create the Account - int64 create_time = 0x09; //Account creation time - // this last operation time, including transfer, voting and so on. //FIXME fix grammar - int64 latest_opration_time = 10; // The last operation time of the account, including transfer, voting, etc. - // witness block producing allowance - int64 allowance = 0x0B; // allowance received - // last withdraw time - int64 latest_withdraw_time = 0x0C; // latest withdrawal time - // not used so far - bytes code = 13; - bool is_witness = 14; // Is it a super node candidate - bool is_committee = 15; // Is it a committee member - // frozen asset(for asset issuer) - repeated Frozen frozen_supply = 16; // Freeze the issued asset list - // asset_issued_name - bytes asset_issued_name = 17; // Name of the asset issued, one account can only issue one type of asset. - map latest_asset_operation_time = 18; - - int64 free_net_usage = 19; // Free Bandwidth points usage - map free_asset_net_usage = 20; // Free Bandwidth points usage for operating each issued asset - int64 latest_consume_time = 21; / The last time to use frozen TRX to gain Bandwidth points - int64 latest_consu Me_free_time = 22; // The last time to use free Bandwidth points - bytes account_id = 23; // Account ID - - message AccountResource { - // energy resource, get from frozen - int64 energy_usage = 1; // Get Energy usage by freezing TRX - // the frozen balance for energy - Frozen frozen_balance_for_energy = 2; // The balance of TRX frozen for Energy - int64 latest_consume_time_for_energy = 3; // The last time to get Energy by consuming frozen TRX - - // storage resource , get from market - int64 storage_limit = 6; // Maximum limit of Energy consumption for storage - int64 storage_usage = 7; // amount of Energy consumption for storage - int64 latest_exchange_storage_time = 8; - } - AccountResource account_resource = 26; // account resources Profile information - - bytes codeHash = 30; - } - - -Basic Structure of Transactions - - message Transaction { - message Contract { - enum ContractType { - AccountCreateContract = 0; - TransferContract = 1; - TransferAssetContract = 2; - VoteAssetContract = 3; - VoteWitnessContract = 4; - WitnessCreateContract = 5; - AssetIssueContract = 6; - WitnessUpdateContract = 8; - ParticipateAssetIssueContract = 9; - AccountUpdateContract = 10; - FreezeBalanceContract = 11; - UnfreezeBalanceContract = 12; - WithdrawBalanceContract = 13; - UnfreezeAssetContract = 14; - UpdateAssetContract = 15; - ProposalCreateContract = 16; - ProposalApproveContract = 17; - ProposalDeleteContract = 18; - SetAccountIdContract = 19; - CustomContract = 20; - // BuyStorageContract = 21; - // BuyStorageBytesContract = 22; - // SellStorageContract = 23; - CreateSmartContract = 30; - TriggerSmartContract = 31; - GetContract = 32; - UpdateSettingContract = 33; - ExchangeCreateContract = 41; - ExchangeInjectContract = 42; - ExchangeWithdrawContract = 43; - ExchangeTransactionContract = 44; - } - ContractType type = 1; - google.protobuf.Any parameter = 2; - bytes provider = 3; - bytes ContractName = 4; - } - - message Result { - enum code { - SUCESS = 0; - FAILED = 1; - } - enum contractResult { - DEFAULT = 0; - SUCCESS = 1; - REVERT = 2; - BAD_JUMP_DESTINATION = 3; - OUT_OF_MEMORY = 4; - PRECOMPILED_CONTRACT = 5; - STACK_TOO_SMALL = 6; - STACK_TOO_LARGE = 7; - ILLEGAL_OPERATION = 8; - STACK_OVERFLOW = 9; - OUT_OF_ENERGY = 10; - OUT_OF_TIME = 11; - JVM_STACK_OVER_FLOW = 12; - UNKNOWN = 13; - } - int64 fee = 1; - code ret = 2; - contractResult contractRet = 3; - - int64 withdraw_amount = 15; - int64 unfreeze_amount = 16; - } - - message raw { - bytes ref_block_bytes = 1; - int64 ref_block_num = 3; - bytes ref_block_hash = 4; - int64 expiration = 8; - repeated authority auths = 9; - // data not used - bytes data = 10; - //only support size = 1, repeated list here for extension - repeated Contract contract = 11; - // scripts not used - bytes scripts = 12; - int64 timestamp = 14; - int64 fee_limit = 18; - } - - raw raw_data = 1; - // only support size = 1, repeated list here for muti-sig extension - repeated bytes signature = 2; // Signature list of transaction initiators; Currently only supports one of them - repeated Result ret = 5; - } - - -### Transaction Fee - -Transactions in the TRON network are generally free, but due to the limitations of the system resources and to ensure a fair principle, there are certain restrictions on Bandwidth points, CPU, and storage resources in the network. - -- Ordinary transactions only consume Bandwidth points. A certain amount of Bandwidth points can be gained by freezing TRX; there are also free Bandwidth points available in the account. When the Bandwidth points are insufficient, TRX will be burned. -- The operation of smart contracts not only consumes Bandwidth points, but also consumes Energy. As with Bandwidth points, you can get a certain amount of Energy by freezing TRX. When Energy is insufficient, TRX will be burned. -- All query transactions are completely free, without consuming Bandwidth points or Energy. - -# Signature Process of Transactions - -## I. Instructions - -1. Take the trading rawdata and transform it into byte[] format -2. Perform sha256 algorithm to rawdata -3. The result of sha256 is signed by the private key of the transaction initiator (as of now, generally there is one contract and one private key). -4. Add the signature to the transaction. - -## II. Signature Algorithm - -1. ECDSA algorithm, SECP256K 2, Signature sample data - - priKey:::8e812436a0e3323166e1f0e8ba79e19e217b2c4a53c970d4cca0cfb1078979df
 - pubKey::04a5bb3b28466f578e6e93fbfd5f75cee1ae86033aa4bbea690e3312c087181eb366f9a1d1d6a437a9bf9fc65ec853b9fd60fa322be3997c47144eb20da658b3d1
 - hash:::159817a085f113d099d3d93c051410e9bfe043cc5c20e43aa9a083bf73660145
 - r:::38b7dac5ee932ac1bf2bc62c05b792cd93c3b4af61dc02dbb4b93dacb758123f
 - s:::08bf123eabe77480787d664ca280dc1f20d9205725320658c39c6c143fd5642d
 - v:::0 - - -Note: the signature should be 65 bytes. 32 for r, 32 for s, and 1 for v. - -3. When fullnode receives the transaction, it will perform verification. An address is generated by the calculation via hash and r, s, v, and is compared with the address in the contract — if the two addresses prove to be the same, the transaction will pass the verification. - -## III. Sample Code - - public static Transaction sign(Transaction transaction, ECKey myKey) {
 Transaction.Builder transactionBuilderSigned = transaction.toBuilder();

 byte[] hash = sha256(transaction.getRawData().toByteArray());
 List listContract = transaction.getRawData().getContractList();
 for (int i = 0; i < listContract.size(); i++) {
 ECDSASignature signature = myKey.sign(hash);
 ByteString bsSign = ByteString.copyFrom(signature.toByteArray());
 transactionBuilderSigned.addSignature(
 bsSign);//Each contract may be signed with a different private key in the future.
 } diff --git a/English_Documentation/TRON_Virtual_Machine/CPU_Storage_consumption_mechanism.md b/English_Documentation/TRON_Virtual_Machine/CPU_Storage_consumption_mechanism.md deleted file mode 100644 index 7ca51220..00000000 --- a/English_Documentation/TRON_Virtual_Machine/CPU_Storage_consumption_mechanism.md +++ /dev/null @@ -1,89 +0,0 @@ -# # CPU, storage consumption mechanism - -### CPU consumption sequence is as follows: - -1. The CPU frozen by the contract creator will be consumed in the proportion set up in the contract. All of the remaining CPU of the contract creator will be deducted first if insufficiency occurs - -2. The remaining consumption needs to be provided by the caller - -3. Caller consumption order (To ensure the normal execution of the contract, CPU frozen by the caller will be consumed first; TRX burn will make up for the insufficient part) - -4. If the creator has no frozen CPU resources, the caller is required to provide all consumption - - - ### Storage consumption order is as follows: - - 1. Storage purchased by the contract creator will be consumed in the proportion set up by the contract. All of the storage owned by the contract creator will be deducted first if insufficiency occurs -2. The remaining consumption needs to be provided by the caller -3. Caller consumption order (To ensure the normal execution of the contract, the system automatically purchase the insufficient part) -4. If the Contract Issuer does not provide the Storage resources, all the consumption needs to be provided by the caller. - -### Related Interface - -##### getTransactionInfoById -``` -getTransactionInfoById needs 1 parameter, transaction id -``` -Related field -``` -CpuFee: //TRX consumed by this contract (TRX burn caused by insufficient CPU remaining) -2400 -CpuUsage: //CPU consumed by this contract (including CPU consumed by the contract creator and caller, excluding that consumed by CpuFee) -120 -NetFee: //TRX consumed due to insufficient Bandwidth with this contract -0 -NetUsage: //Bandwidth consumed by this contract (excluding that related to NetFee) -252 -StorageFee: //TRX purchased last-minute due to insufficient Storage with this contract -0 -StorageDelta: //Bandwidth consumed by this contract(**Including**that related to StorageFee) -0 -OriginCpuUsage: //CPU provided by the contract creator with this contract -120 -OriginStorageDelta: //Storage provided by the contract creator with this contract -0 -``` -##### FreezeBalance -``` -freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 CPU] -``` - -##### buyStorage -``` -buyStorage quantity -``` - -##### buyStorageBytes -``` -buyStorageBytes bytes -``` - -##### buyStorageBytes -``` -sellStorage quantity -``` - -Instruction - -Pass the parameter “fee_limit” during the process of contract deployment and contract calling - - -Total consumption of this execution - -Note: - -CPU gained by burning TRX: 1 CPU = 30 SUN - -合约中调用其他合约使用gas()方法时,只能限制CPU使用量无法限制Storage, -考虑到调用者对消耗量的控制避免出现理解上的偏差,不建议使用gas()方法。 -In the contract, calling other contracts and using the gas() method can only limit the CPU usage, not Storage. Considering that callers may have different understanding of consumption control, it’s not suggested to use the gas() method. - -Related terms: - -Contract creator: account that creates the contract - -Contract caller: account that calls the contract - -CPU resource: resource type corresponding to the consumption time of contract execution - -Storage resource: resource type corresponding to disk consumption post contract execution diff --git a/English_Documentation/TRON_Virtual_Machine/Event_Decoding_in_transactionInfo.md b/English_Documentation/TRON_Virtual_Machine/Event_Decoding_in_transactionInfo.md deleted file mode 100644 index 9173b552..00000000 --- a/English_Documentation/TRON_Virtual_Machine/Event_Decoding_in_transactionInfo.md +++ /dev/null @@ -1,96 +0,0 @@ - -# 1.BackGround - -Event is an important funcionality to help developer confirm, check, search specific status for their smart contract. This article explain how to decode event the result get from transactionHistory database. - -# 2. Event example in solidity -``` -contract EventExampleContract { - event Transfer(address indexed toAddress, uint256 amount); - constructor() payable public{} - function contractTransfer(address toAddress, uint256 amount){ - toAddress.transfer(amount); - emit Transfer(toAddress, amount); - } -} -``` - -# 3. Event structure - -Solidity use LOG instruction to record event information in a transaction. The structure in protobuf: -``` -message TransactionInfo { - enum code { - SUCESS = 0; - FAILED = 1; - } - // LOG Structure represent single event - message Log { - bytes address = 1; - repeated bytes topics = 2; - bytes data = 3; - } - bytes id = 1; - int64 fee = 2; - int64 blockNumber = 3; - int64 blockTimeStamp = 4; - repeated bytes contractResult = 5; - bytes contract_address = 6; - ResourceReceipt receipt = 7; - // A list of LOG represent list of events in a transaction - repeated Log log = 8; - code result = 9; - bytes resMessage = 10; - - string assetIssueID = 14; - int64 withdraw_amount = 15; - int64 unfreeze_amount = 16; - repeated InternalTransaction internal_transactions = 17; - int64 exchange_received_amount = 18; - int64 exchange_inject_another_amount = 19; - int64 exchange_withdraw_another_amount = 20; - int64 exchange_id = 21; -} -``` -- Address: the contract address - -- topics: - - topics[0] => event hash. This is an optional item. If the event is modificated by anonymous keyword, topics[0] is the first indexed param. - - topics[1] => event first indexed param if exist. - - topics[2] => event second indexed param if exist. - - topics[3] => event third indexed param if exist (Maximum 3). - -- data: other params value without being indexed. If it is more than one parameters, all the parameter will be appended one by one. And you can decode them the same way as the contract result in https://github.com/tronprotocol/Documentation/blob/master/中文文档/虚拟机/TVM调用结果解析说明.md basing on abi - -# 4. Example of decoding events. -Use the solidity code in section 2 above. -ABI can be get as -``` -[{"constant":false,"inputs":[{"name":"toAddress","type":"address"},{"name":"amount","type":"uint256"}],"name":"contractTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":true,"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"toAddress","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Transfer","type":"event"}] -``` -so the event abi is -``` -{"anonymous":false,"inputs":[{"indexed":true,"name":"toAddress","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"Transfer","type":"event"} -``` -Use `gettransactioninfobyid ` to get the result of your transaction -``` -LogList: -address: -289C4D540B32C7BC56953E55631F8B141EB86434 // contract address -data: -0000000000000000000000000000000000000000000000000000000000000001 -TopicsList -69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de2 // topics[0] -000000000000000000000000E552F6487585C2B58BC2C9BB4492BC1F17132CD0 // topics[1] -``` -Check along with ABI: - -- topics[0] is 69ca02dd4edd7bf0a4abb9ed3b7af3f14778db5d61921c7dc7cd545266326de2. It is the result of keccak("event(address,uint256)"). - -- topics[1] is 000000000000000000000000E552F6487585C2B58BC2C9BB4492BC1F17132CD0. It is the first indexed param (toAddress) with type address. - -- data is 0000000000000000000000000000000000000000000000000000000000000001. It is the param without being indexed (amount) with type uint256. diff --git a/English_Documentation/TRON_Virtual_Machine/InternalTransaction.md b/English_Documentation/TRON_Virtual_Machine/InternalTransaction.md deleted file mode 100644 index 15db2489..00000000 --- a/English_Documentation/TRON_Virtual_Machine/InternalTransaction.md +++ /dev/null @@ -1,110 +0,0 @@ -# InternalTransaction - -## 1. BackGround - -InternalTransactions represent all transactions happened in a smart contract call. Some important information are included in the transaction, such as the sender/reciever address in a token/trx transfer transaction, trx/token amount, transfer status, etc. - -An user can check all the information about InternalTransactions in a interanlTransaction list, which contains all transaction in a single triggerSmartContract or createSmartContract call. - -## 2. Structure of InternalTransaction information. - -``` -message InternalTransaction { - bytes hash = 1; - // the one send trx or token via function - bytes caller_address = 2; - // the one recieve trx or token via function - bytes transferTo_address = 3; - message CallValueInfo { - // trx or token value - int64 callValue = 1; - // tokenId, trx should be empty - string tokenId = 2; - } - repeated CallValueInfo callValueInfo = 4; - bytes note = 5; - bool rejected = 6; -} -``` -* hash: unique identifier for a internal transaction. Should not exist same hash across all InternalTransactions or transactions. - -* caller_address: the address send trx or trc10 token - -* transferTo_address: the address recieve trx or trc10 token - -* callValueInfo: indicate the amount and type of asset and trx transfer. It could be a list of pairs - - 1. callvalue: the amount of trx or trc10 token. - - 2. tokenId : the trc10 tokenId. An empty value represents trx. - -* note: note can only have 3 types of values, call, create, suicide, that represent the internaltransaction type. - - 1. call: internaltransaction happened within a contract call contract case - - 2. create: internaltransaction happened within a contract create contract case - - 3. suicide: internaltransaction happened within a contract selfdestruct case - -* rejected: boolean value. Show whether this internal transaction is rejected due to some error. - - 1. true: The internal transaction is rejected and it is not be executed. - - 2. false: The internal transaction is successfully executed. - - -## 3. How to get internalTransaction - -Calling rpc api gettransactioninfobyid with a transaction id as its parameter on a internalTransaction supported node, a list of internaltransaction will be shown. - -1. the searching node config.conf should have `saveInternalTx = true` - -2. use rpc example: in wallet-cli, you can use command `gettransactioninfobyid ` to check all the internaltransaction info in `internal_transactions` field. - -Note: You may not be able to get the internal transaction for early transaction id, since the node hasn't switched on `saveInternalTx = true` at that time. So, if you want a full data of internaltransactions, you need a fullnode which turn `saveInternalTx = true` on from the very beginning when tron launched tvm. - -## 4. wallet-cli result example - -``` -InternalTransactionList: -[ - hash: - a07aaf40f35b42344d4909e8f739b32463c21a0c543fa212335f5d0d35f4db9d16 - caller_address: - 4145867eff384dd351003dffc38fe6e25549fac58 - transferTo_address: - 41537144c324033c5dc51759872f76e8f00f2edfa6 - callValueInfo: - [ - TokenName(Default trx): - TRX(SUN) - callValue: - 10000000 - ] - - note: - create - rejected: - false -] -[ - hash: - 28fbeeeab85eda244cf83172380b1f26da07ad7a34bb90abdb75dff905736ab1c - caller_address: - 4143144c324033c5dc51776572f76e8f00f2edfa6 - transferTo_address: - 412301d22dd9c7533b3d9c006f4279a823af41456 - callValueInfo: - [ - TokenName(Default trx): - TRX(SUN) - callValue: - 10000000 - ] - - note: - call - rejected: - false -] - ``` diff --git a/English_Documentation/TRON_Virtual_Machine/Set_up_Your_Own_DApp_Environment.md b/English_Documentation/TRON_Virtual_Machine/Set_up_Your_Own_DApp_Environment.md deleted file mode 100644 index 244941ee..00000000 --- a/English_Documentation/TRON_Virtual_Machine/Set_up_Your_Own_DApp_Environment.md +++ /dev/null @@ -1,136 +0,0 @@ -# Set up Your Own DApp Environment - -Version 0.1 - -## Introduction - -Currently, we can reduce the cost of development by setting up a smart contract environment on TRON's private chain, which does not consume the resource of public chains. TRON's virtual machine is highly compatible with that of Ethereum, and most smart contracts written in Solidity can also run on TRON network. TRON-based smart contracts provide high TPS and free access to most scenarios for its users- this is undoubtedly a significant step for the entire smart contract community. Up to this point, we've completed the underlying part of TRON virtual machine (TVM), and an ecosystem centered around TVM including various development tools is also underway. This article intends to introduce a basic method to deploy smart contracts and to interact with them. - -## Prerequisites - -### The Network for Running the Contract - -Deploying and using contract will need to consume a certain amount of resource (memory, CPU, and storage etc.). Therefore, it is recommended that the developers tune and test their smart contracts on their private networks and confirm that the contract is available before deploying them on the TestNet or MainNet. Please see [Deployment of FullNode (PrivateNet: Just one witness node) on the one host.](https://github.com/tronprotocol/TronDeployment) for further details on building a private network. - -The address of the private chain's block-creation node: TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY - -Witness Private Key: da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0 - -### Wallet Client - -Wallet-cli is TRON Network's command-line wallet. Developers can use wallet-cli to post and deploy contracts on the MainNet as well as execute other operations. - -## Development of Smart Contracts - -At this point, we recommend [Remix](http://remix.ethereum.org/) as the coding language for compiling and testing during the early stages. After the contract is finished, developers can copy the contract to [SimpleWebCompiler](https://github.com/tronprotocol/tron-demo/tree/master/SmartContractTools/SimpleWebCompiler) for further development and then acquire ABI and ByteCode. We present a simple example of contract code of data access to illustrate the process of compiling, deployment, and debugging. - - pragma solidity ^0.4.0; - contract DataStore { - - mapping(uint256 => uint256) data; - - function set(uint256 key, uint256 value) public { - data[key] = value; - } - - function get(uint256 key) view public returns (uint256 value) { - value = data[key]; - } - } - - -### 1. Initiate the Private Chain - -Make sure that the private chain in the prerequisite has been successfully deployed by checking FullNode/logs/tron.log and see if log message "Produce block successfully" of persistent block generation appears. - -### 2. Develop Smart Contracts - -Copy the code mentioned above to Remix to compile and debug. Make sure that logic of the code is correct, and the code itself is bug-free. - -### 3. Compile in SimpleWebCompiler to acquire ABI and ByteCode - -The compiler of TRON is slightly different from that of Ethereum and is still integrating with Remix. Therefore, we are providing a temporary way of acquiring ABI and ByteCode instead of acquiring them directly from Remix. Copy the code above to SImpleWebCompiler and click the Compile button to attain ABI and ByteCode. - -### 4. Deploy Smart Contract via Wallet-cli - -Download Wallet-Cli and compile on it. - -```shell -# Download source code -git clone https://github.com/tronprotocol/wallet-cli -cd wallet-cli -# Compile -./gradlew build -cd build/libs -``` - -> Note: Wallet-cli's default setting will connect to the full node of 127.0.0.1:50051. Developers can make the change in config.conf if they need to connect to a different node or interface. - -Initiate Wallet-Cli - - java -jar wallet-cli.jar - - -After initiation, input the command interactively to the portal. Import the private key and inquire if the remaining balance is correct. - -```Shell -importwallet - - -login - -getbalance -``` - -Contract Deployment - -```Shell -# Contract Deployment Command -deploycontract - -# Parameter Definition -ABI: ABI json data acquired from SimpleWebCompiler -code: binary code -max_cpu_usage: maximum amount of available cpu -max_net_usage: maximum amount of available network -max_storage_useage: maximum amount of available storage -value: use 32-bit hex to denote the transferred value when deploying the contract - -# Sample -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 1000000 1000000 10000000 0000000000000000000000000000000000000000000000000000000000000000 -``` - -A message of "Deploy the contract successfully" will be displayed upon the success of contract deployment - -Acquiring addresses of the contracts - - Your smart contract address will be: - - # In this example - Your smart contract address will be: TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 - - -Call the contracts to store and query data - -```Shell -# The command of calling the contract -triggercontract - -# Parameter Definition -Contract address: The address of the previously deployed contract with the format of base58, for example: TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 -Function signature: The signature of the desired function, for example, set (uint256, uint256) or fool(). Parameters need to be separated with ',' with no space -Input parameter: For non-hex, use ',' to separate natural input, with no space; for hex, enter directly -Hex: Whether the input parameter is hex, false or true -max_net_usage: available amount of network resources -max_storage_usage: available amount of storage -value: Use 32-bit hex to denote the transferred value when deploying the contract - -# Example -## Set the mapping 1->1 -triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256,uint256) 1,1 false 1000000 1000000 10000000 0000000000000000000000000000000000000000000000000000000000000000 - -## Extract the value with the mapping key of 1 -triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 get(uint256) 1 false 1000000 1000000 10000000 0000000000000000000000000000000000000000000000000000000000000000 -``` - -If the called function is constant or VIEW, wallet-cli will return the results directly. \ No newline at end of file diff --git a/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD b/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD deleted file mode 100644 index c3461d15..00000000 --- a/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD +++ /dev/null @@ -1,112 +0,0 @@ -Note: Please read this instruction carefully before you use trc10 related functions. - -# 1.BackGround - -TRC10 token is a system-level token type in TRON. Compare to TRC20 tokens, TRC10 facing a flexible issue to our user experience. In Odyssey 3.2, developers and their smart contract caller will be able to interact with TRC10 token via smart contracts according to the contract logic, which give them more possibility of controls to implement their token in more business scenarios. - -Unlike a TRC20 token, we keep the way to send TRC10 token consistent with the way transfer TRX in a contract, which means the usage of TRC10 is very similar to the way when use TRX. - -# 2. Transfer TRC10 token to a smart contract account - -TRC10 token can be transferred to a smart contract via a contract call, which is involved in two GRPC apis, DeployContract and TriggerContract. - -## 2.1 wallet-cli command and Examples - -- DeployContract: - - ```deployContract ``` - - e.g: deploy a contract and transfer 9 tokens those ids are 1000001 from message sender account to the contract account - - ```deployContract testContract [{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"f1","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"i","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] 6080604052600160005534801561001557600080fd5b50d3801561002257600080fd5b50d2801561002f57600080fd5b5060ef8061003e6000396000f30060806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166382e7eb3d8114604d578063e5aa3d5814607c575b600080fd5b348015605857600080fd5b50d38015606457600080fd5b50d28015607057600080fd5b50607a60043560b8565b005b348015608757600080fd5b50d38015609357600080fd5b50d28015609f57600080fd5b5060a660bd565b60408051918252519081900360200190f35b600055565b600054815600a165627a7a72305820cd4cf61efb71c4c984be5b1e4d84459871b6b10a93a80874a8a96fa3685cccb10029 # # false 1000000000 0 100000000 0 9 1000001``` - -- TriggerContract: - - ```triggercontract ``` - - e.g: trigger set function in TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 and transfer 10 tokens with tokenid 1000001 from msg sender account to contract account. - - ```triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256, uint256) 1,1 false 1000000 0 10 1000001``` - -## 2.2 New parameters explanation - -tokenValue: the token amount caller want to send into the contract account from caller’s account - -tokenId: the target token identifier, which is a int64 type in ProtoBuf. In Wallet client, use # to represent no tokenId. - ->Note: - ->EnergyLimit is a new feature in Odyssey_v3.2, which limit the energy cost when a caller spends developer’s energy. It means the contract owner can set a max energy cost value to avoid other user over use owner’s resource. - ->TokenId is also a new feature in Odyssey_v3.2. It can be found in a new map field called assetV2 in an account. Use GetAccount(Account) to get the tokenId and its value. TokenId is set by the system begin from number 1_000_001. When a new TRC10 token is created, the number add 1 and set the id for this token. - - -# 3. Interacting with TRC10 token in a smart contract. - -## 3.1 TRC10 contract example - -``` -pragma solidity ^0.4.24; -contract transferTokenContract { - constructor() payable public{} - function() payable public{} - function transferTokenTest(address toAddress, uint256 tokenValue, trcToken id) payable public { - require(id > 1000000); - toAddress.transferToken(tokenValue, id); - } - function msgTokenValueAndTokenIdTest() public payable returns(trcToken, uint256){ - trcToken id = msg.tokenid; - uint256 value = msg.tokenvalue; - return (id, value); - } - function getTokenBalanceTest(address accountAddress) payable public returns (uint256){ - trcToken id = 1000001; - require(id > 1000000); - return accountAddress.tokenBalance(id); - } -} -``` - -## 3.2 TRCToken type - -- Odyssey_v3.2 defined a new type (trcToken) for TRC10 token, which represent the tokenId in a token transfer operation. - -- TRC10 token can be convert to uint256 type and vice versa. - - -## 3.3 address.transferToken(uint256 tokenValue, trcToken tokenId) native function - -- Odyssey_v3.2 defined a new transferToken function for TRC10 token transferring in TRON solidity compiler and also supported in JAVA-TRON. - -- An address type variable can invoke this native function and which means current contract would like to transfer specific amount of target token from the contract’s account to this address’s account. - -- TransferToken function share very similar mechanism as the transfer(uint256) function. Please be attention that only 2300 energy will be send to this function and also its related fallback function. - -- **IMPORTANT**: tokenId valide value must > 1000000. The best-practice would be use a require function to guarantee its correctness. - -- **IMPORTANT**: tokenId = 0 (Only in this function) is preserved here, which is presented TRX. This is a experimental feature, we **DO NOT** recommend to use this logic to transfer TRX at least for now for your safety. Please use the widely used transfer() function to send TRX. - -## 3.4 address.tokenBalance(trcToken) returns(uint256 tokenAmount)native function - -- Odyssey_v3.2 defined a new tokenBalance function for TRC10 token balance querying. - -- An address type variable can invoke this native function which returns the amount of target token owned by the account with the address. - -- **IMPORTANT**: Query tokenBalance(0) doesn't represent trx balance, instead it will return 0. - -## 3.5 msg.tokenvalue & msg.tokenid - -- msg.tokenvalue, represent the tokenvalue in current msg call, default 0. - -- msg.tokenid, represent the token id in current msg call, default 0. - -- **IMPORTANT**: msg.tokenid = 0 doesn't represent trx in current version. - -# 4 solidity compiler - -## 4.1 Github: - https://github.com/tronprotocol/solidity/tree/Odyssey_v3.2 - -## 4.2 Important notes: - -The bytecode generated by new TRON/solidity Odyssey_v3.2 compiler will NOT work before ALLOW_TVM_TRANSFER_TRC10 proposal in JAVA-TRON Odyssey_v3.2 be approved. As a result, TRONSTUDIO and any other tools those depends on our TRON compiler should not import 3.2 compiler and expose to public until ALLOW_TVM_TRANSFER_TRC10 proposal be approved on our chain. diff --git a/English_Documentation/TRON_Virtual_Machine/TRC10_TRX_TRANSFER_INTRODUCTION_FOR_EXCHANGES.md b/English_Documentation/TRON_Virtual_Machine/TRC10_TRX_TRANSFER_INTRODUCTION_FOR_EXCHANGES.md deleted file mode 100644 index 840e0f9b..00000000 --- a/English_Documentation/TRON_Virtual_Machine/TRC10_TRX_TRANSFER_INTRODUCTION_FOR_EXCHANGES.md +++ /dev/null @@ -1,282 +0,0 @@ -# I. Abstract - -To detect a trx or trc10 transaction in tron mainly need to deal with 4 different types of contracts,TransferContract (System Contract Type) TransferAssetContract (System Contract Type), CreateSmartContract (Smart Contract Type), TriggerSmartContract (Smart Contract Type). - -The data type also need to be notice are `Transaction`, `TransactionInfo` and `Block`, those contans all the result information for a smart contract transaction. - -## Related Protobuf -- TransferContract -``` -message TransferContract { - bytes owner_address = 1; - bytes to_address = 2; - int64 amount = 3; -} -``` -- TransferAssetContract -``` -message TransferAssetContract { - bytes asset_name = 1; // this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format. - bytes owner_address = 2; - bytes to_address = 3; - int64 amount = 4; -} -``` -- CreateSmartContract -``` -message CreateSmartContract { - bytes owner_address = 1; - SmartContract new_contract = 2; - int64 call_token_value = 3; - int64 token_id = 4; -} - -``` -- TriggerSmartContract -``` -message TriggerSmartContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 call_value = 3; - bytes data = 4; - int64 call_token_value = 5; - int64 token_id = 6; -} -``` -- Transaction -``` -message Transaction { - message Contract { - enum ContractType { - AccountCreateContract = 0; - TransferContract = 1; - TransferAssetContract = 2; - VoteAssetContract = 3; - VoteWitnessContract = 4; - WitnessCreateContract = 5; - AssetIssueContract = 6; - WitnessUpdateContract = 8; - ParticipateAssetIssueContract = 9; - AccountUpdateContract = 10; - FreezeBalanceContract = 11; - UnfreezeBalanceContract = 12; - WithdrawBalanceContract = 13; - UnfreezeAssetContract = 14; - UpdateAssetContract = 15; - ProposalCreateContract = 16; - ProposalApproveContract = 17; - ProposalDeleteContract = 18; - SetAccountIdContract = 19; - CustomContract = 20; - // BuyStorageContract = 21; - // BuyStorageBytesContract = 22; - // SellStorageContract = 23; - CreateSmartContract = 30; - TriggerSmartContract = 31; - GetContract = 32; - UpdateSettingContract = 33; - ExchangeCreateContract = 41; - ExchangeInjectContract = 42; - ExchangeWithdrawContract = 43; - ExchangeTransactionContract = 44; - UpdateEnergyLimitContract = 45; - AccountPermissionUpdateContract = 46; - PermissionAddKeyContract = 47; - PermissionUpdateKeyContract = 48; - PermissionDeleteKeyContract = 49; - } - ContractType type = 1; - google.protobuf.Any parameter = 2; - bytes provider = 3; - bytes ContractName = 4; - } - - message Result { - enum code { - SUCESS = 0; - FAILED = 1; - } - enum contractResult { - DEFAULT = 0; - SUCCESS = 1; - REVERT = 2; - BAD_JUMP_DESTINATION = 3; - OUT_OF_MEMORY = 4; - PRECOMPILED_CONTRACT = 5; - STACK_TOO_SMALL = 6; - STACK_TOO_LARGE = 7; - ILLEGAL_OPERATION = 8; - STACK_OVERFLOW = 9; - OUT_OF_ENERGY = 10; - OUT_OF_TIME = 11; - JVM_STACK_OVER_FLOW = 12; - UNKNOWN = 13; - } - int64 fee = 1; - code ret = 2; - contractResult contractRet = 3; - - string assetIssueID = 14; - int64 withdraw_amount = 15; - int64 unfreeze_amount = 16; - int64 exchange_received_amount = 18; - int64 exchange_inject_another_amount = 19; - int64 exchange_withdraw_another_amount = 20; - int64 exchange_id = 21; - } - - message raw { - bytes ref_block_bytes = 1; - int64 ref_block_num = 3; - bytes ref_block_hash = 4; - int64 expiration = 8; - repeated authority auths = 9; - // data not used - bytes data = 10; - //only support size = 1, repeated list here for extension - repeated Contract contract = 11; - // scripts not used - bytes scripts = 12; - int64 timestamp = 14; - int64 fee_limit = 18; - } - - raw raw_data = 1; - // only support size = 1, repeated list here for muti-sig extension - repeated bytes signature = 2; - repeated Result ret = 5; -} -``` -- TransactionInfo -``` -message TransactionInfo { - enum code { - SUCESS = 0; - FAILED = 1; - } - message Log { - bytes address = 1; - repeated bytes topics = 2; - bytes data = 3; - } - bytes id = 1; - int64 fee = 2; - int64 blockNumber = 3; - int64 blockTimeStamp = 4; - repeated bytes contractResult = 5; - bytes contract_address = 6; - ResourceReceipt receipt = 7; - repeated Log log = 8; - code result = 9; - bytes resMessage = 10; - - string assetIssueID = 14; - int64 withdraw_amount = 15; - int64 unfreeze_amount = 16; - repeated InternalTransaction internal_transactions = 17; - int64 exchange_received_amount = 18; - int64 exchange_inject_another_amount = 19; - int64 exchange_withdraw_another_amount = 20; - int64 exchange_id = 21; -} -``` -Block -``` -message Block { - repeated Transaction transactions = 1; - BlockHeader block_header = 2; -} -``` - -# II. Detect and record Transfer with TransferContract and TransferAssetContract - - -These two contracts, `TransferContract`and `TransferAssetContract`, are system contracts, which are used to transfer trx and trc10 respectively.A transaction contains only one contract, so the query transaction can get specific information about a contract, using interface `GetTransactionbyid`.In addition, using the interface `GetBlockByNum` can get all the transactions of a block. - - -## Steps - -1. Get Block (optional step): Use `GetBlockByNum` to retreive block info (`Block`). - -2. Get Transaction: Travel `Block` or use `GetTransactionInfoById` to get specific transaction (`Transaction`). - -3. Check root Transaction result: Transaction.Result.code is FAILED, simply reject this transaction. No transferring happened. Otherwise, continue to read below. - -4. Check `type` in `Transaction.raw` to get contract type information (`TransferContract` or `TransferAssetContract`). - -5. Check `parameter` in `Transaction.raw` to get contract details according to `type`. - -#### TransferContract - - - `owner_address` (Bytes) is the trx sender address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `to_address` (Bytes) is the trx receiver address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `amount` (int64) is the trx amount send to the contract address. - -#### TransferAssetContract - - - `asset_name` (String) is the trc10 id. No need to do any convert to show readable Tron address. (This parameter used to represent the name of the trc10. After the proposal ALLOW_SAME_TOKEN_NAME, it has been modified to trc10 id) - - - `owner_address` (Bytes) is the trc10 sender address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `to_address` (Bytes) is the trc10 receiver address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `amount` (int64) is the trc10 amount send to the contract address. - - - - -# III. Detect and record Transfer with CreateSmartContract and TriggerSmartContract. - -In general, the way to detect `CreateSmartContract` and `TriggerSmartContract` is pretty similar. By using `GetTransactionbyid` or travel the latest block to get latest transactions one by one, transaction data can be retrieved. As long as you get transaction id, you can use `GetTransactionInfoById` to fetch InternalTransaction info and other smart contract execution details. - -## Steps - -1. Get Block (optional step): Use `GetBlockByNum` to retreive block info (`Block`). - -2. Get Transaction: Travel `Block` or use `GetTransactionInfoById` to get specific transaction (`Transaction`). - -3. Check root Transaction result: Transaction.Result.code is FAILED, simply reject this transaction. No transferring happened. Otherwise, continue to read below. - -4. Check `type` in `Transaction.raw` to get contract type information (`CreateSmartContract` or `TriggerSmartContract`). - -5. **Get trx and trc10 transfer information those send along with the root transaction:** Check `parameter` in `Transaction.raw` to get contract details according to `type`. - -#### CreateSmartContract - - - `owner_address` (Bytes) is the trx or trc10 sender address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `SmartContract.contract_address` (Bytes) is the trx or trc10 reciever's address and it **HAS-TO-BE** a smart contract address. Due to it is created in runtime, you cannot retrieve it from the `Transaction`, instead you have to use `GetTransactionInfoById` to get `contract_address` in `TransactionInfo`. The data need to be converted from Bytes to a base58Check String to show readable Tron address. - - - `SmartContract.call_value` (int64) is the trx amount send to the contract address. - - - `call_token_value` (int64) is the trc10 amount send to the contract address. - - - `token_id` (String) is the related trc10 id. No need to do any convert to show readable Tron address - - #### TriggerSmartContract - - - `owner_address` (Bytes) is the trx or trc10 sender address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `contract_address` (Bytes) is the trx or trc10 reciever's address and it **HAS-TO-BE** a smart contract address. Need to convert Bytes to a base58 String to show readable Tron address. - - - `call_value` (int64) is the trx amount send to the contract address. - - - `call_token_value` (int64) is the trc10 amount send to the contract address. - - - `token_id` (String) is the related trc10 id. No need to do any convert to show readable Tron address - -6. **Check trx transfering or trc10 transfering in `InternalTransaction`**. - - - `caller_address` (Bytes) is the trx or trc10 token sender address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `transferTo_address`(Bytes) is the trx or trc10 token reciever address. Need to convert Bytes to a base58Check String to show readable Tron address. - - - `CallValueInfo` is a list of transfer details. - - - `callvalue` (int64) represent trx amount if `tokenId` is empty. Otherwise it is the token transfer value. - - - `tokenId` (String) is the token identifier. `rejected` represent whether this internaltransaction is failed and rejected. If it is `true`. You do not need to deal with current internaltrasaction, since some error occurred. Otherwise, it is successful with value `false`. - - diff --git a/English_Documentation/TRON_Virtual_Machine/TRC20_Token_Example.sol b/English_Documentation/TRON_Virtual_Machine/TRC20_Token_Example.sol deleted file mode 100644 index ddfe20c3..00000000 --- a/English_Documentation/TRON_Virtual_Machine/TRC20_Token_Example.sol +++ /dev/null @@ -1,88 +0,0 @@ -pragma solidity ^0.4.25; - -contract TronToken { - - string public name = "Tronix"; // token name - string public symbol = "TRX"; // token symbol - uint256 public decimals = 6; // token digit - - mapping (address => uint256) public balanceOf; - mapping (address => mapping (address => uint256)) public allowance; - - uint256 public totalSupply = 0; - bool public stopped = false; - - uint256 constant valueFounder = 100000000000000000; - address owner = 0x0; - - modifier isOwner { - assert(owner == msg.sender); - _; - } - - modifier isRunning { - assert (!stopped); - _; - } - - modifier validAddress { - assert(0x0 != msg.sender); - _; - } - - function TronToken(address _addressFounder) { - owner = msg.sender; - totalSupply = valueFounder; - balanceOf[_addressFounder] = valueFounder; - Transfer(0x0, _addressFounder, valueFounder); - } - - function transfer(address _to, uint256 _value) isRunning validAddress returns (bool success) { - require(balanceOf[msg.sender] >= _value); - require(balanceOf[_to] + _value >= balanceOf[_to]); - balanceOf[msg.sender] -= _value; - balanceOf[_to] += _value; - Transfer(msg.sender, _to, _value); - return true; - } - - function transferFrom(address _from, address _to, uint256 _value) isRunning validAddress returns (bool success) { - require(balanceOf[_from] >= _value); - require(balanceOf[_to] + _value >= balanceOf[_to]); - require(allowance[_from][msg.sender] >= _value); - balanceOf[_to] += _value; - balanceOf[_from] -= _value; - allowance[_from][msg.sender] -= _value; - Transfer(_from, _to, _value); - return true; - } - - function approve(address _spender, uint256 _value) isRunning validAddress returns (bool success) { - require(_value == 0 || allowance[msg.sender][_spender] == 0); - allowance[msg.sender][_spender] = _value; - Approval(msg.sender, _spender, _value); - return true; - } - - function stop() isOwner { - stopped = true; - } - - function start() isOwner { - stopped = false; - } - - function setName(string _name) isOwner { - name = _name; - } - - function burn(uint256 _value) { - require(balanceOf[msg.sender] >= _value); - balanceOf[msg.sender] -= _value; - balanceOf[0x0] += _value; - Transfer(msg.sender, 0x0, _value); - } - - event Transfer(address indexed _from, address indexed _to, uint256 _value); - event Approval(address indexed _owner, address indexed _spender, uint256 _value); -} diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 65c5ca88..00000000 --- a/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/TRX/Common-Patterns.md b/TRX/Common-Patterns.md deleted file mode 100644 index e1e75c36..00000000 --- a/TRX/Common-Patterns.md +++ /dev/null @@ -1,72 +0,0 @@ -# Common Integration Patterns - -## Generating Addresses - -If you need to generate addresses, either as exchange deposit addresses or some way to receive funds, -you will need to generate an address to use. - -#### - Manually Calculate Addresses (Safest) -Follow these steps to create a private key, then calculate out the resulting -- https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-overview.md#6-user-address-generation - -#### - Use an RPC call -- `/wallet/generateaddress` to create a `Private Key` and `TRON Address` pair - -- `/wallet/createaddress` to pass a `Password String` to generate the matching `TRON Address`. These strings are hashed into private keys so treat them as such. - ---- - -## Sending TRX from an address - -TRX transfers require access to the private key or password for the account. - -#### - Manually Create, Sign and Broadcast the transfer transaction - -1. Use the `/wallet/createtransaction` RPC Call to create a transaction and get the transaction data. -2. Sign the transaction data using `/wallet/gettransactionsign` with a `Private Key`. -3. Or manually sign the transaction data (**Only works with gRPC**) following this [Guide](https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-overview.md#103-signature). -4. Broadcast the signed transaction and transaction data onto the network using `/wallet/broadcasttransaction`. - -#### - Use an RPC call -- `/wallet/easytransfer` with a `Password String` to transfer TRX to a destination address. - -- `/wallet/easytransferbyprivate` with a `Private Key` to transfer TRX to a destination address. - ---- - -## Reading Transaction from the network - -Transactions are confirmed once they're available through the Solidity Node. The Full Node allows you to query - -#### - Use an RPC call for a transaction/transaction list directly -- `/walletsolidity/gettransactionbyid` to retrieve **Confirmed** transactions by ID. -- `/wallet/gettransactionbyid` to retrieve **ALL** transactions by ID, including **Unconfirmed** transactions. -- `/walletextension/gettransactionsfromthis` to retrieve transactions from an address. -- `/walletextension/gettransactionstothis` to retrieve transactions to an address. -- `/walletsolidity/gettransactioninfobyid` to retrieve metadata about a transaction, including fees, block number and block production time. - -#### - Use an RPC call for the block -If the block has transactions, it will be listed in the trasactions array. You can parse this to find all the transactions included on that block. - -- `/walletsolidity/getblockbynum` to retrieve block by block height/number from the Solidity Node. These blocks are guaranteed confirmed and irreversable. -- `/wallet/getblockbynum` to retrieve a block by block height/number from the Full Node. These blocks are **NOT** confirmed. -- `/wallet/getblockbyid` to retrieve by block hash. - - ---- - -## Calculating Bandwidth for an Account - -Bandwidth is used for all transactions and cost around 200~ for a TRX transfer. Every active account with an age greater than 24 hours starts with 5000 free bandwidth. Used bandwidth replenishes over a 24 hour period. If there isn't enough bandwidth for a transaction, then a fee of 0.002TRX will be charged. - -#### - Use an RPC call to query an account's available bandwidth. -- `/wallet/getaccountnet` will retrieve the bandwidth information for an account. If a key isn't present, then the value is 0. - -``` -{“freeNetUsed”: 557,“freeNetLimit”: 5000,“NetUsed”: 353,“NetLimit”: 5239157853,“TotalNetLimit”: 43200000000,“TotalNetWeight”: 41228} -``` - - - - ---- diff --git a/TRX/Frequently_Asked_Questions.md b/TRX/Frequently_Asked_Questions.md deleted file mode 100644 index 5b4096db..00000000 --- a/TRX/Frequently_Asked_Questions.md +++ /dev/null @@ -1,17 +0,0 @@ -## For the specific definition of API, please refer to the following link: -https://github.com/tronprotocol/java-tron/blob/develop/src/main/protos/api/api.proto - -## Frequently used APIs: -1. Get general info of the wallet (similar to bitcoin getinfo) -GetAccount -2. Get balance of an address (similar to bitcoin getbalance) -GetAccount -3. Create a new address (similar to bitcoin getnewaddress) -You can create an address at the local system. -And you can create a new address on blockchain by calling rpc api createAccount, TransferAsset or CreateTransaction (TransferContract) to make a transfer from an existing account to the new address. -4. Retrieve the list of transaction history by address (similar to bitcoin listtransactions) -GetTransactionsFromThis -GetTransactionsToThis -5. check address is valid or not (regex or API command) -+ Local check--- After decode58check at local, you can get a 21-byte byte array starting with 0x41. -+ If you want to verify whether an address exists on the blockchain, you can call GetAccount. diff --git a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Developers_After_TRON_Mainnet_Launch.md b/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Developers_After_TRON_Mainnet_Launch.md deleted file mode 100644 index 4ce46509..00000000 --- a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Developers_After_TRON_Mainnet_Launch.md +++ /dev/null @@ -1,64 +0,0 @@ -# Timeline - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png) - -## 1. Launch Prep (Now – 5/31) - -+ Complete mainnet function testing. -+ Complete wallet product testing. -+ Complete blockchain explorer testing. - -## 2. Mainnet Testing (6/1 – 6/24) - -+ 6/1 – 6/24 (GMT+8), maintain stable operations after mainnet launch. Data wipe on June 24 (GMT+8). -+ Users get test tokens from designated links and test on mainnet’s TRON wallet. Community developers test mainnet functions. - - Mainnet testing period: June 1, 2018 00:00 (GMT+8) – June 24, 2018 23:59 (GMT+8). - Mainnet will launch after the mainnet testing period. Genesis block will launch on June 25, 2018 10:00 (GMT+8). - -## 3. Genesis Block Launch & Token Migration - -Official launch of the genesis block will be on June 25 10:00 (GMT+8). - -Token migration: -+ Exchanges: ERC20 TRX tokens will be transferred to TRON. TRON will transfer mainnet tokens to exchanges. -+ SR: Express TRX migration channel for Super Representative candidates can ensure unimpeded application for candidacy and a certain amount of initial votes. - -## 4. SR Elections & Rewards - -Users vote for SR candidates using wallets. SRs are responsible for transaction packaging and block generation. - -# Developer - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_developer.png) - -1. Completion of development: Before May 31st (GMT+8) -Announce the github address of each wallet, download the links for community and users to test and experiment. - -2. Wallet test iteration: June 1-June 24 (GMT+8) -Promote wallets for community and users to test and experiment, get feedback and iterate wallets. - -3. Select the official recommended wallet for each platform (June 15, GMT+8) -On June 15th (GMT+8), the TRON team will review and select the official recommended wallet for each platform. The official recommended wallets can be submitted at any time, and TRON can add recommendations at any time. - -4. Wallet officially launched (June 25, GMT+8) -TRX users vote for SR candidates using wallets. - -**Note** -1. Please note that you have to finish development before May 31st (GMT+8). -2. Please note that the mainnet testing will be from June 1 to June 24 (GMT+8) and please participate. -3. Please submit your wallet versions to TRON before June 15th (GMT+8). - - - - - - - - - - - - - - diff --git a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Exchange_After_Mainnet_Launch.md b/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Exchange_After_Mainnet_Launch.md deleted file mode 100644 index a115ffa2..00000000 --- a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Exchange_After_Mainnet_Launch.md +++ /dev/null @@ -1,58 +0,0 @@ -# Timeline - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png) - -## 1. Launch Prep (Now – 5/31) - -+ Complete mainnet function testing. -+ Complete wallet product testing. -+ Complete blockchain explorer testing. - -## 2. Mainnet Testing (6/1 – 6/24) - -+ 6/1 – 6/24 (GMT+8), maintain stable operations after mainnet launch. Data wipe on June 24 (GMT+8). -+ Users get test tokens from designated links and test on mainnet’s TRON wallet. Community developers test mainnet functions. - - Mainnet testing period: June 1, 2018 00:00 (GMT+8) – June 24, 2018 23:59 (GMT+8). - Mainnet will launch after the mainnet testing period. Genesis block will launch on June 25, 2018 10:00 (GMT+8). - -## 3. Genesis Block launch & Token Migration - -Official launch of the genesis block will be on June 25 10:00 (GMT+8). - -Token migration: -+ Exchanges: ERC20 TRX tokens will be transferred to TRON. TRON will transfer mainnet tokens to exchanges. -+ SR: Express TRX migration channel for Super Representative candidates can ensure unimpeded application for candidacy and a certain amount of initial votes. - -## 4. SR Elections & Rewards - -Users vote for SR candidates using wallets. SRs are responsible for transaction packaging and block generation. - -# Exchange - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_exchange.png) - -1. TRX withdrawals will not be allowed: -TRX withdrawals will not be allowed from June 21st to 24th (GMT+8). - -2. TRX deposits and withdrawals on exchanges will not be allowed: -Deposits and withdrawals are not allowed on June 25th (GMT+8). - -3. ERC20 TRX tokens will be transferred to TRON. TRON will transfer mainnet tokens to exchanges: -Exchanges will transfer ERC20 TRX tokens to TRON and TRON will burn them and transfer mainnet tokens to exchanges. - -4. System is updated and supports deposits and withdrawals of mainnet tokens: -Exchanges update their systems which supports the wallet function of mainnet tokens instead of the function of ERC20 TRX. - -5. A notice will be published on resumed deposit and withdrawal functions: -After confirmation of exchanges, deposits and withdrawals of TRX will resume. - -6. Permanent token-exchange counter: -Permanent token-exchange counter designated by TRON will retain the deposit channel for ERC20 TRX. Users can migrate from ERC20 TRX to mainnet tokens on a regular basis. - -**Note** -1. Exchanges don’t need snapshots and don’t need to suspend trading of TRX. -2. Please take note of token migration order. -3. Please note that TRX withdrawals will be suspended from June 21st to June 24th (GMT+8). Both TRX deposits and withdrawals on exchanges will be suspended on June 25th (GMT+8). Deposits and withdrawals of TRX will resume on June 26th. -4. Please contact TRON Foundation to receive mainnet tokens. - diff --git a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_SRs_After_TRON_Mainnet_Launch.md b/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_SRs_After_TRON_Mainnet_Launch.md deleted file mode 100644 index f5aa6458..00000000 --- a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_SRs_After_TRON_Mainnet_Launch.md +++ /dev/null @@ -1,59 +0,0 @@ -# Timeline - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png) - -## 1. Launch Prep (Now – 5/31) - -+ Complete mainnet function testing. -+ Complete wallet product testing. -+ Complete blockchain explorer testing. - -## 2. Mainnet Testing (6/1 – 6/24) - -+ 6/1 – 6/24 (GMT+8), maintain stable operations after mainnet launch. Data wipe on June 24 (GMT+8). -+ Users get test tokens from designated links and test on mainnet’s TRON wallet. Community developers test mainnet functions. - - Mainnet testing period: June 1, 2018 00:00 (GMT+8) – June 24, 2018 23:59 (GMT+8). - Mainnet will launch after the mainnet testing period. Genesis block will launch on June 25, 2018 10:00 (GMT+8). - -## 3. Genesis Block Launch & Token Migration - -Official launch of the genesis block will be on June 25 10:00 (GMT+8). - -Token migration: -+ Exchanges: ERC20 TRX tokens will be transferred to TRON. TRON will transfer mainnet tokens to exchanges. -+ SR: Express TRX migration channel for Super Representative candidates can ensure unimpeded application for candidacy and a certain amount of initial votes. - -## 4. SR Elections & Rewards - -Users vote for SR candidates using wallets. SRs are responsible for transaction packaging and block generation. - -# SR - -![](https://github.com/ybhgenius/Documentation/blob/master/images/Gudiance_After_TRON_Mainnet_Launch/Gudiance_for_SRs.png) - -1. Campaigning 4/27-5/31 (GMT+8) -SR election campaigning period allows SRs to attract more votes from TRX holders. - -2. Candidates transfer deposit: - Candidates will be informed on May 15th (GMT+8) to transfer - 200K TRX to TRON Foundation by May 31st as deposit. Deposit - will be returned to designated TRON mainnet addresses at midnight - June 25th (GMT+8). - -3. Election test period: 6/1 - 6/24 (GMT+8) -Supporters can do test voting. Run test nodes and generate blocks. - -4. Candidates’ deposit is returned: -Deposit will be returned to designated TRON mainnet addresses at midnight June 25th (GMT+8). - -5. Apply to become an SR candidate using the wallet and call on supporters to vote. - -6. Become official SRs: - -27 candidates who receive most votes will become official SRs. They are eligible to generate blocks and get rewards in TRX. - -**Note** -1. Please pay deposit before May 31st (GMT+8). -2. Please take part in the mainnet test voting and run test nodes from June 1st to June 24th (GMT+8). -3. Please call on your supporters to vote on June 26th. diff --git a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Users_After_TRON_Mainnet_Launch.md b/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Users_After_TRON_Mainnet_Launch.md deleted file mode 100644 index c2928b97..00000000 --- a/TRX/Guidance_after_TRON_Mainnet_Launch/Guidance_For_Users_After_TRON_Mainnet_Launch.md +++ /dev/null @@ -1,49 +0,0 @@ -# Timeline - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png) - -## 1. Launch Prep (Now – 5/31) - -+ Complete mainnet function testing. -+ Complete wallet product testing. -+ Complete blockchain explorer testing. - -## 2. Mainnet Testing (6/1 – 6/24) - -+ 6/1 – 6/24 (GMT+8), maintain stable operations after mainnet launch. Data wipe on June 24 (GMT+8). -+ Users get test tokens from designated links and test on mainnet’s TRON wallet. Community developers test mainnet functions. - - Mainnet testing period: June 1, 2018 00:00 (GMT+8) – June 24, 2018 23:59 (GMT+8). - Mainnet will launch after the mainnet testing period. Genesis block will launch on June 25, 2018 10:00 (GMT+8). - -## 3. Genesis Block Launch & Token Migration - -Official launch of the genesis block will be on June 25 10:00 (GMT+8). - -Token migration: -+ Exchanges: ERC20 TRX tokens will be transferred to TRON. TRON will transfer mainnet tokens to exchanges. -+ SR: Express TRX migration channel for Super Representative candidates can ensure unimpeded application for candidacy and a certain amount of initial votes. - -## 4. SR Elections & Rewards - -Users vote for SR candidates using wallets. SRs are responsible for transaction packaging and block generation. - -# Common users - -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_user.png) - -There are three scenarios: - -1. If your TRX is held on an exchange, no action is required. -2. If your TRX is held in a wallet, please follow the steps below: - + From June 21 to June 24 (GMT+8), TRX withdrawals on exchanges will be suspended. Users must deposit TRX to an exchange before June 24, 2018 (GMT+8). - + On June 25 (GMT+8), both TRX deposits and withdrawals on exchanges will be suspended. - + Withdraw TRX to wallets and vote. From June 26th (GMT+8), deposits and withdrawals of TRX will resume. Users need to withdraw TRX and transfer to wallets in order to vote. -3. If your TRX is held in a wallet and you were not aware of the migration notice, or see the notice after June 25th, please visit our permanent token-exchange counter to exchange your tokens for mainnet TRX. -User's token migration is not perceptible. Please deposit TRX to an exchange before June 25th (GMT+8), and TRX's normal trading will not be affected. - -**Note** -1. Please keep an eye on token migration. -2. Please note that the test voting will be from June 1 to June 24 (GMT+8). -3. Please note that the official voting will be on June 26 (GMT+8). -4. User's token migration is not perceptible. Please deposit TRX to an exchange before June 25th (GMT+8), and TRX's normal trading will not be affected. diff --git a/TRX/Official_Public_Node.md b/TRX/Official_Public_Node.md deleted file mode 100644 index 2b306bf0..00000000 --- a/TRX/Official_Public_Node.md +++ /dev/null @@ -1,52 +0,0 @@ -# Full Node -* GRPC port: 50051 -* P2P network port: 18888 -* HTTP port : 8090 -``` -54.236.37.243 -52.53.189.99 -18.196.99.16 -34.253.187.192 -52.56.56.149 -35.180.51.163 -54.252.224.209 -18.228.15.36 -52.15.93.92 -34.220.77.106 -13.127.47.162 -13.124.62.58 -47.74.149.206 -35.182.37.246 -47.90.215.84 -47.254.77.146 -47.74.242.55 -47.75.249.119 -47.90.201.118 -47.74.21.68 -47.74.13.168 -47.74.33.41 -47.52.59.134 -47.74.229.70 -47.254.27.69 -47.89.243.195 -47.90.201.112 -47.88.174.175 -47.74.224.123 -47.75.249.4 -``` - -# Solidity Node -* GRPC port: 50051 -* HTTP port : 8091 -``` -47.89.187.247 -47.91.18.255 -47.75.10.71 -47.251.52.228 -47.251.48.82 -47.74.147.80 -34.234.164.105 -18.221.34.0 -35.178.11.0 -35.180.18.107 -``` diff --git a/TRX/Solidity_and_Full_Node_Deployment_EN.md b/TRX/Solidity_and_Full_Node_Deployment_EN.md deleted file mode 100644 index b5671813..00000000 --- a/TRX/Solidity_and_Full_Node_Deployment_EN.md +++ /dev/null @@ -1,88 +0,0 @@ -# Deployment of SolidityNode and FullNode on the same host - -Create separate directories for fullnode and soliditynode -``` - /deploy/fullnode - /deploy/soliditynode -``` - -Create two folders for fullnode and soliditynode. - -Clone our latest master branch of https://github.com/tronprotocol/java-tron and extract it to -``` - /deploy/java-tron -``` - -Make sure you have the proper dependencies. - -* JDK 1.8 (JDK 1.9+ is not supported yet) -* On Linux Ubuntu system (e.g. Ubuntu 16.04.4 LTS), ensure that the machine has [__Oracle JDK 8__](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04), instead of having __Open JDK 8__ in the system. If you are building the source code by using __Open JDK 8__, you will get [__Build Failed__](https://github.com/tronprotocol/java-tron/issues/337) result. -* Open **UDP** ports for connection to the network -* **MINIMUM** 2 CPU Cores - -## Deployment guide - - 1. Build the java-tron project -``` - cd /deploy/java-tron - ./gradlew build -``` - - 2. Copy the FullNode.jar and SolidityNode.jar along with config files into the respective directories. -``` - download your needed config file from https://github.com/tronprotocol/TronDeployment. - main_net_config.conf is the config for mainnet, and test_net_config.conf is the config for testnet. - please rename the config file to `config.conf` and use this config.conf to start fullnode and soliditynode. - - cp build/libs/FullNode.jar ../fullnode - cp build/libs/SolidityNode.jar ../soliditynode -``` - - 3. You can now run your Fullnode using the following command: -``` - java -jar FullNode.jar -c config.conf // make sure that your config.conf is downloaded from https://github.com/tronprotocol/TronDeployment -``` - - 4. Configure the SolidityNode configuration file. You'll need to edit `config.conf` to connect to your local `FullNode`. Change `trustNode` in `node` to local `127.0.0.1:50051`, which is the default rpc port. Set `listen.port` to any number within the range of 1024-65535. Please don't use any ports between 0-1024 since you'll most likely hit conflicts with other system services. Also change `rpc port` to `50052` or something to avoid conflicts. **Please forward the UDP port 18888 for FullNode.** -``` - rpc { - port = 50052 - } -``` - - 5. You can now run your SolidityNode using the following command: -``` - java -jar SolidityNode.jar -c config.conf //make sure that your config.conf is downloaded from https://github.com/tronprotocol/TronDeployment -``` - -# Logging and network connection verification - -Logs for both nodes are located in `/deploy/\*/logs/tron.log`. Use `tail -f /logs/tron.log/` to follow along with the block syncing. - -You should see something similar to this in your logs for block synchronization: - -## FullNode - - 12:00:57.658 INFO [pool-7-thread-1] [o.t.c.n.n.NodeImpl](NodeImpl.java:830) Success handle block Num:236610,ID:0000000000039c427569efa27cc2493c1fff243cc1515aa6665c617c45d2e1bf - -## SolidityNode - - 12:00:40.691 INFO [pool-17-thread-1] [o.t.p.SolidityNode](SolidityNode.java:88) sync solidity block, lastSolidityBlockNum:209671, remoteLastSolidityBlockNum:211823 - -# Stop node gracefully -Create file stop.sh,use kill -15 to close java-tron.jar(or FullNode.jar、SolidityNode.jar). -You need to modify pid=`ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'` to find the correct pid. -``` -#!/bin/bash -while true; do - pid=`ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'` - if [ -n "$pid" ]; then - kill -15 $pid - echo "The java-tron process is exiting, it may take some time, forcing the exit may cause damage to the database, please wait patiently..." - sleep 1 - else - echo "java-tron killed successfully!" - break - fi -done -``` diff --git a/TRX/TRX_Migration_Notice_EN.md b/TRX/TRX_Migration_Notice_EN.md deleted file mode 100644 index 0220af6e..00000000 --- a/TRX/TRX_Migration_Notice_EN.md +++ /dev/null @@ -1,19 +0,0 @@ -# TRX Migration Notice -
 -**Dear investors,** - -TRON Mainnet is launching soon. - -Token migration from ERC20 TRX to Mainnet TRX will occur between June 21st – June 25th (GMT+8). - -If your TRX is held on an exchange, no action is required. - -If your TRX is held in a wallet, you must deposit your TRX to an exchange before June 24, 2018 to avoid any losses. - -From June 21st– 25th, TRX withdrawals on exchanges will be suspended. On June 25th, both TRX deposits and withdraws on exchanges will be suspended. Deposits and withdraws will resume on June 26th. During this period, TRX trading will not be affected.
 -If your TRX is held in a wallet and you were not aware of the migration notice, or saw the migration notice after June 25th, please visit our permanent token-exchange counter to exchange your tokens for Mainnet TRX. - -**TRON Foundation -April 28, 2018** - - diff --git a/TRX/Tron-exchange.md b/TRX/Tron-exchange.md deleted file mode 100644 index 6ca2c034..00000000 --- a/TRX/Tron-exchange.md +++ /dev/null @@ -1,47 +0,0 @@ -# TRON Mainnet - Integration Guide - -Connecting to the TRON network is extremely easy and only requires running 1-2 nodes on a machine. Once you've connected to the network, you have multiple ways of interacting with the nodes based on your system's requirements. When you're fully integrated, please reach out to the TRON team so that we can help you verify your setup. - -- [Full TRON Documentation](https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-overview.md) - -# 1. Deploy TRON Nodes - -You'll need to deploy nodes that connect to the network and offer both the ability to read the blockchain state and also to broadcast transactions onto the network. - -TRON's network uses a Full Node to read and broadcast to the network. The Full Node stores the entire blockchain state, including unconfirmed blocks and potential forks. - -Deploying a linked Solidity Node allows you to interact with blocks that are guaranteed confirmed and irreversible. - -Follow this guide to deploy a Full Node and a linked Solidity Node on the same machine. -- [Node Deployment Guide](https://github.com/tronprotocol/Documentation/blob/master/TRX/Solidity_and_Full_Node_Deployment_EN.md) - -# 2. Integrate with the TRON nodes - -The nodes support both a gRPC Service and a HTTP Gateway on the ports specified in the configuration files. You can use either method to communicate with the nodes. -- [Full API documentation](https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-overview.md#4-tron-api) - -### gRPC - -[gRPC](https://grpc.io/) uses Protobuf and the [TRON protocol](https://github.com/tronprotocol/protocol). - -### HTTP Gateway - -The nodes also offer an alternate RESTful HTTP Gateway. -Read the [HTTP Documentation](https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-http.md) for examples. - -## Build your custom integration. - -Take a look at the [Common Patterns](https://github.com/tronprotocol/Documentation/blob/master/TRX/Common-Patterns.md) guide for some basic assistance. - -# 3. Testing - -Once you've fully integrated with the network, please test on both the test network and the main network. - -### Mainnet -- Block Explorer: https://TRONscan.org -- Config: https://github.com/TRONprotocol/TRONDeployment/blob/master/main_net_config.conf - -### Testnet -- Block Explorer: https://test.TRONscan.org -- Config: https://github.com/TRONprotocol/TRONDeployment/blob/master/test_net_config.conf - diff --git a/TRX/Tron-http.md b/TRX/Tron-http.md deleted file mode 100644 index acac3d7c..00000000 --- a/TRX/Tron-http.md +++ /dev/null @@ -1,580 +0,0 @@ -# TRON HTTP Gateway interface - -# Demo of the conversion between base58check and hexString -java: -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92 - -php: -https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php - -Available in the latest release of java-tron. - -Configure the ports for the nodes by modifying these ports in both configuration files. - -``` - - node { - ... - http { - fullNodePort = 8090 - solidityPort = 8091 - } -``` - -# SolidityNode Interface -The default http port on solidityNode is 8091. -``` -/walletsolidity/getaccount -Function:Query information about an account -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}' -Parameters:address should be converted to a hex string -Return value:Account Object - -/walletsolidity/listwitnesses -Function:Query the list of super representatives -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/listwitnesses -Parameters:None -Return value:List of all super representatives - -/walletsolidity/getassetissuelist -Function:Query the list of Tokens -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelist -Parameters:None -Return value:List of all Tokens - -/walletsolidity/getpaginatedassetissuelist -Function:Query the list of Tokens with pagination -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getpaginatedassetissuelist -d '{"offset": 0, "limit":10}' -Parameters:Offset is the index of the starting Token, and limit is the number of Tokens expected to be returned. -Return value:List of Tokens - -/walletsolidity/getassetissuebyname(will not be supported until Odyssey-v3.2) -Function:Query token by name. -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuebyname -d '{"value": "44756354616E"}' -Parameters:The name of the token, converted to a hex string -Return value:token. -Note: From Odyssey-v3.2, it is recommended to use getassetissuebyid or getassetissuelistbyname instead of this api, because it will support the same token name from 3.2, this api will return error msg if there are two or more assets with the same name. - -/walletsolidity/getassetissuelistbyname(will not be supported until Odyssey-v3.2) -Function:Query token list by name. -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelistbyname -d '{"value": "44756354616E"}' -Parameters:The name of the token, converted to a hex string -Return value:List of tokens. - -/walletsolidity/getassetissuebyid(will not be supported until Odyssey-v3.2) -Function:Query token by id. -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuebyid -d '{"value": "1000001"}' -Parameters:The id of the token, it's a string -Return value:token. - -/walletsolidity/getnowblock -Function:Query the latest block -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getnowblock -Parameters:None -Return value:Latest block on solidityNode - -/walletsolidity/getblockbynum -Function:Query block by height -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbynum -d '{"num" : 100}' -Parameters:Num is the height of the block -Return value:specified Block object - -/walletsolidity/gettransactionbyid -Function:Query transaction based on id -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactionbyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' -Parameters:value is the transaction id,converted to a hex string -Return value:specified Transaction object - -/walletsolidity/gettransactioncountbyblocknum(will not be supported until Odyssey-v3.2) -Function:Query transaction's count on a specified block by height -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioncountbyblocknum -d '{"num" : 100}' -Parameters:Num is the height of the block. -Return value:Transaction count. - -/walletsolidity/gettransactioninfobyid -Function:Query transaction fee based on id -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' -Parameters:value is the transaction id,converted to a hex string -Return value:Transaction fee,block height and block creation time - -/walletsolidity/getexchangebyid(will not be supported until Odyssey-v3.2) -Function:Query exchange based on id -demo:curl -X POST http://127.0.0.1:8091/walletsolidity/getexchangebyid -d {"id":1} -Parameters: id is the exchange id, a long -Return value:exchange - -/walletsolidity/listexchanges(will not be supported until Odyssey-v3.2) -Function:Query all exchanges -demo:curl -X POST http://127.0.0.1:8091/walletsolidity/listexchanges -Parameters: None -Return value:List of all exchanges - -/walletextension/gettransactionsfromthis -Function:Query the list of transactions sent by an address -demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionsfromthis -d '{"account" : {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10}' -Parameters:Address is the account address, converted to a hex string; offset is the index of the starting transaction; limit is the number of transactions expected to be returned -Return value:Transactions list - -/walletextension/gettransactionstothis -Function:Query the list of transactions received by an address -demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionstothis -d '{"account" : {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10}' -Parameters:Address is the account address, converted to a hex string; offset is the index of the starting transaction; limit is the number of transactions expected to be returned -Return value:Transactions list - -``` - -# FullNode Interface -The default http port on FullNode is 8090. - -``` - -/wallet/createtransaction -Function:Creates a transaction of transfer. If the recipient address does not exist, a corresponding account will be created on the blockchain. -demo: curl -X POST http://127.0.0.1:8090/wallet/createtransaction -d '{"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount": 1000 }' -Parameters:To_address is the transfer address, converted to a hex string; owner_address is the transfer transfer address, converted to a hex string; amount is the transfer amount -Return value:Transaction contract data - -/wallet/gettransactionsign -Function:Sign the transaction, the api has the risk of leaking the private key, please make sure to call the api in a secure environment -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactionsign -d '{ -"transaction" : {"txID":"454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8","raw_data":{"contract":[{"parameter":{"value":{"amount":1000,"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0","to_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"267e","ref_block_hash":"9a447d222e8de9f2","expiration":1530893064000,"timestamp":1530893006233}},"privateKey": "your private key"} -}' -Parameters:Transaction is a contract created by http api, privateKey is the user private key -Return value:Signed Transaction contract data - -/wallet/broadcasttransaction -Function:Broadcast the signed transaction -demo:curl -X POST http://127.0.0.1:8090/wallet/broadcasttransaction -d '{"signature":["97c825b41c77de2a8bd65b3df55cd4c0df59c307c0187e42321dcc1cc455ddba583dd9502e17cfec5945b34cad0511985a6165999092a6dec84c2bdd97e649fc01"],"txID":"454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8","raw_data":{"contract":[{"parameter":{"value":{"amount":1000,"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0","to_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"267e","ref_block_hash":"9a447d222e8de9f2","expiration":1530893064000,"timestamp":1530893006233}}' -Parameters:Signed Transaction contract data -Return value:broadcast success or failure - -/wallet/updateaccount -Function:Modify account name -demo:curl -X POST http://127.0.0.1:8090/wallet/updateaccount -d '{"account_name": "0x7570646174654e616d6531353330383933343635353139" ,"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"}' -Parameters:account_name is the name of the account, converted into a hex string;owner_address is the account address of the name to be modified, converted to a hex string. -Return value:modified Transaction Object - -/wallet/votewitnessaccount -Function:Vote on the super representative -demo:curl -X POST http://127.0.0.1:8090/wallet/votewitnessaccount -d '{ -"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", -"votes": [{"vote_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "vote_count": 5}] -}' -Parameters:Owner_address is the voter address, converted to a hex string; votes.vote_address is the address of the super delegate being voted, converted to a hex string; vote_count is the number of votes - -/wallet/createassetissue -Function:Issue Token -demo:curl -X POST http://127.0.0.1:8090/wallet/createassetissue -d '{ -"owner_address":"", -"name":"{{assetIssueName}}", -"abbr": "{{abbrName}}", -"total_supply" :4321, -"trx_num":1, -"num":1, -"start_time" :{{startTime}}, -"end_time":{{endTime}}, -"vote_score":2, -"description":"007570646174654e616d6531353330363038383733343633", -"url":"007570646174654e616d6531353330363038383733343633", -"free_asset_net_limit":10000, -"public_free_asset_net_limit":10000, -"frozen_supply":{"frozen_amount":1, "frozen_days":2} -}' - - -/wallet/createaccount -Function:Create an account. Uses an already activated account to create a new account -demo:curl -X POST http://127.0.0.1:8090/wallet/createaccount -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "account_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0"}' -Parameters:Owner_address is an activated account,converted to a hex String; account_address is the address of the new account, converted to a hex string, this address needs to be calculated in advance -Return value:Create account Transaction raw data - -/wallet/createwitness -Function:Apply to become a super representative -demo:curl -X POST http://127.0.0.1:8090/wallet/createwitness -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "url": "007570646174654e616d6531353330363038383733343633"}' -Parameters:owner_address is the account address of the applicant,converted to a hex string;url is the official website address,converted to a hex string -Return value:Super Representative application Transaction raw data - -/wallet/transferasset -Function:Transfer Token -demo:curl -X POST http://127.0.0.1:8090/wallet/transferasset -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "asset_name": "6173736574497373756531353330383934333132313538", "amount": 100}' -Parameters:Owner_address is the address of the withdrawal account, converted to a hex string;To_address is the recipient address,converted to a hex string;asset_name is the Token Name(NOT SYMBOL),converted to a hex string;Amount is the amount of token to transfer -Return value:Token transfer Transaction raw data - -/wallet/easytransfer -Function: Easily transfer from an address using the password string. Only works with accounts created from createAddress -Demo: curl -X POST http://127.0.0.1:8090/wallet/easytransfer -d '{"passPhrase": "7465737470617373776f7264","toAddress": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount":10}' -Parameters: passPhrase is the password, converted from ascii to hex. toAddress is the recipient address, converted into a hex string; amount is the amount of TRX to transfer expressed in SUN. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -/wallet/easytransferbyprivate -Function:Easily transfer from an address using the private key. -demo: curl -X POST http://127.0.0.1:8090/wallet/easytransferbyprivate -d '{"privateKey": "D95611A9AF2A2A45359106222ED1AFED48853D9A44DEFF8DC7913F5CBA727366", "toAddress":"4112E621D5577311998708F4D7B9F71F86DAE138B5","amount":10000}' -Parameters:passPhrase is the private key in hex string format. toAddress is the recipient address, converted into a hex string; amount is the amount of TRX to transfer in SUN. -Return value: transaction, including execution results. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -/wallet/createaddress -Function: Create address from a specified password string (NOT PRIVATE KEY) -Demo: curl -X POST http://127.0.0.1:8090/wallet/createaddress -d '{"value": "7465737470617373776f7264" }' -Parameters: value is the password, converted from ascii to hex -Return value:value is the corresponding address for the password, encoded in hex. Convert it to base58 to use as the address. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -/wallet/generateaddress -Function: Generates a random private key and address pair -demo:curl -X POST -k http://127.0.0.1:8090/wallet/generateaddress -Parameters: no parameters. -Return value:value is the corresponding address for the password, encoded in hex. Convert it to base58 to use as the address. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -/wallet/participateassetissue -Function:Purchase a Token -demo:curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ -"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"amount":100, -"asset_name":"3230313271756265696a696e67" -}' -Parameters: -to_address is the address of the Token issuer,converted to a hex string -owner_address is the address of the Token owner,converted to a hex string -amount is the number of tokens created -asset_name is the name of the token,converted to a hex string -Return value:Token creation Transaction raw data - -/wallet/freezebalance -Function:Freezes an amount of TRX. Will give bandwidth OR Energy and TRON Power(voting rights) to the owner of the frozen tokens. -demo:curl -X POST http://127.0.0.1:8090/wallet/freezebalance -d '{ -"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14294", -"frozen_balance": 10000, -"frozen_duration": 3, -"resource":"ENERGY" -}' -Parameters: -owner_address is the address that is freezing trx account,converted to a hex string -frozen_balance is the number of frozen trx -frozen_duration is the duration in days to be frozen -resource is the type of resource you're freezing for. must be either "ENERGY" or "BANDWIDTH" -Return value:Freeze trx transaction raw data - -/wallet/unfreezebalance -Function:Unfreeze TRX that has passed the minimum freeze duration. Unfreezing will remove bandwidth and TRON Power. -demo:curl -X POST http://127.0.0.1:8090/wallet/unfreezebalance -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -}' -Parameters: -owner_address address to unfreeze TRX for,converted to a hex string -Return value:Unfreeze TRX transaction raw data - -/wallet/unfreezeasset -Function:Unfreeze a token that has passed the minimum freeze duration. -demo:curl -X POST http://127.0.0.1:8090/wallet/unfreezeasset -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -}' -Parameters: -owner_address address to unfreeze Tokens for,converted to a hex string -Return value:Unfreeze Token transaction raw data - -/wallet/withdrawbalance -Function:Withdraw Super Representative rewards, useable every 24 hours. -demo:curl -X POST http://127.0.0.1:8090/wallet/withdrawbalance -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -}' -Parameters: -owner_address is the address to withdraw from,converted to a hex string -Return value:Withdraw TRX transaction raw data - -/wallet/updateasset -Function:Update a Token's information -demo:curl -X POST http://127.0.0.1:8090/wallet/updateasset -d '{"owner_address":"4116440834509C59DE4EE6BA4933678626F451BEFE", "url":"687474", "description":"57732e", "new_limit":1000000, "new_public_limit":1000}' -Parameters: -Owner_address is the address of the token issuer, converted to a hex string -Description is a description of the token, converted to a hex string -Url is the official website address of the token issuer, converted to a hex string -New_limit is the Token Creator's bandwidth avaible for use by holders of the token. -New_public_limit is the free bandwidth that each holder of the token can use for free. This will subtract from the Token Creator's available bandwidth. -Return value: Token update transaction raw data - -/wallet/listnodes -Function:List the nodes which the api fullnode is connecting on the network -demo: curl -X POST http://127.0.0.1:8090/wallet/listnodes -Parameters:None -Return value:List of nodes - -/wallet/getassetissuebyaccount -Function:List the tokens issued by an account. -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyaccount -d '{"address": "41F9395ED64A6E1D4ED37CD17C75A1D247223CAF2D"}' -Parameters:Token issuer account address,converted to a hex string -Return value:The token issued by the account. An account can issue only one token. - -/wallet/getaccountnet -Function:Query bandwidth information. -demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountnet -d '{"address": "4112E621D5577311998708F4D7B9F71F86DAE138B5"}' -Parameters:Account address,converted to a hex string -Return value:Bandwidth information for the account. If a field doesn't appear, then the corresponding value is 0. {"freeNetUsed": 557,"freeNetLimit": 5000,"NetUsed": 353,"NetLimit": 5239157853,"TotalNetLimit": 43200000000,"TotalNetWeight": 41228} - -/wallet/getassetissuebyname -Function:Query token by name. -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyname -d '{"value": "44756354616E"}' -Parameters:The name of the token, converted to a hex string -Return value:token. -Note: From Odyssey-v3.2, it is recommended to use getassetissuebyid or getassetissuelistbyname instead of this api, because it will support the same token name from 3.2, this api will return error msg if there are two or more assets with the same name. - -/wallet/getassetissuelistbyname(will not be supported until Odyssey-v3.2) -Function:Query token list by name. -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuelistbyname -d '{"value": "44756354616E"}' -Parameters:The name of the token, converted to a hex string -Return value:List of tokens. - -/wallet/getassetissuebyid(will not be supported until Odyssey-v3.2) -Function:Query token by id. -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyid -d '{"value": "1000001"}' -Parameters:The id of the token, it's a string -Return value:token. - -/wallet/getnowblock -Function:Query the latest block -demo: curl -X POST http://127.0.0.1:8090/wallet/getnowblock -Parameters:None -Return value:Latest block on full node - -/wallet/getblockbynum -Function:Query block by height -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbynum -d '{"num" : 100}' -Parameters:Num is the height of the block -Return value:specified Block object - -/wallet/getblockbyid -Function:Query block by ID -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbyid -d '{"value": "0000000000038809c59ee8409a3b6c051e369ef1096603c7ee723c16e2376c73"}' -Parameters:Block ID. -Return value:Block Object - -/wallet/getblockbylimitnext -Function:Query a range of blocks by block height -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbylimitnext -d '{"startNum": 1, "endNum": 2}' -Parameters: - startNum:Starting block height, including this block - endNum:Ending block height, excluding that block -Return value:A list of Block Objects - -/wallet/getblockbylatestnum -Function:Query the latest blocks -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbylatestnum -d '{"num": 5}' -Parameters:The number of blocks to query -Return value:A list of Block Objects - -/wallet/gettransactionbyid -Function:Query transaction by ID -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactionbyid -d '{"value": "d5ec749ecc2a615399d8a6c864ea4c74ff9f523c2be0e341ac9be5d47d7c2d62"}' -Parameters:Transaction ID. -Return value:Transaction information. - -/wallet/gettransactioncountbyblocknum(will not be supported until Odyssey-v3.2) -Function:Query transaction's count on a specified block by height -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioncountbyblocknum -d '{"num" : 100}' -Parameters:Num is the height of the block. -Return value:Transaction count. - -wallet/listwitnesses -Function:Query the list of Super Representatives -demo: curl -X POST http://127.0.0.1:8090/wallet/listwitnesses -Parameters:None -Return value:List of all Super Representatives - -/wallet/getassetissuelist -Function:Query the list of Tokens -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuelist -Parameters:None -Return value:List of all Tokens - -/wallet/getpaginatedassetissuelist -Function:Query the list of Tokens with pagination -demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedassetissuelist -d '{"offset": 0, "limit": 10}' -Parameters:Offset is the index of the starting Token, and limit is the number of Tokens expected to be returned. -Return value:List of Tokens - -/wallet/totaltransaction -Function:Count all transactions on the network -demo: curl -X POST http://127.0.0.1:8090/wallet/totaltransaction -Parameters:None -Return value:Total number of transactions. - -/wallet/getnextmaintenancetime -Function:Get the time of the next Super Representative vote -demo: curl -X POST http://127.0.0.1:8090/wallet/getnextmaintenancetime -Parameters:None -Return value: number of milliseconds until the next voting time. - -/wallet/validateaddress -Function:validate address -demo: curl -X POST http://127.0.0.1:8090/wallet/validateaddress -d '{"address": "4189139CB1387AF85E3D24E212A008AC974967E561"}' -Parameters:The address, should be in base58checksum, hexString or base64 format. -Return value: True or false - -wallet/deploycontract -Function:deploys a contract -demo: curl -X POST http://127.0.0.1:8090/wallet/deploycontract -d '{"abi":"[{\"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\"}]","bandwidth_limit":1000000,"bytecode":"608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029","call_value":100,"contract_name":"SomeContract","fee_limit":1000000,"origin_energy_limit":10,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' -Parameters: - abi:abi - bytecode:bytecode - consume_user_resource_percent:The percentage of resources specified for users who use this contract, is an integer between [0, 100]. If it is 0, it means the user does not consume resources until the developer resources are exhausted. - bandwidth_limit:Maximum bandwidth consumption, measured in bytes - fee_limit:Maximum TRX consumption, measured in SUN(1TRX = 1,000,000SUN) - call_value:Amount of TRX transferred with this transaction, measured in SUN(1TRX = 1,000,000SUN) - owner_address:contract owner address, converted to a hex string - name: The name of contract - origin_energy_limit: The max energy which will be consumed by the owner in the process of excution or creation of the contract, is an integer which should be greater than 0. -Return Value:TransactionExtention, TransactionExtention contains unsigned Transaction - -wallet/triggersmartcontract -Function:Calls a function on a contract -demo: curl -X POST http://127.0.0.1:8090/wallet/triggersmartcontract -d '{"contract_address":"4189139CB1387AF85E3D24E212A008AC974967E561","function_selector":"set(uint256,uint256)","parameter":"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","fee_limit":1000000,"call_value":100,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' -Parameters: - contract_address: contract address, converted to a hex string - function_selector: Function signature, no spaces - parameter:Call the virtual machine format of the parameter [1, 2], use the js tool provided by remix, convert the parameter array [1, 2] called by the contract caller into the parameter format required by the virtual machine. - fee_limit:Maximum TRX consumption, measured in SUN(1TRX = 1,000,000SUN) - call_value:Amount of TRX transferred with this transaction, measured in SUN(1TRX = 1,000,000SUN) - owner_address:address that is trigger the contract, converted to a hex string -Return Value:TransactionExtention, TransactionExtention contains unsigned Transaction - - - -wallet/proposalcreate -作用:创建提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/proposalcreate -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9","parameters":[{"key": 0,"value": 100000},{"key": 1,"value": 2}] } -参数说明: -owner_address:创建人地址 -parameters:提案参数 -返回值:创建提案的交易 - -wallet/getproposalbyid -作用:根据id查询提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/getproposalbyid -d {"id":1} -参数说明: -id:提案id -返回值:提案详细信息 - -wallet/listproposals -作用:查询所有提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/listproposals -参数说明:无 -返回值:提案列表信息 - -wallet/listproposalspaginated(Odyssey-v3.1.1暂不支持) -作用:分页查询提案列表 -demo: curl -X POST http://127.0.0.1:8091/wallet/listproposalspaginated -d '{"offset": 0, "limit":10}' -参数说明:offset是起始提案的index,limit是期望返回的提案数量 -返回值:提案列表 - -wallet/proposalapprove -作用:提案批准 -demo: curl -X POST http://127.0.0.1:8090/wallet/proposalapprove -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9", "proposal_id":1, "is_add_approval":true} -参数说明: -owner_address:批准人地址 -proposal_id:提案id -is_add_approval:是否批准 -返回值:批准提案的交易 - -wallet/proposaldelete -作用:删除提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/proposaldelete -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9", "proposal_id":1} -参数说明: -owner_address:删除人的地址,只有提案所有人允许删除提案 -proposal_id:提案id -返回值:删除提案的交易 - -wallet/getaccountresource -作用:查询账户的资源信息 -demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountresource -d {"address" : "419844f7600e018fd0d710e2145351d607b3316ce9"} -参数说明: -address:查询账户的地址 -返回值:账户的资源信息 - -wallet/exchangecreate -作用:创建交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangecreate -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", 、 -"first_token_id":token_a, "first_token_balance":100, "second_token_id":token_b,"second_token_balance":200} -参数说明: -first_token_id :第1种token的id -first_token_balance:第1种token的balance -second_token_id : 第2种token的id -second_token_balance:第2种token的balance -返回值:创建交易对的transaction。 - -wallet/exchangeinject -作用:给交易对注资,注资后可以防止交易对价格波动太大 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangeinject -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100} -参数说明: -owner_address:交易对创建者的地址,hexString格式 -exchange_id:交易对id -token_id: token的id,一般情况是token的name,需要是hexString格式 -quant:注资token的数量 -返回值:注资的transaction。 - -wallet/exchangewithdraw -作用:对交易对撤资,撤资后容易引起交易对价格波动太大。 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangewithdraw -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100} -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -exchange_id:交易对id -token_id: token的id,一般情况是token的name,需要是hexString格式 -quant:撤资token的数量 -返回值:撤资的transaction - -wallet/exchangetransaction -作用:参与交易对交易。 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangetransaction -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100,"expected":10} -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -exchange_id:交易对id -token_id: 卖出的token的id,一般情况是token的name,需要是hexString格式 -quant:卖出token的数量 -expected:期望买入token的数量 -返回值:token交易的transaction - -wallet/getexchangebyid -作用:根据id查询交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/getexchangebyid -d {"id":1} -参数说明: -id:交易对id -返回值:交易对 - -wallet/listexchanges -作用:查询所有交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/listexchanges -参数说明: -返回值:所有交易对 - -wallet/getchainparameters -作用:查询所有交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/getchainparameters -参数说明: -返回值:区块链委员会可以设置的所有参数 - -wallet/listexchangespaginated(Odyssey-v3.1.1暂不支持) -作用:分页查询交易对列表 -demo: curl -X POST http://127.0.0.1:8090/wallet/listexchangespaginated -d '{"offset": 0, "limit":10}' -参数说明:offset是起始交易对的index,limit是期望返回的交易对数量 -返回值:提案列表 - -wallet/updatesetting -作用:更新合约的consume_user_resource_percent -demo: curl -X POST http://127.0.0.1:8090/wallet/updatesetting -d '{"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9", "contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f", "consume_user_resource_percent": 7}' -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -contract_address:要修改的合约的地址 -consume_user_resource_percent:指定的使用该合约用户的资源占比 -返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction - -wallet/updateenergylimit -作用:更新合约的origin_energy_limit -demo: curl -X POST http://127.0.0.1:8090/wallet/updatesetting -d '{"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9", "contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f", "origin_energy_limit": 7}' -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -contract_address:要修改的合约的地址 -origin_energy_limit:创建者设置的,在一次合约执行或创建过程中创建者自己消耗的最大的energy -返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction - -``` diff --git a/TRX/Tron-overview.md b/TRX/Tron-overview.md deleted file mode 100644 index e9466cb9..00000000 --- a/TRX/Tron-overview.md +++ /dev/null @@ -1,281 +0,0 @@ -# Full Overview of TRON - -## 1.1 Project repositories -### https://github.com/tronprotocol -- [Java-TRON](https://github.com/tronprotocol/java-tron) - main repository for TRON nodes -- [Documentation](https://github.com/tronprotocol/Documentation) - all documentation -- [TronDeployment](https://github.com/tronprotocol/TronDeployment) - deployment scripts and config files for java-tron - -## 1.2 Block explorer -- https://tronscan.org - Created by [Rovak](https://github.com/Rovak) - -## 1.3 TRON consensus algorithm -TRON adopts TPoS, an improved DPoS algorithm. - -## 1.4 Block Producing Speed of TRON -The network currently produces 1 block per 3 seconds. - -## 1.5 Transaction model -The adopted transaction model is the account model instead of the UTXO model. The smallest unit of TRX is sun, 1 TRX=1,000,000 sun. Currently, only one-to-one transaction services are available, meaning that one-to-many or many-to-one transactions are not supported. - -## 1.6 Account model -One account has only one corresponding address, which is needed for transfers. The multi-signature mechanism is not yet implemented on the current version of network. There are three ways to create an account on the main blockchain. -``` -a. Create account with an existing account. -b. Send TRX to a new address to create account. -c. Send tokens to a new address to create account. -``` - -# 2. TRON’s network structure - -## 2.1 Node types -There are three types of nodes on TRON’s network: Witnesses(Super Representatives), Full Nodes and Solidity Nodes. A witness is responsible for block production; a full node provides APIs, and broadcasts transactions and blocks; a solidity node synchronizes irrevocable blocks and provides inquiry APIs. - -## 2.2 Mainnet and testnet - -### Mainnet -- Block Explorer: https://tronscan.org -- Config: https://github.com/tronprotocol/TronDeployment/blob/master/main_net_config.conf - -### Testnet -- Block Explorer: https://test.tronscan.org -- Config: https://github.com/tronprotocol/TronDeployment/blob/master/test_net_config.conf - -# 3. Operation of node - -## 3.1 Recommended hardware specifications -``` -Minimum specifications for full node deployment -CPU:16-core -RAM:16G -Bandwidth:100M -DISK:10T -Recommended specifications for full node deployment -CPU:64-core or more -RAM:64G or more -Bandwidth:500M and more -DISK:20T or more - -Minimum specifications for solidity node deployment -CPU:16-core -RAM:16G -Bandwidth:100M -DISK:10T -Recommended specifications for solidity node deployment -CPU:64-core or more -RAM:64G or more -Bandwidth:500M and more -DISK:20T or more - -DISK capacity depends on the actual transaction volume after deployment, but it’s always better to leave some excess capacity. -``` - -## 3.2 Start the full node and solidity node -Please follow the guide here to configure and deploy both nodes: -- https://github.com/tronprotocol/Documentation/blob/master/TRX/Solidity_and_Full_Node_Deployment_EN.md - -We also provide a script to deploy fullnode and soliditynode: -- https://github.com/tronprotocol/TronDeployment/blob/master/README.md - -# 4. TRON API -The TRON Nodes support both a gRPC Service and a HTTP Gateway - -## 4.1 API Definition -Please see the protobuf protocol for the raw API. -- [Protobuf API](https://github.com/tronprotocol/protocol/blob/master/api/api.proto) -- [Protobuf Structures](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Protobuf_Protocol_document.md) - -## 4.2 Explanation of APIs -### 4.2.1 gRPC interface -The Full Node and Solidity Nodes each run a gRPC service that you can connect to. - -- [gRPC Tutorial](https://grpc.io/docs/) -- [gRPC API](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md) - -Please refer to the following two classes for a gRPC example in Java. -``` -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/walletserver/WalletApi.java - -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/walletserver/GrpcClient.java -``` - -### 4.2.2 HTTP Interface -The FullNode and SolidityNode both have an HTTP Service running on them. All parameters are encoded as `HEX` and returned as Hex or `base58check`. If you're trying to pass an address in, please decode from `base58check` and convert it to `HEX`. - -- [HTTP Service API](https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-http.md) - -- [Address DEBUG Tool](https://github.com/tronprotocol/tron-demo/raw/master/TronConvertTool.zip) - -# 5. Transaction Fees -Having too many transactions will clog our network like Ethereum and may incur delays on transaction confirmation. To keep the network operating smoothly, TRON network grants every account a free pool of `Bandwidth points` for free transactions every 24 hours. To engage in transactions more frequently requires freezing TRX for additional bandwidth points, or paying the fee in TRX. - -See also: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/Mechanism_Introduction.md - -## 5.1 Definition of Bandwidth Points -Transactions are transmitted and stored in the network in byte arrays. Bandwidth points consumed in a transaction equals the size of its byte array. -If the length of a byte array is 200 then the transaction consumes 200 bandwidth points. - -## 5.2 Freeze/unfreeze mechanism -TRX can be frozen for a minimum of 3 days to gain both `TRON Power (TP)` for voting and `Bandwidth points` for covering network fees. `TRON Power` is gained at a 1:1 ratio with the amount of frozen TRX. - -The amount of bandwidth points granted follows a formula: -``` -Your Frozen TRX ----------------- * 54Gb of network bandwidth points available = Your available share of bandwidth points -Total Frozen TRX -``` - -## 5.3 Bandwidth points consumption rules -When there is available `Bandwidth points`, no TRX is charged. If a transaction fee is charged, it will be recorded in the fee field in the transaction results. If no transaction fee is charged, meaning that corresponding bandwidth points have been deducted, the fee field will read “0”. There will only be a service charge after a transaction has been written into the blockchain. For more information on the fee field, please see also `Transaction.Result.fee`, with the corresponding proto file at https://github.com/tronprotocol/protocol/blob/master/core/Tron.proto. - -# 6. User address generation -## 6.1 Algorithm description -1. First generate a key pair and extract the public key (a 64-byte byte array representing its x,y coordinates). -2. Hash the public key using sha3-256 function and extract the last 20 bytes of the result. -3. Add `41` to the beginning of the byte array. Length of the initial address should be 21 bytes. -4. Hash the address twice using sha256 function and take the first 4 bytes as verification code. -5. Add the verification code to the end of the initial address and get an address in base58check format through base58 encoding. -6. An encoded mainnet address begins with T and is 34 bytes in length. -``` -Please note that the sha3 protocol we adopt is KECCAK-256. -``` - -## 6.2 Mainnet addresses begin with 41 -``` - address = 41||sha3[12,32): 415a523b449890854c8fc460ab602df9f31fe4293f - sha256_0 = sha256(address): 06672d677b33045c16d53dbfb1abda1902125cb3a7519dc2a6c202e3d38d3322 - sha256_1 = sha256(sha256_0): 9b07d5619882ac91dbe59910499b6948eb3019fafc4f5d05d9ed589bb932a1b4 - checkSum = sha256_1[0, 4): 9b07d561 - addchecksum = address || checkSum: 415a523b449890854c8fc460ab602df9f31fe4293f9b07d561 - base58Address = Base58(addchecksum): TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW -``` - -## 6.3 Java code demo -See: https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/ECKeyDemo.java - -# 7. Transaction signing -See: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/Procedures_of_transaction_signature_generation.md - -# 8. Calculation of transaction ID -Hash the Raw data of the transaction. -in java -``` -Hash.sha256(transaction.getRawData().toByteArray()) -``` -in php by William -``` -try { - $request = new \Protocol\NumberMessage(); - $request->setNum(319139); - list($reply, $status) = $fullnode->GetBlockByNum($request)->wait(); - $i=0; - foreach($reply->getTransactions() as $trans){ - echo $i++; - echo ": "; - echo hash("sha256", $trans->getRawData()->serializeToString()); - echo "\n"; - } - } catch (Exception $e) { - echo 'Caught exception: ', $e->getMessage(), "\n"; - } -``` - -# 9. Calculation of block ID -Block ID is a combination of block height and the hash of the blockheader’s raw data. To get block ID, first hash the raw data of the blockheader and replace the first 8 bytes of the hash with the blockheight, as the following: -``` -private byte[] generateBlockId(long blockNum, byte[] blockHash) { - byte[] numBytes = Longs.toByteArray(blockNum); - byte[] hash = blockHash; - System.arraycopy(numBytes, 0, hash, 0, 8); - return hash; -} -``` -BlockHash is the hash of the raw data of the blockheader, which can be calculated as the following: -``` -Sha256Hash.of(this.block.getBlockHeader().getRawData().toByteArray()) -``` -# 10. Construction and signature of transaction -Based on your own needs there are two methods to construct a transaction. You can either invoke the gRPC / HTTP API through a full node to build the transaction externally, or create the transaction locally. - -## 10.1 Invoke APIs on the full node -You can construct transactions with corresponding APIs. - -- gRPC API: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md -- HTTP API: https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-http.md - -Individual Contract protocol file is available here: https://github.com/tronprotocol/protocol/blob/master/core/Contract.proto - -## 10.2 Local construction -Based on your method of constructing a transaction you are required to populate all fields of a transaction to construct it locally. Please note that you will need to configure the details of reference block and expiration, so you will need to connect to the mainnet during transaction construction. We advise that you set the latest block on the full node as your reference block and production time of the latest block+N minutes as your expiration time. N could be any number you find fit. The backstage condition is `Expiration > production time of the latest block and Expiration < production time of the latest block + 24 hours`. If the condition is fulfilled, then the transaction is legitimate, and if not, the transaction is expired and will not be acknowledged by the network. -A method of setting reference block: set RefBlockHash as subarray of newest block's hash from 8 to 16, set BlockBytes as subarray of newest block's height from 6 to 8. [The demo code](https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java) is as follows: -``` - public static Transaction setReference(Transaction transaction, Block newestBlock) { - long blockHeight = newestBlock.getBlockHeader().getRawData().getNumber(); - byte[] blockHash = getBlockHash(newestBlock).getBytes(); - byte[] refBlockNum = ByteArray.fromLong(blockHeight); - Transaction.raw rawData = transaction.getRawData().toBuilder() - .setRefBlockHash(ByteString.copyFrom(ByteArray.subArray(blockHash, 8, 16))) - .setRefBlockBytes(ByteString.copyFrom(ByteArray.subArray(refBlockNum, 6, 8))) - .build(); - return transaction.toBuilder().setRawData(rawData).build(); - } -``` -Look at a method of setting Expiration and transaction timestamp: -``` - public static Transaction createTransaction(byte[] from, byte[] to, long amount) { - Transaction.Builder transactionBuilder = Transaction.newBuilder(); - Block newestBlock = WalletClient.getBlock(-1); - - Transaction.Contract.Builder contractBuilder = Transaction.Contract.newBuilder(); - Contract.TransferContract.Builder transferContractBuilder = Contract.TransferContract - .newBuilder(); - transferContractBuilder.setAmount(amount); - ByteString bsTo = ByteString.copyFrom(to); - ByteString bsOwner = ByteString.copyFrom(from); - transferContractBuilder.setToAddress(bsTo); - transferContractBuilder.setOwnerAddress(bsOwner); - try { - Any any = Any.pack(transferContractBuilder.build()); - contractBuilder.setParameter(any); - } catch (Exception e) { - return null; - } - contractBuilder.setType(Transaction.Contract.ContractType.TransferContract); - transactionBuilder.getRawDataBuilder().addContract(contractBuilder) - .setTimestamp(System.currentTimeMillis())//timestamp should be in millisecond format - .setExpiration(newestBlock.getBlockHeader().getRawData().getTimestamp() + 10 * 60 * 60 * 1000);//exchange can set Expiration by needs - Transaction transaction = transactionBuilder.build(); - Transaction refTransaction = setReference(transaction, newestBlock); - return refTransaction; - } -``` -## 10.3 Signature -After a transaction is constructed, it can be signed using the ECDSA algorithm. For security reasons, we suggest all exchanges to adopt offline signatures. - -https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/Procedures_of_transaction_signature_generation.md - - -## 10.4 Demo -The demo for local transaction construction and signing can be found at: -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java. - -# 11. demo -For our nodejs demo, please refer https://github.com/tronprotocol/tron-demo/tree/master/demo/nodejs - -# 12. ERC20 TRX to Mainnet TRX Swap -TRON will always support swapping ERC20 TRX to TRON Mainnet TRX. - -- For users: Please deposit your ERC20 in an exchange that supports the swap. -- For Exhanges: Please contact TRON to swap your ERC20 TRX to Mainnet TRX - -# 13. Super Representatives and Voting -The Super Representatives(SR) take important roles to build and operate on TRON network such as block generation and transaction packing. They receive some TRX as rewards. Every 3 seconds a new block is generated. The top 27 SRs receive 32 TRX per block in sequence, and the top 127 SRs share 32 TRX proportional to the amount of votes they hold. This means that the top 27 SRs will be rewarded over 32 TRX per block. - -All TRX holders can vote for SRs as long as they have Tron Power available. Tron Power can be gained by freezing TRX. To vote for SR candidates you can use your favorite wallet or [TronScan, the official Web wallet](https://tronscan.org). - -See also: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Blockchain_Explorer/Guide_to_voting_on_the_new_blockchain_explorer.md - - -# 14. Relevant files -See also: https://github.com/tronprotocol/Documentation#documentation-guide - diff --git a/TRX/grpc-gateway-http.md b/TRX/grpc-gateway-http.md deleted file mode 100644 index c5ab05d4..00000000 --- a/TRX/grpc-gateway-http.md +++ /dev/null @@ -1,258 +0,0 @@ -# TRON GRPC-Gateway-HTTP - -You will need to deploy a [grpc-gateway](https://github.com/tronprotocol/grpc-gateway/blob/master/README.md) - -The grpc-gateway will encode the bytes fields defined in proto into base64 format. For input parameters in bytes format, you should encode in into base64 format, and for output parameters in bytes format, you should decode it into base64 format for subsequent processing. We provide a encoding/decoding tool which you can download from https://github.com/tronprotocol/tron-demo/raw/master/TronConvertTool.zip. - -```shell -wallet/getaccount -Function: returns account info -Parameters: convert to_address and owner_address to base64 format -Demo: curl -X POST http://127.0.0.1:18890/wallet/getaccount -d '{"address": "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}' - -Wallet/createtransaction -Function: create the transaction of a transfer. If the recipient address does not exist, then a corresponding account will be created on the blockchain. -Parameters: convert to_address and owner_address to base64 format -Demo: -curl -X POST http://127.0.0.1:18890/wallet/createtransaction -d '{"to_address": "QYgZmb8EtAG27PTQy5E3TXNTYCcy" ,"owner_address":"QfoWCvbA5qqphqTcvTU0D1+xZMHu", "amount": 1000 }' - -Wallet/broadcasttransaction -Function: transaction broadcasting. Transaction needs to be signed before broadcasting. -Parameter: use the signed transaction as the input parameter. -Demo: -curl -X POST http://127.0.0.1:18890/wallet/broadcasttransaction -d '{ - "raw_data": { - "ref_block_bytes": "dyA=", - "ref_block_hash": "X70qJj+97nQ=", - "expiration": "1529305956000", - "contract": [ - { - "type": "TransferContract", - "parameter": { - "@type": "type.googleapis.com/protocol.TransferContract", - "owner_address": "QVHyqChqzKYaik1etWXHerLDoP69", - "to_address": "Qc0ipGHFhxlCL42QGmC+ems/HYip", - "amount": "987000000" - } - } - ] - }, - "signature": [ - "V+C1KAq2arK7hf7VG9+4CBq96BRYRm3r5ep7TL0P8d1PE4lRfAUvAbfRRCiGmiriKUaOivcno2XN0/udPVj47AE=" - ] - }' - -Wallet/updateaccount -Function: updates account name. Only one update is allowed for each account. -Parameters: owner_address and account_name should be in base64 format; `ewbmV3X25hbWU=` is `new_name` in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/createtransaction -d '{"account_name": "newbmV3X25hbWU=" ,"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy"}' - -Wallet/votewitnessaccount -Function: users can vote for witnesses. -Parameters: owner_address, voter’s address, should be in base64 format; votes, the votes list, should be a byte array; vote_address, address of the witness, should be in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/votewitnessaccount -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "votes": [{"vote_address": "QfSI1WI/szR9S3ZL5f7Mewb18Rd7", "vote_count": 11}]}' - -Wallet/createassetissue -Function: creates token; on Tron’s public blockchain, users can issue tokens which can be transferred reciprocally or participate in token offerings with their TRX. During token creation, an issuer can chose to freeze a certain amount of tokens. -Parameters: owner_address, issuer’s address, should be in base64 format; name, token name, should be in base64 format. -Demo: to issue a token named MyToken -curl -X POST http://127.0.0.1:18890/wallet/createassetissue -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "votes": [{"vote_address": "QfSI1WI/szR9S3ZL5f7Mewb18Rd7", "vote_count": 11}]}' - -Wallet/updatewitness -Function: edit the url of the witness’ official website -Parameters: owner_address, creator’s address, should be in base64 format; update_url, updated url, should be in base64 format -Demo: curl -X POST http://127.0.0.1:18890/wallet/updatewitness -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "update_url": "d3d3Lm5ld3VybC5jb20="}' - -Wallet/createaccount -Function: creates account. An existent account can call the api to create a new account at a ready address. -Parameters: owner_address, account creator’s address, should be in base64 format; account_address, the new address, should be in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/createaccount -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "account_address": ""}' - - -Wallet/createwitness -Function: users can apply to become a Super Representative, which costs 9999 TRX. -Parameters: owner_address, address of the applicant, should be in base64 format; url, url of the applicant’s website, should be in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/createwitness -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "url": "d3d3Lm5ld3VybC5jb20="}' - -Wallet/transferasset -Function: token transfer. -Parameters: asset_name, name of the token, should be in base64 format; owner_address, address of the sender’s account, should be in base64 format; to_address, recipient’s address, should be in base64 format; amount, the amount of tokens, should include only numbers. -Demo: curl -X POST http://127.0.0.1:18890/wallet/transferasset -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "to_address": "d3d3Lm5ld3VybC5jb20=", "asset_name": "TXlBc3NldA==", "amount": 1000}' - -Wallet/participateassetissue -Function: to participate in token offerings, users can exchange for issued tokens with TRX. -Parameters: owner_address, issuer’s address, should be in base64 format; to_address, recipient’s address, should be in base64 format; asset_name, name of the token, should be in base64 format; amount, the amount of tokens, should include only numbers. -Demo: curl -X POST http://127.0.0.1:18890/wallet/participateassetissue -d '{"to_address": "QYgZmb8EtAG27PTQy5E3TXNTYCcy" ,"owner_address":"QfoWCvbA5qqphqTcvTU0D1+xZMHu", "amount":1000, "asset_name":"TXlBc3NldA=="}' - -Wallet/freezebalance -Function: Freezes TRX for the account -Parameters: owner_address should be in base64 format; frozen_balance is the amount of frozen TRX in sun; frozen_duration is the frozen period. -Demo: curl -X POST http://127.0.0.1:18890/wallet/freezebalance -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69", "frozen_balance" : 100000, "frozen_duration" : 3}' - -Wallet/unfreezeasset -Function: Unfreezes TRX for the account -Parameters: owner_address should be in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/unfreezeasset -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69"}' - -Wallet/withdrawbalance -Function: Withdraws rewards for an SR -Parameters: owner_address should be converted to base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/withdrawbalance -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69"}' - -Wallet/updateasset -Function: Updates a token asset -Parameters: owner_address should be in base64 format; description should be in base64 format and the original description is ‘just test’; url should be in base64 format and the original website is www.baidu.com. -Demo: curl -X POST http://127.0.0.1:18890/wallet/updateasset -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69", "description" : "anVzdCB0ZXN0", "url" : "d3d3LnRlc3R1cmwuY29t", "new_limit" : 1000, "new_public_limit" : 1000}' - -Wallet/listnodes -Function: Lists all connected nodes -Parameters: none. -Demo: curl -X POST http://127.0.0.1:18890/wallet/listnodes - -Wallet/getassetissuebyaccount -Function: Lists issued tokens by account: -Parameters: address should be converted to base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getassetissuebyaccount -d {"address" : "QVHyqChqzKYaik1etWXHerLDoP69"} - -Wallet/getaccountnet -Function: Query bandwidth for an account -Parameters: address should be converted to base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getaccountnet -d {"address" : "QVHyqChqzKYaik1etWXHerLDoP69"} - -Wallet/getassetissuebyname -Function: Query tokens by name -Parameters: value is the token name and the original text reads TWX. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getassetissuebyname -d {"value" : "VFdY"} - -Inquire the latest block: wallet/getnowblock -Function: Query the network for the latest block -Parameters: none. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getnowblock - -Wallet/getblockbynum -Function: Query a block by height -Parameters: num is the blockheight. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getblockbynum -d {"num" : 1} - -Wallet/getblockbyid -Function: Query block by ID -Parameters: value shows the block ID 0000000000079080a30e7326c924457cde710b001ecf1a0b66b67df497c60c39 in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getblockbyid -d {"value" : "AAAAAAAHkICjDnMmySRFfN5xCwAezxoLZrZ99JfGDDk="} - -Wallet/getblockbylimitnext -Function: Query block by a range of blockheight -Parameters: startNum is the starting blockheight and the endNum is the end blockheight. The return with include the startNum block and the endNum block. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getblockbylimitnext -d '{"startNum" : 10, "endNum" : 10}' - -Wallet/getblockbylatestnum -Function: Query topN blocks by height -Parameter: num is the latest number of blocks. -Demo: curl -X POST http://127.0.0.1:18890/wallet/getblockbylatestnum -d '{"num" : 10}' - -Wallet/gettransactionbyid -Function: Query transactions by transaction ID -Parameters: value is the transaction ID, which can be obtained through hashing the raw_data of the transaction; value should be in base64 format. -Demo: curl -X POST http://127.0.0.1:18890/wallet/gettransactionbyid -d '{"value" : "JTqX9taV7RNDyZbwGsN4BsMthBqoBaqnROvCQtHYOyg="}' - -Inquire list of all Super Representatives: /wallet/listwitnesses -Demo: curl -X POST http://127.0.0.1:18890/wallet/listwitnesses -Parameters: - -Inquire list of all issued tokens: /wallet/getassetissuelist -Demo: curl -X POST http://127.0.0.1:18890/wallet/getassetissuelist -Parameters: - -Paginated inquiry of list of issued tokens: /wallet/getpaginatedassetissuelist -Demo: curl -X POST http://127.0.0.1:18890/wallet/getpaginatedassetissuelist -d '{"offset" : 0, "limit" : 10}' -Parameters: offset is the ID of the first token on each page, while limit is the maximum amount of returned tokens on each page. - -Inquire total amount of transactions: /wallet/totaltransaction -Demo: curl -X POST http://127.0.0.1:18890/wallet/totaltransaction -Parameters: - -Inquire the next maintenance time of a Super Representative: /wallet/getnextmaintenancetime -Demo: curl -X POST http://127.0.0.1:18890/wallet/getnextmaintenancetime -Parameters: - -Signing: /wallet/gettransactionsign -Demo: curl -X POST http://127.0.0.1:18890/wallet/gettransactionsign -d '{ - "transaction" : { - "raw_data": { - "ref_block_bytes": "gfA=", - "ref_block_hash": "5YSAo+xJYGU=", - "expiration": "1529325009000", - "contract": [ - { - "type": "TransferContract", - "parameter": { - "@type": "type.googleapis.com/protocol.TransferContract", - "owner_address": "QVHyqChqzKYaik1etWXHerLDoP69", - "to_address": "Qc0ipGHFhxlCL42QGmC+ems/HYip", - "amount": "987000000" - } - } - ] - } - }, - "privateKey" : "j5vLuYaQ4w8yolHZWY+CGY1i+p7CYXovSUgzvyYPOPk=" - }' -Parameters: transaction refers to a specific transaction and privateKey is the user’s private key in base64 format. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -Inquire account info: /walletsolidity/getaccount -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/getaccount -d '{"address" : "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}' -Parameters: address should be in base64 format. - -Inquire list of all Super Representatives: /walletsolidity/listwitnesses -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/listwitnesses -Parameters: - -Inquire list of all tokens: /walletsolidity/getassetissuelist -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/getassetissuelist -Parameters: - -Paginated inquiry of list of all tokens: /walletsolidity/getpaginatedassetissuelist -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/getpaginatedassetissuelist -d '{"offset" : 0, "limit" : 10}' -Parameters: offset is the ID of the first token on each page, while limit is the maximum amount of tokens returned on each page. - -Inquire current block: /walletsolidity/getnowblock -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/getnowblock -Parameters: - -Inquire block by height: /walletsolidity/getblockbynum -Demo: curl -X POST http://127.0.0.1:18890/walletextension/gettransactionsfromthis -d '{"num" : 10000}' -Parameters: num is blockheight. - -Inquire transactions taken by an account: /walletextension/gettransactionsfromthis -Demo: curl -X POST http://127.0.0.1:18890/walletextension/gettransactionsfromthis -d '{"account" : {"address" : "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}, "offset" : 0, "limit" : 5}' -Parameters: address is in base64 format; offset is the starting index; limit is the maximum amount of transactions to be returned. - -Inquire transactions initiated by an account: /walletextension/gettransactionstothis -Demo: curl -X POST http://127.0.0.1:18890/walletextension/gettransactionstothis -d '{"account" : {"address" : "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}, "offset" : 0, "limit" : 5}' -Parameters: address is in base64 format; offset is the starting index; limit is the maximum amount of transactions to be returned. - -Inquire transaction fee and it block location by transaction hash: /walletsolidity/gettransactioninfobyid -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/gettransactioninfobyid -d '{"value" : "4ebiUlBCZ5vI1JtBMFXjiH/HSaVeIaUO8PN9l5E1kXU="}' -Parameters: value is the transaction ID, hash of the raw_data of the transaction, and should be in base64 format. - -Inquire transaction by transaction hash (and confirm the transaction through this API): /walletsolidity/gettransactionbyid -Demo: curl -X POST http://127.0.0.1:18890/walletsolidity/gettransactionbyid -d '{"value" : "9PeN9FHPDHr1qpILy3U+iMcLAKvwojUek9jYx1EESXA="}' -Parameters: value is the transaction ID, hash of the raw_data of the transaction, and should be in base64 format. - -Create address: /wallet/createadresss -Demo: curl -X POST http://127.0.0.1:18890/wallet/createadresss -d '{"value": "QeVS9kh1hcK1i8LJu0SSvB8XEyzQ" }' -Parameters: value is the password; the address returned in base64 format needs to be converted into base58 for later use. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -TRX easy transfer: /wallet/easytransfer -Demo: curl -X POST http://127.0.0.1:18890/wallet/easytransfer -d '{"passPhrase": "QeVS9kh1hcK1i8LJu0SSvB8XEyzQ","toAddress": "QYkTnLE4evhePSTiEqAIrJdJZ+Vh", "amount":10}' -Parameters: passPhrase is the password; toAddress is the recipient address; amount is the amount of TRX to transfer. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -Generate private key and address: wallet/generateaddress -Wallet/solidity/generateaddress -demo:curl -X POST -k http://127.0.0.1:18890/wallet/generateaddress -Parameters: no parameters. -Warning: Please control risks when using this API. To ensure environmental security, please do not invoke APIs provided by other or invoke this very API on a public network. - -``` diff --git a/TRX_CN/Solidity_and_Full_Node_Deployment_CN.md b/TRX_CN/Solidity_and_Full_Node_Deployment_CN.md deleted file mode 100644 index f9510d09..00000000 --- a/TRX_CN/Solidity_and_Full_Node_Deployment_CN.md +++ /dev/null @@ -1,65 +0,0 @@ -# 在一台主机上同时部署SolidityNode和FullNode - -1. 构建java-tron项目 - - cd /deploy/java-tron - ./gradlew build - -2. 将FullNode.jar、SolidityNode.jar以及配置文件复制到相应目录。 - - download your needed config file from https://github.com/tronprotocol/TronDeployment. - main_net_config.conf is the config for mainnet, and test_net_config.conf is the config for testnet. - please rename the config file to `config.conf` and use this config.conf to start fullnode and soliditynode. - - cp build/libs/FullNode.jar ../fullnode - cp build/libs/SolidityNode.jar ../soliditynode - -3. 现在可以使用以下命令运行Fullnode - - java -jar FullNode.jar -c config.conf // make sure that your config.conf is downloaded from https://github.com/tronprotocol/TronDeployment - -4. 设置SolidityNode配置文件,修改config.conf以连接本地Fullnode。将node中的trustnode修改为本地的默认rpc端口127.0.0.1:50051。将listen.port设置为1024-65535中的任一数字,禁用0-1024间的数字,否则可能会和其他系统服务产生冲突。将rpc port改为50052或其他数字,避免冲突。 - - node { - trustNode = "127.0.0.1:50051" - listen.port = 18889 // This needs to be changed. - } - rpc { - port = 50052 - } - -5. 使用以下命令运行SolidityNode: - - java -jar SolidityNode.jar -c config.conf //make sure that your config.conf is downloaded from https://github.com/tronprotocol/TronDeployment - -# 日志和网络连接的验证 - - fullnode和soliditynode对应的日志在目录`/deploy/\*/logs/tron.log`,可以通过命令`tail -f /logs/tron.log/`去查看block同步的情况。日志大致如下: - -## FullNode - - 12:00:57.658 INFO [pool-7-thread-1] [o.t.c.n.n.NodeImpl](NodeImpl.java:830) Success handle block Num:236610,ID:0000000000039c427569efa27cc2493c1fff243cc1515aa6665c617c45d2e1bf - -## SolidityNode - - 12:00:40.691 INFO [pool-17-thread-1] [o.t.p.SolidityNode](SolidityNode.java:88) sync solidity block, lastSolidityBlockNum:209671, remoteLastSolidityBlockNum:211823 - -# 正确的停止节点 - -新建stop.sh,用kill -15关闭java-tron.jar(或者FullNode.jar、SolidityNode.jar)相关进程。 你需要修改下面的pid=ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'来找到正确的进程号。 - - #!/bin/bash - while true; do - pid=`ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'` - if [ -n "$pid" ]; then - kill -15 $pid - echo "The java-tron process is exiting, it may take some time, forcing the exit may cause damage to the database, please wait patiently..." - sleep 1 - else - echo "java-tron killed successfully!" - break - fi - done - - - diff --git a/TRX_CN/TRX_Migration_Notice.md b/TRX_CN/TRX_Migration_Notice.md deleted file mode 100644 index 32a769fc..00000000 --- a/TRX_CN/TRX_Migration_Notice.md +++ /dev/null @@ -1,20 +0,0 @@ -# TRX迁移公告 - -**亲爱的投资者,** - -波场TRON主网公链即将上线。 - -波场TRON官方Token – TRX的ERC20代币将迁移至波场TRON主网代币,时间为北京时间6月21日-25日。 - -如果投资者的TRX在交易所,无需其他任何操作。 - -如果投资者的TRX在钱包,需要在2018年6月24日前将TRX充值到交易所。 -6月21日-24日,交易所TRX的提现将被暂停,6月25日交易所将暂停TRX的充值和提现。从6月26日开始,TRX的充值和提现将恢复正常。在此期间,TRX的正常交易将不受影响。 - -如果投资者的TRX在钱包,没看见迁移公告,或者是在6月25日之后才看到迁移公告,到永久迁移交易所兑换主网代币。 - -**波场基金会 -2018年4月28日** - - - diff --git a/TRX_CN/Tron-doc.md b/TRX_CN/Tron-doc.md deleted file mode 100644 index 80b55432..00000000 --- a/TRX_CN/Tron-doc.md +++ /dev/null @@ -1,1167 +0,0 @@ -# TRON公链文档 - -[TOC] - -# 1 项目仓库 -仓库地址:https://github.com/tronprotocol -其中 java-tron是主网代码,protocol是api和数据结构定义。wallet-cli是官方命令行钱包。 -配置文件: - -testnet的配置请参照 - -https://github.com/tronprotocol/TronDeployment/blob/master/test_net_config.conf - -mainnet的配置请参照 - -https://github.com/tronprotocol/TronDeployment/blob/master/main_net_config.conf - -# 2 Tron超级代表与委员会 - -## 2.1 申请成为超级代表候选人规则 - - 在TRON网络中,任何账户都可以申请成为超级代表候选人,都有机会成为超级代表。每个账户都可以投票给超级代表候选人,获取投票数最高的27个超级代表候选人就是超级代表。就具有出链块的权利。 - 投票统计每6小时统计一次,超级代表也就每6个小时变更一次。 - - 为了防止恶意攻击,成为超级代表候选人也需要一定代价的。TRON网络将直接烧掉申请者账户9999TRX。申请成功后,您就可以竞选超级代表了。 - -## 2.2 选举超级代表 - - 投票需要TRON Power(TP),你的TRON Power(TP)的多少由当前冻结资金决定。TRON Power(TP)的计算方法:每冻结1TRX,就可以获得1单位TRON Power(TP)。 - - TRON网络中的每一个账户都具有选举权,可以通过投票选出自己认同的超级代表了。 - - 在解冻后,你没有了冻结的资产,相应地失去了所有的TRON Power(TP),因此以前的投票会失效。你可以通过重新冻结并投票来避免投票失效。 - -注意: 波场网络只记录你最后一次投票的状态,也就是说你的每一次投票都会覆盖以前所有的投票效果 - -+ 示例: - -``` -freezebalance 10,000,000 3 // 冻结了10TRX,获取了10单位TRON Power(TP) -votewitness witness1 4 witness2 6 // 同时给witness1投了4票,给witness2投了6票 -votewitness witness1 3 witness2 7 // 同时给witness1投了3票,给witness2投了7票 -``` - -以上命令的最终结果是给witness1投了3票,给witness2投了7票 - -## 2.3 超级代表的奖励 - -1. 票数奖励,每6小时,票数排名前127名的超级代表会获得共计115,200 TRX的票数奖励,这部分奖励将按照票数比例分发。每年的票数奖励总计168,192,000 TRX。 - -2. 出块奖励,波场协议网络每3秒中会出一个区块,每个区块将给予超级代表32个TRX奖励,每年总计336,384,000 TRX将会被奖励给超级代表。 - -+ 超级代表每次出块完成后,出块奖励都会发到超级代表的子账号当中,超级代表不能直接使用这部分资产,但可以查询。 每24h允许一次提取操作。从该子账号转移到超级代表的账户中。 - -## 2.4 委员会 - -### 2.4.1 什么是委员会 -委员会用于修改Tron网络动态参数,如出块奖励、交易费用等等。委员会由当前的27个超级代表组成。每个超级代表都具有提议权、对提议的投票权, -当提议获得19个代表及以上的赞成票时,该提议获得通过,并在下个维护期内进行网络参数修改。 - -### 2.4.2 创建提议 -只有超级代表对应账户具有提议权,其他账户无法创建提议。允许修改的网络动态参数以及编号如下( [min,max] ): -- 0: MAINTENANCE_TIME_INTERVAL, [3 * 27* 1000 ,24 * 3600 * 1000] //修改超级代表调整时间间隔,目前为6 * 3600 * 1000ms -- 1: ACCOUNT_UPGRADE_COST, [0,100 000 000 000 000 000] //修改账户升级为超级代表的费用,目前为9999_000_000 Sun -- 2: CREATE_ACCOUNT_FEE, [0,100 000 000 000 000 000] // 修改创建账户费用,目前为100_000Sun -- 3: TRANSACTION_FEE, [0,100 000 000 000 000 000] // 修改TRX抵扣带宽的费用,目前为10Sun/byte -- 4: ASSET_ISSUE_FEE, [0,100 000 000 000 000 000] // 修改资产发行费用,目前为1024_000_000 Sun -- 5: WITNESS_PAY_PER_BLOCK, [0,100 000 000 000 000 000] // 修改超级代表出块奖励,目前为32_000_000 Sun -- 6: WITNESS_STANDBY_ALLOWANCE, [0,100 000 000 000 000 000] // 修改分给前127名超级代表候选人的奖励,115_200_000_000 Sun -- 7: CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT, []// 修改系统创建账户的费用,目前为0 Sun -- 8: CREATE_NEW_ACCOUNT_BANDWIDTH_RATE, // 提议7、8,组合使用,用于修改创建账户时对资源或TRX的消耗 -- 9: ALLOW_CREATION_OF_CONTRACTS, // 用于控制虚拟机功能的开启 -- 10: REMOVE_THE_POWER_OF_THE_GR // 用于清除GR的创世票数 -- 11: ENERGY_FEE, [0,100 000 000 000 000 000] //sun -- 12: EXCHANGE_CREATE_FEE, [0,100 000 000 000 000 000] //sun -- 13: MAX_CPU_TIME_OF_ONE_TX, [0, 1000] //ms -- 14: ALLOW_UPDATE_ACCOUNT_NAME, // 用于允许用户更改昵称以及昵称同名,目前为0,表示不允许 -- 15: ALLOW_SAME_TOKEN_NAME, // 用于允许创建相同名称的token,目前为0,表示不允许 -- 16: ALLOW_DELEGATE_RESOURCE, // 用于控制资源代理功能的开启 -- 17: TOTAL_ENERGY_LIMIT, // 用于调整Energy上限 -- 18: ALLOW_TVM_TRANSFER_TRC10, // 允许智能合约调用TRC10 token的接口,目前为0,表示不允许。设置为1表示允许 - - -+ API: -` -createproposal id0 value0 ... idN valueN -id0_N: 参数编号 -value0_N: 新参数值 -` - -注:Tron网络中,1 TRX = 1000_000 Sun。 - -### 2.4.3 对提议进行投票 -提议仅支持投赞成票,不投票代表不赞同。从提议创建时间开始,3天时间内为提议的有效期。超过该时间范围,该提议如果没有获得足够的 -赞成票,该提议失效。允许取消之前投的赞成票。 - - -+ API: -` -approveProposal id is_or_not_add_approval -id: 提议Id,根据提议创建时间递增 -is_or_not_add_approval: 赞成或取消赞成 -` - -### 2.4.4 取消提议 -提议创建者,能够在提议生效前,取消提议。 - -+ API: -` -deleteProposal proposalId -id: 提议Id,根据提议创建时间递增 -` - -### 2.4.5 查询提议 - -以下接口可以查询提议,包括: -查询所有提议信息(ListProposals)、分页查询提议信息(GetPaginatedProposalList),查询指定提议信息(GetProposalById)。 -相关api详情,请查询[Tron-http](Tron-http.md)。 - -# 3 Tron账号 -## 3.1 账户模型介绍 -Tron采用账户模型。账户的唯一标识为地址address,对账户操作需要验证私钥签名。每个账户拥有TRX、Token余额及智能合约、带宽、能量等各种资源。通过发送交易可以增减TRX或者Token余额,需要消耗带宽;可以发布并拥有智能合约,也可以调用他人发布的智能合约,需要消耗能量。可以申请成为超级代表并被投票,也可以对超级代表进行投票。等等。Tron所有的活动都围绕账户进行。 -## 3.2 创建账号的方式 -首先用钱包或者浏览器生成私钥和地址,生成方法见3.3和3.4,公钥可以丢弃。 -由已有老账户调用转账TRX(CreateTransaction2)、转让Token(TransferAsset2)或者创建账户(CreateAccount2)合约,并广播到网络后将完成账户创建的流程。 -## 3.3 生成密钥对算法 -Tron的签名算法为ECDSA,选用曲线为SECP256K1。其私钥为一个随机数,公钥为椭圆曲线上一个点。生成过程为,首先生成一个随机数d作为私钥,再计算P=d*G作为公钥;其中G为椭圆曲线的基点。 -## 3.4 地址格式说明 -用公钥P作为输入,计算SHA3得到结果H;这里公钥长度为64字节,SHA3选用Keccak256。 -取H的最后20字节,在前面填充一个字节0x41得到address。 -对address进行basecheck计算得到最终地址,所有地址的第一个字符为T。 -其中basecheck的计算过程为:首先对address计算sha256得到h1,再对h1计算sha256得到h2,取其前4字节作为check填充到address之后得到address||check,对其进行base58编码得到最终结果。 -我们用的字符映射表为: -ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -## 3.5 签名说明 -签名说明请参照 -https://github.com/tronprotocol/Documentation/blob/fix_http/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E4%BA%A4%E6%98%93%E7%AD%BE%E5%90%8D%E6%B5%81%E7%A8%8B.md - -# 4 Tron网络中的节点和部署 -## 4.1 SuperNode -### 4.1.1 SuperNode介绍 -[超级代表](https://github.com/tronprotocol/Documentation/blob/master/中文文档/波场区块链浏览器介绍/什么是超级代表.md)(简称SR)是TRON网络上的记账人,一共27个,负责对网络上广播出来的交易数据进行验证,并将交易打包进区块中,他们是轮流的方式打包区块。超级代表的信息是在TRON网络上公开的,所有人都可以获取这些信息,最便捷的方式是在TRON的[区块链浏览器](https://tronscan.org/#/representatives)查看超级代表列表及其信息。 -### 4.1.2 SuperNode部署方式 -[部署SuperNode](https://github.com/tronprotocol/java-tron#running-a-super-representative-node-for-mainnet) -### 4.1.3 建议硬件配置 -最低配置要求: -CPU:16核 内存:32G 带宽:100M 硬盘:1T -推荐配置要求: -CPU:64核及以上 内存:64G及以上 带宽:500M及以上 硬盘:20T及以上 - -## 4.2 FullNode -### 4.2.1 FullNode介绍 -FullNode是拥有完整区块链数据的节点,能够实时更新数据,负责交易的广播和验证,提供操作区块链的api和查询数据的api。 -### 4.2.2 FullNode部署方式 -详细说明请参考[tron-deployment](https://github.com/tronprotocol/tron-deployment) -[部署FullNode](https://github.com/tronprotocol/tron-deployment#deployment-of-fullnode-on-the-one-host) -### 4.2.3 建议硬件配置 -最低配置要求: -CPU:16核 内存:32G 带宽:100M 硬盘:1T -推荐配置要求: -CPU:64核及以上 内存:64G及以上 带宽:500M及以上 硬盘:20T及以上 - -## 4.3 SolidityNode -### 4.3.1 SolidityNode介绍 -SolidityNode是只从自己信任的FullNode同步固化块的节点,并提供区块、交易查询等服务。 -### 4.3.2 SolidityNode部署方式 -详细说明请参考[tron-deployment](https://github.com/tronprotocol/tron-deployment) -[部署solidityNode](https://github.com/tronprotocol/tron-deployment#deployment-of-soliditynode-on-the-one-host) -### 4.3.3 建议硬件配置 -最低配置要求: -CPU:16核 内存:32G 带宽:100M 硬盘:1T -推荐配置要求: -CPU:64核及以上 内存:64G及以上 带宽:500M及以上 硬盘:20T及以上 - -## 4.4 Tron网络结构 -Tron网络采用Peer-to-Peer(P2P)的网络架构,网络中的节点地位对等。网络中的节点有SuperNode、FullNode、SolidityNode三种类型,SuperNode主要用于生成区块,FullNode用于同步区块、广播交易,SolidityNode用于同步固化的区块。任何部署运行Tron代码的设备都可以加入Tron网络并作为一个节点,和Tron网络中的其他节点有相同的地位,他们可以创建交易,广播交易,同步区块等,也可以作为SuperNode的候选人参与选举。 -![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/network.png) -## 4.5 一键部署FullNode和SolidityNode -下载一键部署脚本,根据不同的节点类型附加相应的参数来运行脚本。 -详见[一键部署节点](https://github.com/tronprotocol/tron-deployment#deployment-of-soliditynode-on-the-one-host) -## 4.6 主网、测试网、私有网络 -加入主网或测试网或私有网络的节点在部署时运行的是同一份代码,区别仅仅在于节点启动时加载的配置文件不同。 -### 4.6.1 主网 -[主网配置文件](https://github.com/tronprotocol/tron-deployment/blob/master/main_net_config.conf) -### 4.6.2 测试网 -[测试网配置文件](https://github.com/tronprotocol/tron-deployment/blob/master/test_net_config.conf) -### 4.6.3 搭建私有网络 -#### 4.6.3.1 前提 - 1、具备至少两个钱包账户的私钥与地址。 [如何生成钱包账户](https://tronscan.org/#/wallet/new) - 2、至少部署一个SuperNode用于出块; - 3、部署任意数量的FullNode节点用于同步区块、广播交易; - 4、SuperNode与FullNode组成了私有网络,可以进行网络发现、区块同步、广播交易。 -#### 4.6.3.2 部署 -##### 4.6.3.2.1 步骤一:部署超级节点 - 1、下载private_net_config.conf - ``` - wget https://github.com/tronprotocol/tron-deployment/blob/master/private_net_config.conf - ``` - 2、在localwitness中添加自己的私钥 - 3、设置genesis.block.witnesses为私钥对应的地址 - 4、设置p2p.version为除了11111之外的任意正整数 - 5、第1个SR设置needSyncCheck为false,其他可以设置为true - 6、设置node.discovery.enable为true - 7、运行部署脚本 - ``` - nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar --witness -c private_net_config.conf - ``` - ``` - 命令行参数说明: - --witness: 启动witness功能,i.e.: --witness - --log-config: 指定日志配置文件路径,i.e.: --log-config logback.xml - -c: 指定配置文件路径,i.e.: -c config.conf - - 日志文件使用: - 可以修改模块的level等级来控制日志的输出,默认每个模块的level级别为INFO,比如,只打印网络模块warn以上级别的信息,可以如下修改 - - ``` - 配置文件中需要修改的参数: - localwitness: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/localwitness.jpg) - witnesses: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/witness.png) - version: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/p2p_version.png) - enable: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/discovery_enable.png) -##### 4.6.3.2.2 步骤二:部署FullNode节点 - 1、下载private_net_config.conf - ``` - wget https://github.com/tronprotocol/tron-deployment/blob/master/private_net_config.conf - ``` - 2、设置seed.node ip.list 为SR的ip地址和端口。 - 3、设置p2p.version与超级节点的p2p.version一致。 - 4、设置genesis.block 与SR中的genesis.block配置一致。 - 5、设置needSyncCheck为true - 6、设置node.discovery.enable 为true - 7、运行部署脚本 - ``` - nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar --witness -c private_net_config.conf - ``` - ``` - 命令行参数说明: - --witness: 启动witness功能,i.e.: --witness。 - --log-config: 指定日志配置文件路径,i.e.: --log-config logback.xml。 - -c: 指定配置文件路径,i.e.: -c config.conf。 - - 日志文件使用: - 可以修改模块的level等级来控制日志的输出,默认每个模块的level级别为INFO,比如,只打印网络模块warn以上级别的信息,可以如下修改 - - ``` - 配置文件中需要修改的参数: - ip.list: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/ip_list.png) - p2p.version: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/p2p_version.png) - genesis.block: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/genesis_block.png) - needSyncCheck: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/need_sync_check.png) - node.discovery.enable: - ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/discovery_enable.png) - - -# 5 智能合约 -## 5.1 Tron智能合约介绍 - -智能合约是一种能自动执行其条款的计算化交易协议。智能合约和普通合约一样,定义了参与者相关的条款和奖惩机制。一旦合约被启动,便能按照设定的条款执行,并自动检查所承诺的条款实施情形。 - -Tron兼容以太坊(Ethereum)上采用Solidity编写的智能合约。当前建议的Solidity语言版本为0.4.24~0.4.25。合约编写、编译完成后,部署到Tron公链上。部署后的合约,被触发时,就会在公链的各个节点上自动执行。 - -## 5.2 Tron智能合约特性(地址等) -Tron virtual machine 基于以太坊 solidity 语言实现,兼容以太坊虚拟机的特性,但基于tron自身属性也有部分的区别。 - -### 5.2.1 智能合约 -波场虚拟机运行的智能合约兼容以太坊智能合约特性,以protobuf的形式定义合约内容: - - message SmartContract { - message ABI { - message Entry { - enum EntryType { - UnknownEntryType = 0; - Constructor = 1; - Function = 2; - Event = 3; - Fallback = 4; - } - message Param { - bool indexed = 1; - string name = 2; - string type = 3; - // SolidityType type = 3; - } - enum StateMutabilityType { - UnknownMutabilityType = 0; - Pure = 1; - View = 2; - Nonpayable = 3; - Payable = 4; - } - - bool anonymous = 1; - bool constant = 2; - string name = 3; - repeated Param inputs = 4; - repeated Param outputs = 5; - EntryType type = 6; - bool payable = 7; - StateMutabilityType stateMutability = 8; - } - repeated Entry entrys = 1; - } - bytes origin_address = 1; - bytes contract_address = 2; - ABI abi = 3; - bytes bytecode = 4; - int64 call_value = 5; - int64 consume_user_resource_percent = 6; - string name = 7; - int64 origin_energy_limit = 8; - } - -origin_address: 合约创建者地址 - -contract_address: 合约地址 - -abi:合约所有函数的接口信息 - -bytecode:合约字节码 - -call_value:随合约调用传入的trx金额 - -consume_user_resource_percent:开发者设置的调用者的资源扣费百分比 - -name:合约名称 - -origin_energy_limit: 开发者设置的在一次合约调用过程中自己消耗的energy的上限,必须大于0。对于之前老的合约,deploy的时候没有提供设置该值的参数,会存成0,但是会按照1000万energy上限计算,开发者可以通过updateEnergyLimit接口重新设置该值,设置新值时也必须大于0 - - -通过另外两个grpc message类型 CreateSmartContract 和 TriggerSmartContract 来创建和使用smart contract - - -### 5.2.2 合约函数的使用 - -1. constant function和非constant function - -函数调用从对链上属性是否有更改可分为两种:constant function 和 非constant function。 -Constant function 是指用 view/pure/constant 修饰的函数。会在调用的节点上直接返回结果,并不以一笔交易的形式广播出去。 -非constant function是指需要依托一笔交易的形式被广播的方法调用。函数会改变链上数据的内容,比如转账,改变合约内部变量的值等等。 - ->注意,如果在合约内部使用create指令(CREATE instruction),即使用view/pure/constant来修饰这个动态创建的合约合约方法,这个合约方法仍会被当作非constant function,以交易的形式来处理。 - -2. 消息调用 (message calls) - -消息调用可以向其他的合约发起函数调用,也可以向合约的账户或非合约的账户转帐trx。 与普通的波场triggercontract类似, 消息调用也有调用的发起者,接受者,数据,转账金额,扣费,以及返回值等属性。每一个消息调用都可以递归的生成新的消息调用。 -合约可以决定在其内部的消息调用中,对于剩余的 energy ,应发送和保留多少。如果在内部消息调用时发生了OutOfEnergyException -异常(或其他任何异常),会返回false,但不会以异常的形式抛出。此时,只有与该内部消息调用一起发送的gas会被消耗掉,如果不表明消息调用所传入的费用call.value(energy),则会扣掉所有的剩余energy。 - - -3. 委托调用/代码调用和库 (delegatecall/callcode/libary) - -有一种特殊类型的消息调用,被称为 委托调用(delegatecall) 。它和一般的消息调用的区别在于,目标地址的代码将在发起调用的合约的上下文中执行,并且msg.sender 和msg.value 不变。 这意味着一个合约可以在运行时从另外一个地址动态加载代码。存储、当前地址和余额都指向发起调用的合约,只有代码是从被调用地址获取的。 这使得 Solidity 可以实现”库“能力:可复用的代码库可以放在一个合约的存储上,如用来实现复杂的数据结构的库。 - -4. CREATE 指令 (CREATE instruction) - -另一个与合约调用相关的是调用指令集的时候使用CREATE指令。这个指令将会创建一个新的合约并生成新的地址。与以太坊的创建唯一的不同在于波场新生成的地址使用的是传入的本次智能合约交易id与调用的nonce的哈希组合。和以太坊不同,这个nonce的定义为本次根调用开始创建的合约序号。即如果有多次的 CREATE指令调用,从1开始,顺序编号每次调用的合约。详细请参考代码。还需注意,与deploycontract的grpc调用创建合约不同,CREATE的合约并不会保存合约的abi。 - -5. 内置功能属性及内置函数 (Odyssey-v3.1.1及之后的版本暂时不支持TVM内置函数) - -1)TVM兼容solidity语言的转账形式,包括: -伴随constructor调用转账 -伴随合约内函数调用转账 -transfer/send/call/callcode/delegatecall函数调用转账 - ->注意,波场的智能合约与波场系统合约的逻辑不同,如果转账的目标地址账户不存在,不能通过智能合约转账的形式创建目标地址账户。这也是与以太坊的不同点。 - -2)不同账户为超级节点投票 (Odyssey-v3.1.1及之后的版本暂时不支持) - -3)超级节点获取所有奖励 (Odyssey-v3.1.1及之后的版本暂时不支持) - -4)超级节点通过或否定提案 (Odyssey-v3.1.1及之后的版本暂时不支持) - -5)超级节点提出提案 (Odyssey-v3.1.1及之后的版本暂时不支持) - -6)超级节点删除提案 (Odyssey-v3.1.1及之后的版本暂时不支持) - -7)波场byte地址转换为solidity地址 (Odyssey-v3.1.1及之后的版本暂时不支持) - -8)波场string地址转换为solidity地址 (Odyssey-v3.1.1及之后的版本暂时不支持) - -9)向目标账户地址发送token转账 (Odyssey-v3.1.1及之后的版本暂时不支持) - -10)查询目标账户地址的指定token的数量 (Odyssey-v3.1.1及之后的版本暂时不支持) - -11)兼容所有以太坊内置函数 - ->注意: -波场2)- 10)为波场自己的内置函数 具体中文文档请参看:https://github.com/tronprotocol/Documentation/blob/master/中文文档/虚拟机/虚拟机内置函数.md - ->以太坊 RIPEMD160 函数不推荐使用,波场返回的是一个自己的基于sha256的hash结果,并不是准确的以太坊RIPEMD160。以后会考虑删除这个函数。 - -### 5.2.3 合约地址在solidity语言的使用 - -以太坊虚拟机地址为是20字节,而波场虚拟机解析地址为21字节。 -1. 地址转换 -在solidity中使用的时候需要对波场地址做如下处理 (推荐): -``` - /** - * @dev convert uint256 (HexString add 0x at beginning) tron address to solidity address type - * @param tronAddress uint256 tronAddress, begin with 0x, followed by HexString - * @return Solidity address type - */ - - function convertFromTronInt(uint256 tronAddress) public view returns(address){ - return address(tronAddress); - } -``` - -这个和在以太坊中其他类型转换成address类型语法相同。 -2. 地址判断 -solidity中有地址常量判断,如果写的是21字节地址编译器会报错,只用写20字节地址即可,如: -``` - function compareAddress(address tronAddress) public view returns (uint256){ - // if (tronAddress == 0x41ca35b7d915458ef540ade6068dfe2f44e8fa733c) { // compile error - if (tronAddress == 0xca35b7d915458ef540ade6068dfe2f44e8fa733c) { // right - return 1; - } else { - return 0; - } - } -``` -tronAddress从wallet-cli传入是0000000000000000000041ca35b7d915458ef540ade6068dfe2f44e8fa733c这个21字节地址,即正常的波场地址时,是会返回1的,判断正确。 -3. 地址赋值 -solidity中有地址常量的赋值,如果写的是21字节地址编译器会报错,只用写20字节地址即可,solidity中后续操作直接利用这个20位地址,波场虚拟机内部做了补位操作。如: -``` - function assignAddress() public view { - // address newAddress = 0x41ca35b7d915458ef540ade6068dfe2f44e8fa733c; // compile error - address newAddress = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c; - // do something - } -``` -如果想直接使用string 类型的波场地址(如TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm)请参考内置函数的两种地址转换方式 (见II-4-7,II-4-8)。 - -### 5.2.4 与以太坊有区别的特殊常量 - -1 货币 - -类似于solidity对ether的支持,波场虚拟机的代码支持的货币单位有trx和sun,其中1trx = 1000000sun,大小写敏感,只支持小写。目前tron-studio支持trx和sun,在remix中,不支持trx和sun,如果使用ether、finney等单位时,注意换算(可能会发生溢出错误)。 -我们推荐使用tron-studio代替remix进行tron智能合约的编写。 - -2 区块相关 - -• block.blockhash(uint blockNumber) returns (bytes32):指定区块的区块哈希——仅可用于最新的 256 个区块且不包括当前区块;而 blocks 从 0.4.22 版本开始已经不推荐使用,由 blockhash(uint blockNumber) 代替 - -• block.coinbase (address): 产当前区块的超级节点地址 - -• block.difficulty (uint): 当前区块难度,波场不推荐使用,设置恒为0 - -• block.gaslimit (uint): 当前区块 gas 限额,波场暂时不支持使用, 暂时设置为0 - -• block.number (uint): 当前区块号 - -• block.timestamp (uint): 当前区块以秒计的时间戳 - -• gasleft() returns (uint256):剩余的 gas - -• msg.data (bytes): 完整的 calldata - -• msg.gas (uint): 剩余 gas - 自 0.4.21 版本开始已经不推荐使用,由 gesleft() 代替 - -• msg.sender (address): 消息发送者(当前调用) - -• msg.sig (bytes4): calldata 的前 4 字节(也就是函数标识符) - -• msg.value (uint): 随消息发送的 sun 的数量 - -• now (uint): 目前区块时间戳(block.timestamp) - -• tx.gasprice (uint): 交易的 gas 价格,波场不推荐使用,设置值恒为0 - -• tx.origin (address): 交易发起者 - - - - -## 5.3 Energy介绍 -智能合约运行时执行每一条指令都需要消耗一定的系统资源,资源的多少用Energy的值来衡量。 - -### 5.3.1 Energy的获取 - -冻结获取Energy,即将持有的trx锁定,无法进行交易,作为抵押,并以此获得免费使用Energy的权利。具体计算与全网所有账户冻结有关,可参考相关部分计算。 - -##### FreezeBalance 冻结获得能量 - -``` -freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 ENERGY] -``` - -通过冻结TRX获取的Energy, 额度 = 为获取Energy冻结的TRX / 整个网络为获取Energy冻结的TRX 总额 * 50_000_000_000。 -也就是所有用户按冻结TRX平分固定额度的Energy。 - -示例: - -``` -如全网只有两个人A,B分别冻结2TRX,2TRX。 - -二人冻结获得的可用Energy分别是 - -A: 25_000_000_000 且energy_limit 为25_000_000_000 - -B: 25_000_000_000 且energy_limit 为25_000_000_000 - -当第三人C冻结1TRX时。 - -三人冻结获得的可用Energy调整为 - -A: 20_000_000_000 且energy_limit调整为20_000_000_000 - -B: 20_000_000_000 且energy_limit调整为20_000_000_000 - -B: 10_000_000_000 且energy_limit 为10_000_000_000 - -``` - -##### FreezeBalance 恢复能量 - -所消耗的能量会在24小时内平滑减少至0。 - -示例: - -``` -在某一时刻A的Energy已使用量为72_000_000 Energy - -在没有其他消耗或冻结的操作下: - -一小时后A的Energy已使用量为 72_000_000 - (72_000_000 * (60*60/60*60*24)) Energy = 69_000_000 Energy - -24小时后A的Energy已使用量为 0 Energy。 -``` - -### 5.3.2 如何填写feeLimit(用户必读) -*** -*在本节范围内,将合约的开发部署人员,简称为“开发者”;将调用合约的用户或者其他合约,简称为“调用者”。* - -*调用合约消耗的Energy能以一定比例折合成trx(或者sun),所以在本节范围内,指代合约消耗的资源时,并不严格区分Energy和 trx;仅在作为 数值的单位时,才区分Energy、trx和sun。* - -*** - -合理设置feeLimit,一方面能尽量保证正常执行;另外一方面,如果合约所需Energy过大,又不会过多消耗调用者的trx。在设置feeLimit之前,需要了解几个概念: - -1). 合法的feeLimit为0 - 10^9 之间的整数值,单位是sun,折合0 - 1000 trx; - -2). 不同复杂度的合约,每次正常执行消耗不同的Energy;相同合约每次消耗的Energy基本相同[1];执行合约时,逐条指令计算并扣除Energy,如果超过feeLimit的限制,则合约执行失败,已扣除的Energy不退还; - -3). 目前feeLimit仅指调用者愿意承担的Energy折合的trx[2];执行合约允许的最大Energy还包括开发者承担的部分; - -4). 一个恶意合约,如果最终执行超时,或者因bug合约崩溃,则会扣除该合约允许的所有energy; - -5). 开发者可能会承担一定比例的Energy消耗(比如承担90%)。但是,当开发者账户的Energy不足以支付时,剩余部分完全由调用者承担。在feeLimit限制范围内,如调用者的Energy不足,则会燃烧等价值的trx。[2] - -开发者通常会有充足的Energy,以鼓励低成本调用;调用者在估算feeLimit时,可以假设开发者能够承担其承诺比例的Energy,如果一次调用因为feeLimit不足而失败,可以再适当扩大。 - -##### 示例5.3.2.1 -下面将以一个合约C的执行,来具体举例,如何估算feeLimit: - - * 假设合约C上一次成功执行时,消耗了18000 Energy,那么预估本次执行消耗的Energy上限为20000 Energy;[3] - * 冻结trx时,当前全网用于CPU冻结的TRX总量和Energy总量的比值,假设是冻结1 trx,可以获得400 Energy; - * 燃烧trx时,1 trx固定可以兑换10000 Energy;[4] - * 假设开发者承诺承担90%的Energy,而且开发者账户有充足的Energy; - -则,feeLimit的预估方法为: - -1). A = 20000 energy * (1 trx / 400 energy) = 50 trx = 50_000_000 sun, - -2). B = 20000 energy * (1 trx / 10000 energy) = 2 trx = 2_000_000 sun, - -3). 取A和B的最大值,为50_000_000 sun, - -4). 开发者承诺承担90%,用户需要承担10%, - -那么,建议用户填写的feeLimit为 50_000_000 sun * 10% = 5_000_000 sun。 - - -小节附录: - -[1] 根据tron各节点的情况,每次执行消耗的Energy可能会有小幅度的浮动。 - -[2] tron可能会视后续公链的情况,调整这一策略。 - -[3] 预估的下一次执行所需Energy上限,应该略大于上一次实际消耗的Energy。 - -[4] 1 trx = 10^4 energy 为目前的燃烧trx的比例,后续Tron可能会根据全网拥塞情况调整,调整后,将通知到全网的节点。 - - -### 5.3.3 Energy的计算(开发者必读) - -在讨论本章节前,需要了解: - -1). tron为了惩罚恶意开发者,对于异常合约,如果执行超时(超过50ms),或因bug异常退出(不包含revert),会扣除本次的最大可用Energy。若合约正常执行,或revert,则仅扣除执行相关指令所需的Energy; - -2). 开发者可以设置执行合约时,消耗Energy中自己承担的比例,该比例后续可修改。一次合约调用消耗的Energy,若开发者的Energy不足以支付其承担的部分,剩余部分全由调用者支付; - -3). 目前执行一个合约,可用的Energy总数由 调用者调用时设置的feeLimit 和 开发者承担部分共同决定; - - 注意: - 1.若开发者不确定合约是否正常,请勿将用户承担比例设置为0%,否则在被判为恶意执行时,会扣除开发者的所有Energy。[1] - 2.因此建议开发者设置的用户承担的比例为10%~100%。[2] - -下面具体举例,详细描述合约可用Energy的计算方法。 - -##### 示例5.3.3.1 -如果一个账户A的balance是 100 TRX(100000000 SUN),冻结 10 TRX 获得了100000 Energy,未冻结的balance是 90 TRX。有一个合约C设置的消耗调用者资源的比例是100%,也就是完全由调用者支付所需资源。 -此时A调用了合约C,填写的feeLimit是 30000000(单位是SUN, 30 TRX)。那么A此次调用能够使用的Energy是由两部分计算出来的: - -* A冻结剩余的Energy -这部分的价格是根据账户A当前冻结的TRX和当前冻结所获得的Energy总量按比例计算出来的,也就是:1 Energy = (10 / 100000) TRX,还剩100000 Energy,价值10 TRX,小于feeLimit,则能获得所有的100000 Energy,价值的10 TRX算进feeLimit中。 -* 按照固定比例换算出来的Energy -如果feeLimit大于冻结剩余Energy价值的TRX,那么需要使用balance中的TRX来换算。固定比例是: 1 Energy = 100 SUN, feeLimit还有(30 - 10) TRX = 20 TRX,获得的Energy是 20 TRX / 100 SUN = 200000 Energy - -所以,A此次调用能够使用的Energy是 (100000 + 200000) = 300000 Energy -如果合约执行成功,没有发生任何异常,则会扣除合约运行实际消耗的Energy,一般都远远小于此次调用能够使用的Energy。如果发生了Assert-style异常,则会消耗feeLimit对应的所有的Energy。Assert-style异常的介绍详见[异常介绍](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md) -##### 示例5.3.3.2 -如果一个账户A的balance是 100 TRX(100000000 SUN),冻结 10 TRX 获得了100000 Energy,未冻结的balance是 90 TRX。有一个合约C设置的消耗调用者资源的比例是40%,也就是由合约开发者支付所需资源的60%,开发者是D,冻结 50 TRX 获得了500000 Energy。 -此时A调用了合约C,填写的feeLimit是 200000000(单位是SUN, 200 TRX)。 -那么A此次调用能够使用的Energy是于以下三部分相关: - -* 调用者A冻结剩余的Energy(X Energy) -这部分的价格是根据账户A当前冻结的TRX和当前冻结所获得的Energy总量按比例计算出来的,也就是:1 Energy = (10 / 100000) TRX,还剩100000 Energy,价值10 TRX,小于剩下的feeLimit,则能获得所有的100000 Energy,价值的10 TRX算进feeLimit中。 -* 从调用者A的balance中,按照固定比例换算出来的Energy (Y Energy) -如果feeLimit大于1和2的和,那么需要使用A的balance中的TRX来换算。固定比例是: 1 Energy = 100 SUN, feeLimit还有(200 - 10)TRX = 190 TRX,但是A的balance只有90 TRX,按照min(190 TRX, 90 TRX) = 90 TRX来计算获得的Energy,即为 90 TRX / 100 SUN = 900000 Energy -* 开发者D冻结剩余的Energy (Z Energy) -开发者D冻结剩余500000 Energy。 -会出现以下两种情况: -当(X + Y) / 40% >= Z / 60%,A此次调用能够使用的Energy是 X + Y + Z Energy。 -当(X + Y) / 40% < Z / 60%,A此次调用能够使用的Energy是 (X + Y) / 40% Energy。 - -若A此次调用能够使用的Energy是 Q Energy -同上,如果合约执行成功,没有发生任何异常,消耗总Energy小于Q Energy,如消耗 500000 Energy ,会按照比例扣除合约运行实际消耗的Energy,调用者A消耗500000 * 40=200000 Energy,开发者D消耗500000 * 60% = 300000 Energy。 -一般实际消耗Energy都远远小于此次调用能够使用的Energy。如果发生了Assert-style异常,则会消耗feeLimit对应的所有的Energy。Assert-style异常的介绍详见[异常介绍](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md) -##### 注意事项 -1. 开发者创建合约的时候,consume_user_resource_percent不要设置成0,也就是开发者自己承担所有资源消耗。 -开发者自己承担所有资源消耗,意味着当发生了Assert-style异常时,会消耗开发者冻结的所有Energy(Assert-style异常的介绍详见[异常介绍](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md) )。为避免造成不必要的损失consume_user_resource_percent建议值是10-100。 - -## 5.4 智能合约开发工具介绍 -### 5.4.1 TronStudio -波场智能合约开发工具。提供可视化界面,支持开发者对solidity语言智能合约进行编译,调试,运行等功能。 -https://developers.tron.network/docs/tron-studio-intro -### 5.4.2 TronBox -波场智能合约部署工具。支持solidity语言智能合约的编译,部署,移植等功能。 -https://developers.tron.network/docs/tron-box-user-guide -### 5.4.3 TronWeb -波场智能合约开发使用的http api库。提供和主链交互,合约部署调用等接口。 -https://developers.tron.network/docs/tron-web-intro -### 5.4.4 TronGrid -波场智能合约事件查询服务。可以查询智能合约中写入的事件log信息。 -https://developers.tron.network/docs/tron-grid-intro - -## 5.5 使用命令行工具进行智能合约开发 - -在tron上进行智能合约的开发,除了使用现有的工具之(tron-studio)外,也可以直接使用wallet-cli命令行工具进行智能合约的开发,编译和部署。编写智能合约,可以使用使用TronStudio进行编译、调试等前期的开发工作。 当合约开发完成之后,可以把合约复制到[SimpleWebCompiler](https://github.com/tronprotocol/tron-demo/tree/master/SmartContractTools/SimpleWebCompiler)中进行编译,获取ABI和ByteCode。 我们提供一个简单的数据存取的合约代码示例,以这个示例来说明编译、部署、调用的步骤。 - -``` -pragma solidity ^0.4.0; -contract DataStore { - - mapping(uint256 => uint256) data; - - function set(uint256 key, uint256 value) public { - data[key] = value; - } - - function get(uint256 key) view public returns (uint256 value) { - value = data[key]; - } -} -``` - -### 启动私有链 - -确保前提条件中,私有链已经在本地部署完成。可以检查FullNode/logs/tron.log中,是否有持续产块的log信息出现:“Produce block successfully” - -### 开发智能合约 - -把上述代码复制到remix中编译,调试,确保代码的逻辑是自己需要的,编译通过,没有错误 - -### 在SimpleWebCompiler编译得到ABI和ByteCode - -因为波场的编译器与以太坊的编译略有差异,正在与Remix集成中,所以临时采用改方案获取ABI和ByteCode,而不是通过Remix直接获取ABI和ByteCode。 -把上述代码复制到SimpleWebCompiler中,点击Compile按钮,获取ABI和ByteCode。 - -### 通过Wallet-cli部署智能合约 - -下载Wallet-Cli,文件然后编译。 - -``` -shell -# 下载源代码 -git clone https://github.com/tronprotocol/wallet-cli -cd wallet-cli -# 编译 -./gradlew build -cd build/libs -``` - -> Note:wallet-cli 默认的配置会连接本地127.0.0.1:50051的 fullnode,如果开发者需要连接不同的其他节点或者端口可在 config.conf 文件中进行修改 - -启动wallet-cli - -``` -java -jar wallet-cli.jar -``` - -启动之后,可在命令中交互式输入指令。导入私钥,并查询余额是否正确 - -``` -importwallet -<输入你自己的设定的钱包密码2次> -<输入私钥:da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0> -login -<输入你自己的设定的钱包密码> -getbalance -``` - -部署合约 - -``` -Shell -# 合约部署指令 -DeployContract contractName ABI byteCode constructor params isHex fee_limit consume_user_resource_percent - -# 参数说明 -contract_name:自己制定的合约名 -ABI:从SimpleWebCompiler中获取到的 ABI json 数据 -bytecode:从SimpleWebCompiler中获取到的二进制代码 -constructor:部署合约时,会调用构造函数,如果需要调用,就把构造函数的参数类型填写到这里,例如:constructor(uint256,string),如果没有,就填写一个字符# -params:构造函数的参数,使用逗号分隔开来,例如 1,"test" ,如果没有构造函数,就填写一个字符# -fee_limit:本次部署合约消耗的TRX的上限,单位是SUN(1 SUN = 10^-6 TRX),包括CPU资源、STORAGE资源和可用余额的消耗 -consume_user_resource_percent:指定的使用该合约用户的资源占比,是[0, 100]之间的整数。如果是0,则表示用户不会消耗资源。如果开发者资源消耗完了,才会完全使用用户的资源。 -value:在部署合约时,给该合约转账金额,使用十六进制32位表示 -library:address,library:address,...:如果合约包含library,则需要在部署合约的时候指定library的地址,具体见下文;没有library的话则不需要填写。 - -# 运行例子 -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 -部署成功会显示Deploy the contract successfully -``` - -得到合约的地址 - -``` -Your smart contract address will be: <合约地址> - -# 在本例中 -Your smart contract address will be: TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 -``` - -调用合约存储数据、查询数据 - -``` -Shell -# 调用合约指令 -triggercontract - -# 参数说明 -contract_address:即之前部署过合约的地址,格式 base58,如:TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 -method:调用的函数签名,如set(uint256,uint256)或者 fool(),参数使用','分割且不能有空格 -args:如果非十六进制,则自然输入使用','分割且不能有空格,如果是十六进制,直接填入即可 -is_hex:输入参数是否为十六进制,false 或者 true -fee_limit:和deploycontract的时候类似,表示本次部署合约消耗的TRX的上限,单位是SUN(1 SUN = 10^-6 TRX),包括CPU资源、STORAGE资源和可用余额的消耗。 -value:在部署合约时,给该合约转账金额,使用十六进制32位表示 - -# 调用的例子 -## 设置 mapping 1->1 -triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256,uint256) 1,1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000 - -## 取出 mapping key = 1的 value -triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 get(uint256) 1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000 -``` - -如果调用的函数是 constant 或 view,wallet-cli 将会直接返回结果 - -如果包含library,则需要在部署合约之前先部署library,部署完library之后,知道了library地址,将地址填进library:address,library:address,... - -``` -# 比如使用remix生成的合约,bytecode是 -608060405234801561001057600080fd5b5061013f806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f75dac5a14610046575b600080fd5b34801561005257600080fd5b5061005b610071565b6040518082815260200191505060405180910390f35b600073__browser/oneLibrary.sol.Math3__________<\b>634f2be91f6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156100d357600080fd5b505af41580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b81019080805190602001909291905050509050905600a165627a7a7230582052333e136f236d95e9d0b59c4490a39e25dd3a3dcdc16285820ee0a7508eb8690029 -``` - -之前部署的library地址是:TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 -那么部署的时候,需要将 browser/oneLibrary.sol.Math3:TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 作为deploycontract的参数。 - -# 6 内置合约以及API说明 -## 6.1 内置合约说明 -请参考: - -https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E4%BA%A4%E6%98%93%E6%93%8D%E4%BD%9C%E7%B1%BB%E5%9E%8B%E8%AF%B4%E6%98%8E.md - -## 6.2 gRPC 接口说明 -请参考: - -https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md - -## 6.3 http 接口说明 -请参考: - -https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-http.md - -# 7 Tron TRC10 token说明 -TRON网络支持2种token,一种是通过智能合约发行的TRC20协议的token,一种是通过Tron公链内置的TRC10 token。 - -下面对TRC10 token进行说明。 -## 7.1 如何发行TRC10 token -[grpc接口](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md#7-%E9%80%9A%E8%AF%81%E5%8F%91%E8%A1%8C) - -http接口: - -wallet/createassetissue -作用:发行Token -demo:curl -X POST http://127.0.0.1:8090/wallet/createassetissue -d '{ -"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"name":"0x6173736574497373756531353330383934333132313538", -"abbr": "0x6162627231353330383934333132313538", -"total_supply" :4321, -"trx_num":1, -"num":1, -"precision":1, -"start_time" : 1530894315158, -"end_time":1533894312158, -"description":"007570646174654e616d6531353330363038383733343633", -"url":"007570646174654e616d6531353330363038383733343633", -"free_asset_net_limit":10000, -"public_free_asset_net_limit":10000, -"frozen_supply":{"frozen_amount":1, "frozen_days":2} -}' -参数说明: -owner_address发行人地址;name是token名称;abbr是token简称;total_supply是发行总量;trx_num和num是token和trx的兑换价值;precision是精度,也就是小数点个数;start_time和end_time是token发行起止时间;description是token说明,需要是hexString格式;url是token发行方的官网,需要是hexString格式;free_asset_net_limit是Token的总的免费带宽;public_free_asset_net_limit是每个token拥护者能使用本token的免费带宽;frozen_supply是token发行者可以在发行的时候指定冻结的token -返回值:发行Token的Transaction -【注意】 -- 当前不支持precision,也就是说,目前的precision默认为0。只有当委员会通过AllowSameTokenName提议后,才允许设置精度。 -- 当前不支持token重名。只有当委员会通过AllowSameTokenName提议后,才允许发行相同名字的token。 - -## 7.2 参与TRC10 token -[grpc接口](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md#12-%E5%8F%82%E4%B8%8E%E9%80%9A%E8%AF%81%E5%8F%91%E8%A1%8C) - -http接口: - -wallet/participateassetissue -作用:参与token发行 -demo:curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ -"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"amount":100, -"asset_name":"3230313271756265696a696e67" -}' -参数说明: -to_address是Token发行人的地址,需要是hexString格式 -owner_address是参与token人的地址,需要是hexString格式 -amount是参与token的数量 -asset_name是token的名称,需要是hexString格式 -返回值:参与token发行的transaction - -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -## 7.3 TRC10 token转账 -[grpc接口](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md#11) - -http接口: - -wallet/transferasset -作用:转账Token -demo:curl -X POST http://127.0.0.1:8090/wallet/transferasset -d '{ - "owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", - "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", - "asset_name": "0x6173736574497373756531353330383934333132313538", - "amount": 100 -}' -参数说明: - owner_address是token转出地址,需要是hexString格式; - to_address是token转入地址,需要是hexString格式; - asset_name是token名称,需要是hexString格式; - amount是token转账数量 -返回值:token转账的Transaction -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -# 8 Tron资源(Resource)模型 -## 8.1 资源模型介绍 - -TRON网络中的资源有4种:带宽,CPU,存储和内存。得益于波场独有的内存模型,TRON网络中的内存资源几乎是无限的。 -TRON网络引入了Bandwidth point 和 Energy 两种资源概念。其中Bandwidth Point表示带宽资源,Energy表示CPU和存储资源。 -**注意** -- 普通交易仅消耗Bandwidth points -- 智能合约的操作不仅要消耗Bandwidth points,还会消耗Energy - -## 8.2 Bandwidth Points - - -交易以字节数组的形式在网络中传输及存储,一条交易消耗的Bandwidth Points = 交易字节数 * Bandwidth Points费率。当前Bandwidth Points费率 = 1。 - -如一条交易的字节数组长度为200,那么该交易需要消耗200 Bandwidth Points。 - -**注意** 由于网络中总冻结资金以及账户的冻结资金随时可能发生变化,因此账户拥有的Bandwidth Points不是固定值。 - -### 8.2.1 Bandwidth PointsBandwidth Points的来源 - -Bandwidth Points的获取分两种: - -- 一种是通过冻结TRX获取的Bandwidth Points, 额度 = 为获取Bandwidth Points冻结的TRX / 整个网络为获取Bandwidth Points冻结的TRX 总额 * 43_200_000_000。 -也就是所有用户按冻结TRX平分固定额度的Bandwidth Points。 - -- 还有一种是每个账号每天有固定免费额度的带宽,为5000。 - -### 8.2.2 Bandwith Points的消耗 - -除了查询操作,任何交易都需要消耗bandwidth points。 - -还有一种情况,如果是转账,包括普通转账或发行Token转账,如果目标账户不存在,转账操作则会创建账户并转账,只会扣除创建账户消耗的Bandwidth Points,转账不会再消耗额外的Bandwidth Points。 - -### 8.2.3 Bandwidth Points的计算规则 - -Bandwidth Points是一个账户1天内能够使用的总字节数。一定时间内,整个网络能够处理的Bandwidth为确定值。 - -如果交易需要创建新账户,Bandwidth Points消耗如下: - - 1、尝试消耗交易发起者冻结获取的Bandwidth Points。如果交易发起者Bandwidth Points不足,则进入下一步。 - - 2、尝试消耗交易发起者的TRX,这部分烧掉0.1TRX。 - -如果交易是发行Token转账,Bandwidth Points消耗如下: - - 1、依次验证 发行Token资产总的免费Bandwidth Points是否足够消耗,转账发起者的Token剩余免费Bandwidth Points是否足够消耗, - Token发行者冻结TRX获取Bandwidth Points剩余量是否足够消耗。如果满足则扣除Token发行者的Bandwidth Points,任意一个不满足则进入下一步。 - - 2、尝试消耗交易发起者冻结获取的Bandwidth Points。如果交易发起者Bandwidth Points不足,则进入下一步。 - - 3、尝试消耗交易发起者的免费Bandwidth Points。如果免费Bandwidth Points也不足,则进入下一步。 - - 4、尝试消耗交易发起者的TRX,交易的字节数 * 10 sun。 - -如果交易普通交易,Bandwidth Points消耗如下: - - 1、尝试消耗交易发起者冻结获取的Bandwidth Points。如果交易发起者Bandwidth Points不足,则进入下一步。 - - 2、尝试消耗交易发起者的免费Bandwidth Points。如果免费Bandwidth Points也不足,则进入下一步。 - - 3、尝试消耗交易发起者的TRX,交易的字节数 * 10 sun。 - -### 8.2.4 带宽的自动恢复 -在网络总锁定资金以及账户锁定资金不变的情况向,账户的带宽的已使用量随着时间增加而按比例衰减,24h衰减到0。如时间T1时刻,账户带宽已使用量为U,到T1+12h,账户再次使用带宽u,此时账户已使用带宽为 U/2 + u。具体公式如下: - -![image](https://github.com/tronprotocol/Documentation/blob/fix_http/TRX_CN/figures/bandwidthRestoreEqn.gif) - -即可以理解为每24h,用户已使用的带宽值重置为0。 - -## 8.3 Energy -[5.3 Energy介绍](#5.3 Energy介绍) - -## 8.4 资源委托(resource delegate) -在TRON中,一个账户可以通过冻结TRX来获取带宽和能量。同时,也可以把冻结TRX获取的带宽或者能量委托(delegate)给其他地址。 -此时,主账号拥有冻结的TRX以及相应的投票权,受委托账户拥有冻结获取的资源(带宽或者能量)。 -和普通冻结一样,委托资源也至少冻结3天。 -资源委托的命令如下: -` - freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 ENERGY] [receiverAddress] -` -其中frozen_balance是冻结的TRX数量(单位为sun),frozen_duration为冻结的天数(目前固定为3天), -ResourceCode表示要获取的资源是带宽还是能量,receiverAddress表示受委托账户的地址 -【注意】资源委托功能需要委员会开启 - - -## 8.5 其他交易费 - -|交易类型|费用| -| :------|:------:| -|创建witness|9999TRX| -|发行token|1024TRX| -|创建account|0.1TRX| -|创建exchange|1024TRX| - -# 9 去中心化交易所(DEX)说明 - -## 9.1 什么是交易对 -TRON网络原生支持去中心化交易所(DEX)。去中心化交易所由多个交易对构成。一个交易对(Exchange)是token与token之间,或者token与TRX之间的交易市场(Exchange Market)。 -任何账户都可以创建任何token之间的交易对,即使TRON网络中已经存在相同的交易对。交易对的买卖与价格波动遵循Bancor协议。 -TRON网络规定,所有交易对中的两个token的权重相等,因此它们数量(balance)的比率即是它们之间的价格。 -举一个简单的例子,假设一个交易对包含ABC和DEF两种token,ABC的balance为1000万,DEF的balance为100万,由于权重相等,因此10 ABC = 1 DEF,也就是说,当前ABC对于DEF的价格为10ABC/DEF。 - -## 9.2 创建交易对 -任何账户都可以创建任何token之间的交易对。创建交易对的手续费是1024TRX,这个手续费会被TRON网络烧掉。 -创建交易对相当于为该交易对注入(inject)原始资本,因此创建者账户中要拥有该交易对的初始balance。当创建成功后,会立即从创建者账户中扣除这两个token的balance。 -创建交易对的合约是ExchangeCreateContract,该合约有4个参数: -- first_token_id,第1种token的id -- first_token_balance,第1种token的balance -- second_token_id,第2种token的id -- second_token_balance,第2种token的balance - -其中token的id由token的name得到,具体概念请参见token发行相关部分的文档。如果交易对中包含TRX,则使用"_"表示TRX的id。需要注意的是,TRX的单位是sun,即10-6 TRX。 -例子: -` -ExchangeCreate abc 10000000 _ 1000000000000 -` -该交易会创建abc与TRX之间的交易对,初始balance分别为10000000个abc和1000000000000 sun(1000000TRX), -如果创建者没有足够的abc和TRX,则交易对创建失败;否则创建者账户中立即扣除相应的abc和TRX,交易对创建成功,可以开始交易。 - -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -## 9.3 交易 -任何账户都可以在任何交易对中进行交易。交易量和价格完全遵循Bancor协议。也就是说,一个账户在交易时,交易的对象是exchange。交易是即时的,不需要挂单和抢单,只要有足够的token,就可以交易成功。 -交易的合约是ExchangeTransactionContract,该合约有3个参数: - - exchange_id,交易对的id,TRON网络会根据交易对创建时间顺序给每个交易对唯一的id - - token_id,要卖出的token的id - - quant,要卖出的token的金额 - - expected,期望得到的另一个token的最小金额。如果小于此数值,交易不会成功 - -例子: -我们在刚刚创建的abc与TRX的交易对中进行交易,假设此交易对id为1,当前交易对中abc balance为10000000,TRX balance为1000000,如果期望花100个TRX买到至少990个abc,则 -` -ExchangeTransaction 1 _ 100 990 -` -其中"_"表示TRX,即向交易对卖出100个TRX。如果成功,该交易会使得交易对中增加100个TRX,并根据Bancor协议计算出减少的abc的数量,交易对创建者的账户中abc和TRX的数量会相应地增加和减少。 - -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -## 9.4 注资 -当一个交易对其中1种token的balance很小时,只需要很小的交易量就会造成很大的价格波动,这不利于正常交易。为了避免这种情况,该交易对的创建者可以选择向该交易对注资(inject)。 -一个交易对只能由该交易对的创建者来注资。注资不需要手续费。 -注资需要指定一种token以及注资金额,TRON网络会自动根据当前交易对中两种token的比例,计算出另一个token所需的金额,从而保证注资前后,交易对中两个token的比例相同,价格没有变化。 -与创建交易对相同,注资要求创建者拥有足够多的两种token的balance。 -注资的合约是ExchangeInjectContract,该合约有3个参数: - - - exchange_id,交易对的id - - token_id,要注资的token的id - - quant,要注资的token的金额 - -例子: -我们对刚刚创建的abc与TRX的交易对进行注资,假设此交易对id为1(TRON网络中第1个交易对),当前交易对中abc balance为10000000,TRX balance为1000000,如果要增加10%的abc,则 -` -ExchangeInject 1 abc 1000000 -` -如果成功,该交易会使得交易对中增加1000000个abc,并增加100000个TRX,交易对创建者的账户中abc和TRX的数量会相应地减少。 - -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -## 9.5 撤资 -一个交易对中的所有资产都是创建者的。创建者可以随时撤资(withdraw),把交易对中的token赎回到自身账户中。一个交易对只能由该交易对的创建者来撤资。撤资不需要手续费。 -和注资一样,撤资需要指定一种token以及撤资金额,TRON网络会自动根据当前交易对中两种token的比例,计算出另一个token撤资的金额,从而保证撤资前后,交易对中两个token的比例相同,价格没有变化。 -【风险提示】撤资前后价格没有变化,但是价格波动会更大 -撤资的合约是ExchangeWithdrawContract,该合约有3个参数: - - exchange_id,交易对的id - - token_id,要撤资的token的id - - quant,要撤资的token的金额 - -例子: -我们对之前创建的abc与TRX的交易对进行撤资,假设此交易对id为1,当前交易对中abc balance为10000000,TRX balance为1000000,如果要赎回10%的abc,则 -` -ExchangeWithdraw 1 abc 1000000 -` -如果成功,该交易会使得交易对中减少1000000个abc,以及减少100000个TRX,交易对创建者的账户中abc和TRX的数量会相应地增加。 - -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -## 9.6 查询 -### 9.6.1 查询交易 -有三个查询交易对的接口,包括:查询所有交易对信息(ListExchanges)、分页查询交易对信息(GetPaginatedExchangeList)(Odyssey-v3.1.1暂不支持),查询指定交易对信息(GetExchangeById)。 -相关api详情,请查询[波场RPC-API说明]。 - -https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md#64-%E6%9F%A5%E8%AF%A2%E6%8C%87%E5%AE%9A%E4%BA%A4%E6%98%93%E5%AF%B9 - -### 9.6.2 计算当前价格 -交易中token的当前价格信息的计算过程:\ -假设 first_token 当前的价格为 100 Sun,first_token_balance 为1000_000,second_token_balance 为2000_000,\ -second_token 当前的价格为 first_token*first_token_balance/second_token_balance = 50 Sun \ -first_token的价格可有"first_token&&TRX"交易对计算获得。 - -### 9.6.3 计算交易获得token量 -交易中花费first_token置换获得的second_token的数量的计算过程:\ -假设 sellTokenQuant是要卖出的first_token的金额,buyTokenQuant是要买入的second_token的金额。 - -supply = 1_000_000_000_000_000_000L;\ -supplyQuant = -supply * (1.0 - Math.pow(1.0 + (double) sellTokenQuant/(firstTokenBalance + sellTokenQuant), 0.0005)); \ -buyTokenQuant = (long)balance * (Math.pow(1.0 + (double) supplyQuant / supply, 2000.0) - 1.0); - -注意:由于网络其他账户发生交易,价格可能发生变化。 - -相关api详情,请查询[Tron-http](Tron-http.md)。 - -# 10 钱包介绍 -## 10.1 wallet-cli功能介绍 -请参考: - - https://github.com/tronprotocol/wallet-cli/blob/master/README.md - -## 10.2 计算交易ID - -对交易的RawData取Hash。 -``` -Hash.sha256(transaction.getRawData().toByteArray()) - -``` -## 10.3 计算blockID -block id是块高度和块头raw_data的hash的混合,具体是计算出块头中raw_data的hash。用 - 块的高度替换该hash中的前8个byte。具体代码如下: -``` -private byte[] generateBlockId(long blockNum, byte[] blockHash) {
 - byte[] numBytes = Longs.toByteArray(blockNum);
 - byte[] hash = blockHash;
 - System.arraycopy(numBytes, 0, hash, 0, 8);
 - return hash; - 
} -``` - -## 10.4 如何本地构造交易 -根据交易的定义,自己填充交易的各个字段,本地构造交易。需要注意是交易里面需要设置refference block信息和Expiration信息,所以在构造交易的时候需要连接mainnet。建议设置refference block为fullnode上面的最新块,设置Expiration为最新块的时间加N分钟。N的大小根据需要设定,后台的判断条件是(Expiration > 最新块时间 and Expiration < 最新块时时 + 24小时),如果条件成立则交易合法,否则交易为过期交易,不会被mainnet接收。 refference block 的设置方法:设置RefBlockHash为最新块的hash的第8到16(不包含)之间的字节,设置BlockBytes为最新块高度的第6到8(不包含)之间的字节,代码如下: -``` -public static Transaction setReference(Transaction transaction, Block newestBlock) { - long blockHeight = newestBlock.getBlockHeader().getRawData().getNumber(); - byte[] blockHash = getBlockHash(newestBlock).getBytes(); - byte[] refBlockNum = ByteArray.fromLong(blockHeight); - Transaction.raw rawData = transaction.getRawData().toBuilder() - .setRefBlockHash(ByteString.copyFrom(ByteArray.subArray(blockHash, 8, 16))) - .setRefBlockBytes(ByteString.copyFrom(ByteArray.subArray(refBlockNum, 6, 8))) - .build(); - return transaction.toBuilder().setRawData(rawData).build(); - } -``` -Expiration 和交易时间戳的设置方法: -``` -public static Transaction createTransaction(byte[] from, byte[] to, long amount) { - Transaction.Builder transactionBuilder = Transaction.newBuilder(); - Block newestBlock = WalletClient.getBlock(-1); - - Transaction.Contract.Builder contractBuilder = Transaction.Contract.newBuilder(); - Contract.TransferContract.Builder transferContractBuilder = Contract.TransferContract - .newBuilder(); - transferContractBuilder.setAmount(amount); - ByteString bsTo = ByteString.copyFrom(to); - ByteString bsOwner = ByteString.copyFrom(from); - transferContractBuilder.setToAddress(bsTo); - transferContractBuilder.setOwnerAddress(bsOwner); - try { - Any any = Any.pack(transferContractBuilder.build()); - contractBuilder.setParameter(any); - } catch (Exception e) { - return null; - } - contractBuilder.setType(Transaction.Contract.ContractType.TransferContract); - transactionBuilder.getRawDataBuilder().addContract(contractBuilder) - .setTimestamp(System.currentTimeMillis())//交易时间戳设置毫秒形式 - .setExpiration(newestBlock.getBlockHeader().getRawData().getTimestamp() + 10 * 60 * 60 * 1000);//交易所可以根据实际情况设置超时时间 - Transaction transaction = transactionBuilder.build(); - Transaction refTransaction = setReference(transaction, newestBlock); - return refTransaction; - } -``` -## 10.5 相关demo - -本地构造交易、签名的demo请参考 - - -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java - -nodejs的demo,具体请参考 - -https://github.com/tronprotocol/tron-demo/tree/master/demo/nodejs diff --git a/TRX_CN/Tron-eventsubscribe_CN.md b/TRX_CN/Tron-eventsubscribe_CN.md deleted file mode 100644 index 3a01aeb4..00000000 --- a/TRX_CN/Tron-eventsubscribe_CN.md +++ /dev/null @@ -1,27 +0,0 @@ -# 波场事件订阅机制 -## 1. 项目背景 -为了更好支持开发者社区,波场正式推出事件订阅机制,已完成内部测试,随Java-tron 3.5版本正式上线。现阶段为beta版,开发者们可以开始体验了。 - -## 2. 主要功能: -1. 事件plugin的支持,目前已支持kafka、mongodb两种插件,开发者也可以根据自己的需求定制自己的事件插件。 -2. 支持block、transaction、contract log、contract event等链上数据的订阅。对于transaction event,开发者可以获取internal transaction、contract等信息;对于contract event,开发者可以配置contract address列表或者contract topic列表,只接收自己感兴趣的events,并且event订阅具有较低的时延,fullnode执行合约后便可以收到event信息。 -3. 事件查询服务tron-eventquery,波场提供的线上Event查询服务,开发者可通过http方式查询最近七天的trigger信息,查询地址为: https://api.tronex.io。 - -## 3. github项目 -- [java-tron](https://github.com/tronprotocol/java-tron) develop分支 (目前为3.5 beta版本) -- [eventplugin](https://github.com/tronprotocol/event-plugin) master分支 -- [tron-eventquery](https://github.com/tronprotocol/tron-eventquery) master分支 - -## 4. event subscribe -- https://github.com/tronprotocol/TIPs/issues/12 - -## 5. event plugin -- kafka plugin: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/eventplugin_deploy.md - -- mongodb plugin: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/mongodb_deploy.md - -## 6. tron-eventquery -### Deploy -- https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/tron-eventquery_deploy.md -### Http API -- https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md diff --git a/TRX_CN/Tron-exchange.md b/TRX_CN/Tron-exchange.md deleted file mode 100644 index 72043efd..00000000 --- a/TRX_CN/Tron-exchange.md +++ /dev/null @@ -1,41 +0,0 @@ -# Tron公链与交易所对接方案 -交易所与tron公链对接,建议遵循如下方案: - -# 1. 节点部署 - -1.1 下载最新release代码 https://github.com/tronprotocol/java-tron/releases - -1.2 部署fullnode和solidity node,solidity node连接本地的fullnode。请参考 https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-overview.md#3-%E8%8A%82%E7%82%B9%E8%BF%90%E8%A1%8C - -# 2. 对接需求开发 - -2.1 根据交易所的具体业务需求,使用tron提供的api,连接本地的fullnode和solidity node实现对接过程。api说明请参考https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-overview.md#4-tron-api%E8%AF%B4%E6%98%8E - -请注意:使用gRPC的的api,禁止使用grpc-gateway进行功能开发。grpc-gateway可以作为调试程序用,方便查看区块链数据。grpc-gateway部署方式请参照:https://github.com/tronprotocol/grpc-gateway/blob/master/README.md - -# 3. 测试 - -建议6月18号之前完成与tron公链的对接测试,可以直接在mainnet上进行测试。 - -相关技术文档,可以参阅https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-overview.md - - -# 4. 一般部署 - -![一般部署](https://github.com/tronprotocol/Documentation/blob/feature/add_node_deployment_diagram/TRX_CN/figures/General_node_deployment_diagram.png) - -# 5. 安全部署 -需要提供生成公私钥地址、交易签名等方法时,建议采用安全部署方式。 - -![安全部署](https://github.com/tronprotocol/Documentation/blob/feature/add_node_deployment_diagram/TRX_CN/figures/Secure_node_deployment_diagram.png) - - -# 6. 充值流程 - -![充值流程](https://github.com/tronprotocol/Documentation/blob/feature/add_node_deployment_diagram/TRX_CN/figures/Recharge_process.png) - - -# 7. 提现流程 - -![提现流程](https://github.com/tronprotocol/Documentation/blob/feature/add_node_deployment_diagram/TRX_CN/figures/Withdrawal_process.png) - diff --git a/TRX_CN/Tron-http.md b/TRX_CN/Tron-http.md deleted file mode 100644 index 84c6af16..00000000 --- a/TRX_CN/Tron-http.md +++ /dev/null @@ -1,707 +0,0 @@ -# TRON内置http接口说明 -# hexString和base58check转码demo -java: -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92 - -php: -https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php - -# SolidityNode接口说明 - -solidityNode默认的http端口是8091,启动solidityNode的时候会同时启动http服务。 -``` -/walletsolidity/getaccount -作用:查询一个账号的信息 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}' -参数说明:address 需要转为hexString -返回值:Account对象 - -/walletsolidity/listwitnesses -作用:查询超级代表列表 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/listwitnesses -参数说明: -返回值:所有超级代表列表 - -/walletsolidity/getassetissuelist -作用:查询所有Token列表 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelist -参数说明: -返回值:所有Token列表 - -/walletsolidity/getpaginatedassetissuelist -作用:分页查询Token列表 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getpaginatedassetissuelist -d '{"offset": 0, "limit":10}' -参数说明:offset是起始Token的index,limit是期望返回的Token数量 -返回值:Token列表 - -/walletsolidity/getassetissuebyname(Odyssey-v3.2开始支持) -作用:根据名称查询token。 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuebyname -d '{"value": "44756354616E"}' -参数说明:通证名称,格式为hexString。 -返回值:token。 -注意:Odyssey-v3.2开始,推荐使用getassetissuebyid或者getassetissuelistbyname替换此接口,因为从3.2开始将允许通证名称相同。如果存在相同的通证名称,此接口将会报错。 - -/walletsolidity/getassetissuelistbyname(Odyssey-v3.2开始支持) -作用:根据名称查询token list。 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelistbyname -d '{"value": "44756354616E"}' -参数说明:通证名称,格式为hexString。 -返回值:token列表。 - -/walletsolidity/getassetissuebyid(Odyssey-v3.2开始支持) -作用:根据id查询token。 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuebyid -d '{"value": "1000001"}' -参数说明:通证id,格式为String。 -返回值:token。 - -/walletsolidity/getnowblock -作用:查询最新block -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getnowblock -参数说明: -返回值:solidityNode上的最新block - -/walletsolidity/getblockbynum -作用:按照高度查询block -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbynum -d '{"num" : 100}' -参数说明:num是块的高度 -返回值:指定高度的block - -/walletsolidity/gettransactionbyid -作用:根据id查询交易 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactionbyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' -参数说明:value是交易id,需要是hexString -返回值:指定ID的Transaction - -/walletsolidity/gettransactioncountbyblocknum(Odyssey-v3.2开始支持) -作用:查询特定block上transaction的个数 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioncountbyblocknum -d '{"num" : 100}' -参数说明:num是块的高度. -返回值e:transaction的个数. - -/walletsolidity/gettransactioninfobyid -作用:根据id查询交易的fee,所在的block -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' -参数说明:value是交易id,需要是hexString -返回值:Transaction的交易fee,所在block的高度,创建时间 - -/walletsolidity/getdelegatedresource(Odyssey-v3.2开始支持) -作用:查看一个账户代理给另外一个账户的资源情况 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdelegatedresource -d ' -{ -"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9", -"toAddress": "41c6600433381c731f22fc2b9f864b14fe518b322f" -}' -参数说明: -fromAddress:是要查询的账户地址,hexString格式 -toAddress:代理对象的账户地址,hexString格式 -返回值:账户的资源代理的列表,列表的元素为DelegatedResource - -/walletsolidity/getdelegatedresourceaccountindex(Odyssey-v3.2开始支持) -作用:查看一个账户的资源代理情况 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdelegatedresourceaccountindex -d ' -{ -"value": "419844f7600e018fd0d710e2145351d607b3316ce9", -}' -参数说明: -value:是要查询的账户地址,hexString格式 -返回值:账户的DelegatedResourceAccountIndex - -/walletsolidity/getexchangebyid(Odyssey-v3.2开始支持) -作用:根据id查询交易对 -demo:curl -X POST http://127.0.0.1:8091/walletsolidity/getexchangebyid -d {"id":1} -参数说明: -id:交易对id -返回值:交易对 - -/walletsolidity/listexchanges(Odyssey-v3.2开始支持) -作用:查询所有交易对 -demo:curl -X POST http://127.0.0.1:8091/walletsolidity/listexchanges -参数说明: -返回值:所有交易对 - -/walletextension/gettransactionsfromthis(新版本将不再支持) -作用:查询某个账号的出账交易记录 -demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionsfromthis -d '{"account" : {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10}' -参数说明:address是账号地址,需要是hexString格式;offset是起始交易的index;limit是期望返回的交易数量 -返回值:Transaction列表 -备注:该接口在新版本节点中将不再提供,如需要该功能,可以使用中心节点提供的接口,47.90.247.237:8091/walletextension/gettransactionsfromthis, - 使用参考getTransactionsFromThis。 - -/walletextension/gettransactionstothis(新版本将不再支持) -作用:查询某个账号的入账交易记录 -demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionstothis -d '{"account" : {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10}' -参数说明:address是账号地址,需要是hexString格式;offset是起始交易的index;limit是期望返回的交易数量 -返回值:Transaction列表 -备注:该接口在新版本节点中将不再提供,如需要该功能,可以使用中心节点提供的接口,47.90.247.237:8091/walletextension/gettransactionstothis, - 使用参考getTransactionsToThis。 - -/wallet/getnodeinfo(Odyssey-v3.2开始支持) -作用:获取当前node的信息 -demo: curl -X GET http://127.0.0.1:8091/wallet/getnodeinfo -参数说明:无 -返回值:当前节点的信息NodeInfo -``` - -# FullNode接口说明 -FullNode默认的http端口是8090,启动FullNode的时候会同时启动http服务。 - -``` - -wallet/createtransaction -作用: 创建一个转账的Transaction,如果转账的to地址不存在,则在区块链上创建该账号 -demo: curl -X POST http://127.0.0.1:8090/wallet/createtransaction -d '{"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount": 1000 }' -参数说明:to_address是转账转入地址,需要转为hexString;owner_address是转账转出地址,需要转为hexString;amount是转账数量 -返回值:转账合约 - -/wallet/gettransactionsign -作用:对交易签名,该api有泄漏private key的风险,请确保在安全的环境中调用该api -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactionsign -d '{ -"transaction" : {"txID":"454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8","raw_data":{"contract":[{"parameter":{"value":{"amount":1000,"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0","to_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"267e","ref_block_hash":"9a447d222e8de9f2","expiration":1530893064000,"timestamp":1530893006233}}, "privateKey": "your private key" -}' -参数说明:transaction是通过http api创建的合约,privateKey是用户private key -返回值:签名之后的transaction - -wallet/broadcasttransaction -作用:对签名后的transaction进行广播 -demo:curl -X POST http://127.0.0.1:8090/wallet/broadcasttransaction -d '{"signature":["97c825b41c77de2a8bd65b3df55cd4c0df59c307c0187e42321dcc1cc455ddba583dd9502e17cfec5945b34cad0511985a6165999092a6dec84c2bdd97e649fc01"],"txID":"454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8","raw_data":{"contract":[{"parameter":{"value":{"amount":1000,"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0","to_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"267e","ref_block_hash":"9a447d222e8de9f2","expiration":1530893064000,"timestamp":1530893006233}}' -参数说明:签名之后的Transaction -返回值:广播是否成功 - -wallet/updateaccount -作用:修改账号名称 -demo:curl -X POST http://127.0.0.1:8090/wallet/updateaccount -d '{"account_name": "0x7570646174654e616d6531353330383933343635353139" ,"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"}' -参数说明:account_name是账号名称,需要是hexString格式;owner_address是要修改名称的账号地址,需要是hexString格式 -返回值:修改名称的Transaction - -wallet/votewitnessaccount -作用:对超级代表进行投票 -demo:curl -X POST http://127.0.0.1:8090/wallet/votewitnessaccount -d '{ -"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", -"votes": [{"vote_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "vote_count": 5}] -}' -参数说明:owner_address是投票人地址,需要是hexString格式;votes.vote_address是被投票的超级代表的地址,需要是hexString格式;vote_count是投票数量 - -wallet/createassetissue -作用:发行Token -demo:curl -X POST http://127.0.0.1:8090/wallet/createassetissue -d '{ -"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"name":"0x6173736574497373756531353330383934333132313538", -"abbr": "0x6162627231353330383934333132313538", -"total_supply" :4321, -"trx_num":1, -"num":1, -"start_time" : 1530894315158, -"end_time":1533894312158, -"description":"007570646174654e616d6531353330363038383733343633", -"url":"007570646174654e616d6531353330363038383733343633", -"free_asset_net_limit":10000, -"public_free_asset_net_limit":10000, -"frozen_supply":{"frozen_amount":1, "frozen_days":2} -}' -参数说明: -owner_address发行人地址;name是token名称;abbr是token简称;total_supply是发行总量;trx_num和num是token和trx的兑换价值;start_time和end_time是token发行起止时间;description是token说明,需要是hexString格式;url是token发行方的官网,需要是hexString格式;free_asset_net_limit是Token的总的免费带宽;public_free_asset_net_limit是每个token拥护者能使用本token的免费带宽;frozen_supply是token发行者可以在发行的时候指定冻结的token -返回值:发行Token的Transaction - -wallet/updatewitness -作用:修改witness的url -demo:curl -X POST http://127.0.0.1:8090/wallet/updatewitness -d '{ -"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", -"update_url": "007570646174654e616d6531353330363038383733343633" -}' -参数说明:owner_address是创建人地址,需要是hexString格式;update_url是更新的官网的url,需要是hexString格式; - -wallet/createaccount -作用:创建账号,一个已经激活的账号创建一个新账号,需要花费0.1trx -demo:curl -X POST http://127.0.0.1:8090/wallet/createaccount -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "account_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0"}' -参数说明:owner_address是已经激活的账号,需要是hexString格式;account_address是新账号的地址,需要是hexString格式,这个地址需要事先创建好 -返回值:创建账号的Transaction - -wallet/createwitness -作用:申请成为超级代表 -demo:curl -X POST http://127.0.0.1:8090/wallet/createwitness -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "url": "007570646174654e616d6531353330363038383733343633"}' -参数说明:owner_address是申请成为超级代表的账号地址,需要是hexString格式;url是官网地址,需要是hexString格式 -返回值:申请超级代表的Transaction - -wallet/transferasset -作用:转账Token -demo:curl -X POST http://127.0.0.1:8090/wallet/transferasset -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "asset_name": "0x6173736574497373756531353330383934333132313538", "amount": 100}' -参数说明:owner_address是token转出地址,需要是hexString格式;to_address是token转入地址,需要是hexString格式;asset_name是token名称,需要是hexString格式;amount是token转账数量 -返回值:token转账的Transaction -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -wallet/easytransfer -作用:快捷转账,该api存在泄漏密码的风险,请确保在安全的环境中调用该api。调用该api前请先调用createAddress生成地址。 -demo:curl -X POST http://127.0.0.1:8090/wallet/easytransfer -d '{ -"passPhrase": "your password", -"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"amount":100 -}' -参数说明:passPhrase是用户密码,需要是hexString格式;toAddress是转入地址,需要是hexString格式;amount是转账trx数量 -返回值:对应的Transaction和广播是否成功的状态 - -wallet/easytransferasset -作用:快捷转账,该api存在泄漏密码的风险,请确保在安全的环境中调用该api。调用该api前请先调用createAddress生成地址。 -demo:curl -X POST http://127.0.0.1:8090/wallet/easytransferasset -d '{ -"passPhrase": "your password", -"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"assetId": "1000001", -"amount":100 -}' -参数说明:passPhrase是用户密码,需要是hexString格式;toAddress是转入地址,需要是hexString格式;assetId是通证的ID;amount是转账通证数量,单位是通证的最小单位。 -返回值:对应的Transaction和广播是否成功的状态 - -wallet/createaddress -作用:通过密码创建地址,该api存在泄漏密码的风险,请确保在安全的环境中调用该api。 -demo:curl -X POST http://127.0.0.1:8090/wallet/createaddress -d '{"value": "3230313271756265696a696e67"}' -参数说明:value是用户密码,需要是hexString格式 -返回值:一个地址 - - -wallet/participateassetissue -作用:参与token发行 -demo:curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ -"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"amount":100, -"asset_name":"3230313271756265696a696e67" -}' -参数说明: -to_address是Token发行人的地址,需要是hexString格式 -owner_address是参与token人的地址,需要是hexString格式 -amount是参与token的数量 -asset_name是token的名称,需要是hexString格式 -返回值:参与token发行的transaction -【注意】 -- 当前的asset_name为token名称。当委员会通过AllowSameTokenName提议后asset_name改为token ID的String类型。 - -wallet/freezebalance -作用:冻结trx,获取带宽,获取投票权 -demo:curl -X POST http://127.0.0.1:8090/wallet/freezebalance -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"frozen_balance": 10000, -"frozen_duration": 3, -"resource" : "BANDWIDTH", -"receiveraddress":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" -}' -参数说明: -owner_address是冻结trx账号的地址,需要是hexString格式 -frozen_balance是冻结trx的数量 -frozen_duration是冻结天数,最少是3天 -resource: 冻结trx获取资源的类型(可以是BANDWIDTH或者ENERGY,BANDWIDTH为带宽,ENERGY为虚拟机消耗资源) -receiverAddress表示受委托账户的地址 -返回值:冻结trx的transaction -【注意】资源委托功能需要委员会开启 - -wallet/unfreezebalance -作用:解冻已经结束冻结期的trx,会同时失去这部分trx带来的带宽和投票权 -demo:curl -X POST http://127.0.0.1:8090/wallet/unfreezebalance -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"resource": "BANDWIDTH", -"receiveraddress":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" -}' -参数说明: -owner_address是解冻trx账号的地址,需要是hexString格式 -resource可以是BANDWIDTH或者ENERGY -receiverAddress表示受委托账户的地址 -返回值:解冻trx的transaction -【注意】资源委托功能需要委员会开启 - -walle/unfreezeasset -作用:解冻已经结束冻结期的Token -demo:curl -X POST http://127.0.0.1:8090/wallet/unfreezeasset -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -}' -参数说明: -owner_address是解冻token账号的地址,需要是hexString格式 -返回值:解冻token的transaction - -wallet/withdrawbalance -作用:超级代表提现奖励到balance,每24个小时可以提现一次 -demo:curl -X POST http://127.0.0.1:8090/wallet/withdrawbalance -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -}' -参数说明: -owner_address是提现账号的地址,需要是hexString格式 -返回值:提现Trx的transaction - -wallet/updateasset -作用:修改token信息 -demo:curl -X POST http://127.0.0.1:8090/wallet/updateasset -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"description": "", -"url": "", -"new_limit" : 1000000, -"new_public_limit" : 100 -}' -参数说明: -owner_address是token发行人的地址,需要是hexString格式 -description是token的描述,需要是hexString格式 -url是token发行人的官网地址,需要是hexString格式 -new_limit是token每个持有人能够使用的免费带宽 -new_public_limit是该token全部的免费带宽 -返回值:修改Token信息的transaction - - -wallet/listnodes -作用:查询api所在机器连接的节点。 -demo: curl -X POST http://127.0.0.1:8090/wallet/listnodes -参数说明:无 -返回值:节点列表。 - -wallet/getassetissuebyaccount -作用:查询账户发行的token。 -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyaccount -d '{"address": "41F9395ED64A6E1D4ED37CD17C75A1D247223CAF2D"}' -参数说明:发行者账户地址,格式为hexString。 -返回值:用户发行的token(一个用户只能发行一个token)。 - -wallet/getaccountnet -作用:查询带宽信息。 -demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountnet -d '{"address": "4112E621D5577311998708F4D7B9F71F86DAE138B5"}' -参数说明:账户地址,格式为hexString。 -返回值:带宽信息。 - -wallet/getassetissuebyname -作用:根据名称查询token。 -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyname -d '{"value": "44756354616E"}' -参数说明:通证名称,格式为hexString。 -返回值:token。 -注意:Odyssey-v3.2开始,推荐使用getassetissuebyid或者getassetissuelistbyname替换此接口,因为从3.2开始将允许通证名称相同。如果存在相同的通证名称,此接口将会报错。 - -wallet/getassetissuelistbyname(Odyssey-v3.2开始支持) -作用:根据名称查询token list。 -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuelistbyname -d '{"value": "44756354616E"}' -参数说明:通证名称,格式为hexString。 -返回值:token列表。 - -wallet/getassetissuebyid(Odyssey-v3.2开始支持) -作用:根据id查询token。 -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyid -d '{"value": "1000001"}' -参数说明:通证id,格式为String。 -返回值:token。 - -wallet/getnowblock -作用:查询最新块。 -demo: curl -X POST http://127.0.0.1:8090/wallet/getnowblock -参数说明:无 -返回值:当前块。 - -wallet/getblockbynum -作用:通过高度查询块 -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbynum -d '{"num": 1}' -参数说明:块高度。 -返回值:块。 - -wallet/getblockbyid -作用:通过ID查询块 -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbyid -d '{"value": "0000000000038809c59ee8409a3b6c051e369ef1096603c7ee723c16e2376c73"}' -参数说明:块ID。 -返回值:块。 - -wallet/getblockbylimitnext -作用:按照范围查询块 -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbylimitnext -d '{"startNum": 1, "endNum": 2}' -参数说明: - startNum:起始块高度,包含此块 - endNum:截止块高度,不包含此此块 -返回值:块的列表。 - -wallet/getblockbylatestnum -作用:查询最新的几个块 -demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbylatestnum -d '{"num": 5}' -参数说明:块的数量。 -返回值:块的列表。 - -wallet/gettransactionbyid -作用:通过ID查询交易 -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactionbyid -d '{"value": "d5ec749ecc2a615399d8a6c864ea4c74ff9f523c2be0e341ac9be5d47d7c2d62"}' -参数说明:交易ID。 -返回值:交易信息。 - -wallet/gettransactioninfobyid(Odyssey-v3.2开始支持) -作用:根据id查询交易的fee,所在的block -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' -参数说明:value是交易id,需要是hexString -返回值:Transaction的交易fee,所在block的高度,创建时间 - -/wallet/gettransactioncountbyblocknum(Odyssey-v3.2开始支持) -作用:查询特定block上transaction的个数 -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioncountbyblocknum -d '{"num" : 100}' -参数说明:num是块的高度. -返回值e:transaction的个数. - -wallet/getaccount -作用:查询一个账号的信息 -demo: curl -X POST http://127.0.0.1:8090/wallet/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}' -参数说明:address 需要转为hexString -返回值:Account对象 - -wallet/listwitnesses -作用:查询所有witness列表 -demo: curl -X POST http://127.0.0.1:8090/wallet/listwitnesses -参数说明:无 -返回值:witness列表。 - -wallet/getassetissuelist -作用:查询所有token列表 -demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuelist -参数说明:无 -返回值:token列表。 - -wallet/getpaginatedassetissuelist -作用:分页查询token列表 -demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedassetissuelist -d '{"offset": 0, "limit": 10}' -参数说明:offset是起始Token的index,limit是期望返回的Token数量 -返回值:token列表。 - -wallet/getpaginatedproposallist(Odyssey-v3.5开始支持) -作用:分页查询proposal列表 -demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedproposallist -d '{"offset": 0, "limit": 10}' -参数说明:offset是起始Token的index,limit是期望返回的Token数量 -返回值:token列表。 - -wallet/getpaginatedexchangelist(Odyssey-v3.2开始支持) -作用:分页查询交易对列表 -demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedexchangelist -d '{"offset": 0, "limit":10}' -参数说明:offset是起始交易对的index,limit是期望返回的交易对数量 -返回值:提案列表 - -wallet/totaltransaction -作用:统计所有交易总数 -demo: curl -X POST http://127.0.0.1:8090/wallet/totaltransaction -参数说明:无 -返回值:交易总数。 - -wallet/getnextmaintenancetime -作用:获取下次统计投票的时间 -demo: curl -X POST http://127.0.0.1:8090/wallet/getnextmaintenancetime -参数说明:无 -返回值:下次统计投票时间的毫秒数。 - -wallet/easytransferbyprivate -作用:快捷转账 -demo: curl -X POST http://127.0.0.1:8090/wallet/easytransferbyprivate -d '{"privateKey": "D95611A9AF2A2A45359106222ED1AFED48853D9A44DEFF8DC7913F5CBA727366", "toAddress":"4112E621D5577311998708F4D7B9F71F86DAE138B5","amount":10000}' -参数说明: - privateKey:私钥,hexString格式 - toAddress:转入账户地址,hexString格式。 - amount:转账的drop数量。 -返回值:交易,含执行结果。 -警告:该api有泄漏private key的风险,请确保在安全的环境中调用该api。 - -wallet/easytransferassetbyprivate -作用:快捷转账 -demo: curl -X POST http://127.0.0.1:8090/wallet/easytransferassetbyprivate -d '{"privateKey": "D95611A9AF2A2A45359106222ED1AFED48853D9A44DEFF8DC7913F5CBA727366", "toAddress":"4112E621D5577311998708F4D7B9F71F86DAE138B5", -"assetId": "1000001", -"amount":10000}' -参数说明: - privateKey:私钥,hexString格式 - toAddress:转入账户地址,hexString格式。 - assetId:通证ID。 - amount:转账的通证数量,单位是通证的最小单位。 -返回值:交易,含执行结果。 -警告:该api有泄漏private key的风险,请确保在安全的环境中调用该api。 - -wallet/generateaddress -作用:生成私钥和地址 -demo: curl -X POST http://127.0.0.1:8090/wallet/generateaddress -参数说明:无 -返回值:地址和私钥 -警告:该api有泄漏private key的风险,请确保在安全的环境中调用该api。 - -wallet/validateaddress -作用:检查地址是否正确 -demo: curl -X POST http://127.0.0.1:8090/wallet/validateaddress -d '{"address": "4189139CB1387AF85E3D24E212A008AC974967E561"}' -参数说明:地址,可以是base58checksum、hexString、base64格式 -返回值:地址正确或者错误 - -wallet/deploycontract -作用:部署合约 -demo: curl -X POST http://127.0.0.1:8090/wallet/deploycontract -d '{"abi":"[{\"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\"}]","bytecode":"608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029","parameter":"","call_value":100,"name":"SomeContract","consume_user_resource_percent":30,"fee_limit":10,"origin_energy_limit": 10,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' -参数说明: -abi:abi -bytecode:bytecode,需要是hexString格式 -parameter:构造函数的参数列表,需要按照ABI encoder编码后转话为hexString格式。如果构造函数没有参数,该参数可以不用设置。 -consume_user_resource_percent:指定的使用该合约用户的资源占比,是[0, 100]之间的整数。如果是0,则表示用户不会消耗资源。如果开发者资源消耗完了,才会完全使用用户的资源。 -fee_limit:最大消耗的SUN(1TRX = 1,000,000SUN) -call_value:本次调用往合约转账的SUN(1TRX = 1,000,000SUN) -owner_address:发起deploycontract的账户地址 -name:合约名 -origin_energy_limit: 创建者设置的,在一次合约执行或创建过程中创建者自己消耗的最大的energy,是大于0的整数 -返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction - -wallet/triggersmartcontract -作用:调用合约 -demo: curl -X POST http://127.0.0.1:8090/wallet/triggercontract -d '{"contract_address":"4189139CB1387AF85E3D24E212A008AC974967E561","function_selector":"set(uint256,uint256)","parameter":"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","fee_limit":10,"call_value":100,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' -参数说明: -contract_address,hexString格式 -function_selector,函数签名,不能有空格 -parameter:调用参数[1,2]的虚拟机格式,使用remix提供的js工具,将合约调用者调用的参数数组[1,2]转化为虚拟机所需要的参数格式 -fee_limit:最大消耗的SUN(1TRX = 1,000,000SUN) -call_value:本次调用往合约转账的SUN(1TRX = 1,000,000SUN) -owner_address:发起triggercontract的账户地址 -返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction - -wallet/getcontract -作用:获取合约 -demo: curl -X POST http://127.0.0.1:8090/wallet/getcontract -d '{"value":"4189139CB1387AF85E3D24E212A008AC974967E561"}' -参数说明: -value:合约地址,hexString格式 -返回值:SmartContract,智能合约的内容 - -wallet/proposalcreate -作用:创建提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/proposalcreate -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9","parameters":[{"key": 0,"value": 100000},{"key": 1,"value": 2}] } -参数说明: -owner_address:创建人地址 -parameters:提案参数 -返回值:创建提案的交易 - -wallet/getproposalbyid -作用:根据id查询提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/getproposalbyid -d {"id":1} -参数说明: -id:提案id -返回值:提案详细信息 - -wallet/listproposals -作用:查询所有提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/listproposals -参数说明:无 -返回值:提案列表信息 - -wallet/proposalapprove -作用:提案批准 -demo: curl -X POST http://127.0.0.1:8090/wallet/proposalapprove -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9", "proposal_id":1, "is_add_approval":true} -参数说明: -owner_address:批准人地址 -proposal_id:提案id -is_add_approval:是否批准 -返回值:批准提案的交易 - -wallet/proposaldelete -作用:删除提案 -demo: curl -X POST http://127.0.0.1:8090/wallet/proposaldelete -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9", "proposal_id":1} -参数说明: -owner_address:删除人的地址,只有提案所有人允许删除提案 -proposal_id:提案id -返回值:删除提案的交易 - -wallet/getaccountresource -作用:查询账户的资源信息 -demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountresource -d {"address" : "419844f7600e018fd0d710e2145351d607b3316ce9"} -参数说明: -address:查询账户的地址 -返回值:账户的资源信息 - -wallet/exchangecreate -作用:创建交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangecreate -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", 、 -"first_token_id":token_a, "first_token_balance":100, "second_token_id":token_b,"second_token_balance":200} -参数说明: -first_token_id :第1种token的id -first_token_balance:第1种token的balance -second_token_id : 第2种token的id -second_token_balance:第2种token的balance -返回值:创建交易对的transaction。 - -wallet/exchangeinject -作用:给交易对注资,注资后可以防止交易对价格波动太大 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangeinject -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100} -参数说明: -owner_address:交易对创建者的地址,hexString格式 -exchange_id:交易对id -token_id: token的id,一般情况是token的name,需要是hexString格式 -quant:注资token的数量 -返回值:注资的transaction。 - -wallet/exchangewithdraw -作用:对交易对撤资,撤资后容易引起交易对价格波动太大。 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangewithdraw -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100} -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -exchange_id:交易对id -token_id: token的id,一般情况是token的name,需要是hexString格式 -quant:撤资token的数量 -返回值:撤资的transaction - -wallet/exchangetransaction -作用:参与交易对交易。 -demo:curl -X POST http://127.0.0.1:8090/wallet/exchangetransaction -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100,"expected":10} -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -exchange_id:交易对id -token_id: 卖出的token的id,一般情况是token的name,需要是hexString格式 -quant:卖出token的数量 -expected:期望买入token的数量 -返回值:token交易的transaction - -wallet/getexchangebyid -作用:根据id查询交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/getexchangebyid -d {"id":1} -参数说明: -id:交易对id -返回值:交易对 - -wallet/listexchanges -作用:查询所有交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/listexchanges -参数说明: -返回值:所有交易对 - -wallet/getchainparameters -作用:查询所有交易对 -demo:curl -X POST http://127.0.0.1:8090/wallet/getchainparameters -参数说明: -返回值:区块链委员会可以设置的所有参数 - -wallet/getnodeinfo(Odyssey-v3.2开始支持) -作用:获取当前node的信息 -demo: curl -X GET http://127.0.0.1:8090/wallet/getnodeinfo -参数说明:无 -返回值:当前节点的信息NodeInfo - -wallet/updatesetting -作用:更新合约的consume_user_resource_percent -demo: curl -X POST http://127.0.0.1:8090/wallet/updatesetting -d '{"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9", "contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f", "consume_user_resource_percent": 7}' -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -contract_address:要修改的合约的地址 -consume_user_resource_percent:指定的使用该合约用户的资源占比 -返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction - -wallet/updateenergylimit -作用:更新合约的origin_energy_limit -demo: curl -X POST http://127.0.0.1:8090/wallet/updatesetting -d '{"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9", "contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f", "origin_energy_limit": 7}' -参数说明: -owner_address:是交易对创建者的地址,hexString格式 -contract_address:要修改的合约的地址 -origin_energy_limit:创建者设置的,在一次合约执行或创建过程中创建者自己消耗的最大的energy -返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction - -wallet/getdelegatedresource(Odyssey-v3.2开始支持) -作用:查看一个账户代理给另外一个账户的资源情况 -demo: curl -X POST http://127.0.0.1:8090/wallet/getdelegatedresource -d ' -{ -"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9", -"toAddress": "41c6600433381c731f22fc2b9f864b14fe518b322f" -}' -参数说明: -fromAddress:是要查询的账户地址,hexString格式 -toAddress:代理对象的账户地址,hexString格式 -返回值:账户的资源代理的列表,列表的元素为DelegatedResource - -wallet/getdelegatedresourceaccountindex(Odyssey-v3.2开始支持) -作用:查看一个账户给哪些账户代理了资源 -demo: curl -X POST http://127.0.0.1:8090/wallet/getdelegatedresourceaccountindex -d ' -{ -"value": "419844f7600e018fd0d710e2145351d607b3316ce9", -}' -参数说明: -value:是要查询的账户地址,hexString格式 -返回值:账户的资源代理概况,结构为DelegatedResourceAccountIndex - -wallet/getnodeinfo(Odyssey-v3.2.2开始支持) -作用:查看节点的信息 -demo: curl http://127.0.0.1:8090/wallet/getnodeinfo -返回值:节点当前状态的相关信息(省略) - -``` diff --git a/TRX_CN/Tron-overview.md b/TRX_CN/Tron-overview.md deleted file mode 100644 index 32ec1d3e..00000000 --- a/TRX_CN/Tron-overview.md +++ /dev/null @@ -1,231 +0,0 @@ -# TRON公链概览 -# 1 TRON总体介绍 -# 1.1项目仓库 -仓库地址:https://github.com/tronprotocol -其中 java-tron是主网代码,protocol是api和数据结构定义。wallet-cli是官方命令行钱包。 -## 1.2 浏览器 -https://tronscan.org -作者是Rovak,github账号 -https://github.com/Rovak -## 1.3 TRON共识算法 -Tpos, 一种改进的Dpos算法。 -## 1.4 TRON出块速度 -当前版本是3秒。 -## 1.5 交易模型 -基于账号模型,目前不支持UTXO模型。TRX的最小单位是Drop,1TRX = 1000000Drop。目前仅支持1对1交易,尚不支持1对n或者n对1转账。 -## 1.6 账号模型 -一个账号对应一个address,转账使用address。当前版本尚未支持多重签名机制。 -在主链上创建账号有三种方式: -``` -a. 使用已经存在的账号创建新账号 -b. 给一个新address转账,会同时创建账号 -c. 给一个新address转Token,会同时创建账号 -``` -# 2 TRON网络结构 -## 2.1 节点类型 -TRON主链网络中有三种类型的节点,分别是witness、fullnode和solidity node。 -其中:witness负责生产块;fullnode 提供api,广播交易和块;solidity node 同步不可回退块,并提供查询api。 -## 2.2 网络部署方式(只针对交易所) -部署一个fullnode,一个solidity node,solidity node连接本地的fullnode,fullnode连接mainnet -## 2.3 关于mainnet和testnet -mainnet浏览器https://tronscan.org -testnet浏览器https://test.tronscan.org -请交易所在testnet上进行测试。 -testnet的配置请参照https://github.com/tronprotocol/TronDeployment/blob/master/test_net_config.conf -mainnet的配置请参考https://github.com/tronprotocol/TronDeployment/blob/master/main_net_config.conf - -# 3 节点运行 -## 3.1 建议硬件配置 -``` -运行FullNode最低配置要求: -CPU:16核 -RAM:32G -带宽:100M -DISK:1T -运行FullNode推荐配置要求: -CPU:64核及以上 -RAM:64G及以上 -带宽:500M及以上 -DISK:20T及以上 - -运行SolidityNode最低配置要求: -CPU:16核 -RAM:32G -带宽:100M -DISK:1T -运行SolidityNode推荐配置要求: -CPU:64核及以上 -RAM:64G及以上 -带宽:500M及以上 -DISK:20T及以上 - -DISK视实际上线后交易量而定,可以预留的大一些 - -``` - -## 3.2 启动fullnode和soliditynode -具体请参考:https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Solidity_and_Full_Node_Deployment_CN.md -同时我们也提供了一键部署的脚本,可以通过该脚本一键部署fullnode和soliditynode,具体请参考https://github.com/tronprotocol/TronDeployment/blob/master/README_CN.md - -# 4 Tron API说明 - 目前Tron推荐使用gRPC接口,同时也支持http接口。 -## 4.1 api定义 - api的定义请参考: -https://github.com/tronprotocol/protocol/blob/master/api/api.proto -## 4.2 api说明 -### 4.2.1 grpc接口说明 -以wallet前缀的api是fullnode提供;以walletSolidity为前缀的api是solidity提供;以walletExtension以前缀的api是solidity提供,且这些api比较耗时。 -Fullnode提供操作区块链的api和查询数据的api,Solidity只提供查询数据的api。Fullnode和Solidity的区别是fullnode当前的数据因为分叉的原因有可能被回退,而solidity上的数据是固化块的数据,不可能被回退。 -具体请参考: -https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md - - -### 4.2.2 http接口说明 - -http 接口我们用两种实现方案 - -a. fullNode和solidityNode内置的http实现,文档请参考 -https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-http.md - -b. 基于grpc-gateway实现,文档请参考 -https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/grpc-gateway-http.md - -我们推荐交易所使用方案a,我们在上面做了很多的优化,比方案b使用起来更加方便。 - -内置http会自动把proto中的bytes字段转换为hexString编码。所以如果输入参数是bytes类型,需要首先转化为hexString编码,再发送请求;如果输出参数是bytes类型,请用hexString解码该参数,再做后续处理。 - -grpc-gateway会自动把proto中的bytes字段转换为base64编码。所以如果输入参数是bytes类型,需要首先转化为base64编码,再发送请求;如果输出参数是bytes类型,请用base64解码该参数,再做后续处理。 - -Tron提供了一个编解码的工具,下载地址是:https://github.com/tronprotocol/tron-demo/raw/master/TronConvertTool.zip - -## 4.3 api代码生成 - api基于google的gRPC协议,具体请参考 https://grpc.io/docs/ -## 4.4 api demo -具体请参考如下class: - -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/walletserver/GrpcClient.java -# 5 相关费用 -在带宽足够的情况下,免除手续费。交易如果扣费,会在交易结果中的fee字段中记录。如果交易不扣费,也就是扣除带宽 -,对应fee字段为0。只有交易被写入区块链之后才会有手续费。fee字段请参考Transaction.Result.fee字段,对应的proto文件是: https://github.com/tronprotocol/protocol/blob/master/core/Tron.proto - -请参考:https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E8%B4%B9%E7%94%A8%E6%A8%A1%E5%9E%8B.md - -# 6 用户地址生成过程 -## 6.1 算法描述 - -+ 首先产生密钥对,取公钥,仅包含x,y坐标的64字节的byte数组。 -+ 对公钥做sha3-256的hash运算。取其最后20字节。测试网在前面填充A0。 -+ 主网地址在前面补41,得到地址的原始格式。长度为21字节。 -+ 做两次sha256计算,取其前4字节得到校验码。 -+ 将校验码附加在地址的原始格式后面,做base58编码,得到base58check格式的地址。测试网地址编码后以27开头,长度为35字节。 -+ 主网地址编码后以T开头,长度34字节。 - -`注意:sha3协议我们使用的是KECCAK-256。` - -## 6.2 Mainnet地址,以41为前缀 - address = 41||sha3[12,32): 415a523b449890854c8fc460ab602df9f31fe4293f - sha256_0 = sha256(address): 06672d677b33045c16d53dbfb1abda1902125cb3a7519dc2a6c202e3d38d3322 - sha256_1 = sha256(sha256_0): 9b07d5619882ac91dbe59910499b6948eb3019fafc4f5d05d9ed589bb932a1b4 - checkSum = sha256_1[0, 4): 9b07d561 - addchecksum = address || checkSum: 415a523b449890854c8fc460ab602df9f31fe4293f9b07d561 - base58Address = Base58(addchecksum): TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW - -## 6.3 java代码demo -请参考:https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/ECKeyDemo.java -# 7 交易签名过程 -请参考: -https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E4%BA%A4%E6%98%93%E7%AD%BE%E5%90%8D%E6%B5%81%E7%A8%8B.md - -# 8 交易id计算过程 -对交易的RawData取Hash。 -``` -Hash.sha256(transaction.getRawData().toByteArray()) -``` - -# 9 block id计算过程 -block id是块高度和块头raw_data的hash的混合,具体是计算出块头中raw_data的hash。用块的高度替换该hash中的前8个byte。具体代码如下: -``` -private byte[] generateBlockId(long blockNum, byte[] blockHash) {
 - byte[] numBytes = Longs.toByteArray(blockNum);
 - byte[] hash = blockHash;
 - System.arraycopy(numBytes, 0, hash, 0, 8);
 - return hash; -
} - -``` -其中blockHash是块头row_data的hash,计算方式如下: -``` -Sha256Hash.of(this.block.getBlockHeader().getRawData().toByteArray()) -``` -# 10 交易的构造、签名 -构造交易有两种方式: -## 1 调用fullnode上的api -根据需要,本地构造相应的Contract,然后对应的api构造交易。具体的合约请参照 https://github.com/tronprotocol/protocol/blob/master/core/Contract.proto -## 2 本地构造 -根据交易的定义,自己填充交易的各个字段,本地构造交易。需要注意是交易里面需要设置refference block信息和Expiration信息,所以在构造交易的时候需要连接mainnet。建议设置refference block为fullnode上面的最新块,设置Expiration为最新块的时间加N分钟。N的大小根据需要设定,后台的判断条件是(Expiration > 最新块时间 and Expiration < 最新块时时 + 24小时),如果条件成立则交易合法,否则交易为过期交易,不会被mainnet接收。 -refference block 的设置方法:设置RefBlockHash为最新块的hash的第8到16(不包含)之间的字节,设置BlockBytes为最新块高度的第6到8(不包含)之间的字节,代码如下: -``` - public static Transaction setReference(Transaction transaction, Block newestBlock) { - long blockHeight = newestBlock.getBlockHeader().getRawData().getNumber(); - byte[] blockHash = getBlockHash(newestBlock).getBytes(); - byte[] refBlockNum = ByteArray.fromLong(blockHeight); - Transaction.raw rawData = transaction.getRawData().toBuilder() - .setRefBlockHash(ByteString.copyFrom(ByteArray.subArray(blockHash, 8, 16))) - .setRefBlockBytes(ByteString.copyFrom(ByteArray.subArray(refBlockNum, 6, 8))) - .build(); - return transaction.toBuilder().setRawData(rawData).build(); - } -``` -Expiration 和交易时间戳的设置方法: -``` - public static Transaction createTransaction(byte[] from, byte[] to, long amount) { - Transaction.Builder transactionBuilder = Transaction.newBuilder(); - Block newestBlock = WalletClient.getBlock(-1); - - Transaction.Contract.Builder contractBuilder = Transaction.Contract.newBuilder(); - Contract.TransferContract.Builder transferContractBuilder = Contract.TransferContract - .newBuilder(); - transferContractBuilder.setAmount(amount); - ByteString bsTo = ByteString.copyFrom(to); - ByteString bsOwner = ByteString.copyFrom(from); - transferContractBuilder.setToAddress(bsTo); - transferContractBuilder.setOwnerAddress(bsOwner); - try { - Any any = Any.pack(transferContractBuilder.build()); - contractBuilder.setParameter(any); - } catch (Exception e) { - return null; - } - contractBuilder.setType(Transaction.Contract.ContractType.TransferContract); - transactionBuilder.getRawDataBuilder().addContract(contractBuilder) - .setTimestamp(System.currentTimeMillis())//交易时间戳设置毫秒形式 - .setExpiration(newestBlock.getBlockHeader().getRawData().getTimestamp() + 10 * 60 * 60 * 1000);//交易所可以根据实际情况设置超时时间 - Transaction transaction = transactionBuilder.build(); - Transaction refTransaction = setReference(transaction, newestBlock); - return refTransaction; - } -``` - -## 10.3 签名 -交易构造好以后,便可以对交易进行签名,签名算法是ECDSA,为了安全起见,建议交易所进行离线签名。签名的说明请参考https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/Procedures_of_transaction_signature_generation.md - -## 10.4 demo -本地构造交易、签名的demo请参考 -https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java - -# 11 demo -当前有nodejs的demo,具体请参考https://github.com/tronprotocol/tron-demo/tree/master/demo/nodejs - -# 12 迁移计划 -波场TRON官方Token – TRX的ERC20代币将迁移至波场TRON主网代币,时间为北京时间6月21日-25日。 -如果投资者的TRX在交易所,无需其他任何操作。 -如果投资者的TRX在钱包,需要在2018年6月24日前将TRX充值到交易所。 6月21 - 24日,交易所TRX的提现将被暂停,6月25日交易所将暂停TRX的充值和提现。从6月26日开始,TRX的充值和提现将恢复正常。在此期间,TRX的正常交易将不受影响。 -如果投资者的TRX在钱包,没看见迁移公告,或者是在6月25日之后才看到迁移公告,到永久迁移交易所兑换主网代币。 -# 13 相关文档 -具体请参考:https://github.com/tronprotocol/Documentation#%E6%96%87%E6%A1%A3%E6%8C%87%E5%BC%95 - - - -``` - -``` diff --git a/TRX_CN/grpc-gateway-http.md b/TRX_CN/grpc-gateway-http.md deleted file mode 100644 index 6b179de6..00000000 --- a/TRX_CN/grpc-gateway-http.md +++ /dev/null @@ -1,258 +0,0 @@ -# TRON GRPC-Gateway-HTTP - -需要部署grpc-gateway,详情请见:[grpc-gateway文档](https://github.com/tronprotocol/grpc-gateway/blob/master/README.md) - -grpc-gateway会自动把proto中的bytes字段转换为base64编码。所以如果输入参数是bytes类型,需要首先转化为base64编码,再发送请求;如果输出参数是bytes类型,请用base64解码该参数,再做后续处理。 Tron提供了一个编解码的工具,下载地址是:https://github.com/tronprotocol/tron-demo/raw/master/TronConvertTool.zip - -```shell -wallet/getaccount -作用:返回一个账号的信息 -demo: curl -X POST http://127.0.0.1:18890/wallet/getaccount -d '{"address": "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}' -参数说明:to_address, owner_address 需要转为base64 - - -wallet/createtransaction -demo: curl -X POST http://127.0.0.1:18890/wallet/createtransaction -d '{"to_address": "QYgZmb8EtAG27PTQy5E3TXNTYCcy" ,"owner_address":"QfoWCvbA5qqphqTcvTU0D1+xZMHu", "amount": 1000 }' -作用: 创建一个转账的Transaction,如果转账的to地址不存在,则在区块链上创建该账号 -说明:to_address, owner_address 需要转为base64 - -wallet/broadcasttransaction -demo: -curl -X POST http://127.0.0.1:18890/wallet/broadcasttransaction -d '{ - "raw_data": { - "ref_block_bytes": "dyA=", - "ref_block_hash": "X70qJj+97nQ=", - "expiration": "1529305956000", - "contract": [ - { - "type": "TransferContract", - "parameter": { - "@type": "type.googleapis.com/protocol.TransferContract", - "owner_address": "QVHyqChqzKYaik1etWXHerLDoP69", - "to_address": "Qc0ipGHFhxlCL42QGmC+ems/HYip", - "amount": "987000000" - } - } - ] - }, - "signature": [ - "V+C1KAq2arK7hf7VG9+4CBq96BRYRm3r5ep7TL0P8d1PE4lRfAUvAbfRRCiGmiriKUaOivcno2XN0/udPVj47AE=" - ] -}' -作用: 广播交易,广播之前需要做签名 -说明:将已经签名完成的交易作为传入参数 - -wallet/updateaccount -demo: curl -X POST http://127.0.0.1:18890/wallet/createtransaction -d '{"account_name": "newbmV3X25hbWU=" ,"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy"}' -作用: 更新账号名称,一个账号只能更新一次账号名称 -说明:owner_address,account_name为base64格式. `ewbmV3X25hbWU=` 为 `new_name` 的 base64格式 - -wallet/votewitnessaccount -demo:curl -X POST http://127.0.0.1:18890/wallet/votewitnessaccount -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "votes": [{"vote_address": "QfSI1WI/szR9S3ZL5f7Mewb18Rd7", "vote_count": 11}]}' -作用:普通用户对witness进行投票 -参数说明: -owner_address, 投票人的地址,格式base64;votes, 投票列表,为一个数组,vote_address, witness地址,格式base64 - -wallet/createassetissue -demo:发行一个名为MyToken的资产 -curl -X POST http://127.0.0.1:18890/wallet/createassetissue -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "votes": [{"vote_address": "QfSI1WI/szR9S3ZL5f7Mewb18Rd7", "vote_count": 11}]}' -作用: 发行Token,用户可以再Tron公链上发行Token,Token可以被相互转账,可以用Trx参与。用户在发行Token的时候,可以选择冻结部分Token。 -参数说明: -owner_address,创建人地址,格式base64;name,资产名称,格式base64 - - -wallet/updatewitness -作用: 修改wieness的url -demo: -curl -X POST http://127.0.0.1:18890/wallet/updatewitness -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "update_url": "d3d3Lm5ld3VybC5jb20="}' -参数说明: -owner_address,创建人地址,格式base64;update_url,更新的url,格式base64 - - -wallet/createaccount -作用: 创建账号,目前之后已经存在的账号,可以调用该api创建一个新账号,需要指定新账号的Address -demo: -curl -X POST http://127.0.0.1:18890/wallet/createaccount -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "account_address": ""}' -参数说明:owner_address,创建人的账号地址,base64;account_address,新账号地址,base64 - - -/wallet/createwitness -作用: 普通用户申请成为超级代表,需要花费9999个trx -demo: -curl -X POST http://127.0.0.1:18890/wallet/createwitness -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "url": "d3d3Lm5ld3VybC5jb20="}' -参数说明:owner_address,创建这的账号地址,base64;url,创建的url,base64 - -wallet/transferasset -作用: Token转账 -demo: -curl -X POST http://127.0.0.1:18890/wallet/transferasset -d '{"owner_address":"QYgZmb8EtAG27PTQy5E3TXNTYCcy", "to_address": "d3d3Lm5ld3VybC5jb20=", "asset_name": "TXlBc3NldA==", "amount": 1000}' -参数说明:asset_name,资产名称,格式base64;owner_address,发送者账户地址,格式base64;to_address,接收账户地址,格式base64;amount,交易量,格式数字 - -wallet/participateassetissue -作用: 参与Token发行,用户可以花费一定的Trx参与别人发行的Token -demo: -curl -X POST http://127.0.0.1:18890/wallet/participateassetissue -d '{"to_address": "QYgZmb8EtAG27PTQy5E3TXNTYCcy" ,"owner_address":"QfoWCvbA5qqphqTcvTU0D1+xZMHu", "amount":1000, "asset_name":"TXlBc3NldA=="}' -参数说明: owner_address,创建者的账号地址,格式base64;to_address,目标地址,格式base64;asset_name,资产名称,格式base64;amount,交易量,格式数字 - -冻结trx:/wallet/freezebalance -demo:curl -X POST http://127.0.0.1:18890/wallet/freezebalance -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69", "frozen_balance" : 100000, "frozen_duration" : 3}' -参数说明:owner_address需要是base64格式,frozen_balance是drop形式的冻结trx金额,frozen_duration是冻结天数 - -解冻trx:/wallet/unfreezebalance -demo:curl -X POST http://127.0.0.1:18890/wallet/unfreezebalance -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69"}' -参数说明:owner_address需要是base64格式 - -解冻Token:/wallet/unfreezeasset -demo:curl -X POST http://127.0.0.1:18890/wallet/unfreezeasset -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69"}' -参数说明:owner_address需要是base64格式 - -提现奖励:wallet/withdrawbalance -demo:curl -X POST http://127.0.0.1:18890/wallet/withdrawbalance -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69"}' -参数说明:owner_address需要转成base64格式 - -更新通证:wallet/updateasset -demo:curl -X POST http://127.0.0.1:18890/wallet/updateasset -d '{"owner_address" : "QVHyqChqzKYaik1etWXHerLDoP69", "description" : "anVzdCB0ZXN0", "url" : "d3d3LnRlc3R1cmwuY29t", "new_limit" : 1000, "new_public_limit" : 1000}' -参数说明:owner_address需要转成base64格式,description是base64编码,原文是just test,url是base64编码,原文是www.baidu.com - -查询所有节点:wallet/listnodes -demo:curl -X POST http://127.0.0.1:18890/wallet/listnodes -参数说明:无 - -查询账户发行的通证:wallet/getassetissuebyaccount -demo:curl -X POST http://127.0.0.1:18890/wallet/getassetissuebyaccount -d {"address" : "QVHyqChqzKYaik1etWXHerLDoP69"} -参数说明:address需要转成base64格式 - -查询带宽:wallet/getaccountnet -demo:curl -X POST http://127.0.0.1:18890/wallet/getaccountnet -d {"address" : "QVHyqChqzKYaik1etWXHerLDoP69"} -参数说明:address需要转成base64格式 - -通过名称查询通证:wallet/getassetissuebyname -demo:curl -X POST http://127.0.0.1:18890/wallet/getassetissuebyname -d {"value" : "VFdY"} -参数说明:value是通证名称,原文是TWX - -查询最新区块:wallet/getnowblock -demo:curl -X POST http://127.0.0.1:18890/wallet/getnowblock -参数说明:无 - -通过高度查区块:wallet/getblockbynum -demo:curl -X POST http://127.0.0.1:18890/wallet/getblockbynum -d {"num" : 1} -参数说明:num是要查询的区块高度 - -通过ID查区块:wallet/getblockbyid -demo:curl -X POST http://127.0.0.1:18890/wallet/getblockbyid -d {"value" : "AAAAAAAHkICjDnMmySRFfN5xCwAezxoLZrZ99JfGDDk="} -参数说明:value是blockId的base64编码,原文是0000000000079080a30e7326c924457cde710b001ecf1a0b66b67df497c60c39 - -按照高度区间查询块:/wallet/getblockbylimitnext -demo:curl -X POST http://127.0.0.1:18890/wallet/getblockbylimitnext -d '{"startNum" : 10, "endNum" : 10}' -参数说明:startNum是起始块高度,endNum是结束块高度。返回结果中会同时包含startNum块和endNum块 - -按照高度查询TopN的块:/wallet/getblockbylatestnum -demo:curl -X POST http://127.0.0.1:18890/wallet/getblockbylatestnum -d '{"num" : 10}' -参数说明:num是最近块的个数 - -按照交易ID查询交易:/wallet/gettransactionbyid -demo:curl -X POST http://127.0.0.1:18890/wallet/gettransactionbyid -d '{"value" : "JTqX9taV7RNDyZbwGsN4BsMthBqoBaqnROvCQtHYOyg="}' -参数说明:value是交易的id,通过hash交易的raw_data得到,value需要是base64格式 - -查询超级代表列表:/wallet/listwitnesses -demo:curl -X POST http://127.0.0.1:18890/wallet/listwitnesses -参数说明: - -查询所有发行Token列表:/wallet/getassetissuelist -demo:curl -X POST http://127.0.0.1:18890/wallet/getassetissuelist -参数说明 - -分页查询发行Token列表:/wallet/getpaginatedassetissuelist -demo:curl -X POST http://127.0.0.1:18890/wallet/getpaginatedassetissuelist -d '{"offset" : 0, "limit" : 10}' -参数说明:offset为分页起始token的id,limit为最多返回的token数量 - -查询所有交易数量:/wallet/totaltransaction -demo: curl -X POST http://127.0.0.1:18890/wallet/totaltransaction -参数说明: - -查询超级代表下次轮值时间:/wallet/getnextmaintenancetime -demo:curl -X POST http://127.0.0.1:18890/wallet/getnextmaintenancetime -参数说明 - -签名:/wallet/gettransactionsign -demo:curl -X POST http://127.0.0.1:18890/wallet/gettransactionsign -d '{ -"transaction" : { - "raw_data": { - "ref_block_bytes": "gfA=", - "ref_block_hash": "5YSAo+xJYGU=", - "expiration": "1529325009000", - "contract": [ - { - "type": "TransferContract", - "parameter": { - "@type": "type.googleapis.com/protocol.TransferContract", - "owner_address": "QVHyqChqzKYaik1etWXHerLDoP69", - "to_address": "Qc0ipGHFhxlCL42QGmC+ems/HYip", - "amount": "987000000" - } - } - ] - } -}, -"privateKey" : "j5vLuYaQ4w8yolHZWY+CGY1i+p7CYXovSUgzvyYPOPk=" -}' -参数说明:transaction是一个具体的交易,privateKey是用户私钥,需要是base64格式。 -警告:使用本接口请控制风险。保证环境的安全,不要调用他人提供的API,不要在公共网路上调用本接口。 - -查询账号信息:/walletsolidity/getaccount -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/getaccount -d '{"address" : "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}' -参数说明:address是base64格式 - -查询所有超级代表列表:/walletsolidity/listwitnesses -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/listwitnesses -参数说明: - -查询所有Token列表:/walletsolidity/getassetissuelist -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/getassetissuelist -参数说明: - -分页查询Token列表:/walletsolidity/getpaginatedassetissuelist -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/getpaginatedassetissuelist -d '{"offset" : 0, "limit" : 10}' -参数说明: offset是分页起始ID,limit是返回token的最大个数 - -按照高度查询块:/walletsolidity/getnowblock -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/getnowblock -参数说明: - -按照高度查询块:/walletsolidity/getblockbynum -demo:curl -X POST http://127.0.0.1:18890/walletextension/gettransactionsfromthis -d '{"num" : 10000}' -参数说明:num是块高度 - -查询某个账号的出账交易:/walletextension/gettransactionsfromthis -demo:curl -X POST http://127.0.0.1:18890/walletextension/gettransactionsfromthis -d '{"account" : {"address" : "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}, "offset" : 0, "limit" : 5}' -参数说明:address是base64格式,offset是起始index,limit是返回的最大交易数量 - -查询某个账号的入账交易:/walletextension/gettransactionstothis -demo:curl -X POST http://127.0.0.1:18890/walletextension/gettransactionstothis -d '{"account" : {"address" : "QYgZmb8EtAG27PTQy5E3TXNTYCcy"}, "offset" : 0, "limit" : 5}' -参数说明:address是base64格式,offset是起始index,limit是返回的最大交易数量 - -按照交易hash查询交易fee,交易所在块:/walletsolidity/gettransactioninfobyid -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/gettransactioninfobyid -d '{"value" : "4ebiUlBCZ5vI1JtBMFXjiH/HSaVeIaUO8PN9l5E1kXU="}' -参数说明:value是交易的id,通过hash交易的raw_data得到,value需要是base64格式 - -按照交易hash查询交易(通过这个接口确认最终确认交易):/walletsolidity/gettransactionbyid -demo:curl -X POST http://127.0.0.1:18890/walletsolidity/gettransactionbyid -d '{"value" : "9PeN9FHPDHr1qpILy3U+iMcLAKvwojUek9jYx1EESXA="}' -参数说明:value是交易的id,通过hash交易的raw_data得到,value需要是base64格式 - -创建地址:/wallet/createadresss -demo:curl -X POST http://127.0.0.1:18890/wallet/createadresss -d '{"value": "QeVS9kh1hcK1i8LJu0SSvB8XEyzQ" }' -参数说明:value是用户的密码,返回时base64格式的地址,需要转换成base58后才能使用 -警告:使用本接口请控制风险。保证环境的安全,不要调用他人提供的API,不要在公共网路上调用本接口。 - -TRX快捷转账:/wallet/easytransfer -demo:curl -X POST http://127.0.0.1:18890/wallet/easytransfer -d '{"passPhrase": "QeVS9kh1hcK1i8LJu0SSvB8XEyzQ","toAddress": "QYkTnLE4evhePSTiEqAIrJdJZ+Vh", "amount":10}' -参数说明:passPhrase是用户密码,toAddress是转账接收地址,amount是转账trx数量 -警告:使用本接口请控制风险。保证环境的安全,不要调用他人提供的API,不要在公共网路上调用本接口。 - -生成地址和私钥:/wallet/generateaddress - /walletsolidity/generateaddress -demo:curl -X POST -k http://127.0.0.1:18890/wallet/generateaddress -参数说明:无需参数 -警告:使用本接口请控制风险。保证环境的安全,不要调用他人提供的API,不要在公共网路上调用本接口。 - -``` diff --git a/TRX_CN/index.php b/TRX_CN/index.php deleted file mode 100755 index 1ad21408..00000000 --- a/TRX_CN/index.php +++ /dev/null @@ -1,187 +0,0 @@ - - - - -

My first PHP page

- -= $base) { - $div = bcdiv($decimal, $base, 0); - $mod = bcmod($decimal, $base); - $output .= $alphabet[$mod]; - $decimal = $div; - } - if ($decimal > 0) { - $output .= $alphabet[$decimal]; - } - $output = strrev($output); - foreach ($bytes as $byte) { - if ($byte === 0) { - $output = $alphabet[0] . $output; - continue; - } - break; - } - return (string) $output; - } - function base58_decode($base58) - { - $alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; - $base = strlen($alphabet); - if (is_string($base58) === false) { - return false; - } - if (strlen($base58) === 0) { - return ''; - } - $indexes = array_flip(str_split($alphabet)); - $chars = str_split($base58); - foreach ($chars as $char) { - if (isset($indexes[$char]) === false) { - return false; - } - } - $decimal = $indexes[$chars[0]]; - for ($i = 1, $l = count($chars); $i < $l; $i++) { - $decimal = bcmul($decimal, $base); - $decimal = bcadd($decimal, $indexes[$chars[$i]]); - } - $output = ''; - while ($decimal > 0) { - $byte = bcmod($decimal, 256); - $output = pack('C', $byte) . $output; - $decimal = bcdiv($decimal, 256, 0); - } - foreach ($chars as $char) { - if ($indexes[$char] === 0) { - $output = "\x00" . $output; - continue; - } - break; - } - return $output; - } - - //encode address from byte[] to base58check string - function base58check_en($address) - { - $hash0 = hash("sha256", $address); - $hash1 = hash("sha256", hex2bin($hash0)); - $checksum = substr($hash1, 0, 8); - $address = $address.hex2bin($checksum); - $base58add = base58_encode($address); - return $base58add; - } - - //decode address from base58check string to byte[] - function base58check_de($base58add) - { - $address = base58_decode($base58add); - $size = strlen($address); - if ($size != 25) { - return false; - } - $checksum = substr($address, 21); - $address = substr($address, 0, 21); - $hash0 = hash("sha256", $address); - $hash1 = hash("sha256", hex2bin($hash0)); - $checksum0 = substr($hash1, 0, 8); - $checksum1 = bin2hex($checksum); - if (strcmp($checksum0, $checksum1)) { - return false; - } - return $address; - } - - function hexString2Base58check($hexString){ - $address = hex2bin($hexString); - $base58add = base58check_en($address); - return $base58add; - } - - function base58check2HexString($base58add){ - $address = base58check_de($base58add); - $hexString = bin2hex($address); - return $hexString; - } - - function hexString2Base64($hexString){ - $address = hex2bin($hexString); - $base64 = base64_encode($address); - return $base64; - } - - function base642HexString($base64){ - $address = base64_decode($base64); - $hexString = bin2hex($address); - return $hexString; - } - - function base58check2Base64($base58add){ - $address = base58check_de($base58add); - $base64 = base64_encode($address); - return $base64; - } - - function base642Base58check($base64){ - $address = base64_decode($base64); - $base58add = base58check_en($address); - return $base58add; - } - - $base64 = 'QUiA0LBVaoVtXofZAEWjebc3ggpl'; - echo "base64_0:: ".$base64; - echo '
'; - echo "----Test base64 to hexString , base64 to base58check---"; - echo "
"; - $hexString = base642HexString($base64); - echo "hexString_0:: ".$hexString; - echo '
'; - $base58check = base642Base58check($base64); - echo "base58check_0:: ".$base58check; - echo '
'; - echo "-------------------------------------------------------"; - echo "
"; - echo "
"; - echo "--Test hexString to base58check, hexString to base64--"; - echo "
"; - $base58check_1 = hexString2Base58check($hexString); - echo "base58check_1:: ".$base58check_1; - echo '
'; - $base64_1 = hexString2Base64($hexString); - echo "base64_1:: ".$base64_1; - echo '
'; - echo "-------------------------------------------------------"; - echo "
"; - echo "
"; - echo "--Test base58check to hexString, base58check to base64-"; - echo "
"; - $hexString_2 = base58check2HexString($base58check); - echo "hexString_2:: ".$hexString_2; - echo '
'; - $base64_2 = base58check2Base64($base58check); - echo "base64_2:: ".$base64_2; - echo '
'; - echo "-----------------------end------------------------------"; -?> - - - - diff --git a/TRX_CN/nginx_config_https_servers.md b/TRX_CN/nginx_config_https_servers.md deleted file mode 100644 index ab35ca05..00000000 --- a/TRX_CN/nginx_config_https_servers.md +++ /dev/null @@ -1,51 +0,0 @@ -**系统环境:Centos7 系列** - -# 一、 安装nginx - yum install nginx -y - -# 二、 配置nginx -创建配置文件/etc/nginx/conf.d/ssl_proxy_host.conf,编辑内容如下:
-
->server {
->listen 80;
->listen [::]:80; ->server_name www.test.com; #此处配置你自己的域名
->return 301 https://$server_name$request_uri;
->}
->server {
->listen 443;
->listen [::]:443;
->server_name www.test.com; #此处配置你自己的域名
->ssl on;
->ssl_certificate /etc/pki/nginx/test.crt; #此处配置你的证书'.crt'文件路径
->ssl_certificate_key /etc/pki/nginx/test.key; #此处配置你的证书'.key'文件路径
->gzip on;
->gzip_min_length 1k;
->gzip_buffers 4 16k;
->gzip_comp_level 6;
->gzip_types text/css text/javascript application/css application/javascript image/jpeg image/gif image/png;
->gzip_vary on;
->location / {
->proxy_set_header X-Real-IP $remote_addr;
->proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
->proxy_set_header Host $http_host;
->proxy_set_header X-Nginx-Proxy true;
->proxy_pass http://127.0.0.1:8080; #此处配置你想代理的服务器地址及端口
->proxy_redirect off;
->}
->error_page 404 /404.html;
->location = /40x.html {
->}
->error_page 500 502 503 504 /50x.html;
->location = /50x.html {
->}
->}
-# 三、 启动nginx服务 - systemctl start nginx - -# 四、 附官网nginx配置https文档教程 -[http://nginx.org/en/docs/http/configuring_https_servers.html](http://nginx.org/en/docs/http/configuring_https_servers.html) - - - - diff --git "a/TRX_CN/\345\270\270\350\247\201\351\227\256\351\242\230" "b/TRX_CN/\345\270\270\350\247\201\351\227\256\351\242\230" deleted file mode 100644 index 2849eb82..00000000 --- "a/TRX_CN/\345\270\270\350\247\201\351\227\256\351\242\230" +++ /dev/null @@ -1,23 +0,0 @@ -API的具体定义请参考: - -https://github.com/tronprotocol/java-tron/blob/develop/src/main/protos/api/api.proto - -你可能需要经常用到的如下几个API: - -1. 如何获取账号基本信息(类比比特币 getinfo) - GetAccount - -2. 如何获取余额(类比比特币:getbalance) - GetAccount - -3. 如何生成一个地址(类比比特币:getnewaddress) - 可以在本地生成一个地址 - 可以通过一个已经存在的账号给一个新地址转账从而在区块链上生成一个新地址,通过CreateTransaction(TransferContract)完成 - -4. 如何获取一个地址的历史交易(类比比特币:listtransactions) - GetTransactionsFromThis - GetTransactionsToThis - -5. 如何校验地址具有正确的格式 - 本地校验:经过decode58check后,会得到一个长度是21的byte数组,第一个字节是0x41。 - 如果想要验证一个地址是否存在于区块链上,请求API GetAccount。 diff --git "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/SR\346\214\207\345\274\225.md" "b/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/SR\346\214\207\345\274\225.md" deleted file mode 100644 index e3b4a62f..00000000 --- "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/SR\346\214\207\345\274\225.md" +++ /dev/null @@ -1,50 +0,0 @@ -# 时间计划 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/时间计划.png) - -## 1.上线准备阶段 - -+ 主网功能开发测试完成。 -+ 钱包产品开发测试完成。 -+ 区块链浏览器开发测试完成。 - -## 2.主网测试期 - -+ 主网上线后,保持稳定,数据不清零,6月1日(GMT+8)至6月24日(GMT+8)持续运行,在6月24日(GMT+8)数据清零。 -+ 用户领测试币,主网测试。用户在指定链接领测试币,然后在波场钱包测试。社区开发者测试主网功能。 - - 主网测试期:6月1日0点0分(GMT+8)至6月24日23点59分(GMT+8)。主网测试期结束后,主网正式上线,创世区块在6月25日(GMT+8)10点0分正式启动。 - -## 3.创世区块及币迁移阶段 - -1.波场创世区块在6月25日10点0分(GMT+8)正式启动。 - -2.币迁移: -+ 交易所: TRX的ERC20代币打给波场,波场打主网代币给交易所 -+ SR:候选人币迁移快速通道,可以确保第一时间申请成为候选人,并拥有一定数目的初始投票。 - -## 4.超级代表竞选及奖励阶段 - -用户用钱包投票产生超级代表,超级代表负责打包交易出块并获得TRX奖励。 - -# SR指引 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/SR指引.png) - -1. 宣传造势(4月27日-5月31日)(GMT+8) -SR竞选宣传,让更多的用户投票给自己。 -2. 候选人交保证金 -5月15日(GMT+8)通知打钱,5月31日(GMT+8)之前打200K TRX给波场基金会,相当于保证金,保证金将于6月25日凌晨(GMT+8)返还到指定波场主网地址。 -3. 选举测试期(6月1日-6月24日)(GMT+8) -让粉丝测试投票,运行测试节点出块。 -4. 候选人保证金返还 -保证金将于6月25日凌晨(GMT+8)返还到指定波场主网地址。 -5. SR候选人在钱包申请成为SR候选人,号召粉丝投票给自己。 -6. 正式成为SR -得票最高的27个SR候选人正式成为SR,可以打包交易出块获取TRX奖励。 - -**注意** -1. 注意5月31日(GMT+8)前交保证金。 -2. 注意参加6月1日(GMT+8)至6月24日(GMT+8)的主网测试投票,并运行测试节点。 -3. 注意号召粉丝参加6月26日(GMT+8)的正式投票。 - diff --git "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\344\272\244\346\230\223\346\211\200\346\214\207\345\274\225.md" "b/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\344\272\244\346\230\223\346\211\200\346\214\207\345\274\225.md" deleted file mode 100644 index 284c73c6..00000000 --- "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\344\272\244\346\230\223\346\211\200\346\214\207\345\274\225.md" +++ /dev/null @@ -1,63 +0,0 @@ -# 时间计划 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/时间计划.png) - -## 1.上线准备阶段 - -+ 主网功能开发测试完成。 -+ 钱包产品开发测试完成。 -+ 区块链浏览器开发测试完成。 - -## 2.主网测试期 - -+ 主网上线后,保持稳定,数据不清零,6月1日至北6月24日(GMT+8)持续运行,在6月24日(GMT+8数据清零。 -+ 用户领测试币,主网测试。用户在指定链接领测试币,然后在波场钱包测试。社区开发者测试主网功能。 - - 主网测试期:6月1日凌晨0点0分至6月24日23点59分(GMT+8)。主网测试期结束后,主网正式上线,创世区块在6月25日10点0分(GMT+8)正式启动。 - -## 3.创世区块及币迁移阶段 - -1.波场创世区块在6月25日10点0分(GMT+8)正式启动。 - -2.币迁移: -+ 交易所: TRX的ERC20代币打给波场,波场打主网代币给交易所 -+ SR:候选人币迁移快速通道,可以确保第一时间申请成为候选人,并拥有一定数目的初始投票。 - -## 4.超级代表竞选及奖励阶段 - -用户用钱包投票产生超级代表,超级代表负责打包交易出块并获得TRX奖励。 - -# 交易所指引 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/交易所指引.png) - -## 1.禁止提币 - -6月21日-6月24日(GMT+8),禁止用户提币。 - -## 2.禁止充币提币 - -6月25日(GMT+8)禁止用户充提币。 - -## 3.TRX ERC20代币打给波场,波场将TRX打给交易所 - -交易所把TRX ERC20代币打给波场,波场销毁,将主网代币打给交易所。 - -## 4.系统升级,支持充提主网代币 - -交易所升级系统,支持主网代币的钱包功能,下线TRX ERC20代币的功能。 - -## 5.发公告恢复充提币功能 - -交易所确认没问题后,恢复TRX的充提币功能。 - -## 6.指定交易所支持永久迁移 - -波场指定的永久支持迁移的交易所保留TRX ERC20代币的充值渠道,定期迁移成主网代币。 - -**注意** -1. 交易所不需要快照,不需要暂停TRX交易。 -2. 注意代币迁移顺序。 -3. 注意6月21日到6月24日(GMT+8)禁止提币,6月25日(GMT+8)禁止充提,6月26日(GMT+8)公告恢复。 -4. 联系波场基金会获取主网代币。 - diff --git "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\345\274\200\345\217\221\350\200\205\346\214\207\345\274\225.md" "b/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\345\274\200\345\217\221\350\200\205\346\214\207\345\274\225.md" deleted file mode 100644 index a94d32f7..00000000 --- "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\345\274\200\345\217\221\350\200\205\346\214\207\345\274\225.md" +++ /dev/null @@ -1,47 +0,0 @@ -# 时间计划 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/时间计划.png) - -## 1.上线准备阶段 - -+ 主网功能开发测试完成。 -+ 钱包产品开发测试完成。 -+ 区块链浏览器开发测试完成。 - -## 2.主网测试期 - -+ 主网上线后,保持稳定,数据不清零,6月1日至6月24日(GMT+8)持续运行,在6月24日(GMT+8)数据清零。 -+ 用户领测试币,主网测试。用户在指定链接领测试币,然后在波场钱包测试。社区开发者测试主网功能。 - - 主网测试期:6月1日凌晨0点0分至6月24日23点59分(GMT+8)。主网测试期结束后,主网正式上线,创世区块在6月25日10点0分(GMT+8)正式启动。 - -## 3.创世区块及币迁移阶段 - -1.波场创世区块在6月25日10点0(GMT+8分正式启动。 - -2.币迁移: -+ 交易所: TRX的ERC20代币打给波场,波场打主网代币给交易所 -+ SR:候选人币迁移快速通道,可以确保第一时间申请成为候选人,并拥有一定数目的初始投票。 - -## 4.超级代表竞选及奖励阶段 - -用户用钱包投票产生超级代表,超级代表负责打包交易出块并获得TRX奖励。 - -# 开发者指引 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/开发者指引.png) - -1. 钱包开发完成 (5月31日之前)(GMT+8) -公布各个钱包的github地址,下载地址,供社区和用户测试体验。 -2. 钱包测试迭代(6月1日-6月24日)(GMT+8) -钱包推广,供社区和用户测试体验,反馈问题,迭代钱包。 -3. 选出各平台官方推荐钱包(6月15日)(GMT+8) -6月15日(GMT+8)波场团队评选,选出各平台的官方推荐钱包。官网推荐钱包可以随时提交,官方随时添加推荐。 -4. 钱包正式上线(6月25日)(GMT+8) -拥有TRX的用户可以在钱包投票,选出波场超级代表。 - -**注意** - -1. 注意在5月31日前(GMT+8)完成开发。 -2. 注意参加6月1日至6月24日(GMT+8)的主网测试。 -3. 并于6月15日前(GMT+8),向波场官方提交版本。 \ No newline at end of file diff --git "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\231\256\351\200\232\347\224\250\346\210\267\346\214\207\345\274\225.md" "b/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\231\256\351\200\232\347\224\250\346\210\267\346\214\207\345\274\225.md" deleted file mode 100644 index 8170261d..00000000 --- "a/TRX_CN/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\231\256\351\200\232\347\224\250\346\210\267\346\214\207\345\274\225.md" +++ /dev/null @@ -1,53 +0,0 @@ -# 时间计划 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/时间计划.png) - -## 1.上线准备阶段 - -+ 主网功能开发测试完成。 -+ 钱包产品开发测试完成。 -+ 区块链浏览器开发测试完成。 - -## 2.主网测试期 - -+ 主网上线后,保持稳定,数据不清零,6月1日至6月24日(GMT+8)持续运行,在6月24日(GMT+8)数据清零。 -+ 用户领测试币,主网测试。用户在指定链接领测试币,然后在波场钱包测试。社区开发者测试主网功能。 - - 主网测试期:6月1日凌晨0点0分至6月24日23点59分(GMT+8)。主网测试期结束后,主网正式上线,创世区块在6月25日10点0分(GMT+8)正式启动。 - -## 3.创世区块及币迁移阶段 - -1.波场创世区块在北京时间6月25日10点0分正式启动。 - -2.币迁移: -+ 交易所: TRX的ERC20代币打给波场,波场打主网代币给交易所 -+ SR:候选人币迁移快速通道,可以确保第一时间申请成为候选人,并拥有一定数目的初始投票。 - -## 4.超级代表竞选及奖励阶段 - -用户用钱包投票产生超级代表,超级代表负责打包交易出块并获得TRX奖励。 - -# 普通用户 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/波场主网上线后的指导方案/普通用户指引.png) - -分三种情况: - -1.TRX在交易所的,什么都不用做。 - -2.TRX在钱包的,按以下步骤操作 - -+ 6月21日到6月24日(GMT+8),交易所TRX的提币将被暂停。用户需要在2018年6月24日前(GMT+8)将TRX充值到交易所。 -+ 6月25日(GMT+8)交易所将暂停TRX的充币和提币。 -+ 提币到钱包参与投票 - -从6月26日(GMT+8)开始,TRX的充币和提币将恢复正常,用户需要提币到钱包中,才能投票。 - -3.TRX在钱包的,没看见迁移公告的,或者是在6月25日(GMT+8)之后才看到迁移公告的,到永久迁移交易所兑换主网代币 - -注明:用户币迁移无感知,在6月25日(GMT+8)之前把TRX充值到交易所即可,TRX的正常交易将不受影响。 - -**注意** -1. 注意代币迁移。 -2. 注意参加6月1日至6月24日(GMT+8)测试投票。 -3. 注意参加6月26日(GMT+8)正式投票。 \ No newline at end of file diff --git a/TRX_CN/Official_Public_Node.md b/docs/Official_Public_Node.md similarity index 93% rename from TRX_CN/Official_Public_Node.md rename to docs/Official_Public_Node.md index 2b306bf0..dcbd9a71 100644 --- a/TRX_CN/Official_Public_Node.md +++ b/docs/Official_Public_Node.md @@ -1,4 +1,4 @@ -# Full Node +# FullNodes * GRPC port: 50051 * P2P network port: 18888 * HTTP port : 8090 @@ -16,7 +16,7 @@ 13.127.47.162 13.124.62.58 47.74.149.206 -35.182.37.246 +47.90.240.187 47.90.215.84 47.254.77.146 47.74.242.55 @@ -35,7 +35,7 @@ 47.75.249.4 ``` -# Solidity Node +# SolidityNodes * GRPC port: 50051 * HTTP port : 8091 ``` diff --git a/docs/SolidityNode&FullNode_Deployment.md b/docs/SolidityNode&FullNode_Deployment.md new file mode 100644 index 00000000..3fe32b6b --- /dev/null +++ b/docs/SolidityNode&FullNode_Deployment.md @@ -0,0 +1,93 @@ +# SolidityNode and FullNode Deployment on The Same Host + +Create separate directories for fullnode and soliditynode +```text +/deploy/fullnode +/deploy/soliditynode +``` + +Create two folders for fullnode and soliditynode. + +Clone the latest master branch of [https://github.com/tronprotocol/java-tron](https://github.com/tronprotocol/java-tron) and extract it to +```text +/deploy/java-tron +``` + +Make sure you have the proper dependencies. + +* JDK 1.8 (JDK 1.9+ is not supported yet) +* On Linux Ubuntu system (e.g. Ubuntu 16.04.4 LTS), ensure that the machine has [__Oracle JDK 8__](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04), instead of having __Open JDK 8__ in the system. If you are building the source code by using __Open JDK 8__, you will get [__Build Failed__](https://github.com/tronprotocol/java-tron/issues/337) result. +* Open **UDP** ports for connection to the network +* **MINIMUM** 2 CPU Cores + +## Deployment Guide + +1. Build the java-tron project +```text +cd /deploy/java-tron +./gradlew build +``` + +2. Copy the FullNode.jar and SolidityNode.jar along with configuration files into the respective directories +```text +download your needed configuration file from https://github.com/tronprotocol/TronDeployment. + +main_net_config.conf is the configuration for MainNet, and test_net_config.conf is the configuration for TestNet. + +please rename the configuration file to `config.conf` and use this config.conf to start FullNode and SoliditNode. + +cp build/libs/FullNode.jar ../fullnode + +cp build/libs/SolidityNode.jar ../soliditynode +``` + +3. You can now run your FullNode using the following command +```text +java -jar FullNode.jar -c config.conf // make sure that your config.conf is downloaded from https://github.com/tronprotocol/TronDeployment +``` + +4. Configure the SolidityNode configuration file + +You need to edit `config.conf` to connect to your local FullNode. Change `trustNode` in `node` to local `127.0.0.1:50051`, which is the default rpc port. Set `listen.port` to any number within the range of 1024-65535. Please don't use any ports between 0-1024 since you'll most likely hit conflicts with other system services. Also change `rpc port` to `50052` or something to avoid conflicts. **Please forward the UDP port 18888 for FullNode.** +```text +rpc { + port = 50052 + } +``` + +5. You can now run your SolidityNode using the following command: +```text +java -jar SolidityNode.jar -c config.conf //make sure that your config.conf is downloaded from https://github.com/tronprotocol/TronDeployment +``` + +# Logging and Network Connection Verification + +Logs for both nodes are located in `/deploy/\*/logs/tron.log`. Use `tail -f /logs/tron.log/` to follow along with the block syncing. + +You should see something similar to this in your logs for block synchronization: + +**FullNode** +```text +12:00:57.658 INFO [pool-7-thread-1] [o.t.c.n.n.NodeImpl](NodeImpl.java:830) Success handle block Num:236610,ID:0000000000039c427569efa27cc2493c1fff243cc1515aa6665c617c45d2e1bf +``` +**SolidityNode** +```text +12:00:40.691 INFO [pool-17-thread-1] [o.t.p.SolidityNode](SolidityNode.java:88) sync solidity block, lastSolidityBlockNum:209671, remoteLastSolidityBlockNum:211823 +``` +# Stop Node Gracefully +Create file stop.sh,use kill -15 to close java-tron.jar(or FullNode.jar、SolidityNode.jar). +You need to modify pid=`ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'` to find the correct pid. +```text +#!/bin/bash +while true; do + pid=`ps -ef |grep java-tron.jar |grep -v grep |awk '{print $2}'` + if [ -n "$pid" ]; then + kill -15 $pid + echo "The java-tron process is exiting, it may take some time, forcing the exit may cause damage to the database, please wait patiently..." + sleep 1 + else + echo "java-tron killed successfully!" + break + fi +done +``` diff --git a/English_Documentation/TRON_Virtual_Machine/Virtual_Machine_Introduction.md b/docs/Tron-VM.md similarity index 64% rename from English_Documentation/TRON_Virtual_Machine/Virtual_Machine_Introduction.md rename to docs/Tron-VM.md index 4355cdda..608e765b 100644 --- a/English_Documentation/TRON_Virtual_Machine/Virtual_Machine_Introduction.md +++ b/docs/Tron-VM.md @@ -7,52 +7,64 @@ TVM can connect seamlessly with existing development ecosystem and supports DPOS Furthermore, TVM employs the concept of Bandwidth. Different from the gas mechanism on Ethereum’s EVM, operations of transaction or smart contracts on TVM are free, with no tokens consumed. Technically, executable computation capacity on TVM is not restricted by total holding of tokens. ## Features of TVM -1. Lightweight -TVM adopts a lightweight architecture with the aim of reducing resource consumption to guarantee system performance. -2. Stability and security -With a meticulous design paradigm and fine-grained underlying operation code, TVM can guarantee the preciseness of every step of a computation, diminishing ambiguity to the largest extent. Out of security reasons, transfers and smart contract running cost only bandwidth points, not TRX, which exempts TRON from being attacked similarly to Ethereum for its mode of gas consumption. Stability of bandwidth consumption is achieved while the cost of each computational step is fixed. -3. Compatibility -Currently, TVM is compatible with EVM and will be with more mainstream VMs in the future. Thereby, all smart contracts on EVM are executable on TVM. By connecting seamlessly to existing development ecosystem, higher efficiency can be achieved by developers. Needless to learn a new programming language, they can use mainstream programming languages for smart contract such as Solidity to develop, debug and compile smart contracts in the Remix environment, which greatly reduces development costs. -4. Developer-friendly +1. Lightweight + +TVM adopts a lightweight architecture with the aim of reducing resource consumption to guarantee system performance. + +2. Stability and security + +With a meticulous design paradigm and fine-grained underlying operation code, TVM can guarantee the preciseness of every step of a computation, diminishing ambiguity to the largest extent. Out of security reasons, transfers and smart contract running cost only bandwidth points, not TRX, which exempts TRON from being attacked similarly to Ethereum for its mode of gas consumption. Stability of bandwidth consumption is achieved while the cost of each computational step is fixed. + +3. Compatibility + +Currently, TVM is compatible with EVM and will be with more mainstream VMs in the future. Thereby, all smart contracts on EVM are executable on TVM. By connecting seamlessly to existing development ecosystem, higher efficiency can be achieved by developers. Needless to learn a new programming language, they can use mainstream programming languages for smart contract such as Solidity to develop, debug and compile smart contracts in the Remix environment, which greatly reduces development costs. + +4. Developer-friendly + Thanks to TVM’s bandwidth setup, developments costs are reduced and developers can focus on the logic of their contract code. TVM also offers all-in-one interfaces for contract deployment, triggering and viewing, for the convenience of developers. -The following interfaces are available in Tron Wallet-CLI: -+ deploycontract(password, contractAddress, ABI, code, data, value) -+ triggercontract(password, contractAddress, selector, data, value) -+ getcontract(contractAddress) +The following interfaces are available in Tron Wallet-CLI: + + + deploycontract(password, contractAddress, ABI, code, data, value) + + triggercontract(password, contractAddress, selector, data, value) + + getcontract(contractAddress) Developers can call these interfaces to deploy, trigger or check smart contracts. -## How TVM works +## How TVM Works ![Flowchart of Tron Virtual Machine](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Virtual_Machine/虚拟机.png) The above flowchart shows how TVM works: -Compilation of Tron smart contract→execution and computing engines of VM→Interoperation service layer for external interfaces +Compilation of Tron smart contract→execution and computing engines of VM→Interoperation service layer for external interfaces. Put simply, the flow is as follows: + Currently, TVM is compatible mainly with Solidity. The compiler translates Solidity smart contract into bytecode readable and executable on TVM. + A virtual machine processes data through opcode, which is equivalent to operating a logic of a stack-based finite state machine. + TVM accesses blockchain data and invoke External Data Interface through the Interoperation layer. -## Future development of TVM -1. More developer-friendly debugging tools -Tron will be committed to the development of optimized debugging tools and the establishment of standardized symbol and data format, for improved developer efficiency. -2. Fulfillment of diversified processing demands -Different from gas consumption mechanism for every transaction on EVM, there is no charge on TVM. Each operation only occupies bandwidth, which will be released within a certain amount of time after completion of transaction. It takes developers very little to develop smart contracts with more complex logic. It is our belief that besides being used for digital asset transactions, smart contracts could also be suitably applied to areas such as game development, financial risk modeling and scientific computing. The design of TVM inherently supports multi-scenario tasks, and further optimizations of processing speed, response time, and floating point compatibility. -3. Improvement of Just-In-Time (JIT) compilation speed and integration of WebAssembly +## Future Development of TVM +1. More developer-friendly debugging tools -Improving JIT compilation speed is conducive to faster interpretation and optimized compilation of local code. -Meanwhile, Tron is planning to further optimize its TVM based on WebAssembly (WASM). WebAssembly, spearheaded by Apple, Google, Microsoft and Mozilla, is designed to break bottlenecks of current Web browsers and can be generated through compiling C/C++ and other programming languages. -Integrating WASM, TVM will be able to provide high performance and high throughput for blockchain to cope with complex scenarios. +Tron will be committed to the development of optimized debugging tools and the establishment of standardized symbol and data format, for improved developer efficiency. -## The following is a guide to TVM (smart contract deployment) +2. Fulfillment of diversified processing demands -1. Compile contract -Contract compilation address: https://remix.ethereum.org -2. Get ABI and bytecode -``` - pragma solidity^0.4.11; +Different from gas consumption mechanism for every transaction on EVM, there is no charge on TVM. Each operation only occupies bandwidth, which will be released within a certain amount of time after completion of transaction. It takes developers very little to develop smart contracts with more complex logic. It is our belief that besides being used for digital asset transactions, smart contracts could also be suitably applied to areas such as game development, financial risk modeling and scientific computing. The design of TVM inherently supports multi-scenario tasks, and further optimizations of processing speed, response time, and floating point compatibility. + +3. Improvement of Just-In-Time (JIT) compilation speed and integration of WebAssembly + +Improving JIT compilation speed is conducive to faster interpretation and optimized compilation of local code. Meanwhile, Tron is planning to further optimize its TVM based on WebAssembly (WASM). WebAssembly, spearheaded by Apple, Google, Microsoft and Mozilla, is designed to break bottlenecks of current Web browsers and can be generated through compiling C/C++ and other programming languages. Integrating WASM, TVM will be able to provide high performance and high throughput for blockchain to cope with complex scenarios. - contract Tron { +## Usage Guide to TVM + +1. Compile contract + +Contract compilation address: [https://remix.ethereum.org](https://remix.ethereum.org) + +2. Get ABI and bytecode +```text +pragma solidity^0.4.11; + + contract Tron { uint256 tron; constructor() public { } @@ -63,27 +75,29 @@ Contract compilation address: https://remix.ethereum.org } } - ABI: - [{“constant":false,"inputs":[{"name":"number","type":"uint256"}],"name":"set","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] - + ABI: [{“constant":false,"inputs":[{"name":"number","type":"uint256"}],"name":"set","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] - ByteCode:608060405234801561001057600080fd5b5060c48061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506086565b604051808215151515815260200191505060405180910390f35b600081600081905550600190509190505600a165627a7a723058209791df3f67e9af451c35d7ae55bda5e352764f6a38ea23fa850b1c1fe1bc72e90029 + ByteCode: 608060405234801561001057600080fd5b5060c48061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506086565b604051808215151515815260200191505060405180910390f35b600081600081905550600190509190505600a165627a7a723058209791df3f67e9af451c35d7ae55bda5e352764f6a38ea23fa850b1c1fe1bc72e90029 ``` -3. Deploy contract -Wallet-cli-vm branch: https://github.com/tronprotocol/wallet-cli/tree/wallet-cli-vm -Java-tron-vm branch: https://github.com/tronprotocol/java-tron/tree/develop_vm +3. Deploy contract + +Wallet-cli-vm branch: [https://github.com/tronprotocol/wallet-cli/tree/wallet-cli-vm](https://github.com/tronprotocol/wallet-cli/tree/wallet-cli-vm) +Java-tron-vm branch: [https://github.com/tronprotocol/java-tron/tree/develop_vm](https://github.com/tronprotocol/java-tron/tree/develop_vm) Password: password of client-end wallet ContractAddress: customized contract address (in Tron’s required format) ABI: interface description Data: parameters of the initial function Value: reserved field deploycontract(Password, ContractAddress, ABI, Code, Data, Value) -4. Invoke contract + +4. Invoke contract + Selector: function selector Data: parameters triggercontract(Password, ContractAddress, Selector, Data, Value) -5. Check contract -``` + +5. Check contract +```text getcontract(ContractAddress) ``` diff --git a/docs/Tron-http.md b/docs/Tron-http.md new file mode 100644 index 00000000..88c0739a --- /dev/null +++ b/docs/Tron-http.md @@ -0,0 +1,909 @@ +# TRON Built-in Http Introduction +## HexString and Base58check Transcode Demo +JAVA: +[https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92](https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92) +PHP: +[https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php](https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php) + +**Since v3.6, parameter 'visible' is added, when 'visible' is set true, no need to transcode the relevant address and string. This parameter is valid for all api, including solidityNode api and FullNode api.** + +When 'visible' is set true, the format of the input address must be base58, input string must text string, so does the format of the output. If 'visible' is set false or null, the api acts the same as previous version. If the format of the parameters do not match with the set of visible, it will throw out an error. + +Way to set the 'visible' parameter: + +1. For the api need no parameter: by adding 'visible' parameter in the url + ++ example: +```text +http://127.0.0.1:8090/wallet/listexchanges?visible=true +``` +2. For POST method api: By adding 'visible' parameter to the most out layer of the json + ++ example: +```text +curl -X POST http://127.0.0.1:8090/wallet/createtransaction + +{"owner_address_":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ", "to_address_":"TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW", "amount":1000000, "visible":true} +``` +3. For GET method api: By adding 'visible' parameter in the url, as way 1 + + +## SolidityNode Api Introduction + +SolidityNode api's default http port is 8091, when solidityNode is started, http service will be started too. +```text +/walletsolidity/getaccount +Description: Query an account information +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}' +Parameter address: Default hexString +Return: Account object + +/walletsolidity/listwitnesses +Description: Qyery the list of the witnesses +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/listwitnesses +Parameter: No parameter +Return: The list of all the witnesses + +/walletsolidity/getassetissuelist +Description: Query the list of all the tokens +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelist +Parameter: No parameter +Return: The list of all the tokens + +/walletsolidity/getpaginatedassetissuelist +Description: Query the list of all the tokens by pagination +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getpaginatedassetissuelist -d '{"offset": 0, "limit":10}' +Parameter offset: the index of the start token +Parameter limit: the amount of tokens per page +Return: The list of tokens by pagination + +/walletsolidity/getassetissuebyname(Since Odyssey-v3.2) +Description: Query a token by token name +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuebyname -d '{"value": "44756354616E"}' +Parameter value: Token name, default hexString +Return: Token object +Note: Since Odyssey-v3.2, getassetissuebyid or getassetissuelistbyname is recommended, as since v3.2, token name can be repeatable. If the token name you query is not unique, this api will throw out an error + +/walletsolidity/getassetissuelistbyname(Since Odyssey-v3.2) +Description: Query the list of tokens by name +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelistbyname -d '{"value": "44756354616E"}' +Parameter value: Token name, default hexString +Return: The list of tokens + +/walletsolidity/getassetissuebyid(Since Odyssey-v3.2) +Description: Query a token by token id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuebyid -d '{"value": "1000001"}' +Parameter value: Token id +Return: Token object + +/walletsolidity/getnowblock +Description: Query the latest block information +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getnowblock +Parameter: No parameter +Return: the latest block from solidityNode + +/walletsolidity/getblockbynum +Description: Query a block information by block height +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbynum -d '{"num" : 100}' +Parameter num: Block height +Return: Block information + +/walletsolidity/gettransactionbyid +Description: Query an transaction infromation by transaction id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactionbyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: Transaction id +Return: Transaction information + +/walletsolidity/gettransactioncountbyblocknum(Since Odyssey-v3.2) +Description: Query th the number of transactions in a specific block +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioncountbyblocknum -d '{"num" : 100}' +Parameter num: Block height +Return: The number of transactions. + +/walletsolidity/gettransactioninfobyid +Description: Query the transaction fee, block height by transaction id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: Transaction id +Return: Transaction fee & block height + +/walletsolidity/getdelegatedresource(Since Odyssey-v3.2) +Description: Query the energy delegation information +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdelegatedresource -d ' +{ +"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9", +"toAddress": "41c6600433381c731f22fc2b9f864b14fe518b322f" +}' +Parameter fromAddress: Energy from address, default hexString +Parameter toAddress: Energy to address, default hexString +Return: Energy delegation information + +/walletsolidity/getdelegatedresourceaccountindex(Since Odyssey-v3.2) +Description: Query the energy delegation index by an account +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdelegatedresourceaccountindex -d ' +{ +"value": "419844f7600e018fd0d710e2145351d607b3316ce9", +}' +Parameter value: Address, default hexString +Return: Energy delegation index + +/walletsolidity/getexchangebyid(Since Odyssey-v3.2) +Description: Query an exchange pair by exchange pair id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getexchangebyid -d {"id":1} +Parameter id: Exchange pair id +Return: Exchange pair object + +/walletsolidity/listexchanges(Since Odyssey-v3.2) +Description: Query the list of all the exchange pairs +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/listexchanges +Parameter: No parameter +Return: The list of all the exchange pairs + +/walletsolidity/getaccountbyid +Description: Query an account information by account id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getaccountbyid -d '{"account_id":"6161616162626262"}' +Parameter account_id: Account id, default hexString +Return: Account object + +/walletsolidity/getblockbyid +Description: Query a block information by block id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbyid-d '{"value": +"0000000000038809c59ee8409a3b6c051e369ef1096603c7ee723c16e2376c73"}' +Parameter value: Block id +Return: Block object + +/walletsolidity/getblockbylimitnext +Description: Query a list of blocks by range +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbylimitnext -d '{"startNum": 1, "endNum": 2}' +Parameter startNum: The start block height, itself included +Parameter endNum: The end block height, itself not included +Return: The list of the blocks + +/walletsolidity/getblockbylatestnum +Description: Query the several latest blocks +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbylatestnum -d '{"num": 5}' +Parameter num: The number of the blocks expected to return +Return: The list of the blocks + +/walletextension/gettransactionsfromthis(No longer supported in the latest version) +Description: Query the transactions initiated by an account +demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionsfromthis -d '{"account" +: {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10,"startTime": 1546099200000, "endTime": 1552028828000}' +Parameter address: Address, default hexString +Parameter offset: The start index of the transactions, must not greater then 10000 +Parameter limit: The number of transactions expected to return, maximum 50, offset+limit must smaller than 10000 +Parameter startTime: Query start time +Parameter endTime: Query end time, Default latest 7 days +Return: The list of transactions +Note: This api is no longer supported in the latest version, you can use the central node api: 47.90.247.237:8091/walletextension/gettransactionsfromthis + +/walletextension/gettransactionstothis(No longer supported in the latest version) +Description: Query the transactions received by an account +demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionstothis -d '{"account" : +{"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10,"startTime": 1546099200000, "endTime": 1552028828000}' +Parameter address: Address, default hexString +Parameter offset: The start index of the transactions, must not greater then 10000 +Parameter limit: The number of transactions expected to return, maximum 50, offset+limit must smaller than 10000 +Parameter startTime: Query start time +Parameter endTime: Query end time, Default latest 7 days +Return: The list of transactions +Note: This api is no longer supported in the latest version, you can use the central node api: 47.90.247.237:8091/walletextension/gettransactionstothis + +/wallet/getnodeinfo(Since Odyssey-v3.2) +Description: Query the current node infromation +demo: curl -X GET http://127.0.0.1:8091/wallet/getnodeinfo +Parameter: No parameter +Return: The node information + +/walletsolidity/getdeferredtransactionbyid +Description: Query the deferred transaction infromation by transaction id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdeferredtransactionbyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: transaction id +Return: Deferred transaction object + +/walletsolidity/getdeferredtransactioninfobyid +Description: Query the deferred transaction fee, block height by transaction id +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdeferredtransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: transaction id +Return: Deferred transaction fee & block height +``` + +## FullNode Api Introduction +FullNode api's default http port is 8090, when FullNode is started, http service will be started too. + +```text +wallet/createtransaction +Description: Create a transfer transaction, if to address is not existed, then create the account on the blockchain +demo: curl -X POST http://127.0.0.1:8090/wallet/createtransaction -d '{"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount": 1000 }' +Parameter to_address: To address, default hexString +Parameter owner_address: Owner address, default hexString +Parameter amount: Transfer amount +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +/wallet/gettransactionsign +Description: To sign a transaction +demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactionsign -d '{ +"transaction" : {"txID":"454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8","raw_data":{"contract":[{"parameter":{"value":{"amount":1000,"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0","to_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"267e","ref_block_hash":"9a447d222e8de9f2","expiration":1530893064000,"timestamp":1530893006233}}, "privateKey": "your private key" +}' +Parameter transaction: Transaction object +Parameter privateKey: Private key +Return: Transaction after sign +Note: Using this api may leak out private key, please ensure using this api in a secure network + +wallet/broadcasttransaction +Description: Broadcast transaction after sign +demo: curl -X POST http://127.0.0.1:8090/wallet/broadcasttransaction -d '{"signature":["97c825b41c77de2a8bd65b3df55cd4c0df59c307c0187e42321dcc1cc455ddba583dd9502e17cfec5945b34cad0511985a6165999092a6dec84c2bdd97e649fc01"],"txID":"454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8","raw_data":{"contract":[{"parameter":{"value":{"amount":1000,"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0","to_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract"}],"ref_block_bytes":"267e","ref_block_hash":"9a447d222e8de9f2","expiration":1530893064000,"timestamp":1530893006233}}' +Parameter: Transaction after sign +Return: The result of the broadcast + +wallet/updateaccount +Description: Update the name of an account +demo: curl -X POST http://127.0.0.1:8090/wallet/updateaccount -d '{"account_name": "0x7570646174654e616d6531353330383933343635353139" ,"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292"}' +Parameter account_name: Account name, default hexString +Parameter owner_address: Owner address, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/votewitnessaccount +Description: Vote for witnesses +demo: curl -X POST http://127.0.0.1:8090/wallet/votewitnessaccount -d '{ +"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", +"votes": [{"vote_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "vote_count": 5}] +}' +Parameter owner_address: Owner address, default hexString +Parameter votes: 'vote_address' stands for the address of the witness you want to vote, default hexString +'vote_count' stands for the number of votes you want to vote +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/createassetissue +Description: Issue a token +demo: curl -X POST http://127.0.0.1:8090/wallet/createassetissue -d '{ +"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"name":"0x6173736574497373756531353330383934333132313538", +"abbr": "0x6162627231353330383934333132313538", +"total_supply" :4321, +"trx_num":1, +"num":1, +"start_time" : 1530894315158, +"end_time":1533894312158, +"description":"007570646174654e616d6531353330363038383733343633", +"url":"007570646174654e616d6531353330363038383733343633", +"free_asset_net_limit":10000, +"public_free_asset_net_limit":10000, +"frozen_supply":{"frozen_amount":1, "frozen_days":2} +}' +Parameter owner_address: Owner address, default hexString +Parameter name: Token name, default hexString +Parameter abbr: Token name abbreviation, default hexString +Parameter total_supply: Token total supply +Parameter trx_num: Define the price by the ratio of trx_num/num, +Parameter num: Define the price by the ratio of trx_num/num +Parameter start_time: ICO start time +Parameter end_time: ICO end time +Parameter description: Token description, default hexString +Parameter url: Token official website url, default hexString +Parameter free_asset_net_limit: Token free asset net limit +Parameter public_free_asset_net_limit: Token public free asset net limit +Parameter frozen_supply: Token frozen supply +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'trx_num' is SUN + +wallet/updatewitness +Description: Update the witness' website url +demo: curl -X POST http://127.0.0.1:8090/wallet/updatewitness -d '{ +"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", +"update_url": "007570646174654e616d6531353330363038383733343633" +}' +Parameter owner_address: Owner address, default hexString +Parameter update_url: Website url, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/createaccount +Description: Create an account +demo: curl -X POST http://127.0.0.1:8090/wallet/createaccount -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "account_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0"}' +Parameter owner_address: Owner address, default hexString +Parameter account_address: New address, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: It costs 0.1 TRX + +wallet/createwitness +Description: Apply to become a witness +demo: curl -X POST http://127.0.0.1:8090/wallet/createwitness -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "url": "007570646174654e616d6531353330363038383733343633"}' +Parameter owner_address: Owner address, default hexString +Parameter url: Website url, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/transferasset +Description: Transfer token +demo: curl -X POST http://127.0.0.1:8090/wallet/transferasset -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "asset_name": "31303030303031", "amount": 100}' +Parameter owner_address: Owner address, default hexString +Parameter to_address: To address, default hexString +Parameter asset_name: Token id, default hexString +Parameter amount: Token transfer amount +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'amount' is the smallest unit of the token + +wallet/easytransfer +Description: Easy transfer +demo: curl -X POST http://127.0.0.1:8090/wallet/easytransfer -d '{ +"passPhrase": "your password", +"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"amount": 100 +}' +Parameter passPhrase: Password, default hexString +Parameter toAddress: To address, default hexString +Parameter amount: Transfer TRX amount +Return: Transaction object & the result of the broadcast +Note: Using this api may leak out private key, please ensure using this api in a secure network + +wallet/easytransferasset +Description: Easy token transfer +demo:curl -X POST http://127.0.0.1:8090/wallet/easytransferasset -d '{ +"passPhrase": "your password", +"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"assetId": "1000001", +"amount": 100 +}' +Parameter passPhrase: Password, default hexString +Parameter toAddress: To address, default hexString +Parameter assetId: Token id +Parameter amount: Transfer token amount +Return: Transaction object & the result of the broadcast +Note: Using this api may leak out private key, please ensure using this api in a secure network; +The unit of 'amount' is the smallest unit of the token + +wallet/createaddress +Description: Create an address with a password +demo: curl -X POST http://127.0.0.1:8090/wallet/createaddress -d '{"value": "3230313271756265696a696e67"}' +Parameter value: Password, default hexString +Return: An address +Note: Using this api may leak out private key, please ensure using this api in a secure network + +wallet/participateassetissue +Description: Participate a token +demo: curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ +"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"amount":100, +"asset_name":"3230313271756265696a696e67" +}' +Parameter to_address: The issuer address of the token, default hexString +Parameter owner_address: The participant address, default hexString +Parameter amount: Participate token amount +Parameter asset_name: Token id, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'amount' is the smallest unit of the token + +wallet/freezebalance +Description: Freeze TRX +demo: curl -X POST http://127.0.0.1:8090/wallet/freezebalance -d '{ +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"frozen_balance": 10000, +"frozen_duration": 3, +"resource" : "BANDWIDTH", +"receiveraddress":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" +}' +Parameter owner_address: Owner address, default hexString +Parameter frozen_balance: TRX freeze amount +Parameter frozen_duration: TRX freeze duration, at least 3 days +Parameter resource: TRX freeze type, 'BANDWIDTH' or 'ENERGY' +Parameter receiverAddress: The address that will receive the resource, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/unfreezebalance +Description: Unfreeze the frozen TRX that is due +demo: curl -X POST http://127.0.0.1:8090/wallet/unfreezebalance -d '{ +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"resource": "BANDWIDTH", +"receiveraddress":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" +}' +Parameter owner_address: Owner address, default hexString +Parameter resource: Frozen TRX unfreeze type 'BANDWIDTH' or 'ENERGY' +Parameter receiverAddress: The address that will lose the resource, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/unfreezeasset +Description: Unfreeze the frozen token that is due +demo: curl -X POST http://127.0.0.1:8090/wallet/unfreezeasset -d '{ +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +}' +Parameter owner_address: Owner address, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/withdrawbalance +Description: Withdraw reward to account balance for witnesses +demo: curl -X POST http://127.0.0.1:8090/wallet/withdrawbalance -d '{ +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +}' +Parameter owner_address: Owner address, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: It can only withdraw once for every 24 hours + +wallet/updateasset +Description: Update token information +demo: curl -X POST http://127.0.0.1:8090/wallet/updateasset -d '{ +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"description": "", +"url": "", +"new_limit" : 1000000, +"new_public_limit" : 100 +}' +Parameter owner_address: The issuers address of the token, default hexString +Parameter description: The description of token, default hexString +Parameter url: The token's website url, default hexString +Parameter new_limit: Each token holder's free bandwidth +Parameter new_public_limit: The total free bandwidth of the token +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/listnodes +Description: Query the list of nodes connected to the ip of the api +demo: curl -X POST http://127.0.0.1:8090/wallet/listnodes +Parameter: No parameter +Return: The list of nodes + +wallet/getassetissuebyaccount +Description: Query the token issue information of an account +demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyaccount -d '{"address": "41F9395ED64A6E1D4ED37CD17C75A1D247223CAF2D"}' +Parameter address: Token issuer's address, default hexString +Return: Token object + +wallet/getaccountnet +Description: Query the bandwidth information of an account +demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountnet -d '{"address": "4112E621D5577311998708F4D7B9F71F86DAE138B5"}' +Parameter address: Address, default hexString +Return: Bandwidth information + +wallet/getassetissuebyname +Description: Query a token by token name +demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyname -d '{"value": "44756354616E"}' +Parameter value: Token name, default hexString +Return: Token object +Note: Since Odyssey-v3.2, getassetissuebyid or getassetissuelistbyname is recommended, as since v3.2, token name can be repeatable. If the token name you query is not unique, this api will throw out an error + +wallet/getassetissuelistbyname(Since Odyssey-v3.2) +Description: Query the list of tokens by name +demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuelistbyname -d '{"value": "44756354616E"}' +Parameter value: Token name, default hexString +Return: The list of tokens + +wallet/getassetissuebyid(Since Odyssey-v3.2) +Description: Query a token by token id +demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuebyid -d '{"value": "1000001"}' +Parameter value: Token id +Return: Token object + +wallet/getnowblock +Description: Query the latest block information +demo: curl -X POST http://127.0.0.1:8090/wallet/getnowblock +Parameter: No parameter +Return: the latest block from solidityNode + +wallet/getblockbynum +Description: Query a block information by block height +demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbynum -d '{"num" : 1}' +Parameter num: Block height +Return: Block information + +wallet/getblockbyid +Description: Query a block information by block id +demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbyid-d '{"value": +"0000000000038809c59ee8409a3b6c051e369ef1096603c7ee723c16e2376c73"}' +Parameter value: Block id +Return: Block object + +wallet/getblockbylimitnext +Description: Query a list of blocks by range +demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbylimitnext -d '{"startNum": 1, "endNum": 2}' +Parameter startNum: The start block height, itself included +Parameter endNum: The end block height, itself not included +Return: The list of the blocks + +wallet/getblockbylatestnum +Description: Query the several latest blocks +demo: curl -X POST http://127.0.0.1:8090/wallet/getblockbylatestnum -d '{"num": 5}' +Parameter num: The number of the blocks expected to return +Return: The list of the blocks + +wallet/gettransactionbyid +Description: Query an transaction infromation by transaction id +demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactionbyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: Transaction id +Return: Transaction information + +wallet/gettransactioninfobyid(Since Odyssey-v3.2) +Description: Query the transaction fee, block height by transaction id +demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: Transaction id +Return: Transaction fee & block height + +wallet/gettransactioncountbyblocknum(Since Odyssey-v3.2) +Description: Query th the number of transactions in a specific block +demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioncountbyblocknum -d '{"num" : 100}' +Parameter num: Block height +Return: The number of transactions. + +wallet/getaccount +Description: Query an account information +demo: curl -X POST http://127.0.0.1:8090/wallet/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}' +Parameter address: Default hexString +Return: Account object + +wallet/listwitnesses +Description: Qyery the list of the witnesses +demo: curl -X POST http://127.0.0.1:8090/wallet/listwitnesses +Parameter: No parameter +Return: The list of all the witnesses + +wallet/getassetissuelist +Description: Query the list of all the tokens +demo: curl -X POST http://127.0.0.1:8090/wallet/getassetissuelist +Parameter: No parameter +Return: The list of all the tokens + +wallet/getpaginatedassetissuelist +Description: Query the list of all the tokens by pagination +demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedassetissuelist -d '{"offset": 0, "limit":10}' +Parameter offset: The index of the start token +Parameter limit: The amount of tokens per page +Return: The list of tokens by pagination + +wallet/getpaginatedproposallist(Since Odyssey-v3.5) +Description: Query the list of all the proposals by pagination +demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedproposallist -d '{"offset": 0, "limit": 10}' +Parameter offset: The index of the start proposal +Parameter limit: The amount of proposals per page +Return: The list of proposals by pagination + + +wallet/getpaginatedexchangelist(Odyssey-v3.2开始支持) +Description: Query the list of all the exchange pairs by pagination +demo: curl -X POST http://127.0.0.1:8090/wallet/getpaginatedexchangelist -d '{"offset": 0, "limit":10}' +Parameter offset: The index of the start exchange pair +Parameter limit: The amount of exchange pairs per page +Return: The list of exchange pairs by pagination + +wallet/totaltransaction +Description: Query the total transactions number +demo: curl -X POST http://127.0.0.1:8090/wallet/totaltransaction +Parameter: No parameter +Return: Total transaction number + +wallet/getnextmaintenancetime +Description: Query the time interval till the next vote round +demo: curl -X POST http://127.0.0.1:8090/wallet/getnextmaintenancetime +Parameter: No parameter +Return: The time interval till the next vote round(unit: ms) + +wallet/easytransferbyprivate +Description: TRX Easy transfer +demo: curl -X POST http://127.0.0.1:8090/wallet/easytransferbyprivate -d '{"privateKey": "D95611A9AF2A2A45359106222ED1AFED48853D9A44DEFF8DC7913F5CBA727366", "toAddress":"4112E621D5577311998708F4D7B9F71F86DAE138B5","amount":10000}' +Parameter privateKey: Private key, default hexString +Parameter toAddress: To address, default hexString +Parameter amount: TRX transfer amount +Return: Transaction object & the result of the broadcast +Note: Using this api may leak out private key, please ensure using this api in a secure network + +wallet/easytransferassetbyprivate +Description: Token easy transfer +demo: curl -X POST http://127.0.0.1:8090/wallet/easytransferassetbyprivate -d '{"privateKey": "D95611A9AF2A2A45359106222ED1AFED48853D9A44DEFF8DC7913F5CBA727366", "toAddress":"4112E621D5577311998708F4D7B9F71F86DAE138B5", +"assetId": "1000001", +"amount": 10000}' +Parameter privateKey: Private key, default hexString +Parameter toAddress: To address, default hexString +Parameter assetId: Token id +Parameter amount: Token transfer amount +Return: Transaction object & the result of the broadcast +Note: Using this api may leak out private key, please ensure using this api in a secure network; +The unit of 'amount' is the smallest unit of the token + +wallet/generateaddress +Description: Generate address and private key +demo: curl -X POST http://127.0.0.1:8090/wallet/generateaddress +Parameter: No parameter +Return: Address and private key +Note: Using this api may leak out private key, please ensure using this api in a secure network; + +wallet/validateaddress +Description: Check the validity of the address +demo: curl -X POST http://127.0.0.1:8090/wallet/validateaddress -d '{"address": "4189139CB1387AF85E3D24E212A008AC974967E561"}' +Parameter address: Address, can be base58checksum、hexString、base64 +Return: The check result + +wallet/deploycontract +Description: Deploy a smart contract +demo: curl -X POST http://127.0.0.1:8090/wallet/deploycontract -d '{"abi":"[{\"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\"}]","bytecode":"608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029","parameter":"","call_value":100,"name":"SomeContract","consume_user_resource_percent":30,"fee_limit":10,"origin_energy_limit": 10,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' +Parameter abi: Abi +Parameter bytecode: Bytecode, default hexString +Parameter parameter: The list of the parameters of the constructor, It should be converted hexString after encoded according to ABI encoder. If constructor has no parameter, this can be optional +Parameter 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 +Parameter fee_limit: The maximum TRX burns for resource consumption +Parameter call_value: The TRX transfer to the contract for each call +Parameter call_token_value: The amount of trc10 token transfer to the contract for each call (Optional) +Parameter token_id: The id of trc10 token transfer to the contract (Optional) +Parameter owner_address: Owner address of the contract, default hexString +Parameter name: Contract name +Parameter origin_energy_limit: The maximum resource consumption of the creator in one execution or creation +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of TRX in the parameters is SUN + +wallet/triggersmartcontract +Description: Trigger smart contract +demo: curl -X POST http://127.0.0.1:8090/wallet/triggersmartcontract -d '{"contract_address":"4189139CB1387AF85E3D24E212A008AC974967E561","function_selector":"set(uint256,uint256)","parameter":"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","fee_limit":10,"call_value":100,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' +Parameter contract_address: Contract address, default hexString +Parameter function_selector: Function call, must not leave a blank space +Parameter parameter: The parameter passed to 'function_selector', the format must match with the VM's requirement. You can use a js tool provided by remix to convert a parameter like [1,2] to the format that VM requires +Parameter fee_limit: The maximum TRX burns for resource consumption +Parameter call_value: The TRX transfer to the contract for each call +Parameter call_token_value: The amount of trc10 token transfer to the contract for each call +Parameter token_id: The id of trc10 token transfer to the contract +Parameter owner_address: Owner address that triggers the contract, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of TRX in the parameters is SUN + +wallet/getcontract +Description: Query a contract +demo: curl -X POST http://127.0.0.1:8090/wallet/getcontract -d '{"value":"4189139CB1387AF85E3D24E212A008AC974967E561"}' +Parameter value: Contract address, default hexString +Return: Smart contract object + +wallet/proposalcreate +Description: Create a proposal +demo: curl -X POST http://127.0.0.1:8090/wallet/proposalcreate -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9","parameters":[{"key": 0,"value": 100000},{"key": 1,"value": 2}] } +Parameter owner_address: Creator address +Parameter parameters: Proposal parameters +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/getproposalbyid +Description: Query a proposal by proposal id +demo: curl -X POST http://127.0.0.1:8090/wallet/getproposalbyid -d {"id":1} +Parameter id: Proposal id +Return: The proposal information + +wallet/listproposals +Description: Query all the proposals +demo: curl -X POST http://127.0.0.1:8090/wallet/listproposals +Parameter: No parameter +Return: The list of all the proposals + +wallet/proposalapprove +Description: To approve a proposal +demo: curl -X POST http://127.0.0.1:8090/wallet/proposalapprove -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9", "proposal_id":1, "is_add_approval":true} +Parameter owner_address: The address that makes the approve action, default hexString +Parameter proposal_id: Proposal id +Parameter is_add_approval: Whether to approve +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/proposaldelete +Description: To delete a proposal +demo: curl -X POST http://127.0.0.1:8090/wallet/proposaldelete -d {"owner_address" : "419844F7600E018FD0D710E2145351D607B3316CE9", "proposal_id":1} +Parameter owner_address: Owner address of the proposal, default hexString +Parameter proposal_id: Proposal id +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/getaccountresource +Description: Query the resource information of an account +demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountresource -d {"address" : "419844f7600e018fd0d710e2145351d607b3316ce9"} +Parameter address: Address, default hexString +Return: The resource information + +wallet/exchangecreate +Description: Create an exchange pair +demo: curl -X POST http://127.0.0.1:8090/wallet/exchangecreate -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", 、 +"first_token_id":token_a, "first_token_balance":100, "second_token_id":token_b,"second_token_balance":200} +Parameter first_token_id: The first token's id, default hexString +Parameter first_token_balance: The first token's balance +Parameter second_token_id: The second token's id, default hexString +Parameter second_token_balance: The second token's balance +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'first_token_balance' and 'second_token_balance' is the smallest unit of the token + +wallet/exchangeinject +Description: Inject funds for exchange pair +demo: curl -X POST http://127.0.0.1:8090/wallet/exchangeinject -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100} +Parameter owner_address: Owner address of the exchange pair, default hexString +Parameter exchange_id: Exchange pair id +Parameter token_id: Token id, default hexString +Parameter quant: Token inject amount +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'quant' is the smallest unit of the token + +wallet/exchangewithdraw +Description: Withdraw from exchange pair +demo: curl -X POST http://127.0.0.1:8090/wallet/exchangewithdraw -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100} +Parameter owner_address: Owner address of the exchange pair, default hexString +Parameter exchange_id: Exchange pair id +Parameter token_id: Token id, default hexString +Parameter quant: Token withdraw amount +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'quant' is the smallest unit of the token + +wallet/exchangetransaction +Description: Participate the transaction of exchange pair +demo: curl -X POST http://127.0.0.1:8090/wallet/exchangetransaction -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100,"expected":10} +Parameter owner_address: Owner address of the exchange pair, default hexString +Parameter exchange_id: Exchange pair id +Parameter token_id: Token id, default hexString +Parameter quant: Sell token amount +Parameter expected: Expected token amount to get +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'quant' and 'expected' is the smallest unit of the token + +wallet/getexchangebyid +Description: Query an exchange pair by exchange pair id +demo: curl -X POST http://127.0.0.1:8090/wallet/getexchangebyid -d {"id":1} +Parameter id: Exchange pair id +return: Exchange pair information + +wallet/listexchanges +Description: Query the list of all the exchange pairs +demo: curl -X POST http://127.0.0.1:8090/wallet/listexchanges +Parameter: No parameter +Return: The list of all the exchange pairs + +wallet/getchainparameters +Description: Query the parameters of the blockchain used for witnessses to create a proposal +demo: curl -X POST http://127.0.0.1:8090/wallet/getchainparameters +Parameter: No parameter +Return: The list of parameters of the blockchain + +wallet/updatesetting +Description: Update the consume_user_resource_percent parameter of a smart contract +demo: curl -X POST http://127.0.0.1:8090/wallet/updatesetting -d '{"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9", "contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f", "consume_user_resource_percent": 7}' +Parameter owner_address: Owner address of the smart contract, default hexString +Parameter contract_address: Smart contract address, default hexString +Parameter consume_user_resource_percent: Consume user's resource percentage +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/updateenergylimit +Description: Update the origin_energy_limit parameter of a smart contract +demo: curl -X POST http://127.0.0.1:8090/wallet/updatesetting -d '{"owner_address": "419844f7600e018fd0d710e2145351d607b3316ce9", "contract_address": "41c6600433381c731f22fc2b9f864b14fe518b322f", "origin_energy_limit": 7}' +Parameter owner_address: Owner address of the smart contract, default hexString +Parameter contract_address: Smart contract address, default hexString +Parameter origin_energy_limit: The maximum resource consumption of the creator in one execution or creation +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object + +wallet/getdelegatedresource(Since Odyssey-v3.2) +Description: Query the energy delegation information +demo: curl -X POST http://127.0.0.1:8090/wallet/getdelegatedresource -d ' +{ +"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9", +"toAddress": "41c6600433381c731f22fc2b9f864b14fe518b322f" +}' +Parameter fromAddress: Energy from address, default hexString +Parameter toAddress: Energy to address, default hexString +Return: Energy delegation information + +wallet/getdelegatedresourceaccountindex(Since Odyssey-v3.2) +Description: Query the energy delegation index by an account +demo: curl -X POST http://127.0.0.1:8090/wallet/getdelegatedresourceaccountindex -d ' +{ +"value": "419844f7600e018fd0d710e2145351d607b3316ce9", +}' +Parameter value: Address, default hexString +Return: Energy delegation index + +wallet/getnodeinfo(Since Odyssey-v3.2) +Description: Query the current node infromation +demo: curl -X GET http://127.0.0.1:8090/wallet/getnodeinfo +Parameter: No Parameter +Return: The node information + +wallet/setaccountid +Description: To set an account id for an account +demo: curl -X POST http://127.0.0.1:8090/wallet/setaccountid -d '{ +"owner_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0","account_id":"6161616162626262"}' +Parameter owner_address: Owner address, default hexString +Parameter account_id: Account id, default hexString +Return: Transaction object + +wallet/getaccountbyid +Description: Query an account information by account id +demo: curl -X POST http://127.0.0.1:8090/wallet/getaccountbyid -d '{"account_id":"6161616162626262"}' +Parameter account_id: Account id, default hexString +Return: Account object + +wallet/getdeferredtransactionbyid +Description: Query the deferred transaction infromation by transaction id +demo: curl -X POST http://127.0.0.1:8090/wallet/getdeferredtransactionbyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: Transaction id +Return: Deferred transaction object + +wallet/canceldeferredtransactionbyid +Description: Query a deferred transaction by transaction id +demo: curl -X POST http://127.0.0.1:8090/wallet/canceldeferredtransactionbyid -d '{ +"transactionId":"34e6b6497b71100756790a7f20cd729376768dd2bebb6a4a9c5e87b920d5de10", +"ownerAddress":"41a7d8a35b260395c14aa456297662092ba3b76fc0"}' +Parameter owner_address: Owner address of the transaction, default hexString +Parameter transactionId: Transaction id +Return: Transaction object + +wallet/getdeferredtransactioninfobyid +Description: Query the deferred transaction fee, block height by transaction id +demo: curl -X POST http://127.0.0.1:8090/wallet/getdeferredtransactioninfobyid -d '{"value" : "309b6fa3d01353e46f57dd8a8f27611f98e392b50d035cef213f2c55225a8bd2"}' +Parameter value: Transaction id +Return: Deferred transaction fee & block height + +wallet/triggerconstantcontract +Description: Trigger the constant of the smart contract, the transaction is off the blockchain +demo: curl -X POST http://127.0.0.1:8090/wallet/triggerconstantcontract -d '{"contract_address":"4189139CB1387AF85E3D24E212A008AC974967E561","function_selector":"set(uint256,uint256)","parameter":"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","fee_limit":10,"call_value":100,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}' +Parameter contract_address: Smart contract address, defualt hexString +Parameter function_selector: Function call, must not leave a blank space +Parameter parameter: The parameter passed to 'function_selector', the format must match with the VM's requirement. You can use a hs tool provided by remix to convert a parameter like [1,2] to the format that VM requires +Parameter fee_limit: The maximum TRX burns for resource consumption +Parameter call_value: The TRX transfer to the contract for each call +Parameter owner_address: Owner address that triggers the contract, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of TRX in the parameters is SUN + +wallet/clearabi +Description: To clear the abi of a smart contract +demo: curl -X POST http://127.0.0.1:8090/wallet/clearabi -d '{ +"owner_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0", +"contract_address":"417bcb781f4743afaacf9f9528f3ea903b3782339f"}' +Parameter owner_address: Owner address of the smart contract +Parameter contract_address: Smart contract address, default hexString +Return: Transaction object + +wallet/addtransactionsign +Description: To sign the transaction of trigger constant contract +demo: curl -X POST http://127.0.0.1:8090/wallet/addtransactionsign -d '{ +"owner_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0", +"contract_address":"417bcb781f4743afaacf9f9528f3ea903b3782339f"}' +Parameter owner_address: Owner address of the smart contract +Parameter contract_address: Smart contract address, default hexString +Return: Transaction object after sign + +wallet/getsignweight +Description: Query the current signatures total weight of a transaction after sign +demo: curl -X POST http://127.0.0.1:8090/wallet/getsignweight -d '{"visible":true, +"signature +":["36c9d227b9dd6b6f377d018bb2df784be884f28c743dc97edfdaa8bd64b2ffb058bca24a4eb8b4543a052a4f353fee8cb9e606ff739c74d22f9451c7a35c8f5200"],"txID":"4d928f7adfbad5c82f5b8518a6f7b7c5e459d06d1cb5306c61fad8a793587d2d","raw_data":{"contract":[{"parameter":{"value":{"amount":1000000,"owner_address":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ","to_address":"TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract","Permission_id":2}],"ref_block_bytes":"0380","ref_block_hash":"6cdc8193f096be0f","expiration":1556249055000,"timestamp":1556248995694},"raw_data_hex":"0a02038022086cdc8193f096be0f40989eb0bda52d5a69080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541a7d8a35b260395c14aa456297662092ba3b76fc01215415a523b449890854c8fc460ab602df9f31fe4293f18c0843d280270eeceacbda52d"}' +Parameter: Transaction object after sign +Return: The current signatures total weight + +wallet/getapprovedlist +Description: Query the signatures list of a transaction after sign +demo: curl -X POST http://127.0.0.1:8090/wallet/getapprovedlist -d '{"visible":true, +"signature +":["36c9d227b9dd6b6f377d018bb2df784be884f28c743dc97edfdaa8bd64b2ffb058bca24a4eb8b4543a052a4f353fee8cb9e606ff739c74d22f9451c7a35c8f5200"],"txID":"4d928f7adfbad5c82f5b8518a6f7b7c5e459d06d1cb5306c61fad8a793587d2d","raw_data":{"contract":[{"parameter":{"value":{"amount":1000000,"owner_address":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ","to_address":"TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW"},"type_url":"type.googleapis.com/protocol.TransferContract"},"type":"TransferContract","Permission_id":2}],"ref_block_bytes":"0380","ref_block_hash":"6cdc8193f096be0f","expiration":1556249055000,"timestamp":1556248995694},"raw_data_hex":"0a02038022086cdc8193f096be0f40989eb0bda52d5a69080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541a7d8a35b260395c14aa456297662092ba3b76fc01215415a523b449890854c8fc460ab602df9f31fe4293f18c0843d280270eeceacbda52d"}' +Parameter: Transaction object after sign +Return: The list of the signatures + +wallet/accountpermissionupdate +Description: To set multi-signature for an account +demo: curl -X POST http://127.0.0.1:8090/wallet/accountpermissionupdate -d +'{"owner_address":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ","owner":{"type":0, +"permission_name":"owner","threshold":1,"keys":[{"address":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ", +"weight":1}]},"witness":{"type":1,"permission_name":"witness","threshold":1, +"keys":[{"address":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ","weight":1}]},"actives":[{"type":2,"permission_name":"active12323","threshold":2,"operations":"7fff1fc0033e0000000000000000000000000000000000000000000000000000","keys":[{"address":"TNhXo1GbRNCuorvYu5JFWN3m2NYr9QQpVR","weight":1},{"address":"TKwhcDup8L2PH5r6hxp5CQvQzZqJLmKvZP","weight":1}]}],"visible":true}' +Parameter owner_address: Owner address of the account, default hexString +Parameter owner: Account owner permission +Parameter witness: Account witness permission, only for witness +Parameter actives: Operation permission +Return: Transaction object + +``` diff --git a/docs/Tron-overview.md b/docs/Tron-overview.md new file mode 100644 index 00000000..fe402014 --- /dev/null +++ b/docs/Tron-overview.md @@ -0,0 +1,1102 @@ +# TRON Blockchain Documentation + +# 1 Project Repository + +Github Url: [https://github.com/tronprotocol](https://github.com/tronprotocol) +[java-tron](https://github.com/tronprotocol/java-tron) is the source code of the MainNet. +[protocol](https://github.com/tronprotocol/protocol) is the defination of the api and data structure. +[wallet-cli](https://github.com/tronprotocol/wallet-cli) is the official command line wallet. + +MainNet Configuration: +[https://github.com/tronprotocol/TronDeployment/blob/master/main_net_config.conf](https://github.com/tronprotocol/TronDeployment/blob/master/main_net_config.conf) +TestNet Configuration: +[https://github.com/tronprotocol/TronDeployment/blob/master/test_net_config.conf](https://github.com/tronprotocol/TronDeployment/blob/master/test_net_config.conf) + +# 2 Tron Super Representatives and Committee + +## 2.1 How to Become a Super Representative + + In TRON network, any account can apply to become a super representative candidate. Every account can vote for super representative candidates. The top 27 candidates with the most votes are the super representatives. Super representatives can produce blocks. The votes will be counted every 6 hours, so super representatives may also change every 6 hours. + + To prevent vicious attack, TRON network burns 9999 TRX from the account that applies to become a super representative candidate. + +## 2.2 Super Representatives Election + + To vote, you need to have TRON Power(TP). To get TRON Power, you need to freeze TRX. Every 1 frozen TRX accounts for one TRON Power(TP). Every account in TRON network has the right to vote for a super representative candidate. After you unfreeze your frozen TRX, you will lose the responding TRON Power(TP), so your previous vote will be invalid. + + Note: Only your latest vote will be counted in TRON network which means your previous vote will be over written by your latest vote. + ++ Examples (Using wallet-cli): + +```text +freezebalance 10,000,000 3 // Freeze 10 TRX to get 10 TRON Power(TP) +votewitness witness1 4 witness2 6 // Vote 4 votes for witness1, 6 votes for witness2 +votewitness witness1 3 witness2 7 // Vote 3 votes for witness1, 7 votes for witness2 +``` + +The final output above is: Vote 3 votes for witness1, 7 votes for witness2 + +## 2.3 Reward for Super Representatives + +**Votes Reward:** +Every 6 hours, the top 127 super representative candidates with the most votes will share a total amount of 115,200 TRX according to their votes percentage. The annual votes reward is 168,192,000 TRX in total. + +**Block Producing Reward:** +Every time after a super representative produces a block, it will be reward 32 TRX. The 27 super representatives take turns to produce blocks every 3 seconds. The annual block producing reward is 336,384,000 TRX in total. + +Every time after a super representative produces a block, the 32 TRX block producing reward will be sent to it's sub-account. The sub-account is a read-only account, it allows a withdraw action from sub-account to super representative account every 24 hours. + +## 2.4 Committee + +### 2.4.1 What is Committee + +Committee can modify the TRON network parameters, like transacton fees, block producing reward amount, etc. Committee is composed of the current 27 super representatives. Every super representative has the right to start a proposal. The proposal will be passed after it gets more than 19 approves from the super representatives and will become valid in the next maintenance period. + +### 2.4.2 Create a Proposal + +Only the account of a super representative can create a proposal. +The network parameters can be modified([min,max]): + +0: MAINTENANCE_TIME_INTERVAL, [3 * 27* 1000, 24 * 3600 * 1000] //super representative votes count time interval, currently 6 * 3600 * 1000 ms +1: ACCOUNT_UPGRADE_COST, [0, 100 000 000 000 000 000] //the fee to apply to become a super representative candidate, currently 9999_000_000 SUN +2: CREATE_ACCOUNT_FEE, [0, 100 000 000 000 000 000] //the fee to create an account, currently 100_000 SUN +3: TRANSACTION_FEE, [0, 100 000 000 000 000 000] //the fee for bandwidth, currently 10 SUN/byte +4: ASSET_ISSUE_FEE, [0, 100 000 000 000 000 000] //the fee to issue an asset, currently 1024_000_000 SUN +5: WITNESS_PAY_PER_BLOCK, [0, 100 000 000 000 000 000] //the block producing reward, currently 32_000_000 SUN +6: WITNESS_STANDBY_ALLOWANCE, [0, 100 000 000 000 000 000] //the votes reward for top 127 super representative candidates, currently 115_200_000_000 SUN +7: CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT, //the fee to create an account in system, currently 0 SUN +8: CREATE_NEW_ACCOUNT_BANDWIDTH_RATE, //the consumption of bandwith or TRX while creating an account, using together with #7 +9: ALLOW_CREATION_OF_CONTRACTS, //to enable the VM +10: REMOVE_THE_POWER_OF_THE_GR, //to clear the votes of GR +11: ENERGY_FEE, [0,100 000 000 000 000 000] //SUN +12: EXCHANGE_CREATE_FEE, [0, 100 000 000 000 000 000] //SUN +13: MAX_CPU_TIME_OF_ONE_TX, [0, 1000] //ms +14: ALLOW_UPDATE_ACCOUNT_NAME, //to allow users to change account name and allow account duplicate name, currently 0, means false +15: ALLOW_SAME_TOKEN_NAME, //to allow create a token with duplicate name, currently 1, means true +16: ALLOW_DELEGATE_RESOURCE, //to enable the resource delegation +17: TOTAL_ENERGY_LIMIT, //to modify the energy limit +18: ALLOW_TVM_TRANSFER_TRC10, //to allow smart contract to transfer TRC-10 token, currently 0, means false + ++ Examples (Using wallet-cli): +```text +createproposal id value +id: the serial number (0 ~ 18) +value: the parameter value +``` + +Note: In TRON network, 1 TRX = 1000_000 SUN + +### 2.4.3 Vote for a Proposal + +Proposal only support YES vote. Since the creation time of the proposal, the proposal is valid within 3 days. If the proposal does not receive enough YES votes within the period of validity, the proposal will be invalid beyond the period of validity. Yes vote can be cancelled. + ++ Examples (Using wallet-cli): +```text +approveProposal id is_or_not_add_approval +id: proposal id +is_or_not_add_approval: YES vote or cancel YES vote +``` + +### 2.4.4 Cancel Proposal + +Proposal creator can cancel the proposal before it is passed. + ++ Examples (Using wallet-cli): +```text +deleteProposal id +id: proposal id +``` + +### 2.4.5 Query Proposal + +Query all the proposals list (ListProposals) +Query all the proposals list by pagination (GetPaginatedProposalList) +Query a proposal by proposal id (GetProposalById) +For more api detail, please refer to [Tron-http](Tron-http.md) + +# 3 TRON Account + +## 3.1 Introduction + +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 transfered 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. + +## 3.2 How to Create an Account + +1. Use a wallet to generate the address and private key. To active the account, you need to transfer TRX or transfer token to the new created account. [generate an account](https://tronscan.org/#/wallet/new) + +2. Use an account already existed in TRON network to create an account + +## 3.3 Key-pair Generation Algorithm +Tron signature algorithm is ECDSA, curve used is SECP256K1. Private key is a random bumber, public key is a point in the elliptic curve. The process is: first generate a random number d to be the private key, then caculate P = d * G as the public key, G is the elliptic curve base point. + +## 3.4 Address Format +Use the public key P as the input, by SHA3 get the result H. The length of the public key is 64 bytes, SHA3 uses Keccak256. Use the last 20 bytes of H, and add a byte of 0x41 in front of it, then the address come out. Do basecheck to address, here is the final address. All addresses start with 'T'. + +basecheck process: first do sha256 caculation to address to get h1, then do sha256 to h1 to get h2, use the first 4 bytes as check to add it to the end of the address to get address||check, do base58 encode to address||check to get the final result. + +character map: +ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" + +## 3.5 Signature +Signature introduction, please refer to: +[https://github.com/tronprotocol/Documentation/blob/fix_http/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E4%BA%A4%E6%98%93%E7%AD%BE%E5%90%8D%E6%B5%81%E7%A8%8B.md]( +https://github.com/tronprotocol/Documentation/blob/fix_http/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E4%BA%A4%E6%98%93%E7%AD%BE%E5%90%8D%E6%B5%81%E7%A8%8B.md) + +# 4 TRON Network Node +## 4.1 SuperNode +### 4.1.1 SuperNode Introduction +Super Representative(abbr: SR) is the block producer in TRON network, there are 27 SR. They verify the transactions and write the transactions into the blocks, they take turns to produce blocks. The super Representatives' information is public to everyone in TRON network. The best way to browse is using [tronscan](https://tronscan.org/#/representatives). +### 4.1.2 SuperNode Deployment +[SuperNode Deployment](https://github.com/tronprotocol/java-tron#running-a-super-representative-node-for-mainnet) +### 4.1.3 Recommended Hardware Configuration +minimum requirement: +CPU: 16 cores, RAM: 32G, Bandwidth: 100M, Disk: 1T +Recommended requirement: +CPU: > 64 cores RAM: > 64G, Bandwidth: > 500M, Disk: > 20T + +## 4.2 FullNode +### 4.2.1 FullNode Introduction +FullNode has the complete block chain data, can update data in real time. It can broadcast the transactions and provide api service. +### 4.2.2 FullNode Deployment +please refer to [TRON-Deployment](https://github.com/tronprotocol/tron-deployment) +### 4.2.3 Recommended Hardware Configuration +minimum requirement: +CPU: 16 cores, RAM: 32G, Bandwidth: 100M, Disk: 1T +Recommended requirement: +CPU: > 64 cores RAM: > 64G, Bandwidth: > 500M, Disk: > 20T + +## 4.3 SolidityNode +### 4.3.1 SolidityNode Introduction +SolidityNode only synchronize solidified blocks data from the fullNode it specifies, It also provie api service. +### 4.3.2 SolidityNode Deployment +please refer to [TRON-Deployment](https://github.com/tronprotocol/tron-deployment) +### 4.3.3 Recommended Hardware Configuration +minimum requirement: +CPU: 16 cores, RAM: 32G, Bandwidth: 100M, Disk: 1T +Recommended requirement: +CPU: > 64 cores RAM: > 64G, Bandwidth: > 500M, Disk: > 20T + +## 4.4 TRON Network Instructure +TRON network uses Peer-to-Peer(P2P) network instructure, all nodes status equal. There are three types of node: SuperNode, FullNode, SolidityNode. SuperNode produces blocks, FullNode synchronizes blocks and broadcasts transactions, SolidityNode synchronizes solidified blocks. Any device that deploy the java-tron code can join TRON network as a node. +![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/network.png) +## 4.5 FullNode and SolidityNode Fast Deployment +Download fast deployment script, run the script according to different types of node. +please refer to [Node Fast Deployment](https://github.com/tronprotocol/tron-deployment#deployment-of-soliditynode-on-the-one-host) +## 4.6 MainNet, TestNet, PrivateNet +MainNet, TestNet, PrivateNet all use the same code, only the node start configuration varies. +### 4.6.1 MainNet +[MainNet configuration](https://github.com/tronprotocol/tron-deployment/blob/master/main_net_config.conf) +### 4.6.2 TestNet +[TestNet configuration](https://github.com/tronprotocol/tron-deployment/blob/master/test_net_config.conf) +### 4.6.3 PrivateNet +#### 4.6.3.1 Preconditions + 1. at least two accounts [generate an account](https://tronscan.org/#/wallet/new) + 2. at least deploy one SuperNode to produce blocks + 3. deploy serval FullNodes to synchronize blocks and broadcast transactions + 4. SuperNode and FullNode comprise the private network +#### 4.6.3.2 Deployment +##### 4.6.3.2.1 Step 1: SuperNode Deployment + 1. download private_net_config.conf +```text +wget https://github.com/tronprotocol/tron-deployment/blob/master/private_net_config.conf +``` + 2. add your private key in localwitness + 3. set genesis.block.witnesses as the private key's corresponding address + 4. set p2p.version, any positive integer but 11111 + 5. set the first SR needSyncCheck = false, others can be set true + 6. set node.discovery.enable = true + 7. run the script +```text +nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar --witness -c private_net_config.conf + +command line parameters introduction: +--witness: start witness function, i.e.: --witness +--log-config: specify the log configuration file path, i.e.: --log-config logback.xml +-c: specify the configuration file path, i.e.: -c config.conf +``` + + The usage of the log file: + You can change the level of the module to control the log output. The default level of each module is INFO, for example: only print the message with the level higher than warn: + + The parameters in configuration file that need to modify: + localwitness: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/localwitness.jpg) + witnesses: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/witness.png) + version: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/p2p_version.png) + enable: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/discovery_enable.png) + +##### 4.6.3.2.2 Step 2: FullNode Deployment + 1. Download private_net_config.conf +```text +wget https://github.com/tronprotocol/tron-deployment/blob/master/private_net_config.conf +``` + 2. set seed.node ip.list with SR's ip and port + 3. set p2p.version the same as SuperNode's p2p.version + 4. set genesis.block the same as genesis.block + 5. set needSyncCheck true + 6. set node.discovery.enable true + 7. run the script +```text + nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar --witness -c private_net_config.conf + + command lines parameters + --witness: start witness function,i.e.: --witness + --log-config: specify the log configuration file path, i.e.: --log-config logback.xml + -c: specify the configuration file path, i.e.: -c config.conf +``` + + The usage of the log file: + You can change the level of the module to control the log output. The default level of each module is INFO, for example: only print the message with the level higher than warn: + + The parameters in configuration file that need to modify: + ip.list: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/ip_list.png) + p2p.version: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/p2p_version.png) + genesis.block: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/genesis_block.png) + needSyncCheck: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/need_sync_check.png) + node.discovery.enable: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/discovery_enable.png) + +## 4.7 DB Engine +### 4.7.1 Rocksdb +#### 4.7.1.1 Configuration + Use rocksdb as the data storage engine, need to set db.engine to "ROCKSDB" + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/db_engine.png) + Note: rocksdb only support db.version=2, do not support db.version=1 + + The optimization parameters rocksdb support: + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/rocksdb_tuning_parameters.png) + +#### 4.7.1.2 Use rocksdb's data backup function + Choose rocksdb to be the data storage engine, you can use it's data backup funchtion while running + ![image](https://raw.githubusercontent.com/tronprotocol/documentation/tree/docs_reorganization/imags/db_backup.png) + Note: FullNode can use data backup function. In order not to affect SuperNode's block producing performance, SuperNode does not support backup service, but SuperNode's backup service node can use this function. +#### 4.7.1.3 Convert leveldb data to rocksdb data + The data storage structure of leveldb and rocksdb is not compatible, please make sure the node use the same type of data engine all the time. We provide data conversion script which can convert leveldb data to rocksdb data. + Usage: +```text + cd to the source code root directory + ./gradlew build #build the source code + java -jar build/libs/DBConvert.jar #run data conversion command +``` + Note: If the node's data storage directory is self-defined, before run DBConvert.jar, you need to add the following parameters: + + **src_db_path**: specify LevelDB source directory, default output-directory/database + **dst_db_path**: specify RocksDb source directory, default output-directory-dst/database + ++ example, if you run the script like this: +```text + nohup java -jar FullNode.jar -d your_database_dir & +``` ++ then, you should run DBConvert.jar this way: +```text + java -jar build/libs/DBConvert.jar your_database_dir/database output-directory-dst/database +``` + Note: You have to stop the running of the node, and then to run the data conversion script. + + If you do not want to stop the running of the node for too long, after node is shut down, you can copy leveldb's output-directory to the new directory, and then restart the node. Run DBConvert.jar in the previous directory of the new directory, and specify the parameters: `src_db_path`和`dst_db_path`. + ++ example: +```text + cp -rf output-directory /tmp/output-directory + cd /tmp + java -jar DBConvert.jar output-directory/database output-directory-dst/database +``` + All the whole data conversion process may take 10 hours. + +#### 4.7.1.4 rocksdb vs leveldb +you can refer to: +[rocksdb vs leveldb](https://github.com/tronprotocol/documentation/blob/master/TRX_CN/Rocksdb_vs_Leveldb.md) +[ROCKSDB vs LEVELDB](https://github.com/tronprotocol/documentation/blob/master/TRX/Rocksdb_vs_Leveldb.md) + +# 5 Smart Contract +## 5.1 TRON Smart Contract Introduction + +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. + +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. + +## 5.2 TRON Smart Contract Features +TRON virtual machine is based on Ethereum solidity language, it also has TRON's own features. + +### 5.2.1 Smart Contract +TRON VM is compatible with Ethereum's smart contract, using protobuf to define the content of the contract: + + message SmartContract { + message ABI { + message Entry { + enum EntryType { + UnknownEntryType = 0; + Constructor = 1; + Function = 2; + Event = 3; + Fallback = 4; + } + message Param { + bool indexed = 1; + string name = 2; + string type = 3; + // SolidityType type = 3; + } + enum StateMutabilityType { + UnknownMutabilityType = 0; + Pure = 1; + View = 2; + Nonpayable = 3; + Payable = 4; + } + + bool anonymous = 1; + bool constant = 2; + string name = 3; + repeated Param inputs = 4; + repeated Param outputs = 5; + EntryType type = 6; + bool payable = 7; + StateMutabilityType stateMutability = 8; + } + repeated Entry entrys = 1; + } + bytes origin_address = 1; + bytes contract_address = 2; + ABI abi = 3; + bytes bytecode = 4; + int64 call_value = 5; + int64 consume_user_resource_percent = 6; + string name = 7; + int64 origin_energy_limit = 8; + } + +origin_address: smart contract creator address +contract_address: smart contract address +abi: the api information of the all the function of the smart contract +bytecode: smart contract byte code +call_value: TRX transferred into smart contract while call the contract +consume_user_resource_percent: resource consumption percentage set by the developer +name: smart contract name +origin_energy_limit: energy consumption of the developer limit in one call, must greater than 0. For the old contracts, if this parameter is not set, it will be set 0, developer can use updateEnergyLimit api to update this parameter (must greater than 0) + +Through other two grpc message types CreateSmartContract and TriggerSmartContract to create and use smart contract. + +### 5.2.2 The Usage of the Function of Smart Contract + +1. constant function and inconstant function + +There are two types of function according to whether any change will be made to the properties on the chain: constant function and inconstant function +Constant function uses view/pure/constant to decorate, will return the result on the node it is called and not be broadcasted in the form of a transaction +Inconstant function will be broadcasted in the form of a transaction while be called, the function will change the data on the chain, such as transfer, changing the value of the internal variables of contracts, etc. + +Note: If you use create command inside a contract (CREATE instruction), even use view/pure/constant to decorate the dynamically created contract function, this function will still be treated as inconstant function, be dealt in the form of transaction. + +2. message calls + +Message calls can call the functions of other contracts, also can transfer TRX to the accounts of contract and none-contract. Like the common TRON triggercontract, Message calls have initiator, recipient, data, transfer amount, fees and return attributes. Every message call can generate a new one recursively. Contract can define the distribution of the remaining energy in the internal message call. If it comes with OutOfEnergyException in the internal message call, it will return false, but not error. In the meanwhile, only the gas sent with the internal message call will be consumed, if energy is not specified in call.value(energy), all the remaining energy will be used. + +3. delegate call/call code/libary + +There is a special type of message call, delegate call. The difference with common message call is the code of the target address will be run in the context of the contract that initiates the call, msg.sender and msg.value remain unchanged. This means a contract can dynamically loadcode from another address while running. Storage, current address and balance all point to the contract that initiates the call, only the code is get from the address being called. This gives Solidity the ability to achieve the 'lib' function: the reusable code lib can be put in the storage of a contract to implement complex data structure library. + +4. CREATE command + +This command will create a new contract with a new address. The only difference with Ethereum is the newly generated TRON address used the smart contract creation transaction id and the hash of nonce called combined. Different from Ethereum, the defination of nonce is the comtract sequence number of the creation of the root call. Even there are many CREATE commands calls, contract number in sequence from 1. Refer to the source code for more detail. +Note: Different from creating a contract by grpc's deploycontract, contract created by CREATE command does not store contract abi. + +5. built-in function and built-in function attribute (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) + +1)TVM is compatible with solidity language's transfer format, including: +- accompany with constructor to call transfer +- accompany with internal function to call transfer +- use transfer/send/call/callcode/delegatecall to call transfer + +Note: TRON's smart contract is different from TRON's system contract, if the transfer to address does not exist it can not create an account by smart contract transfer. + +2)Different accouts vote for SuperNode (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +3)SuperNode gets all the reward (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +4)SuperNode approves or disappoves the proposal (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +5)SuperNode proposes a proposal (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +6)SuperNode deletes a proposal (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +7)TRON byte address converts to solidity address (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +8)TRON string address converts to solidity address (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +9)Send token to target address (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +10)Query token amount of target address (Since Odyssey-v3.1.1, TVM built-in function is not supported temporarily) +11)Compatible with all the built-in functions of Ethereum + +Note: Ethereum's RIPEMD160 function is not recommended, because the return of TRON is a hash result based on TRON's sha256, not an accurate Ethereum RIPEMD160. + +### 5.2.3 Contract Address Using in Solidity Language + +Ethereum VM address is 20 bytes, but TRON's VM address is 21 bytes. + +1. address conversion + +Need to convert TRON's address while using in solidity (recommended): +```text +/** + * @dev convert uint256 (HexString add 0x at beginning) tron address to solidity address type + * @param tronAddress uint256 tronAddress, begin with 0x, followed by HexString + * @return Solidity address type +*/ + +function convertFromTronInt(uint256 tronAddress) public view returns(address){ + return address(tronAddress); +} +``` +This is similar with the grammar of the conversion from other types converted to address type in Ethereum. + +2. address judgement + +Solidity has address constant judgement, if using 21 bytes address the compiler will throw out an error, so you should use 20 bytes address, like: +```text +function compareAddress(address tronAddress) public view returns (uint256){ + // if (tronAddress == 0x41ca35b7d915458ef540ade6068dfe2f44e8fa733c) { // compile error + if (tronAddress == 0xca35b7d915458ef540ade6068dfe2f44e8fa733c) { // right + return 1; + } else { + return 0; + } +} +``` +But if you are using wallet-cli, you can use 21 bytes address, like 0000000000000000000041ca35b7d915458ef540ade6068dfe2f44e8fa733c + +3. variable assignment + +Solidity has address constant assignment, if using 21 bytes address the compiler will throw out an error, so you should use 20 bytes address, like: +```text +function assignAddress() public view { + // address newAddress = 0x41ca35b7d915458ef540ade6068dfe2f44e8fa733c; // compile error + address newAddress = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c; + // do something +} +``` +If you want to use TRON address of string type (TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm) please refer to (2-4-7,2-4-8). + +### 5.2.4 The Special Constants Differ from Ethereum + +**Currency** + +Like solidity supports ETH, TRON VM supports trx and sun, 1 trx = 1000000 sun, case sensitive, only support lower case. tron-studio supports trx and sun, remix does not support trx and sun. +We recommend to use tron-studio instead of remix to build TRON smart contract. + +**Block** + +- block.blockhash (uint blockNumber) returns (bytes32): specified block hash, can only apply to the latest 256 blocks and current block excluded +- block.coinbase (address): SuperNode address that produced the current block +- block.difficulty (uint): current block difficulty, not recommended, set 0 +- block.gaslimit (uint): current block gas limit, not supported, set 0 +- block.number (uint): current block number +- block.timestamp (uint): current block timestamp +- gasleft() returns (uint256): remaining gas +- msg.data (bytes): complete call data +- msg.gas (uint): remaining gas - since 0.4.21, not recommended, replaced by gesleft() +- msg.sender (address): message sender (current call) +- msg.sig (bytes4): first 4 bytes of call data (function identifier) +- msg.value (uint): the amount of SUN send with message +- now (uint): current block timestamp (block.timestamp) +- tx.gasprice (uint): the gas price of transaction, not recommended, set 0 +- tx.origin (address): transaction initiator + +## 5.3 Energy Introduction +Each command of smart contract consume system resource while running, we use 'Energy' as the unit of the consumption of the resource. + +### 5.3.1 How to Get Energy + +Freeze TRX to get energy. + ++ Example (Using wallet-cli): + +```text +freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 ENERGY] +``` + +Freeze TRX to get energy, energy obtained = user's TRX frozen amount / total amount of frozen TRX in TRON * 50_000_000_000. + ++ Example: + +```text +If there are only two users, A freezes 2 TRX, B freezes 2 TRX +the energy they can get is: +A: 25_000_000_000 and energy_limit is 25_000_000_000 +B: 25_000_000_000 and energy_limit is 25_000_000_000 + +when C freezes 1 TRX: +the energy they can get is: +A: 20_000_000_000 and energy_limit is 20_000_000_000 +B: 20_000_000_000 and energy_limit is 20_000_000_000 +B: 10_000_000_000 and energy_limit is 10_000_000_000 +``` + +##### Energy Recovery + +The energy consumed will reduce to 0 smoothly within 24 hours. + ++ Example: + +```text +at one moment, A has used 72_000_000 Energy +if there is no continuous consumption or TRX freeze +one hour later, the energy consumption amount will be 72_000_000 - (72_000_000 * (60*60/60*60*24)) Energy = 69_000_000 Energy +24 hours later, the energy consumption amount will be 0 Energy +``` + +### 5.3.2 How to Set Fee Limit (Caller Must Read) +*** + +*Within the scope of this section, the smart contract developer will be called "developer", the users or other contracts which call the smart contract will be called "caller"* + +*The amount of energy consumed while call the contract can be converted to TRX or SUN, so within the scope of this section, when refer to the consumption of the resource, there's no strict difference between Energy, TRX and SUN, unless they are used as a number unit.* + +*** + +Set a rational fee limit can guarantee the smart contract execution. And if the execution of the contract cost great energy, it will not consume too much energy from the caller. Before you set fee limit, you need to know several conception: + +1. The legal fee limit is a integer between 0 - 10^9, unit is SUN. + +2. Different smart contracts consume different amount of energy due to their complexity. The same trigger in the same contract almost consumes the same amount fo energy[1]. When the contract is triggered, the commands will be excuted one by one and consume energy. If it reaches the fee limit, commands will fail to be excuted, and energy is not refundable. + +3. Currently fee limit only refers to the energy converted to SUN that will be consumed from the caller[2]. The energy consumed by triggering contract also includes developer's share. + +4. For a vicious contract, if it encounters execution timeout or bug crash, all it's energy will be consumed. + +5. Developer may undertake a proportion of energy consumption(like 90%). But if the developer's energy is not enough for consumption, the rest of the energy consumption will be undertaken by caller completely. Within the fee limit range, if the caller does not have enough energy, then it will burn equivalent amount of TRX [2]. + +To encourage caller to trigger the contract, usually developer has enough energy. + +##### Example +How to estimate the fee limit: + +Assume contract C's last execution consumes 18000 Energy, so estimate the energy consumption limit to be 20000 Energy[3] + +According to the frozen TRX amount and energy conversion, assume 1 TRX = 400 energy. + +When to burn TRX, 1 TRX = 10000 energy[4] + +Assume developer undertake 90% energy consumption, and developer has enough energy. + +Then the way to estimate the fee limit is: + +1). A = 20000 energy * (1 TRX / 400 energy) = 50 TRX = 50_000_000 SUN, +2). B = 20000 energy * (1 TRX / 10000 energy) = 2 TRX = 2_000_000 SUN, +3). Take the greater number of A and B, which is 50_000_000 SUN, +4). Developer undertakes 90% energy consumption, caller undertakes 10% energy consumption, + +So, the caller is suggested to set fee limit to 50_000_000 SUN * 10% = 5_000_000 SUN + +Note: + +[1] The energy consumption of each execution may fluctuate slightly due to the situation of all the nodes. +[2] TRON may change this policy. +[3] The estimated energy consumption limit for the next execution should be greater than the last one. +[4] 1 TRX = 10^4 energy is a fixed number for burning TRX to get energy, TRON may change it in future. + +### 5.3.3 Energy Calculation (Developer Must Read) + +1. In order to punish the vicious developer, for the abnormal contract, if the execution times out (more than 50ms) or quits due to bug (revert not included), the maximum available energy will be deducted. If the contract runs normally or revert, only the energy needed for the execution of the commands will be deducted. + +2. Developer can set the proportion of the energy consumption it undertakes during the execution, this proportion cna be changed later. If the developer's energy is not enough, it will consume the caller's energy. + +3. Currently, the total energy available when trigger a contract is composed of caller fee limit and developer's share + +Note: +- If the developer is not sure about whether the contract is normal, do not set caller's energy consumption proportion to 0%, in case all developer's energy will be deducted due to vicious execution[1]. +- We recommend to set caller's energy consumption proportion to 10% ~ 100%[2]. + +##### Example 1 +A has an account with a balance of 90 TRX(90000000 SUN) and 10 TRX frozen for 100000 energy. + +Smart contract C set the caller energy consumption proportion to 100% which means the caller will pay for the energy consumption completely. + +A triggers C, the fee limit set is 30000000 (unit SUN, 30 TRX) + +So during this trigger the energy A can use is from two parts: +- A's energy by freezing TRX; +- The energy converted from the amount of TRX burning according to a fixed rate; + +If fee limit is greater than the energy obtained from freezing TRX, then it will burn TRX to get energy. The fixed rate is: 1 Energy = 100 SUN, fee limit still has (30 - 10) TRX = 20 TRX available, so the energy it can keep consuming is 20 TRX / 100 SUN = 200000 energy. + +Finally, in this call, the energy A can use is (100000 + 200000) = 300000 energy. + +If contract executes successfully without any exception, the energy needed for the execution will be deducted. Generally, it is far more less than the amount of energy this trigger can use. + +If Assert-style error come out, it will consume the whole number of energy set for fee limit. + +Assert-style error introduction, refer to [https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md) + +##### Example 2 +A has an account with a balance of 90 TRX(90000000 SUN) and 10 TRX frozen for 100000 energy. + +Smart contract C set the caller energy consumption proportion to 40% which means the developer will pay for the rest 60% energy consumption. + +Developer D freezes 50 TRX to get 500000 energy. + +A triggers C, the fee limit set is 200000000 (unit SUN, 200 TRX). + +So during this trigger the energy A can use is from three parts: +- A's energy by freezing TRX -- X; +- The energy converted from the amount of TRX bruning according to a fixed rate -- Y; +If fee limit is greater than the energy obtained from freezing TRX, then it will burn TRX to get energy. The fixed rate is: 1 Energy = 100 SUN, fee limit still has (200 - 10) TRX = 190 TRX available, but A only has 90 TRX left, so the energy it can keep consuming is 90 TRX / 100 SUN = 900000 energy; +- D's energy by freezing TRX -- Z; + +There are two situation: +if (X + Y) / 40% >= Z / 60%, the energy A can use is X + Y + Z +if (X + Y) / 40% < Z / 60%, the energy A can use is (X + Y) / 40% + +If contract executes successfully without any exception, the energy needed for the execution will be deducted. Generally, it is far more less than the amount of energy this trigger can use. + +If Assert-style error comes out, it will consume the whole number of energy set for fee limit. Assert-style error introduction, refer to (https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md) + +Note: when developer create a contract, do not set consume_user_resource_percent to 0, which means developer will undertake all the energy consumption. If Assert-style error comes out, it will consume all energy from the developer itsef. + +Assert-style error introduction, refer to [https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E8%99%9A%E6%8B%9F%E6%9C%BA/%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86.md) + +To avoid unnecessary lost, 10 - 100 is recommended for consume_user_resource_percent. + +## 5.4 Smart Contract Development Tool +### 5.4.1 TronStudio +Support the build, debug, run, etc. for solidity language written smart contract. +[https://developers.tron.network/docs/tron-studio-intro](https://developers.tron.network/docs/tron-studio-intro) +### 5.4.2 TronBox +Support the build, deploy, transplant, etc. for solidity language written smart contract. +[https://developers.tron.network/docs/tron-box-user-guide](https://developers.tron.network/docs/tron-box-user-guide) +### 5.4.3 TronWeb +Provide http api service for the usage of smart contract. +[https://developers.tron.network/docs/tron-web-intro](https://developers.tron.network/docs/tron-web-intro) +### 5.4.4 TronGrid +Provide smart contract event query service. +[https://developers.tron.network/docs/tron-grid-intro](https://developers.tron.network/docs/tron-grid-intro) + +## 5.5 Using Command Lines Tool to Develop Smart Contract + +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: + +```text +pragma solidity ^0.4.0; +contract DataStore { + + mapping(uint256 => uint256) data; + + function set(uint256 key, uint256 value) public { + data[key] = value; + } + + function get(uint256 key) view public returns (uint256 value) { + value = data[key]; + } +} +``` + +### Start a Private Net + +Make sure the fullnode code has been deployed locally, you can check if 'Produce block successfully' log appears in FullNode/logs/tron.log + +### Develop a Smart Contract + +Copy the code example above to remix to debug. + +### Compile in SimpleWebCompiler for ABI and ByteCode + +Copy the code example above to SimpleWebCompiler to get ABI and ByteCode. +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. + +### Using Wallet-cli to Deploy + +Download Wallet-Cli and build + +```text +shell +# download cource code +git clone https://github.com/tronprotocol/wallet-cli +cd wallet-cli +# build +./gradlew build +cd build/libs +``` + +Note: You need to change the node ip and port in config.conf + +start wallet-cli + +```text +java -jar wallet-cli.jar +``` + +after started, you can use command lines to operate: + +```text +importwallet + + +login + +getbalance +``` + +deploy contract + +```text +Shell +# contract deployment command +DeployContract contractName ABI byteCode constructor params isHex fee_limit consume_user_resource_percent + +# parameters +contract_name: Contract name +ABI: ABI from SimpleWebCompiler +bytecode: ByteCode from SimpleWebCompiler +constructor: When deploy contract, this will be called. If is needed, write as constructor(uint256,string). If not, just write # +params: The parameters of the constructor, use ',' to split, like 1, "test", if no constructor, just write # +fee_limit: The TRX consumption limit for the deployment, unit is SUN(1 SUN = 10^-6 TRX) +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 +value: The amount of TRX transfer to the contract when deploy +library: If the contract contains library, you need to specify the library address + +# example +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 +If it is deployed successfully, it will return 'Deploy the contract successfully' +``` + +get the contract address + +```text +Your smart contract address will be: + +# in this example +Your smart contract address will be: TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 +``` + +call the contract to store data, query data + +```text +Shell +# call contract command +triggercontract + +# parameters +contract_address: Contract address, like TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 +method: The method called, like set(uint256,uint256) or fool(), use ',' to split the parameters. Do not leave space between parameters +args: The parameters passed to the method called, use ',' to split the parameters. Do not leave space between parameters +is_hex: whether the input parameters is Hex, false or true +fee_limit: The TRX consumption limit for the trigger, unit is SUN(1 SUN = 10^-6 TRX) +value: The amount of TRX transfer to the contract when trigger + +# trigger example +## set mapping 1->1 +triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256,uint256) 1,1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000 + +## get mapping key = 1 +triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 get(uint256) 1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000 +``` + +If the function called is constant or view, wallet-cli will return the result directly. +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,... + +```text +# for instance, using remix to get the bytecode of the contract, like: +608060405234801561001057600080fd5b5061013f806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f75dac5a14610046575b600080fd5b34801561005257600080fd5b5061005b610071565b6040518082815260200191505060405180910390f35b600073__browser/oneLibrary.sol.Math3__________<\b>634f2be91f6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156100d357600080fd5b505af41580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b81019080805190602001909291905050509050905600a165627a7a7230582052333e136f236d95e9d0b59c4490a39e25dd3a3dcdc16285820ee0a7508eb8690029 +``` + +The address of the library deployed before is: TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 +When you deploy, you need to use browser/oneLibrary.sol.Math3:TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 as the parameter of deploycontract. + +# 6 Built-in Contracts and API Introduction +## 6.1 Built-in Contracts +Please refer to: +[https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E4%BA%A4%E6%98%93%E6%93%8D%E4%BD%9C%E7%B1%BB%E5%9E%8B%E8%AF%B4%E6%98%8E.md](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E4%BA%A4%E6%98%93%E6%93%8D%E4%BD%9C%E7%B1%BB%E5%9E%8B%E8%AF%B4%E6%98%8E.md) + +## 6.2 GRPC API Introduction +Please refer to: +[https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md](https://github.com/tronprotocol/Documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E6%B3%A2%E5%9C%BA%E9%92%B1%E5%8C%85RPC-API.md) + +## 6.3 Http API Introduction +Please refer to: +[https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-http.md](https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-http.md) + +# 7 TRON TRC-10 Token Introduction +TRON network support two types of token, one is TRC-20 token issued by smart contract, the other one is TRC-10 token issued by system contract. + +## 7.1 How to Issue a TRC-10 Token +Http Api: +```text +wallet/createassetissue +Description: Issue a token +demo: curl -X POST http://127.0.0.1:8090/wallet/createassetissue -d '{ +"owner_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"name":"0x6173736574497373756531353330383934333132313538", +"abbr": "0x6162627231353330383934333132313538", +"total_supply" :4321, +"trx_num":1, +"num":1, +"start_time" : 1530894315158, +"end_time":1533894312158, +"description":"007570646174654e616d6531353330363038383733343633", +"url":"007570646174654e616d6531353330363038383733343633", +"free_asset_net_limit":10000, +"public_free_asset_net_limit":10000, +"frozen_supply":{"frozen_amount":1, "frozen_days":2} +}' +Parameter owner_address: Owner address, default hexString +Parameter name: Token name, default hexString +Parameter abbr: Token name abbreviation, default hexString +Parameter total_supply: Token total supply +Parameter trx_num: Define the price by the ratio of trx_num/num, +Parameter num: Define the price by the ratio of trx_num/num +Parameter start_time: ICO start time +Parameter end_time: ICO end time +Parameter description: Token description, default hexString +Parameter url: Token official website url, default hexString +Parameter free_asset_net_limit: Token free asset net limit +Parameter public_free_asset_net_limit: Token public free asset net limit +Parameter frozen_supply: Token frozen supply +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'trx_num' is SUN +``` + +## 7.2 Participate TRC-10 Token +Http Api: +```text +wallet/participateassetissue +Description: Participate a token +demo: curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ +"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"amount":100, +"asset_name":"3230313271756265696a696e67" +}' +Parameter to_address: The issuer address of the token, default hexString +Parameter owner_address: The participant address, default hexString +Parameter amount: Participate token amount +Parameter asset_name: Token id, default hexString +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'amount' is the smallest unit of the token +``` + +## 7.3 TRC-10 Token Transfer +Http Api: +```text +wallet/transferasset +Description: Transfer token +demo: curl -X POST http://127.0.0.1:8090/wallet/transferasset -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "asset_name": "31303030303031", "amount": 100}' +Parameter owner_address: Owner address, default hexString +Parameter to_address: To address, default hexString +Parameter asset_name: Token id, default hexString +Parameter amount: Token transfer amount +Parameter permission_id: Optional, for multi-signature use +Return: Transaction object +Note: The unit of 'amount' is the smallest unit of the token +``` + +# 8 TRON Resource Model +## 8.1 Resource Model Introduction + +TRON network has 4 types of resources: Bandwidth, CPU, Storage and RAM. Benefit by TRON's exclusive RAM model, TRON's RAM resource is almost infinite. + +TRON network imports two resource conceptions: Bandwidth points and Energy. Bandwidth Point represents Bandwidth, Energy represents CPU and Storage. + +Note: +- Ordinary transaction only consumes Bandwidth points +- Smart contract related transaction not only consumes Bandwidth points, but also Energy + +## 8.2 Bandwidth Points + +The transaction information is stored and transmitted in the form of byte array, Bandwidth Points consumed = the number of bytes of the transaction * Bandwidth Points rate. Currently Bandwidth Points rate = 1 + +Such as if the number of bytes of a transaction is 200, so this transaction consumes 200 Bandwidth Points. + +Note: Due to the change of the total amount of the frozen TRX in the network and the self-frozen TRX amount, the Bandwidth Points an account possesses is not fixed. + +### 8.2.1 How to Get Bandwidth Points + +1. By Freezing TRX to get Bandwidth Points, Bandwidth Points = the amount of TRX self-frozen / the total amount of TRX frozen for Bandwidth Points in the network * 43_200_000_000 + +2. Every account has a fixed amount of free Bandwidth Points(5000) every day + +### 8.2.2 Bandwith Points Consumption + +Except for query operation, any transaction consumes Bandwidth points. + +There's another situation: When you transfer(TRX or token) to an account that does not exist in the network, this operation will first create that account in the network and then do the transfer. It only consumes Bandwidth points for account creation, no extra Bandwidth points consumption for transfer. + +Create a new account transaction, Bandwidth points consumption sequence: + +1. Bandwidth points from freezing TRX. If transaction initiator does not have enough Bandwidth Points of this type, it will go to step 2; +2. Burn 0.1 TRX; + +Token transfer transaction, Bandwidth points consumption sequence: + +1. 依次验证 发行Token资产总的免费Bandwidth Points是否足够消耗,转账发起者的Token剩余免费Bandwidth Points是否足够消耗, + Token发行者冻结TRX获取Bandwidth Points剩余量是否足够消耗。如果满足则扣除Token发行者的Bandwidth Points,任意一个不满足则进入下一步。 +2. Bandwidth points from freezing TRX. If transaction initiator does not have enough Bandwidth Points of this type, it will go to step 3; +3. Free Bandwidth points. If transaction initiator does not have enough Bandwidth Points of this type, it will go to step 4; +4. Bandwidth points from burning TRX, the rate = the number of bytes of the transaction * 10 SUN; + +Ordinary transaction, Bandwidth points consumption sequence: + +1. Bandwidth points from freezing TRX. If transaction initiator does not have enough Bandwidth Points of this type, it will go to step 2; +2. Free Bandwidth points. If transaction initiator does not have enough Bandwidth Points of this type, it will go to step 3; +3. Bandwidth points from burning TRX, the rate = the number of bytes of the transaction * 10 SUN; + +### 8.2.3 Bandwidth Points Recovery +Every 24 hours, the amount of the usage of Bandwidth points of an account will be reset to 0. For the specific formula: +![image](https://github.com/tronprotocol/documentation/tree/docs_reorganization/imags/bandwidthRestoreEqn.gif) + +Every 24 hours, the amount of the usage of Bandwidth points of an account will be reset to 0. + +## 8.3 Energy +[5.3 Energy Introduction](#53-energy-introduction) + +## 8.4 Resource Delegation +In TRON network, an account can freeze TRX for Bandwidth or Energy for other accounts. The primary account owns the frozen TRX and TRON power, the recipient account owns the Bandwidth or Energy. Like ordinary freezing, resource delegation freezing is also at least 3 days. + ++ Example(Using wallet-cli) +```text +freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 ENERGY] [receiverAddress] + +frozen_balance: the amount of TRX to freeze (unit SUN) +frozen_duration: the freezing period (currently a fixed 3 days) +ResourceCode: 0 for Bandwidth, 1 for Energy +receiverAddress: recipient account address +``` + +## 8.5 Other Fees + +|Type|Fee| +| :------|:------:| +|Create a witness|9999 TRX| +|Issue a token|1024 TRX| +|Create an account|0.1 TRX| +|Create an exchange|1024 TRX| + +# 9 DEX Introduction + +TRON network supports decentralized exchange(DEX) using Bancor protocol. DEX is composed of many exchange pairs. + +## 9.1 What is an Exchange Pair +The term of 'Exchange Pair' describes a trade between one token with another, like A/B, A/TRX. + +## 9.2 Exchange Pair Creation +Any account can create an exchange pair, it burns 1024 TRX. + +Please refer to 'wallet/exchangecreate': +[https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md](https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md) + +## 9.3 Exchange Pair Transaction +Any account can trade in the DEX. The trade follows Bancor protocol. + +Please refer to 'wallet/exchangetransaction': +[https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md](https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md) + +## 9.4 Exchange Pair Injection +The exchange pair creator can inject more tokens into the exchange pair. Injection can decrease the range of ratio fluctuation. If one token is injected, the other one will be injected automatically to keep the current ratio of the two tokens unchanged. + +Please refer to 'wallet/exchangeinject': +[https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md](https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md) + +## 9.5 Exchange Pair Withdrawal +The exchange pair creator can withdraw tokens from the exchange pair. Withdrawal can increase the range of ratio fluctuation. If one token is withdrawn, the other one will be withdrawn automatically to keep the current ratio of the two tokens unchanged. + +Please refer to 'wallet/exchangewithdraw': +[https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md)](https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md) + +## 9.6 Query +### 9.6.1 Transaction Query +ListExchanges: Query the list of all the exchange pairs +GetPaginatedExchangeList: Query the list of all the exchange pairs by pagination +GetExchangeById: Query an exchange pair by exchange pair id + +Please refer to: +[https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md](https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-http.md) + +### 9.6.2 Price Calculation +The token price is determined by the ratio of the balance of the two tokens. + +### 9.6.3 Calculate the Amount of Token You Can Get +sellTokenQuant is the amount of the first_token you want to sell; +buyTokenQuant is the amount of second_token you can get; +supply = 1_000_000_000_000_000_000L; +supplyQuant = -supply * (1.0 - Math.pow(1.0 + (double) sellTokenQuant/(firstTokenBalance + sellTokenQuant, 0.0005)); +buyTokenQuant = (long)balance * (Math.pow(1.0 + (double) supplyQuant / supply, 2000.0) - 1.0); + + +# 10 Multi-signatures +Please refer to: +[https://github.com/tronprotocol/documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E5%A4%9A%E9%87%8D%E7%AD%BE%E5%90%8D.md](https://github.com/tronprotocol/documentation/blob/master/%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/%E6%B3%A2%E5%9C%BA%E5%8D%8F%E8%AE%AE/%E5%A4%9A%E9%87%8D%E7%AD%BE%E5%90%8D.md) + +# 11 Wallet Introduction +## 11.1 wallet-cli Introduction +Please refer to: +[https://github.com/tronprotocol/wallet-cli/blob/master/README.md](https://github.com/tronprotocol/wallet-cli/blob/master/README.md) + +## 11.2 Get Transaction ID +```text +Hash.sha256(transaction.getRawData().toByteArray()) +``` +## 11.3 Get Block ID +```text +private byte[] generateBlockId(long blockNum, byte[] blockHash) {
 + byte[] numBytes = Longs.toByteArray(blockNum);
 + byte[] hash = blockHash;
 + System.arraycopy(numBytes, 0, hash, 0, 8);
 + return hash; + 
} +``` +## 11.4 How to Build a Transaction Locally +According to the defination of the transaction, you need to fill up all the fields of the transaction. + +You need to set refference block and expiration time information, so you need to connect to the Mainnet. We recommend to use the latest block on fullnode as the value of refference block, use the latest block time plus N minutes as the value of expiration time. + +The network judgment condition is if (expiration > latest block time and expiration < latest block time + 24 hours) means the transaction is in period of validity. Otherwise, it will be a overdue transaction, will not be accepted by the Mainnet. + +Way to set refference block: set RefBlockHash the bytes from the 8 to 16(not included) of the hash of the latest block, set BlockBytes the bytes from 6 to 8(not included) of the height of the latest block. +```text +public static Transaction setReference(Transaction transaction, Block newestBlock) { + long blockHeight = newestBlock.getBlockHeader().getRawData().getNumber(); + byte[] blockHash = getBlockHash(newestBlock).getBytes(); + byte[] refBlockNum = ByteArray.fromLong(blockHeight); + Transaction.raw rawData = transaction.getRawData().toBuilder() + .setRefBlockHash(ByteString.copyFrom(ByteArray.subArray(blockHash, 8, 16))) + .setRefBlockBytes(ByteString.copyFrom(ByteArray.subArray(refBlockNum, 6, 8))) + .build(); + return transaction.toBuilder().setRawData(rawData).build(); + } +``` +Way to set expiration time and transaction timestamp: +```text +public static Transaction createTransaction(byte[] from, byte[] to, long amount) { + Transaction.Builder transactionBuilder = Transaction.newBuilder(); + Block newestBlock = WalletClient.getBlock(-1); + + Transaction.Contract.Builder contractBuilder = Transaction.Contract.newBuilder(); + Contract.TransferContract.Builder transferContractBuilder = Contract.TransferContract + .newBuilder(); + transferContractBuilder.setAmount(amount); + ByteString bsTo = ByteString.copyFrom(to); + ByteString bsOwner = ByteString.copyFrom(from); + transferContractBuilder.setToAddress(bsTo); + transferContractBuilder.setOwnerAddress(bsOwner); + try { + Any any = Any.pack(transferContractBuilder.build()); + contractBuilder.setParameter(any); + } catch (Exception e) { + return null; + } + contractBuilder.setType(Transaction.Contract.ContractType.TransferContract); + transactionBuilder.getRawDataBuilder().addContract(contractBuilder) + .setTimestamp(System.currentTimeMillis()) //in the form of millisecond + .setExpiration(newestBlock.getBlockHeader().getRawData().getTimestamp() + 10 * 60 * 60 * 1000); + Transaction transaction = transactionBuilder.build(); + Transaction refTransaction = setReference(transaction, newestBlock); + return refTransaction; + } +``` +## 11.5 Related Demo + +Build transaction locally, signature demo, please refer to: +[https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java](https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java) +nodejs demo, please refer to: +[https://github.com/tronprotocol/tron-demo/tree/master/demo/nodejs](https://github.com/tronprotocol/tron-demo/tree/master/demo/nodejs) diff --git a/docs/Tron-rpc.md b/docs/Tron-rpc.md new file mode 100644 index 00000000..d7c661d5 --- /dev/null +++ b/docs/Tron-rpc.md @@ -0,0 +1,249 @@ + +**For the specific definition of API, please refer to the following link:** +[https://github.com/tronprotocol/java-tron/blob/develop/src/main/protos/api/api.proto](https://github.com/tronprotocol/java-tron/blob/develop/src/main/protos/api/api.proto) + + +**1. Get account information** + +Interface statement: +rpc GetAccount (Account) returns (Account) {} +Nodes: +Fullnode and SolidityNode + +**2. TRX transfer** + +Interface statement: +rpc CreateTransaction (TransferContract) returns (Transaction) {} +Nodes: +Fullnode + +**3. Broadcast transaction** + +Interface statement: +rpc BroadcastTransaction (Transaction) returns (Return) {} +Nodes: +Fullnode +Description: +Transfer, vote, issuance of token, or participation in token offering. Sending signed transaction information to node, and broadcasting it to the entire network after witness verification. + +**4. Create an account** + +Interface statement: +rpc CreateAccount (AccountCreateContract) returns (Transaction) {} +Nodes: +FullNode + +**5. Account name update** +Interface statement: +rpc UpdateAccount (AccountUpdateContract) returns (Transaction) {} +Nodes: +Fullnode + +**6. Vote for super representative candidates** +Interface statement: +rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction) {} +Nodes: +FullNode + +**7. Issue a token** +Interface statement: +rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) {} +Nodes: +FullNode + +**8. Query of list of super representative candidates** +Interface statement: +rpc ListWitnesses (EmptyMessage) returns (WitnessList) {} +Nodes: +FullNode and SolidityNode + +**9. Application for super representative** +Interface statement: +rpc CreateWitness (WitnessCreateContract) returns (Transaction) {} +Nodes: +FullNode +Description: +To apply to become TRON’s Super Representative candidate. + +**10. Information update of Super Representative candidates** +Interface statement: +rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) {} +Nodes: +FullNode +Description: +Update the website url of the SR. + +**11. Token transfer** +Interface statement
: +rpc TransferAsset (TransferAssetContract) returns (Transaction){} +Node: +FullNode + +**12. Participate a token** +Interface statement: +rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction) {} +Nodes: +FullNode + +**13. Query the list of nodes connected to the ip of the api** +Interface statement: +rpc ListNodes (EmptyMessage) returns (NodeList) {} +Nodes: +FullNode and SolidityNode + +**14. Query the list of all issued tokens** +Interface statement: +rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) {} +Node: +FullNode and SolidityNode + +**15. Query the token issued by a given account** +Interface statement: +rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) {} +Nodes: +FullNode and SolidityNode + +**16. Query the token information by token name** +Interface statement: +rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) {} +Nodes: +FullNode and Soliditynode + +**17. Query the list of tokens by timestamp** +Interface statement: +rpc GetAssetIssueListByTimestamp (NumberMessage) returns (AssetIssueList){} +Nodes: +SolidityNode + +**18. Get current block information** +Interface statement: +rpc GetNowBlock (EmptyMessage) returns (Block) {} +Nodes: +FullNode and SolidityNode + +**19. Get a block by block height** +Interface statement: +rpc GetBlockByNum (NumberMessage) returns (Block) {} +Nodes: +FullNode and SolidityNode + +**20. Get the total number of transactions** +Interface statement: +rpc TotalTransaction (EmptyMessage) returns (NumberMessage) {} +Nodes: +FullNode and SolidityNode + +**21. Query the transaction by transaction id** +Interface statement: +rpc getTransactionById (BytesMessage) returns (Transaction) {} +Nodes: +SolidityNode + +**22. Query the transaction by timestamp** +Interface statement: +rpc getTransactionsByTimestamp (TimeMessage) returns (TransactionList) {} +Nodes: +SolidityNode + +**23. Query the transactions initiated by an account** +Interface statement: +rpc getTransactionsFromThis (Account) returns (TransactionList) {} +Node: +SolidityNode + +**24. Query the transactions received by an account** +Interface statement: +rpc getTransactionsToThis (Account) returns (NumberMessage) {} +Nodes: +SolidityNode + +**25. Freeze TRX** +Interface statement: +rpc FreezeBalance (FreezeBalanceContract) returns (Transaction) {} +Nodes: +FullNode + +**26. Unfreeze TRX** +Interface statement: +rpc UnfreezeBalance (UnfreezeBalanceContract) returns (Transaction) {} +Nodes: +FullNode + +**27. Block producing reward redemption** +Interface statement: +rpc WithdrawBalance (WithdrawBalanceContract) returns (Transaction) {} +Nodes: +FullNode + +**28. Unfreeze token balance** +Interface statement: +rpc UnfreezeAsset (UnfreezeAssetContract) returns (Transaction) {} +Nodes: +FullNode + +**29. Query the next maintenance time** +Interface statement: +rpc GetNextMaintenanceTime (EmptyMessage) returns (NumberMessage) {} +Nodes: +FullNode + +**30. Query the transaction fee & block information** +Interface statement: +rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) {} +Nodes: +SolidityNode + +**31. Query block information by block id** +Interface statement: +rpc GetBlockById (BytesMessage) returns (Block) {} +Nodes: +FullNode + +**32. Update token information** +Interface statement: +rpc UpdateAsset (UpdateAssetContract) returns (Transaction) {} +Nodes: +Fullnode +Description: +Token update can only be initiated by the token issuer to update token description, url, maximum bandwidth consumption by each account and total bandwidth consumption. + +**33. Query the list of all the tokens by pagination** +Interface statement: +rpc GetPaginatedAssetIssueList (PaginatedMessage) returns (AssetIssueList) {} +Nodes: +FullNode and SolidityNode + +**34. To sign a transaction** +Interface statement: +rpc GetTransactionSign (TransactionSign) returns (Transaction) {} +Nodes: +FullNode + +**35. Address and private key creation** +35.1 Interface statement: +rpc CreateAdresss (BytesMessage) returns (BytesMessage) {}; +35.2 Node +Fullnode. +35.3 Parameters +BytesMessage: Passphrase +35.4 Returns +BytesMessage: address. + +**36. TRX easy transfer** +Interface statement: +rpc EasyTransfer (EasyTransferMessage) returns (EasyTransferResponse) {} +Nodes: +FullNode + +**37. Deploy a smart contract** +Interface statement: +rpc DeployContract (CreateSmartContract) returns (TransactionExtention) {} +Nodes: +FullNode and SolidityNode + +**38. Trigger a smart contract** +Interface statement: +rpc TriggerContract (TriggerSmartContract) returns (TransactionExtention) {} +Nodes: +FullNode + diff --git a/README.md b/docs/index.md similarity index 54% rename from README.md rename to docs/index.md index f9420c38..ae5d50d3 100644 --- a/README.md +++ b/docs/index.md @@ -1,9 +1,7 @@ -# Documentation - -#### Please visit the new [TRON Developers Hub](https://developers.tron.network/) for detailed guides, interactive APIs, and much more! - # Documentation Guide +**Please visit the new [TRON Developers Hub](https://developers.tron.network/) for detailed guides, interactive APIs, and much more!** + + If you want to know more about the recent progress of the TRON project, please check out [TRON Introduction](https://github.com/tronprotocol/Documentation/tree/master/English_Documentation/TRON_Introduction). + If you want to know more about the protocol documentation, please check out [TRON Protocol](https://github.com/tronprotocol/Documentation/tree/master/English_Documentation/TRON_Protocol). + If you want to know more about the SR information, vote, or token creation, please check out [TRON blockchain explorer](https://github.com/tronprotocol/Documentation/tree/master/English_Documentation/TRON_Blockchain_Explorer). @@ -13,25 +11,7 @@ + For more information about Virtual Machine, please check out [TVM](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Virtual_Machine/Virtual_Machine_Introduction.md). + For latest process of TRON, please follow the [TRON documentation](https://github.com/tronprotocol/Documentation/tree/master/English_Documentation). -# Super Representative Guide - -## What is a Super Representative? - -To learn about Super Representatives, please read [What is a Super Representative](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Blockchain_Explorer/What_is_a_Super_Representative.md). - -## How to become a Super Representative - -**Step1.** - -First of all, you need to run a Super Representative. For more information about running a Super Representative, please visit [java-tron Guide](https://github.com/tronprotocol/java-tron/blob/develop/README.md) and take *Running a local node and connecting to the public testnet* -> *Running a Super Node* as reference. - -**Step2.** -Visit our blockchain explorer to apply for Super Representative, please take [Running a Super Representative](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Blockchain_Explorer_Introduction/How_to_run_a_Super_Representative.md). - -**Step3.** - -After approval voting, the top 27 Super Representatives by total approval will be selected. The voting of Super Representatives is held once every 6 hours. Please read [How to vote](https://github.com/ybhgenius/Documentation/blob/master/English_Documentation/TRON_Blockchain_Explorer/Guide_to_voting_on_the_new_blockchain_explorer.md). @@ -49,22 +29,5 @@ After approval voting, the top 27 Super Representatives by total approval will b + 对于波场虚拟机的更多信息,请查看[TVM](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Virtual_Machine/Virtual_Machine_Introduction.md)相关文档。 + 对于波场发展的最新进展,请时刻关注[波场文档](https://github.com/tronprotocol/Documentation/tree/master/中文文档)。 -# 超级代表文档指引 - -## 什么是超级代表? - -请参见:[超级代表介绍](https://github.com/tronprotocol/Documentation/blob/master/中文文档/波场区块链浏览器介绍/什么是超级代表.md)。 - -## 如何申请成为一个超级代表? - -**Step1.** - -首先,你需要运行一个超级代表节点。如何运行超级代表节点请参见[java-tron 指引](https://github.com/tronprotocol/java-tron/blob/develop/README.md)里的*Running a local node and connecting to the public testnet* -> *Running a Super Node*。 - -**Step2.** - -对于如何使用波场区块链浏览器,请参见[波场区块链浏览器使用指南](https://github.com/tronprotocol/Documentation/blob/master/中文文档/波场区块链浏览器介绍/区块链浏览器使用指南.md)。 -## 常见问题 -有关超级代表、超级代表节点运行、申请、竞选的相关问题请查看[关于SR的常见问题解答](https://github.com/tronprotocol/Documentation/blob/master/中文文档/常见问题解答/关于SR的常见问题解答.md)。 diff --git a/images/Architecture.png b/images/Architecture.png deleted file mode 100644 index 71ea42c9..00000000 Binary files a/images/Architecture.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png deleted file mode 100644 index 96b23796..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png deleted file mode 100644 index 7c1dc295..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png deleted file mode 100644 index b6b29e9e..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png deleted file mode 100644 index ee48b015..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png deleted file mode 100644 index 66c84200..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1_ZH.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1_ZH.png deleted file mode 100644 index ddd92636..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1_ZH.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png deleted file mode 100644 index 72192848..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2_ZH.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2_ZH.png deleted file mode 100644 index 0813418f..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2_ZH.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png deleted file mode 100644 index 7d03c7ad..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3_ZH.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3_ZH.png deleted file mode 100644 index 85edbfa2..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3_ZH.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png deleted file mode 100644 index c36f5c7d..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4_ZH.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4_ZH.png deleted file mode 100644 index cb5cb27f..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4_ZH.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png deleted file mode 100644 index 4e813b8c..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png deleted file mode 100644 index e9ff4ade..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6_ZH.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6_ZH.png deleted file mode 100644 index d87d32ae..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6_ZH.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png deleted file mode 100644 index 3fc446ac..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png deleted file mode 100644 index aaa21876..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png deleted file mode 100644 index 755b90d0..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/fork-repo.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/fork-repo.png deleted file mode 100644 index 24ef26b4..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/fork-repo.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png b/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png deleted file mode 100644 index abba48d0..00000000 Binary files a/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png and /dev/null differ diff --git "a/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/SP\344\277\241\346\201\257.png" "b/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/SP\344\277\241\346\201\257.png" deleted file mode 100644 index ab5e8e9f..00000000 Binary files "a/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/SP\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/SP\345\200\231\351\200\211\344\277\241\346\201\257.png" "b/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/SP\345\200\231\351\200\211\344\277\241\346\201\257.png" deleted file mode 100644 index 9e91bddb..00000000 Binary files "a/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/SP\345\200\231\351\200\211\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/\346\237\245\347\234\213\350\257\246\347\273\206\344\277\241\346\201\257.png" "b/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/\346\237\245\347\234\213\350\257\246\347\273\206\344\277\241\346\201\257.png" deleted file mode 100644 index 0bf90e4d..00000000 Binary files "a/images/Blockchain-Explorer/SP\345\222\214SP\345\200\231\351\200\211\344\277\241\346\201\257/\346\237\245\347\234\213\350\257\246\347\273\206\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/1.\346\211\213\346\234\272\346\241\214\351\235\242\346\230\276\347\244\272.jpg" "b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/1.\346\211\213\346\234\272\346\241\214\351\235\242\346\230\276\347\244\272.jpg" deleted file mode 100755 index 315c3fd3..00000000 Binary files "a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/1.\346\211\213\346\234\272\346\241\214\351\235\242\346\230\276\347\244\272.jpg" and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/edit-team-intro.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/edit-team-intro.png deleted file mode 100644 index f20050df..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/edit-team-intro.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/example-page.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/example-page.png deleted file mode 100644 index 7fe624cf..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/example-page.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/fork-repo.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/fork-repo.png deleted file mode 100644 index 24ef26b4..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/fork-repo.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-edit-file.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-edit-file.png deleted file mode 100644 index 5232b29b..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-edit-file.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-open-file.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-open-file.png deleted file mode 100644 index 8b29a2e0..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-open-file.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-upload-files.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-upload-files.png deleted file mode 100644 index 0007a436..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/github-upload-files.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/input-username.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/input-username.png deleted file mode 100644 index 5f17b0ce..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/input-username.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/login-with-private-key.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/login-with-private-key.png deleted file mode 100644 index 5a5918c1..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/login-with-private-key.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/open-account.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/open-account.png deleted file mode 100644 index 984ec82c..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/open-account.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/set-github-link.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/set-github-link.png deleted file mode 100644 index 7171f9dc..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/set-github-link.png and /dev/null differ diff --git a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/view-page.png b/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/view-page.png deleted file mode 100644 index ae958c73..00000000 Binary files a/images/Blockchain-Explorer/Tronscan_Super_Representative_Template/view-page.png and /dev/null differ diff --git "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\214\272\345\235\227.png" "b/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\214\272\345\235\227.png" deleted file mode 100644 index 60c3f475..00000000 Binary files "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\214\272\345\235\227.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\214\272\345\235\227\347\233\264\346\222\255.png" "b/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\214\272\345\235\227\347\233\264\346\222\255.png" deleted file mode 100644 index 924baac3..00000000 Binary files "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\214\272\345\235\227\347\233\264\346\222\255.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\234\260\345\235\200\344\272\244\346\230\223\347\273\237\350\256\241\346\225\260\346\215\256.png" "b/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\234\260\345\235\200\344\272\244\346\230\223\347\273\237\350\256\241\346\225\260\346\215\256.png" deleted file mode 100644 index b0c24229..00000000 Binary files "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\347\234\213\345\234\260\345\235\200\344\272\244\346\230\223\347\273\237\350\256\241\346\225\260\346\215\256.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\350\257\242\344\272\244\346\230\223.png" "b/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\350\257\242\344\272\244\346\230\223.png" deleted file mode 100644 index 7b2bf168..00000000 Binary files "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\350\257\242\344\272\244\346\230\223.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\350\257\242\350\264\246\346\210\267.png" "b/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\350\257\242\350\264\246\346\210\267.png" deleted file mode 100644 index 9ee2ffb7..00000000 Binary files "a/images/Blockchain-Explorer/blockchain\346\250\241\345\235\227/\346\237\245\350\257\242\350\264\246\346\210\267.png" and /dev/null differ diff --git a/images/Blockchain-Explorer/fork-repo.png b/images/Blockchain-Explorer/fork-repo.png deleted file mode 100644 index 24ef26b4..00000000 Binary files a/images/Blockchain-Explorer/fork-repo.png and /dev/null differ diff --git "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\344\270\211\345\244\247\346\250\241\345\235\227.png" "b/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\344\270\211\345\244\247\346\250\241\345\235\227.png" deleted file mode 100644 index db03ab65..00000000 Binary files "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\344\270\211\345\244\247\346\250\241\345\235\227.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\344\273\243\345\270\201\346\246\202\350\247\210.png" "b/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\344\273\243\345\270\201\346\246\202\350\247\210.png" deleted file mode 100644 index d5dbc6a4..00000000 Binary files "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\344\273\243\345\270\201\346\246\202\350\247\210.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\210\233\345\273\272\344\273\243\345\270\2011.png" "b/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\210\233\345\273\272\344\273\243\345\270\2011.png" deleted file mode 100644 index b623894a..00000000 Binary files "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\210\233\345\273\272\344\273\243\345\270\2011.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\210\233\345\273\272\344\273\243\345\270\2012.png" "b/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\210\233\345\273\272\344\273\243\345\270\2012.png" deleted file mode 100644 index 741e3782..00000000 Binary files "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\210\233\345\273\272\344\273\243\345\270\2012.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\217\202\344\270\216\344\273\243\345\270\201.png" "b/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\217\202\344\270\216\344\273\243\345\270\201.png" deleted file mode 100644 index 8e9fa3a0..00000000 Binary files "a/images/Blockchain-Explorer/\345\205\263\344\272\216\344\273\243\345\270\201/\345\217\202\344\270\216\344\273\243\345\270\201.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\345\270\202\345\234\272\350\265\204\350\256\257/\345\270\202\345\234\272\350\265\204\350\256\257.png" "b/images/Blockchain-Explorer/\345\270\202\345\234\272\350\265\204\350\256\257/\345\270\202\345\234\272\350\265\204\350\256\257.png" deleted file mode 100644 index cbf4e070..00000000 Binary files "a/images/Blockchain-Explorer/\345\270\202\345\234\272\350\265\204\350\256\257/\345\270\202\345\234\272\350\265\204\350\256\257.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\345\241\253\345\206\231\347\275\221\347\253\231\345\234\260\345\235\200\345\271\266\345\213\276\351\200\211.jpg" "b/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\345\241\253\345\206\231\347\275\221\347\253\231\345\234\260\345\235\200\345\271\266\345\213\276\351\200\211.jpg" deleted file mode 100644 index 2012f345..00000000 Binary files "a/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\345\241\253\345\206\231\347\275\221\347\253\231\345\234\260\345\235\200\345\271\266\345\213\276\351\200\211.jpg" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\347\202\271\345\207\273\350\264\246\346\210\267.jpg" "b/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\347\202\271\345\207\273\350\264\246\346\210\267.jpg" deleted file mode 100644 index 40e746ba..00000000 Binary files "a/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\347\202\271\345\207\273\350\264\246\346\210\267.jpg" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\347\224\263\350\257\267\346\210\220\344\270\272\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211.jpg" "b/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\347\224\263\350\257\267\346\210\220\344\270\272\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211.jpg" deleted file mode 100644 index 336c65a1..00000000 Binary files "a/images/Blockchain-Explorer/\347\253\236\351\200\211\350\266\205\347\272\247\344\273\243\350\241\250/\347\224\263\350\257\267\346\210\220\344\270\272\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211.jpg" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\345\234\260\345\233\276\345\210\206\345\270\203.png" "b/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\345\234\260\345\233\276\345\210\206\345\270\203.png" deleted file mode 100644 index 389899a5..00000000 Binary files "a/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\345\234\260\345\233\276\345\210\206\345\270\203.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\346\225\260\351\207\217\344\270\216\345\210\206\345\270\203.png" "b/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\346\225\260\351\207\217\344\270\216\345\210\206\345\270\203.png" deleted file mode 100644 index 67a27543..00000000 Binary files "a/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\346\225\260\351\207\217\344\270\216\345\210\206\345\270\203.png" and /dev/null differ diff --git "a/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\350\212\202\347\202\271\344\277\241\346\201\257.png" "b/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\350\212\202\347\202\271\344\277\241\346\201\257.png" deleted file mode 100644 index 25fd3f48..00000000 Binary files "a/images/Blockchain-Explorer/\350\212\202\347\202\271\344\277\241\346\201\257/\350\212\202\347\202\271\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/FAQ/\346\237\245\350\257\242\350\212\202\347\202\271.png" "b/images/FAQ/\346\237\245\350\257\242\350\212\202\347\202\271.png" deleted file mode 100644 index 243d0187..00000000 Binary files "a/images/FAQ/\346\237\245\350\257\242\350\212\202\347\202\271.png" and /dev/null differ diff --git a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_SRs.png b/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_SRs.png deleted file mode 100644 index 239dd617..00000000 Binary files a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_SRs.png and /dev/null differ diff --git a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_developer.png b/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_developer.png deleted file mode 100644 index 32124b4b..00000000 Binary files a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_developer.png and /dev/null differ diff --git a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_exchange.png b/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_exchange.png deleted file mode 100644 index 22ec53f9..00000000 Binary files a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_exchange.png and /dev/null differ diff --git a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_user.png b/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_user.png deleted file mode 100644 index 7de23fa2..00000000 Binary files a/images/Guidance_After_TRON_Mainnet_Launch/Guidance_for_user.png and /dev/null differ diff --git a/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png b/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png deleted file mode 100644 index 8602749a..00000000 Binary files a/images/Guidance_After_TRON_Mainnet_Launch/Timeline.png and /dev/null differ diff --git "a/images/Virtual_Machine/\350\231\232\346\213\237\346\234\272.png" "b/images/Virtual_Machine/\350\231\232\346\213\237\346\234\272.png" deleted file mode 100644 index 04db4d85..00000000 Binary files "a/images/Virtual_Machine/\350\231\232\346\213\237\346\234\272.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\200\222\345\205\245\351\222\261\345\214\205/\345\257\274\345\205\245\351\222\261\345\214\205.png" "b/images/Wallet_for_Android/\345\200\222\345\205\245\351\222\261\345\214\205/\345\257\274\345\205\245\351\222\261\345\214\205.png" deleted file mode 100644 index 0a3c7b7c..00000000 Binary files "a/images/Wallet_for_Android/\345\200\222\345\205\245\351\222\261\345\214\205/\345\257\274\345\205\245\351\222\261\345\214\205.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/1.\346\241\214\351\235\242\346\230\276\347\244\272.png" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/1.\346\241\214\351\235\242\346\230\276\347\244\272.png" deleted file mode 100644 index 0a279bbf..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/1.\346\241\214\351\235\242\346\230\276\347\244\272.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/2.\347\202\271\345\207\273app\344\271\213\345\220\216\347\232\204\347\225\214\351\235\242.jpg" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/2.\347\202\271\345\207\273app\344\271\213\345\220\216\347\232\204\347\225\214\351\235\242.jpg" deleted file mode 100755 index 38edde62..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/2.\347\202\271\345\207\273app\344\271\213\345\220\216\347\232\204\347\225\214\351\235\242.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/3.\350\256\276\347\275\256\347\224\250\346\210\267\345\220\215\345\222\214\345\257\206\347\240\201.png" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/3.\350\256\276\347\275\256\347\224\250\346\210\267\345\220\215\345\222\214\345\257\206\347\240\201.png" deleted file mode 100644 index de29f991..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/3.\350\256\276\347\275\256\347\224\250\346\210\267\345\220\215\345\222\214\345\257\206\347\240\201.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/4.png" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/4.png" deleted file mode 100644 index 2bc702ce..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/4.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/5.\347\202\271\345\207\273\345\206\267\351\222\261\345\214\205\345\256\214\346\257\225\345\220\216\347\232\204\346\230\276\347\244\272\351\241\265\351\235\242.jpg" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/5.\347\202\271\345\207\273\345\206\267\351\222\261\345\214\205\345\256\214\346\257\225\345\220\216\347\232\204\346\230\276\347\244\272\351\241\265\351\235\242.jpg" deleted file mode 100755 index 1e98eb82..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/5.\347\202\271\345\207\273\345\206\267\351\222\261\345\214\205\345\256\214\346\257\225\345\220\216\347\232\204\346\230\276\347\244\272\351\241\265\351\235\242.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/6.png" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/6.png" deleted file mode 100644 index 81282fe5..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/6.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/7.\351\222\261\345\214\205\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216\347\232\204\351\241\265\351\235\242 now we see here is a public address ,private key and 24 words recovery phrase.jpg" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/7.\351\222\261\345\214\205\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216\347\232\204\351\241\265\351\235\242 now we see here is a public address ,private key and 24 words recovery phrase.jpg" deleted file mode 100755 index fd299724..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/7.\351\222\261\345\214\205\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216\347\232\204\351\241\265\351\235\242 now we see here is a public address ,private key and 24 words recovery phrase.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/8.\345\210\233\345\273\272\345\217\267\351\222\261\345\214\205\344\271\213\345\220\216\344\270\213\346\273\221\351\241\265\351\235\242\346\211\276\345\210\260continue\346\214\211\351\222\256.jpg" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/8.\345\210\233\345\273\272\345\217\267\351\222\261\345\214\205\344\271\213\345\220\216\344\270\213\346\273\221\351\241\265\351\235\242\346\211\276\345\210\260continue\346\214\211\351\222\256.jpg" deleted file mode 100755 index aface031..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/8.\345\210\233\345\273\272\345\217\267\351\222\261\345\214\205\344\271\213\345\220\216\344\270\213\346\273\221\351\241\265\351\235\242\346\211\276\345\210\260continue\346\214\211\351\222\256.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/9.\351\222\261\345\214\205\350\264\246\346\210\267\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216.jpg" "b/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/9.\351\222\261\345\214\205\350\264\246\346\210\267\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216.jpg" deleted file mode 100755 index 536f8741..00000000 Binary files "a/images/Wallet_for_Android/\345\210\233\345\273\272\351\222\261\345\214\205\350\264\246\346\210\267/9.\351\222\261\345\214\205\350\264\246\346\210\267\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/1.\350\277\233\345\205\245\345\216\206\345\217\262\350\256\260\345\275\225\347\225\214\351\235\242.png" "b/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/1.\350\277\233\345\205\245\345\216\206\345\217\262\350\256\260\345\275\225\347\225\214\351\235\242.png" deleted file mode 100644 index 13e7d30f..00000000 Binary files "a/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/1.\350\277\233\345\205\245\345\216\206\345\217\262\350\256\260\345\275\225\347\225\214\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/2.\346\237\245\347\234\213\345\215\225\347\254\224\344\272\244\346\230\223\344\277\241\346\201\257.png" "b/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/2.\346\237\245\347\234\213\345\215\225\347\254\224\344\272\244\346\230\223\344\277\241\346\201\257.png" deleted file mode 100644 index a0f189b2..00000000 Binary files "a/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/2.\346\237\245\347\234\213\345\215\225\347\254\224\344\272\244\346\230\223\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/3.tronscan\344\270\212\346\237\245\347\234\213\350\256\260\345\275\225.png" "b/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/3.tronscan\344\270\212\346\237\245\347\234\213\350\256\260\345\275\225.png" deleted file mode 100644 index 08bce851..00000000 Binary files "a/images/Wallet_for_Android/\345\216\206\345\217\262\350\256\260\345\275\225/3.tronscan\344\270\212\346\237\245\347\234\213\350\256\260\345\275\225.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/1.\344\275\231\351\242\235TP\345\270\246\345\256\275\346\230\276\347\244\272\347\225\214\351\235\242.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/1.\344\275\231\351\242\235TP\345\270\246\345\256\275\346\230\276\347\244\272\347\225\214\351\235\242.png" deleted file mode 100644 index d2aee40c..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/1.\344\275\231\351\242\235TP\345\270\246\345\256\275\346\230\276\347\244\272\347\225\214\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/10.\347\202\271\345\207\273\346\212\225\347\245\250\346\214\211\351\222\256\344\271\213\345\220\216\350\277\233\345\205\245\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211\344\272\272list\351\241\265\351\235\242\357\274\214candidates\344\270\200\346\240\217\344\270\213\346\230\276\347\244\272\347\232\204\346\230\257\346\211\200\346\234\211\345\276\205\346\212\225\347\245\250\347\253\236\351\200\211\347\232\204SR\345\200\231\351\200\211\344\272\272.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/10.\347\202\271\345\207\273\346\212\225\347\245\250\346\214\211\351\222\256\344\271\213\345\220\216\350\277\233\345\205\245\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211\344\272\272list\351\241\265\351\235\242\357\274\214candidates\344\270\200\346\240\217\344\270\213\346\230\276\347\244\272\347\232\204\346\230\257\346\211\200\346\234\211\345\276\205\346\212\225\347\245\250\347\253\236\351\200\211\347\232\204SR\345\200\231\351\200\211\344\272\272.jpg" deleted file mode 100755 index 10f6978a..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/10.\347\202\271\345\207\273\346\212\225\347\245\250\346\214\211\351\222\256\344\271\213\345\220\216\350\277\233\345\205\245\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211\344\272\272list\351\241\265\351\235\242\357\274\214candidates\344\270\200\346\240\217\344\270\213\346\230\276\347\244\272\347\232\204\346\230\257\346\211\200\346\234\211\345\276\205\346\212\225\347\245\250\347\253\236\351\200\211\347\232\204SR\345\200\231\351\200\211\344\272\272.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/11.\346\255\244\344\270\272your votes\351\241\265\351\235\242\344\270\213\347\232\204\346\230\276\347\244\272\346\203\205\345\206\265\357\274\214\345\233\240\344\270\272\346\210\221\344\273\254\350\277\230\346\262\241\346\234\211\345\257\271\344\273\273\344\275\225\344\270\200\344\270\252SR\345\200\231\351\200\211\350\212\202\347\202\271\350\277\233\350\241\214\346\212\225\347\245\250\357\274\214\346\211\200\344\273\245\345\210\227\350\241\250\344\270\255\347\251\272\347\251\272\345\246\202\344\271\237.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/11.\346\255\244\344\270\272your votes\351\241\265\351\235\242\344\270\213\347\232\204\346\230\276\347\244\272\346\203\205\345\206\265\357\274\214\345\233\240\344\270\272\346\210\221\344\273\254\350\277\230\346\262\241\346\234\211\345\257\271\344\273\273\344\275\225\344\270\200\344\270\252SR\345\200\231\351\200\211\350\212\202\347\202\271\350\277\233\350\241\214\346\212\225\347\245\250\357\274\214\346\211\200\344\273\245\345\210\227\350\241\250\344\270\255\347\251\272\347\251\272\345\246\202\344\271\237.png" deleted file mode 100755 index bb9ad07e..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/11.\346\255\244\344\270\272your votes\351\241\265\351\235\242\344\270\213\347\232\204\346\230\276\347\244\272\346\203\205\345\206\265\357\274\214\345\233\240\344\270\272\346\210\221\344\273\254\350\277\230\346\262\241\346\234\211\345\257\271\344\273\273\344\275\225\344\270\200\344\270\252SR\345\200\231\351\200\211\350\212\202\347\202\271\350\277\233\350\241\214\346\212\225\347\245\250\357\274\214\346\211\200\344\273\245\345\210\227\350\241\250\344\270\255\347\251\272\347\251\272\345\246\202\344\271\237.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/12.\346\210\221\344\273\254\345\233\236\345\210\260candidates\344\270\200\346\240\217\357\274\214\344\273\273\346\204\217\351\200\211\346\213\251\344\270\200\344\270\252SR\345\200\231\351\200\211\344\272\272\350\277\233\350\241\214\346\212\225\347\245\250\346\274\224\347\244\272\357\274\214\344\273\245list\344\270\255\351\246\226\344\270\252\347\263\273\350\212\202\347\202\271\344\270\272\344\276\213\357\274\214\346\263\250\357\274\214candidates list \347\232\204\346\216\222\345\210\227\346\230\257\344\273\245\347\245\250\346\225\260\345\244\232\345\260\221\344\270\272\351\241\272\345\272\217.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/12.\346\210\221\344\273\254\345\233\236\345\210\260candidates\344\270\200\346\240\217\357\274\214\344\273\273\346\204\217\351\200\211\346\213\251\344\270\200\344\270\252SR\345\200\231\351\200\211\344\272\272\350\277\233\350\241\214\346\212\225\347\245\250\346\274\224\347\244\272\357\274\214\344\273\245list\344\270\255\351\246\226\344\270\252\347\263\273\350\212\202\347\202\271\344\270\272\344\276\213\357\274\214\346\263\250\357\274\214candidates list \347\232\204\346\216\222\345\210\227\346\230\257\344\273\245\347\245\250\346\225\260\345\244\232\345\260\221\344\270\272\351\241\272\345\272\217.jpg" deleted file mode 100755 index 2212f259..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/12.\346\210\221\344\273\254\345\233\236\345\210\260candidates\344\270\200\346\240\217\357\274\214\344\273\273\346\204\217\351\200\211\346\213\251\344\270\200\344\270\252SR\345\200\231\351\200\211\344\272\272\350\277\233\350\241\214\346\212\225\347\245\250\346\274\224\347\244\272\357\274\214\344\273\245list\344\270\255\351\246\226\344\270\252\347\263\273\350\212\202\347\202\271\344\270\272\344\276\213\357\274\214\346\263\250\357\274\214candidates list \347\232\204\346\216\222\345\210\227\346\230\257\344\273\245\347\245\250\346\225\260\345\244\232\345\260\221\344\270\272\351\241\272\345\272\217.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/13.\350\276\223\345\205\245\345\270\214\346\234\233\344\270\272\346\255\244\350\212\202\347\202\271\346\212\225\345\207\272\347\232\204\347\245\250\346\225\260.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/13.\350\276\223\345\205\245\345\270\214\346\234\233\344\270\272\346\255\244\350\212\202\347\202\271\346\212\225\345\207\272\347\232\204\347\245\250\346\225\260.jpg" deleted file mode 100755 index 7769df71..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/13.\350\276\223\345\205\245\345\270\214\346\234\233\344\270\272\346\255\244\350\212\202\347\202\271\346\212\225\345\207\272\347\232\204\347\245\250\346\225\260.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/14.\347\202\271\345\207\273submit votes\344\271\213\345\220\216\350\246\201\346\261\202\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244\346\212\225\347\245\250.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/14.\347\202\271\345\207\273submit votes\344\271\213\345\220\216\350\246\201\346\261\202\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244\346\212\225\347\245\250.jpg" deleted file mode 100755 index dd5c1cee..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/14.\347\202\271\345\207\273submit votes\344\271\213\345\220\216\350\246\201\346\261\202\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244\346\212\225\347\245\250.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/15.\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\345\271\266\347\202\271\345\207\273submit.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/15.\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\345\271\266\347\202\271\345\207\273submit.jpg" deleted file mode 100755 index 8d61f72c..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/15.\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\345\271\266\347\202\271\345\207\273submit.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/16.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/16.png" deleted file mode 100644 index 84b06e0a..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/16.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/17.\344\270\272\346\255\244\345\200\231\351\200\211\344\272\272\346\212\225\350\277\207\347\245\250\345\220\216\346\255\244\345\200\231\351\200\211\344\272\272\345\217\263\344\276\247\346\230\276\347\244\272\344\275\240\344\270\272\345\205\266\351\200\217\350\277\207\347\232\204\347\245\250\346\225\260.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/17.\344\270\272\346\255\244\345\200\231\351\200\211\344\272\272\346\212\225\350\277\207\347\245\250\345\220\216\346\255\244\345\200\231\351\200\211\344\272\272\345\217\263\344\276\247\346\230\276\347\244\272\344\275\240\344\270\272\345\205\266\351\200\217\350\277\207\347\232\204\347\245\250\346\225\260.jpg" deleted file mode 100755 index 756ffeec..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/17.\344\270\272\346\255\244\345\200\231\351\200\211\344\272\272\346\212\225\350\277\207\347\245\250\345\220\216\346\255\244\345\200\231\351\200\211\344\272\272\345\217\263\344\276\247\346\230\276\347\244\272\344\275\240\344\270\272\345\205\266\351\200\217\350\277\207\347\232\204\347\245\250\346\225\260.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/18.\350\277\231\344\270\252\346\227\266\345\200\231\346\210\221\344\273\254\345\217\257\344\273\245\347\234\213\345\210\260\345\234\250your votes\344\270\200\346\240\217\344\270\255\344\270\216\346\212\225\347\245\250\345\211\215\344\270\215\345\220\214\347\232\204\346\230\257\345\207\272\347\216\260\344\272\206\346\210\221\344\273\254\344\270\272\345\205\266\346\212\225\350\277\207\347\245\250\347\232\204SR\345\200\231\351\200\211\344\272\272\344\277\241\346\201\257.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/18.\350\277\231\344\270\252\346\227\266\345\200\231\346\210\221\344\273\254\345\217\257\344\273\245\347\234\213\345\210\260\345\234\250your votes\344\270\200\346\240\217\344\270\255\344\270\216\346\212\225\347\245\250\345\211\215\344\270\215\345\220\214\347\232\204\346\230\257\345\207\272\347\216\260\344\272\206\346\210\221\344\273\254\344\270\272\345\205\266\346\212\225\350\277\207\347\245\250\347\232\204SR\345\200\231\351\200\211\344\272\272\344\277\241\346\201\257.jpg" deleted file mode 100755 index 31a20461..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/18.\350\277\231\344\270\252\346\227\266\345\200\231\346\210\221\344\273\254\345\217\257\344\273\245\347\234\213\345\210\260\345\234\250your votes\344\270\200\346\240\217\344\270\255\344\270\216\346\212\225\347\245\250\345\211\215\344\270\215\345\220\214\347\232\204\346\230\257\345\207\272\347\216\260\344\272\206\346\210\221\344\273\254\344\270\272\345\205\266\346\212\225\350\277\207\347\245\250\347\232\204SR\345\200\231\351\200\211\344\272\272\344\277\241\346\201\257.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/2.\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\350\275\254\350\264\246\347\225\214\351\235\242.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/2.\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\350\275\254\350\264\246\347\225\214\351\235\242.png" deleted file mode 100644 index 6cb634ac..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/2.\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\350\275\254\350\264\246\347\225\214\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/3.freeze\351\241\265\351\235\242.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/3.freeze\351\241\265\351\235\242.png" deleted file mode 100644 index c8bddfea..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/3.freeze\351\241\265\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/4.\345\234\250freeze amount \350\276\223\345\205\245\346\240\217\344\270\255\351\224\256\345\205\245\345\270\214\346\234\233\345\206\273\347\273\223\347\232\204TRX\346\225\260\351\207\217\357\274\214\347\204\266\345\220\216\347\202\271\345\207\273freeze\346\214\211\351\222\256\357\274\214\346\263\250\357\274\214\346\213\245\346\234\211\345\244\232\345\260\221\345\206\273\347\273\223TRX\345\260\261\346\213\245\346\234\211\345\244\232\345\260\221\346\212\225\347\245\250\346\235\203.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/4.\345\234\250freeze amount \350\276\223\345\205\245\346\240\217\344\270\255\351\224\256\345\205\245\345\270\214\346\234\233\345\206\273\347\273\223\347\232\204TRX\346\225\260\351\207\217\357\274\214\347\204\266\345\220\216\347\202\271\345\207\273freeze\346\214\211\351\222\256\357\274\214\346\263\250\357\274\214\346\213\245\346\234\211\345\244\232\345\260\221\345\206\273\347\273\223TRX\345\260\261\346\213\245\346\234\211\345\244\232\345\260\221\346\212\225\347\245\250\346\235\203.jpg" deleted file mode 100755 index 90d2ab1c..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/4.\345\234\250freeze amount \350\276\223\345\205\245\346\240\217\344\270\255\351\224\256\345\205\245\345\270\214\346\234\233\345\206\273\347\273\223\347\232\204TRX\346\225\260\351\207\217\357\274\214\347\204\266\345\220\216\347\202\271\345\207\273freeze\346\214\211\351\222\256\357\274\214\346\263\250\357\274\214\346\213\245\346\234\211\345\244\232\345\260\221\345\206\273\347\273\223TRX\345\260\261\346\213\245\346\234\211\345\244\232\345\260\221\346\212\225\347\245\250\346\235\203.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/5.\347\241\256\350\256\244\345\220\210\347\272\246.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/5.\347\241\256\350\256\244\345\220\210\347\272\246.png" deleted file mode 100644 index 7597b922..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/5.\347\241\256\350\256\244\345\220\210\347\272\246.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/6\350\276\223\345\205\245\345\257\206\347\240\201\347\202\271\345\207\273\345\217\221\351\200\201.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/6\350\276\223\345\205\245\345\257\206\347\240\201\347\202\271\345\207\273\345\217\221\351\200\201.png" deleted file mode 100644 index 315656ec..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/6\350\276\223\345\205\245\345\257\206\347\240\201\347\202\271\345\207\273\345\217\221\351\200\201.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/7.\345\217\221\351\200\201\346\210\220\345\212\237.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/7.\345\217\221\351\200\201\346\210\220\345\212\237.png" deleted file mode 100644 index 4b7fb5d0..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/7.\345\217\221\351\200\201\346\210\220\345\212\237.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/8.\350\277\233\350\241\214100TRX\345\206\273\347\273\223\344\271\213\345\220\216\347\232\204\351\241\265\351\235\242\346\230\276\347\244\272.jpg" "b/images/Wallet_for_Android/\346\212\225\347\245\250/8.\350\277\233\350\241\214100TRX\345\206\273\347\273\223\344\271\213\345\220\216\347\232\204\351\241\265\351\235\242\346\230\276\347\244\272.jpg" deleted file mode 100755 index bee2795e..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/8.\350\277\233\350\241\214100TRX\345\206\273\347\273\223\344\271\213\345\220\216\347\232\204\351\241\265\351\235\242\346\230\276\347\244\272.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\212\225\347\245\250/9.\347\202\271\345\207\273\346\212\225\347\245\250\346\214\211\351\222\256.png" "b/images/Wallet_for_Android/\346\212\225\347\245\250/9.\347\202\271\345\207\273\346\212\225\347\245\250\346\214\211\351\222\256.png" deleted file mode 100644 index 5b024bb8..00000000 Binary files "a/images/Wallet_for_Android/\346\212\225\347\245\250/9.\347\202\271\345\207\273\346\212\225\347\245\250\346\214\211\351\222\256.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\230\276\347\244\272\344\275\231\351\242\235\351\241\265/9.\351\222\261\345\214\205\350\264\246\346\210\267\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216.jpg" "b/images/Wallet_for_Android/\346\230\276\347\244\272\344\275\231\351\242\235\351\241\265/9.\351\222\261\345\214\205\350\264\246\346\210\267\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216.jpg" deleted file mode 100755 index 536f8741..00000000 Binary files "a/images/Wallet_for_Android/\346\230\276\347\244\272\344\275\231\351\242\235\351\241\265/9.\351\222\261\345\214\205\350\264\246\346\210\267\345\210\233\345\273\272\345\245\275\344\271\213\345\220\216.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\345\214\272\345\235\227\345\222\214\344\272\244\346\230\223\344\277\241\346\201\257.png" "b/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\345\214\272\345\235\227\345\222\214\344\272\244\346\230\223\344\277\241\346\201\257.png" deleted file mode 100644 index 2a720253..00000000 Binary files "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\345\214\272\345\235\227\345\222\214\344\272\244\346\230\223\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213SP\345\200\231\351\200\211\344\277\241\346\201\257.png" "b/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213SP\345\200\231\351\200\211\344\277\241\346\201\257.png" deleted file mode 100644 index 24351b03..00000000 Binary files "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213SP\345\200\231\351\200\211\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213token\344\277\241\346\201\257.png" "b/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213token\344\277\241\346\201\257.png" deleted file mode 100644 index 4c1d82b2..00000000 Binary files "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213token\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213\350\212\202\347\202\271\344\277\241\346\201\257.png" "b/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213\350\212\202\347\202\271\344\277\241\346\201\257.png" deleted file mode 100644 index b4fde0f3..00000000 Binary files "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213\350\212\202\347\202\271\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213\350\264\246\346\210\267\344\277\241\346\201\257.png" "b/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213\350\264\246\346\210\267\344\277\241\346\201\257.png" deleted file mode 100644 index af0a321b..00000000 Binary files "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\346\237\245\347\234\213\350\264\246\346\210\267\344\277\241\346\201\257.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\351\200\211\346\213\251\350\264\255\344\271\260\346\225\260\351\207\217.png" "b/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\351\200\211\346\213\251\350\264\255\344\271\260\346\225\260\351\207\217.png" deleted file mode 100644 index e4ac2a6c..00000000 Binary files "a/images/Wallet_for_Android/\346\237\245\347\234\213\347\233\270\345\205\263\344\277\241\346\201\257/\351\200\211\346\213\251\350\264\255\344\271\260\346\225\260\351\207\217.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/1.\346\230\276\347\244\272\344\275\231\351\242\235\347\225\214\351\235\242.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/1.\346\230\276\347\244\272\344\275\231\351\242\235\347\225\214\351\235\242.png" deleted file mode 100644 index 95b446ec..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/1.\346\230\276\347\244\272\344\275\231\351\242\235\347\225\214\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/3.\347\202\271\345\207\273\345\217\263\344\276\247\350\275\254\350\264\246\346\214\211\351\222\256\345\220\216\345\207\272\347\216\260\347\232\204\347\225\214\351\235\242\357\274\210\351\273\230\350\256\244\345\201\234\347\225\231\345\234\250send\344\271\237\345\260\261\346\230\257\350\275\254\345\207\272TRX\346\227\266\347\232\204\346\223\215\344\275\234\351\241\265\351\235\242\357\274\211\345\217\257\344\273\245\351\200\232\350\277\207\345\234\250to\344\270\200\346\240\217\350\276\223\345\205\245\350\275\254\345\205\245\345\234\260\345\235\200\344\271\237\345\217\257\344\273\245\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\344\272\214\347\273\264\347\240\201\345\260\217\346\240\207\345\277\227\357\274\214\346\211\223\345\274\200\344\272\214\347\273\264\347\240\201\346\211\253\346\217\217\351\241\265\351\235\242.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/3.\347\202\271\345\207\273\345\217\263\344\276\247\350\275\254\350\264\246\346\214\211\351\222\256\345\220\216\345\207\272\347\216\260\347\232\204\347\225\214\351\235\242\357\274\210\351\273\230\350\256\244\345\201\234\347\225\231\345\234\250send\344\271\237\345\260\261\346\230\257\350\275\254\345\207\272TRX\346\227\266\347\232\204\346\223\215\344\275\234\351\241\265\351\235\242\357\274\211\345\217\257\344\273\245\351\200\232\350\277\207\345\234\250to\344\270\200\346\240\217\350\276\223\345\205\245\350\275\254\345\205\245\345\234\260\345\235\200\344\271\237\345\217\257\344\273\245\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\344\272\214\347\273\264\347\240\201\345\260\217\346\240\207\345\277\227\357\274\214\346\211\223\345\274\200\344\272\214\347\273\264\347\240\201\346\211\253\346\217\217\351\241\265\351\235\242.png" deleted file mode 100755 index e4b789cf..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/3.\347\202\271\345\207\273\345\217\263\344\276\247\350\275\254\350\264\246\346\214\211\351\222\256\345\220\216\345\207\272\347\216\260\347\232\204\347\225\214\351\235\242\357\274\210\351\273\230\350\256\244\345\201\234\347\225\231\345\234\250send\344\271\237\345\260\261\346\230\257\350\275\254\345\207\272TRX\346\227\266\347\232\204\346\223\215\344\275\234\351\241\265\351\235\242\357\274\211\345\217\257\344\273\245\351\200\232\350\277\207\345\234\250to\344\270\200\346\240\217\350\276\223\345\205\245\350\275\254\345\205\245\345\234\260\345\235\200\344\271\237\345\217\257\344\273\245\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\344\272\214\347\273\264\347\240\201\345\260\217\346\240\207\345\277\227\357\274\214\346\211\223\345\274\200\344\272\214\347\273\264\347\240\201\346\211\253\346\217\217\351\241\265\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/4.\347\202\271\345\207\273receive\345\220\216\346\230\276\347\244\272\350\207\252\345\267\261\347\232\204\351\222\261\345\214\205\345\234\260\345\235\200\345\222\214\344\272\214\347\273\264\347\240\201\346\200\247\350\264\250\347\232\204\345\234\260\345\235\200\357\274\214\345\217\257\344\276\233\350\275\254\345\207\272\350\264\246\346\210\267\350\277\233\350\241\214\350\276\223\345\205\245\345\222\214scan\357\274\214\345\276\205\350\275\254\345\207\272\350\264\246\346\210\267\346\223\215\344\275\234\345\256\214\346\257\225\345\220\216\357\274\214\347\202\271\345\207\273\345\267\246\344\270\212\350\247\222\350\277\224\345\233\236\347\256\255\345\244\264\350\277\233\350\241\214\344\275\231\351\242\235\346\237\245\347\234\213.jpg" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/4.\347\202\271\345\207\273receive\345\220\216\346\230\276\347\244\272\350\207\252\345\267\261\347\232\204\351\222\261\345\214\205\345\234\260\345\235\200\345\222\214\344\272\214\347\273\264\347\240\201\346\200\247\350\264\250\347\232\204\345\234\260\345\235\200\357\274\214\345\217\257\344\276\233\350\275\254\345\207\272\350\264\246\346\210\267\350\277\233\350\241\214\350\276\223\345\205\245\345\222\214scan\357\274\214\345\276\205\350\275\254\345\207\272\350\264\246\346\210\267\346\223\215\344\275\234\345\256\214\346\257\225\345\220\216\357\274\214\347\202\271\345\207\273\345\267\246\344\270\212\350\247\222\350\277\224\345\233\236\347\256\255\345\244\264\350\277\233\350\241\214\344\275\231\351\242\235\346\237\245\347\234\213.jpg" deleted file mode 100755 index e6d1b9ed..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/4.\347\202\271\345\207\273receive\345\220\216\346\230\276\347\244\272\350\207\252\345\267\261\347\232\204\351\222\261\345\214\205\345\234\260\345\235\200\345\222\214\344\272\214\347\273\264\347\240\201\346\200\247\350\264\250\347\232\204\345\234\260\345\235\200\357\274\214\345\217\257\344\276\233\350\275\254\345\207\272\350\264\246\346\210\267\350\277\233\350\241\214\350\276\223\345\205\245\345\222\214scan\357\274\214\345\276\205\350\275\254\345\207\272\350\264\246\346\210\267\346\223\215\344\275\234\345\256\214\346\257\225\345\220\216\357\274\214\347\202\271\345\207\273\345\267\246\344\270\212\350\247\222\350\277\224\345\233\236\347\256\255\345\244\264\350\277\233\350\241\214\344\275\231\351\242\235\346\237\245\347\234\213.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/5.\350\275\254\345\207\272\346\226\271\345\217\257\351\207\207\345\217\226\350\276\223\345\205\245\346\234\254\351\222\261\345\214\205\346\224\266\346\254\276\345\234\260\345\235\200\345\222\214\346\211\253\346\217\217\346\255\244\344\272\214\347\273\264\347\240\201\344\270\244\347\247\215\346\226\271\345\274\217\350\277\233\350\241\214\350\275\254\345\205\245\357\274\210\350\257\246\346\203\205\350\257\267\345\217\202\351\230\205TRX\351\222\261\345\214\205\350\275\254\345\207\272\346\225\231\347\250\213\357\274\211\346\224\266\345\210\26010\344\270\252TRX\345\220\216\344\275\231\351\242\235\350\207\252\345\212\250\345\242\236\345\212\240\344\272\20610\344\270\252TRX.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/5.\350\275\254\345\207\272\346\226\271\345\217\257\351\207\207\345\217\226\350\276\223\345\205\245\346\234\254\351\222\261\345\214\205\346\224\266\346\254\276\345\234\260\345\235\200\345\222\214\346\211\253\346\217\217\346\255\244\344\272\214\347\273\264\347\240\201\344\270\244\347\247\215\346\226\271\345\274\217\350\277\233\350\241\214\350\275\254\345\205\245\357\274\210\350\257\246\346\203\205\350\257\267\345\217\202\351\230\205TRX\351\222\261\345\214\205\350\275\254\345\207\272\346\225\231\347\250\213\357\274\211\346\224\266\345\210\26010\344\270\252TRX\345\220\216\344\275\231\351\242\235\350\207\252\345\212\250\345\242\236\345\212\240\344\272\20610\344\270\252TRX.png" deleted file mode 100755 index 8f21c7ea..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\205\245/5.\350\275\254\345\207\272\346\226\271\345\217\257\351\207\207\345\217\226\350\276\223\345\205\245\346\234\254\351\222\261\345\214\205\346\224\266\346\254\276\345\234\260\345\235\200\345\222\214\346\211\253\346\217\217\346\255\244\344\272\214\347\273\264\347\240\201\344\270\244\347\247\215\346\226\271\345\274\217\350\277\233\350\241\214\350\275\254\345\205\245\357\274\210\350\257\246\346\203\205\350\257\267\345\217\202\351\230\205TRX\351\222\261\345\214\205\350\275\254\345\207\272\346\225\231\347\250\213\357\274\211\346\224\266\345\210\26010\344\270\252TRX\345\220\216\344\275\231\351\242\235\350\207\252\345\212\250\345\242\236\345\212\240\344\272\20610\344\270\252TRX.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/1.\350\264\246\346\210\267\344\270\255\346\234\211\344\275\231\351\242\235\346\227\266\345\200\231\347\232\204\344\275\231\351\242\235\346\230\276\347\244\272\347\225\214\351\235\242.jpg" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/1.\350\264\246\346\210\267\344\270\255\346\234\211\344\275\231\351\242\235\346\227\266\345\200\231\347\232\204\344\275\231\351\242\235\346\230\276\347\244\272\347\225\214\351\235\242.jpg" deleted file mode 100755 index 4dea6659..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/1.\350\264\246\346\210\267\344\270\255\346\234\211\344\275\231\351\242\235\346\227\266\345\200\231\347\232\204\344\275\231\351\242\235\346\230\276\347\244\272\347\225\214\351\235\242.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/10.\350\277\224\345\233\236\351\222\261\345\214\205\344\275\231\351\242\235\351\241\265\351\235\242\345\220\216\346\237\245\347\234\213\350\275\254\350\264\246\346\223\215\344\275\234\344\271\213\345\220\216\347\232\204\344\275\231\351\242\235.jpg" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/10.\350\277\224\345\233\236\351\222\261\345\214\205\344\275\231\351\242\235\351\241\265\351\235\242\345\220\216\346\237\245\347\234\213\350\275\254\350\264\246\346\223\215\344\275\234\344\271\213\345\220\216\347\232\204\344\275\231\351\242\235.jpg" deleted file mode 100755 index e578b353..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/10.\350\277\224\345\233\236\351\222\261\345\214\205\344\275\231\351\242\235\351\241\265\351\235\242\345\220\216\346\237\245\347\234\213\350\275\254\350\264\246\346\223\215\344\275\234\344\271\213\345\220\216\347\232\204\344\275\231\351\242\235.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/2.\347\202\271\345\207\273\344\275\231\351\242\235\346\225\260\345\255\227\345\217\257\350\275\254\346\215\242\346\210\220\347\276\216\345\205\203\347\232\204\347\255\211\345\200\274\351\242\235\345\272\246.jpg" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/2.\347\202\271\345\207\273\344\275\231\351\242\235\346\225\260\345\255\227\345\217\257\350\275\254\346\215\242\346\210\220\347\276\216\345\205\203\347\232\204\347\255\211\345\200\274\351\242\235\345\272\246.jpg" deleted file mode 100755 index 7fab0921..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/2.\347\202\271\345\207\273\344\275\231\351\242\235\346\225\260\345\255\227\345\217\257\350\275\254\346\215\242\346\210\220\347\276\216\345\205\203\347\232\204\347\255\211\345\200\274\351\242\235\345\272\246.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/3.\347\202\271\345\207\273\345\217\263\344\276\247\350\275\254\350\264\246\346\214\211\351\222\256\345\220\216\345\207\272\347\216\260\347\232\204\347\225\214\351\235\242\357\274\210\351\273\230\350\256\244\345\201\234\347\225\231\345\234\250send\344\271\237\345\260\261\346\230\257\350\275\254\345\207\272TRX\346\227\266\347\232\204\346\223\215\344\275\234\351\241\265\351\235\242\357\274\211\345\217\257\344\273\245\351\200\232\350\277\207\345\234\250to\344\270\200\346\240\217\350\276\223\345\205\245\350\275\254\345\205\245\345\234\260\345\235\200\344\271\237\345\217\257\344\273\245\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\344\272\214\347\273\264\347\240\201\345\260\217\346\240\207\345\277\227\357\274\214\346\211\223\345\274\200\344\272\214\347\273\264\347\240\201\346\211\253\346\217\217\351\241\265\351\235\242.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/3.\347\202\271\345\207\273\345\217\263\344\276\247\350\275\254\350\264\246\346\214\211\351\222\256\345\220\216\345\207\272\347\216\260\347\232\204\347\225\214\351\235\242\357\274\210\351\273\230\350\256\244\345\201\234\347\225\231\345\234\250send\344\271\237\345\260\261\346\230\257\350\275\254\345\207\272TRX\346\227\266\347\232\204\346\223\215\344\275\234\351\241\265\351\235\242\357\274\211\345\217\257\344\273\245\351\200\232\350\277\207\345\234\250to\344\270\200\346\240\217\350\276\223\345\205\245\350\275\254\345\205\245\345\234\260\345\235\200\344\271\237\345\217\257\344\273\245\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\344\272\214\347\273\264\347\240\201\345\260\217\346\240\207\345\277\227\357\274\214\346\211\223\345\274\200\344\272\214\347\273\264\347\240\201\346\211\253\346\217\217\351\241\265\351\235\242.png" deleted file mode 100755 index e4b789cf..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/3.\347\202\271\345\207\273\345\217\263\344\276\247\350\275\254\350\264\246\346\214\211\351\222\256\345\220\216\345\207\272\347\216\260\347\232\204\347\225\214\351\235\242\357\274\210\351\273\230\350\256\244\345\201\234\347\225\231\345\234\250send\344\271\237\345\260\261\346\230\257\350\275\254\345\207\272TRX\346\227\266\347\232\204\346\223\215\344\275\234\351\241\265\351\235\242\357\274\211\345\217\257\344\273\245\351\200\232\350\277\207\345\234\250to\344\270\200\346\240\217\350\276\223\345\205\245\350\275\254\345\205\245\345\234\260\345\235\200\344\271\237\345\217\257\344\273\245\347\202\271\345\207\273\345\217\263\344\276\247\347\232\204\344\272\214\347\273\264\347\240\201\345\260\217\346\240\207\345\277\227\357\274\214\346\211\223\345\274\200\344\272\214\347\273\264\347\240\201\346\211\253\346\217\217\351\241\265\351\235\242.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/4.\346\211\223\345\274\200\346\211\253\346\217\217\344\272\214\347\273\264\347\240\201\351\241\265\351\235\242.jpg" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/4.\346\211\223\345\274\200\346\211\253\346\217\217\344\272\214\347\273\264\347\240\201\351\241\265\351\235\242.jpg" deleted file mode 100755 index 6793ab00..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/4.\346\211\223\345\274\200\346\211\253\346\217\217\344\272\214\347\273\264\347\240\201\351\241\265\351\235\242.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/5.\346\211\253\346\217\217\350\275\254\345\205\245\345\234\260\345\235\200.jpg" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/5.\346\211\253\346\217\217\350\275\254\345\205\245\345\234\260\345\235\200.jpg" deleted file mode 100755 index e434ede5..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/5.\346\211\253\346\217\217\350\275\254\345\205\245\345\234\260\345\235\200.jpg" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/6.\350\276\223\345\205\245\345\270\214\346\234\233\350\275\254\345\205\245\347\232\204\351\242\235\345\272\246\347\202\271\345\207\273send.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/6.\350\276\223\345\205\245\345\270\214\346\234\233\350\275\254\345\205\245\347\232\204\351\242\235\345\272\246\347\202\271\345\207\273send.png" deleted file mode 100755 index 5a309a32..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/6.\350\276\223\345\205\245\345\270\214\346\234\233\350\275\254\345\205\245\347\232\204\351\242\235\345\272\246\347\202\271\345\207\273send.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/7.\347\202\271\345\207\273send\344\271\213\345\220\216\351\234\200\350\246\201\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/7.\347\202\271\345\207\273send\344\271\213\345\220\216\351\234\200\350\246\201\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244.png" deleted file mode 100755 index 362cd443..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/7.\347\202\271\345\207\273send\344\271\213\345\220\216\351\234\200\350\246\201\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/8.\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/8.\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244.png" deleted file mode 100755 index ef37babf..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/8.\350\276\223\345\205\245\350\264\246\346\210\267\345\257\206\347\240\201\350\277\233\350\241\214\347\241\256\350\256\244.png" and /dev/null differ diff --git "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/9.png" "b/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/9.png" deleted file mode 100644 index 25f6603b..00000000 Binary files "a/images/Wallet_for_Android/\350\275\254\345\207\272\345\222\214\350\275\254\345\205\245/\350\275\254\345\207\272/9.png" and /dev/null differ diff --git "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/SR\346\214\207\345\274\225.png" "b/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/SR\346\214\207\345\274\225.png" deleted file mode 100644 index 4df462fe..00000000 Binary files "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/SR\346\214\207\345\274\225.png" and /dev/null differ diff --git "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\344\272\244\346\230\223\346\211\200\346\214\207\345\274\225.png" "b/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\344\272\244\346\230\223\346\211\200\346\214\207\345\274\225.png" deleted file mode 100644 index 02559641..00000000 Binary files "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\344\272\244\346\230\223\346\211\200\346\214\207\345\274\225.png" and /dev/null differ diff --git "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\345\274\200\345\217\221\350\200\205\346\214\207\345\274\225.png" "b/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\345\274\200\345\217\221\350\200\205\346\214\207\345\274\225.png" deleted file mode 100644 index 2f99bc4f..00000000 Binary files "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\345\274\200\345\217\221\350\200\205\346\214\207\345\274\225.png" and /dev/null differ diff --git "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\227\266\351\227\264\350\256\241\345\210\222.png" "b/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\227\266\351\227\264\350\256\241\345\210\222.png" deleted file mode 100644 index 3c9cce42..00000000 Binary files "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\227\266\351\227\264\350\256\241\345\210\222.png" and /dev/null differ diff --git "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\231\256\351\200\232\347\224\250\346\210\267\346\214\207\345\274\225.png" "b/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\231\256\351\200\232\347\224\250\346\210\267\346\214\207\345\274\225.png" deleted file mode 100644 index edc8ed0b..00000000 Binary files "a/images/\346\263\242\345\234\272\344\270\273\347\275\221\344\270\212\347\272\277\345\220\216\347\232\204\346\214\207\345\257\274\346\226\271\346\241\210/\346\231\256\351\200\232\347\224\250\346\210\267\346\214\207\345\274\225.png" and /dev/null differ diff --git a/TRX_CN/figures/General_node_deployment_diagram.png b/imags/General_node_deployment_diagram.png similarity index 100% rename from TRX_CN/figures/General_node_deployment_diagram.png rename to imags/General_node_deployment_diagram.png diff --git a/TRX_CN/figures/Recharge_process.png b/imags/Recharge_process.png similarity index 100% rename from TRX_CN/figures/Recharge_process.png rename to imags/Recharge_process.png diff --git a/TRX_CN/figures/Secure_node_deployment_diagram.png b/imags/Secure_node_deployment_diagram.png similarity index 100% rename from TRX_CN/figures/Secure_node_deployment_diagram.png rename to imags/Secure_node_deployment_diagram.png diff --git a/TRX_CN/figures/Withdrawal_process.png b/imags/Withdrawal_process.png similarity index 100% rename from TRX_CN/figures/Withdrawal_process.png rename to imags/Withdrawal_process.png diff --git a/TRX_CN/figures/bandwidthRestoreEqn.gif b/imags/bandwidthRestoreEqn.gif similarity index 100% rename from TRX_CN/figures/bandwidthRestoreEqn.gif rename to imags/bandwidthRestoreEqn.gif diff --git a/imags/db_backup.png b/imags/db_backup.png new file mode 100644 index 00000000..dd0442c8 Binary files /dev/null and b/imags/db_backup.png differ diff --git a/imags/db_engine.png b/imags/db_engine.png new file mode 100644 index 00000000..65c39ac0 Binary files /dev/null and b/imags/db_engine.png differ diff --git a/TRX_CN/figures/discovery_enable.png b/imags/discovery_enable.png similarity index 100% rename from TRX_CN/figures/discovery_enable.png rename to imags/discovery_enable.png diff --git a/TRX_CN/figures/genesis_block.png b/imags/genesis_block.png similarity index 100% rename from TRX_CN/figures/genesis_block.png rename to imags/genesis_block.png diff --git a/TRX_CN/figures/ip_list.png b/imags/ip_list.png similarity index 100% rename from TRX_CN/figures/ip_list.png rename to imags/ip_list.png diff --git a/TRX_CN/figures/localwitness.jpg b/imags/localwitness.jpg similarity index 100% rename from TRX_CN/figures/localwitness.jpg rename to imags/localwitness.jpg diff --git a/TRX_CN/figures/need_sync_check.png b/imags/need_sync_check.png similarity index 100% rename from TRX_CN/figures/need_sync_check.png rename to imags/need_sync_check.png diff --git a/TRX_CN/figures/network.png b/imags/network.png similarity index 100% rename from TRX_CN/figures/network.png rename to imags/network.png diff --git a/TRX_CN/figures/p2p_version.png b/imags/p2p_version.png similarity index 100% rename from TRX_CN/figures/p2p_version.png rename to imags/p2p_version.png diff --git a/imags/rocksdb_tuning_parameters.png b/imags/rocksdb_tuning_parameters.png new file mode 100644 index 00000000..c7041b05 Binary files /dev/null and b/imags/rocksdb_tuning_parameters.png differ diff --git a/TRX_CN/figures/witness.png b/imags/witness.png similarity index 100% rename from TRX_CN/figures/witness.png rename to imags/witness.png diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 00000000..b6d3e6af --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,10 @@ +site_name: TRON Documentation +nav: + - Home: index.md + - TRON Overview: Tron-overview.md + - TRON Http Api: Tron-http.md + - TRON RPC Api: Tron-rpc.md + - TRON Official Public Nodes: Official_Public_Node.md + - TRON Virtual Machine: Tron-VM.md + - TRON Deployment: SolidityNode&FullNode_Deployment.md +theme: readthedocs diff --git a/viltis b/viltis deleted file mode 100644 index 8b137891..00000000 --- a/viltis +++ /dev/null @@ -1 +0,0 @@ - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/Android\351\222\261\345\214\205/Android\351\222\261\345\214\205\344\275\277\347\224\250\346\214\207\345\257\274.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/Android\351\222\261\345\214\205/Android\351\222\261\345\214\205\344\275\277\347\224\250\346\214\207\345\257\274.md" deleted file mode 100644 index 8b99c634..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/Android\351\222\261\345\214\205/Android\351\222\261\345\214\205\344\275\277\347\224\250\346\214\207\345\257\274.md" +++ /dev/null @@ -1,153 +0,0 @@ -# Android钱包使用指导 - -## 简介 - -波场钱包适用于波场网络,是一款多功能安卓端钱包。使用波场钱包,用户可以快速便捷的使用账户功能,并保证TRX及账户信息在冷钱包设置下的安全性。本应用可以为您的私密信息保驾护航,让用户能更加轻松快捷的连接波场网络,壮大波场社区,提供更多可能性。 - -### 应用特色 -创建钱包 -+ 对私密信息进行密码加密 -+ 生成公私钥对 -+ 生成24字的助记词(用户可读的私钥助记词)(BIP39) - -### 钱包导入 -+ 使用私钥或24字助记词进行导入 -+ 或者仅导入公共地址(观察钱包设置) - -### 钱包功能 -+ 个人联系(能够连接任何节点、局域网) -+ 查询余额(TRX、代币) -+ 切换查询市场价格 -+ 查询冻结金额 -+ 发起TRX及代币转账 -+ 接收TRX及代币转账 -+ 二维码收款 -+ 冻结TRX获得投票和bandwidth -+ 为超级代表投票 -+ 二维码离线签名机制 -+ 参与代币发售 -+ 手动进行节点连接设置 - -### 区块浏览器 -+ 查看最新区块 -+ 查看最新交易 -+ 查看超级代表候选人 -+ 查看已连接节点 -+ 查看代币销售情况 -+ 查看账户 -+ 检索结果筛选 - -### 钱包设置 - -观察钱包 -+ 仅导入公共地址 -+ 私密信息不可访问,保证安全性 -+ 账户信息一览 -+ 创建未签名交易(与冷钱包设置搭配使用) - -热钱包 -+ 包含公钥及私钥 -+ 账户信息一览 -+ 功能完备(发起转账、冻结资产、进行投票等) - -冷钱包 -+ 极简安全钱包 -+ 包含公钥及私钥 -+ 保持离线使用(设备永不联网才能保证安全性) -+ 交易签名(交易来自观察钱包) - -## 查看区块信息和最近交易信息 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/区块和交易信息.png) - -## 查看SR候选者信息 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看SP候选信息.png) - -## 查看节点信息 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看节点信息.png) - -## 参与其他tokens交易 - + 选择相应token。 - + 输入购买数量 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看token信息.png) -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Wallet_for_Android/查看相关信息/选择购买数量.png) - -## 查看账户信息 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/查看相关信息/查看账户信息.png) - -## 导入钱包 -+ 仅输入地址,可以导入观察钱包、 -+ 输入密钥或者助记词,可以导入钱包。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/倒入钱包/导入钱包.png) - -## 创建账户 - -1. 手机桌面显示 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/1.桌面显示.png) -2. 点击进入app创建钱包页面 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/2.点击app之后的界面.jpg) -3. 点击创建钱包。 - + 冷钱包创建:勾选冷钱包设置选项,勾选阅读注意事项选项。设置用户名和密码。 - + 热钱包创建:无需勾选冷钱包选项,勾选阅读注意事项选项。设置用户名和密码。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/3.设置用户名和密码.png) -4. 点击创建地址和私钥,阅读创建钱包注意事项,点击确定按钮。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/4.png) -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Wallet_for_Android/创建钱包账户/6.png) -5. 请保存好自己的私钥与24个助记词。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/创建钱包账户/7.钱包创建好之后的页面%20now%20we%20see%20here%20is%20a%20public%20address%20%2Cprivate%20key%20and%2024%20words%20recovery%20phrase.jpg) -6. 点击继续,进入钱包界面。 -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Wallet_for_Android/创建钱包账户/8.创建号钱包之后下滑页面找到continue按钮.jpg) - -## 进行投票 - -热钱包具备投票功能。 - -1. 进入钱包。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/1.余额TP带宽显示界面.png) -2. 进入转账界面。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/2.点击右侧的转账界面.png) -3. 选择FREEZE,进入冻结界面。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/3.freeze页面.png) -4. 输入需要冻结的TRX数量。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/4.在freeze%20amount%20输入栏中键入希望冻结的TRX数量,然后点击freeze按钮,注,拥有多少冻结TRX就拥有多少投票权.jpg) -5. 确认合约。输入密码点击发送。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/5.确认合约.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/6输入密码点击发送.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/7.发送成功.png) - -6. 回到余额显示界面,点击左侧投票按钮。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/9.点击投票按钮.png) -7. 进入SR候选界面。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/10.点击投票按钮之后进入超级代表候选人list页面,candidates一栏下显示的是所有待投票竞选的SR候选人.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/11.此为your%20votes页面下的显示情况,因为我们还没有对任何一个SR候选节点进行投票,所以列表中空空如也.png) -8. 选择相应的SR候选,输入投票数目。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/12.我们回到candidates一栏,任意选择一个SR候选人进行投票演示,以list中首个系节点为例,注,candidates%20list%20的排列是以票数多少为顺序.jpg) -9. 点击submit,输入投票数目和密码,确认提交。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/13.输入希望为此节点投出的票数.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/14.点击submit%20votes之后要求输入账户密码进行确认投票.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/16.png) -10. 可以再SR候选列表和投票中查看已投票信息。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/17.为此候选人投过票后此候选人右侧显示你为其透过的票数.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/投票/18.这个时候我们可以看到在your%20votes一栏中与投票前不同的是出现了我们为其投过票的SR候选人信息.jpg) -## 进行转账 - -1. 进入账户界面。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转入/1.显示余额界面.png) - -2. 输入地址信息,或者使用二维码扫描获得地址,输入要发送的数量,点击发送按钮。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转入/3.点击右侧转账按钮后出现的界面(默认停留在send也就是转出TRX时的操作页面)可以通过在to一栏输入转入地址也可以点击右侧的二维码小标志,打开二维码扫描页面.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转入/4.点击receive后显示自己的钱包地址和二维码性质的地址,可供转出账户进行输入和scan,待转出账户操作完毕后,点击左上角返回箭头进行余额查看.jpg) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转出/6.输入希望转入的额度点击send.png) -3. 输入账户密码进行确认,显示转账成功界面。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转出/7.点击send之后需要输入账户密码进行确认.png) -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/转出和转入/转出/9.png) - -## 查看历史交易记录 - -1. 进入历史记录页面。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/历史记录/1.进入历史记录界面.png) - -2. 查看单笔交易信息。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/历史记录/2.查看单笔交易信息.png) - -3. 也可以从Tronscan上查看交易记录。 -![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/Wallet_for_Android/历史记录/3.tronscan上查看记录.png) \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\344\272\244\346\230\223\347\255\276\345\220\215\346\265\201\347\250\213.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\344\272\244\346\230\223\347\255\276\345\220\215\346\265\201\347\250\213.md" deleted file mode 100644 index f9b2e0f7..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\344\272\244\346\230\223\347\255\276\345\220\215\346\265\201\347\250\213.md" +++ /dev/null @@ -1,46 +0,0 @@ -# 交易签名流程 - -[转至元数据结尾](http://192.168.1.188:8090/pages/viewpage.action?pageId=5112345#page-metadata-end) - -[转至元数据起始](http://192.168.1.188:8090/pages/viewpage.action?pageId=5112345#page-metadata-start) - -## 一、步骤 - -1. 取交易的rawdata,转成byte[]格式。 -2. 对rawdata进行sha256运算。 -3. 用交易每个合约中地址对应的私钥(现在一般就是一个合约,一个私钥),对sha256的结果进行签名。 -4. 把签名结果添加到交易中。 -  -## 二、签名算法 - -1, ECDSA算法,SECP256K。 -2, 签名示例数据 - - priKey:::8e812436a0e3323166e1f0e8ba79e19e217b2c4a53c970d4cca0cfb1078979df
        - pubKey::04a5bb3b28466f578e6e93fbfd5f75cee1ae86033aa4bbea690e3312c087181eb366f9a1d1d6a437a9bf9fc65ec853b9fd60fa322be3997c47144eb20da658b3d1
        - hash:::159817a085f113d099d3d93c051410e9bfe043cc5c20e43aa9a083bf73660145
        - r:::38b7dac5ee932ac1bf2bc62c05b792cd93c3b4af61dc02dbb4b93dacb758123f
        - s:::08bf123eabe77480787d664ca280dc1f20d9205725320658c39c6c143fd5642d
        - v:::0 - - 注意:签名结果应该是65字节。 r 32字节, s 32字节,v 1个字节。 - -3, fullnode节点收到交易后会进行验签,由hash 和 r、s、v计算出一个地址,与合约中的地址进行比较,相同则为验签通过。 -  -## 三、代码示例 - -``` -public static Transaction sign(Transaction transaction, ECKey myKey) { - Transaction.Builder transactionBuilderSigned = transaction.toBuilder(); - byte[] hash = sha256(transaction.getRawData().toByteArray()); - List listContract = transaction.getRawData().getContractList(); - - for (int i = 0; i < listContract.size(); i++) { - ECDSASignature signature = myKey.sign(hash); - ByteString bsSign = ByteString.copyFrom(signature.toByteArray()); - - //Each contract may be signed with a different private key in the future. - transactionBuilderSigned.addSignature(bsSign); - } - } -``` diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\345\270\270\350\247\201\351\227\256\351\242\230\350\247\243\347\255\224/\345\205\263\344\272\216SR\347\232\204\345\270\270\350\247\201\351\227\256\351\242\230\350\247\243\347\255\224.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\345\270\270\350\247\201\351\227\256\351\242\230\350\247\243\347\255\224/\345\205\263\344\272\216SR\347\232\204\345\270\270\350\247\201\351\227\256\351\242\230\350\247\243\347\255\224.md" deleted file mode 100644 index 4d8fa9c4..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\345\270\270\350\247\201\351\227\256\351\242\230\350\247\243\347\255\224/\345\205\263\344\272\216SR\347\232\204\345\270\270\350\247\201\351\227\256\351\242\230\350\247\243\347\255\224.md" +++ /dev/null @@ -1,285 +0,0 @@ - -Private运行环境下full node模式的问题 ------ -1. 问: config.conf中的genesis.block.witnesses替换成在https://tronscan.org/ 注册时给出的address字符串:是否需要删除其他address?url和voteCount字段是否需要删除? - - 答: 不需要删除其他地址,但是这些地址也会成为您网络的一部分,而如果您不持有其私钥,这些相当于是废地址。注意:Zion、Sun以及Blackhole账户不能从创世块的配置文件中删除,但是可以对它们的地址进行更改。
 - -2. 问: seed.node ip.list 替换成自己公网的ip地址后,使用启动命令 java -jar java-tron.jar 启动后,如何测试部署是否正常,比如是否有测试接口或者命令,类似redis,get ping 会返回 pong? - - 答: Java-tron没有默认的接口。一旦服务器开始运行,就能够发送grpc命令,基于这一点,有几种检验部署是否成功的方法。首先,需要您确认grpc端口已处于开启状态: - 
 - - - netstat -tulnp| grep 50051
 - - ![](https://raw.githubusercontent.com/tronprotocol/Documentation/master/images/FAQ/查询节点.png) - - 如果端口已开启,需要您使用tronscan.org测试节点,确保端口和IP对网络开放。如果使用的是私网IP,则需要其他gRPC软件。 - - 也可以使用下面的终端指令,检查节点是否正常运行: - - - tail -f logs/tron.log |grep "MyheadBlockNumber" - - -Private运行环境下super node模式的问题 ------ -1. 问: 在部署private 环境时,SuperNode和FullNode 关系是什么样子?是否需要先部署SuperNode ,然后部署FullNode ? - - 答: 在private环境中,至少需要部署一个SuperNode,但对FullNode的数量没有最低要求。 - -2. 问: Private环境,因为我看官网是通过手动投票产生的SuperNode节点,是否还需要提交TRON资料审核注册成为Super Node节点? - - 答: 在private环境的前提下,不需要向波场基金会提交申请材料。 - -3. 问: 既然是Private环境,为什么日志还持续的更新全网其他节点,并同步保存信息?那么private 和public 的区别是什么? - - 答: 如果和IP list有关 A: 需要在config.conf更新seed.ip,如果设置得和公网一样,并且电脑连入了互联网,电脑就会尝试连接其它节点,那么即使连接失败,IP list也会存入DB。如果和区块还有交易有关 A: 在private环境中,需要更改p2p版本和父哈希。如果设置同主网或测试网一样,并且电脑连入了互联网,那么节点也会和公网同步。 - -public运行环境下的问题 ------ - -1. 问: 单点的java程序最大能支持多少内存,cpu,处理请求等? - - 答: 这取决于您的系统环境:如果是32位系统,堆内存最大为32GB。如果是64位系统,堆内存会受到操作系统的限制。最好能将JVM堆内存限制为可以在NUMA区域容纳的大小(在较大的机器上大约是1TB),如果超出NUMA区域,垃圾回收耗费的时间会更久。 - -2. 问: 这个网络流量大概是多少,我们是准备多台主机前面挂负载,还是提供多节点即可? - - 答: 双核CPU能够勉强负担一个Full Node的运行。在private环境中,交易数量更少,4核CPU就够了。所以说CPU性能取决于网络的情况。您需要根据电脑的运行情况,决定CPU性能。在公网,成为TRON的超级代表我们推荐您使用64核CPU的设备。
 - -3. 问: 对公网需要暴露那些服务端口? - - 答: 端口18888,50051是两个默认端口。 - -4. 问: 目前的网络流量有多大?数据能够传输到多个主机还是只能够满足个人的一些节点? - - 答: 网络流量取决于交易数量。作为大致参考,可以将每一个交易的流量算作200字节。当前网络配置是2000TPS(每秒交易量)。 - -5. 问: tokens 申请完成后,如何由not started yet 变更成 participate? - - 答: 发行通证后无法改变发行开始日期,需要等到创建通证时设置的具体时间才能开始发行。在创建通证后,只能修改URL和描述。 - - -运行超级节点报错 ------ -1. 问: 以下错误信息表达了什么意思? - - 17:02:42.699 INFO [o.t.c.s.WitnessService] Try Produce Block - 17:02:42.699 INFO [o.t.c.s.WitnessService] Not sync - - 答: 出现该消息,说明您的节点和网络未同步。开始出块前,首先需要进行同步。请使用以下命令检查区块高度。 - - - tail -f logs/tron.log |grep "MyheadBlockNumber" - - -超级节点出块问题 ------ -1. 问:超级节点也是轮流出块的吗?出块间隔是多少?是不是24小时无心跳消息就从超级节点列表里删除了? - - 答:轮流出,现在测试环境5秒一块,会统计超级节点出块miss率,出块率太低就会被投出局。 - -2. 问:在最坏情况下,万一超级节点无法联通,最多允许多长时间恢复服务? - - 答:SR节点重新连上网络的速度只取决于SR节点自己的恢复速度,跟网络没关系。 - -3. 问:超级节点出块miss率的计算公式是什么? - - 答:主要统计"应该出但是没有出的块的个数", 数量会一直累计,不会清除。 - -4. 问:超级节点服务器的测试版本,或者源码开放了吗? - - 答:都是开源的,参见https://github.com/tronprotocol/java-tron。 - -5. 问:我怎样才能知道我的测试超级节点在运行了呢? - - 答:运行以下命令: - - - tail -f logs/tron.log |grep "Try Produce Block" - -6. 问:另外,根据这个命令:java -jar java-tron.jar -p yourself private key --witness -c yourself config.conf(Example:/data/java-tron/config.conf,我怎样才知道运行的是超级节点? - - 答:运行以下命令: - - - tail -f logs/tron.log |grep "Try Produce Block" - -7. 问:有什么命令行命令可以生成地址,发送tron的吗?一定要通过web wallet? - - 答: 你可以使用命令行钱包 https://github.com/tronprotocol/wallet-cli - -8. 问: 我们要测试超级节点出块和性能的情况,是不是需要你们投票我们的节点才能竞选上? - - 答:测试的时候,我们可以帮你么投票。 - -9. 问:那现在是不是可以看节点有没有出块了? - - 答:可以在通过以下链接查询:https://tronscan.org/#/address/YOURADDRESS - -10. 问:请问刚上线是否出块时间是3秒一块?预计在什么时间会变成1秒1块? - - 答:主网上线后会变成3秒1块。在未来,出块速度会在之后提升为1秒1块。 - -11. 问:未来大概会有出块的TRX会减半的计划吗?如果有的话,大概在什么时间点? - - 答:没有减半计划。 - -12. 问:当27节点中有一个出现故障时,会自动检测并取消轮询资格吧?出现这种情况保留超级代表资格否?如果资格被取消后,何时可以恢复资格? - - 答:会一直保留不出块的记录,其他人看了就不投了。 - - -超级代表选举问题 ------ - -1. 问: 为什么我在 https://tronscan.org/#/network 看不到我的投票? - - 答:投票结果6小时更新一次。 - -2. 问:持有的票数是和目前持有的TRX相等,每个TRX等于一票对吗。而且这个票可以投不止一个超级代表候选人? - - 答:1个TRX等于1票且该票只能投给1个超级代表候选人。但是,当持有TP(或冻结TRX)数量超过1,可以将票数分配给自己认可的候选人。 - -3. 问:如果用TRX来投票,是否代表我们需要在Tronscan钱包里存入一定数量的TRX? - - 答:需要存,因为TRX用来申请成为节点和投票。但是不是必须存到tronscan wallet。区块链的账本是在链上的,钱包只是查看。 - -4. 问:针对每日选举的27个超级节点,是否有门槛?还是鼓励自由竞争? - - 答:自由竞争,拉票。现在由于GR制度的存在,SR需要至少1亿票才能替代GR,作为GR是没有任何收益的。 - -5. 问:这27个超级代表获得的TRX是否是平均分配,还是是依据算力自由竞争? - - 答:和机器算力无关,轮流出块。 - -6. 问:如果有大型矿厂参与竞选的话,是否有可能会出现算力超过50%的问题? - - 答:不会。 - -7. 问:按照每3秒出一个块的速度,出块的32TRX的奖励给对应出块的节点是吗?TRON公链网络是否能保证每秒都有交易数量? - - 答:32个TRX全部奖励给出块的节点。TRON公链网络能够保证。 - -8. 问:细则里的社区支持方案具体是指什么? - - 答:可以理解为预算多、计划多的方案或者精力去发展社区。 - -9. 问:投票会消耗TRX吗? - - 答:投票不会消耗TRX。 - -10. 问:超级代表的权限只维持24小时吗? - - 答:不是,维持6个小时。但是下一轮的竞选结果还保持一样的话,超级代表的权限能够继续维持。 - -11. 问:build/resources/main/config.conf 和 wallet的build/resources/main/config.conf 两个配置节点里没有我的节点的任何信息,能识别我的节点并进行出块吗? - - 答:配置文件需要改成您自己的私钥,然后投票成功,就可以出块了。 - -12. 问:我生成了自己的私钥以后怎样配置? - - 答:配置文件里面有个localwitness,配成您投票账户的私钥。 - - -其他问题 ------ -1. 问:RPC的接口文档在哪? - - 答:https://github.com/tronprotocol/Documentation/tree/master/TRX - -2. 问:启动节点的时候怎么制定数据存储目录? - - 答:现在还不能制定数据目录,下一个版本会加。 - -3. 问:节点有钱包功能吗? - - 答:节点有钱包的RPC接口,不能直接用命令行调用钱包功能,可以用另外一个repo里的命令行钱包使用full node的钱包功能。 - -4. 问:生成地址不需要按照文档里面自己生成私钥,计算生成地址吧? - - 答:你注册一个账户后,不需要关心你的私钥,只要用pincode登入后就可以获取你的地址了。 - -5. 问:API调用有没有更具体的文档,类似比特币或者以太坊的? - - 答:请查看链接https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md - -6. 问:SolidityNode 和 FullNode可以装在同一台机器上吗?数据目录不能指定,两个节点会共用数据吗?有没有问题? - - 答:指定数据目录是可以做到的,配置文件参数:db.directory = "database",index.directory = "index"。但是也可以让FullNode.jar和SolidityNode.jar在不同目录下运行,将数据和日志文档完全分离。记得修改config.conf的端口,因为两个应用无法在同一端口运行。 - -7. 问:没有Txid很麻烦,我们出金后怎么告诉用户?怎么查询出金交易? - - 答:可以使用交易的哈希作为交易ID。 - -8. 问:solidity是根据full同步区块的吗? - - 答:是的。 - -9. 问:gateway是链接solidity节点的吗? - - 答:solidity节点主要目的是存储不可回退的固化块,会落后fullnode几个块,用来确认到账情况是比较合适的。用gateway链接solidity,或者连接fullnode,都能连接上。 - -10. 问:listaccounts是全网所有地址吗? - - 答:目前是的,还不确定会不会改,因为这个地址数量会很庞大,我们需要更多的沟通考量。 - -11. 问:余额小数位是多少? - - 答:6位。 - -12. 问:节点的机器是否搭建在北京,会不会墙的问题? - - 答:39.106.220.120在北京,其他的都在美国欧洲香港。 - -13. 问:用户可以通过将TRX存入tron.network向主网迁移吗?如果不行,还有哪些其他钱包支持迁移,还是只能由交易所经手? - - 答:暂无钱包支持迁移,只能通过交易所。 - -14. 问:TRON现阶段有多少种钱包? - - 答:我们已经有wallet-cli(具指令行钱包)、网页钱包、IOS钱包、安卓钱包和Chrome钱包。 - -15. 问:宽带需要达到25Gbps吗,还是10Gbps就足够?或者有其他的门槛? - - 答:我们对网络宽带不做要求,给定的具体数据仅供参考。 - -16. 问:对于超级代表选举中排名27名开外但是100名以内的人,在当选的超级代表出局时,是由排名决定替补顺序,还是由特定算法决定接替人选? - - 答:在测试网,我们仅是选出得票最多的27个节点。在主网及将来的测试网上,我们会使用另外的算法,增加超级代表产生的随机性。 - -17. 问:想要成为超级代表,我们只需要一个成熟的技术方案就可以,还是需要在提交申请前就搭建硬件? - - 答:技术方案需要包含两个部分:1. 在6月26日即第一次选举之前的技术方案。2. 在6月26日即第一次选举结束之后的技术方案。第二部分只要有一个方案就可以。而第一部分,现阶段可以只有方案,但是只有具备了硬件条件,我们才能测试你的节点,其他用户也才能确认你们确实已经搭建起了测试节点。申请超级代表,并不等于能胜任超级代表。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\234\257\350\257\255\350\241\250.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\234\257\350\257\255\350\241\250.md" deleted file mode 100644 index ff744ca7..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\234\257\350\257\255\350\241\250.md" +++ /dev/null @@ -1,85 +0,0 @@ -# 术语表 - -## 地址(公钥) -地址也即公钥,公钥与私钥是通过一种算法得到的一个密钥对,公钥是密钥对中公开的部分,私钥则是非公开的部分,公钥通常用于加密会话密钥、验证数字签名,或加密可以用相应的私钥解密的数据。 -## 出块奖励 -超级代表的出块奖励,存放于一个子账号中,超级代表可以从Tronscan进行申领。 -## API -API主要用于客户端开发,支持开发者自主设计代币发行平台。 -## 应用层 -开发者可以使用接口来方便的实现丰富的DApp和个性化钱包。波场的协议完全使用google protobuf来定义,天然的支持多语言扩展。 -## 通证 -在波场文档中,Asset同等与token。 -## 发行通证 -只要拥有1024TRX,就可以在波场网络发行代币。 -## TRX账户 -TRX的账户,用来显示TRX余额,以及其他token余额,也会有美元显示账户余额。 -## 带宽 -过多的无关紧要的交易会造成类似于以太坊的网络拥堵,从而使得交易确认时间延迟。 为了避免阻塞网络,TRON网络允许每个账户免费发起限量的交易,更高的交易频率则需要消耗bandwidth points。bandwidth points和TRON Power(TP)一样,通过冻结资金来获取。交易以字节数组的形式在网络中传输及存储,一条交易消耗的Bandwidth Points就是在这个交易的字节数组的大小。如一条交易的字节数组长度为100,那么该交易需要消耗100 Bandwidth Points。 -## 区块 -区块是用来存储你数据记录交易信息的。一个完整的区块包括魔数,区块大小,区块头,交易计数器,交易。 -## 内容分发网络 -CDN的全称是Content Delivery Network,即内容分发网络。 其基本思路是尽可能避开互联网上有可能影响数据传输速度和稳定性的瓶颈和环节,使内容传输的更快、更稳定。 -## 冷钱包 -称为离线钱包或者断网钱包,是网络不能访问到用户私钥的钱包。冷钱包通常依靠“冷”设备(不联网的电脑、手机等)确保TRX私钥的安全,运用二维码通信让私钥不触网。 -## 共识机制 -共识机制是通过特殊节点的投票,在很短的时间内完成对交易的验证和确认;对一笔交易,如果利益不相干的若干个节点能够达成共识,我们就可以认为全网对此也能够达成共识。 -## 核心层 -TRON包含智能合约,账户管理,共识等模块。TRON将会实现基于堆栈式的虚拟机,并且采用优化过的指令集。 -## DApp -DApp即去中心化应用,不通过受信任的中心化机构提供服务。DApp可以在没有中间人的情况下,让终端用户或资源之间产生互动、达成协议或是进行交流。 -## 冻结操作 -冻结一定数量的TRX来获取TRON Power进行投票,同时冻结也会产生Bandwidth,冻结产生的Bandwidth数量是冻结的TRX数量乘以对应的冻结天数,Bandwidth用来进行交易和执行智能合约。冻结的TRX不能流通不能用来进行交易转账。 -## 冻结账户,用于获取TP与带宽 -未冻结的TRX会继续进行交易。 -## Google Protobuf -ProtoBuf是一种灵活高效的独立于语言平台的结构化数据表示方法,可用于表示通信协议和数据存储等各方面,与XML相比,ProtoBuF更小更快更简单。你可以用定义自己ProtoBuf的数据结构,用ProtoBuf编译器生成特定语言的源代码,(如C++,Java,Python等,目前ProtoBuf对主流的编程语言都提供了支持)方便的进行序列化和反序列化。 -## GRPC -GRPC是一款语言中立、平台中立、开源的远程过程调用(RPC)系统。在 gRPC 里客户端应用可以像调用本地对象一样直接调用另一台不同的机器上服务端应用的方法,使得您能够更容易地创建分布式应用和服务。与许多 RPC 系统类似,gRPC 也是基于以下理念:定义一个服务,指定其能够被远程调用的方法(包含参数和返回类型)。在服务端实现这个接口,并运行一个 gRPC 服务器来处理客户端调用。在客户端拥有一个存根能够像服务端一样的方法。 -## 热钱包 -称为在线钱包或者联网钱包,是网络能够访问到用户私钥的钱包。外人可能通过互联网访问用户的私钥,因此安全性相对冷钱包较低,但更便利。 -## JDK -JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境(JVM+Java系统类库)和JAVA工具。 -## KhaosDB -TRON采用的KhaosDB会存储一定时间内所有新产生的分叉链。当发生需要切换主链的情况时,在KhaosDB的支持下,验证节点可以快速切换有效链到新的主链。 -## Level DB -为了同时满足存取速度和快速开发的需求,TRON会在开发初期采用Level DB。在主网上线后,TRON将会根据实际需求进行数据库的升级,使得TRON具有完全量身定制的数据库。 -## 测试私网 -测试私网:其他开发者按照TRON提供的教程部署文件都配置自己的网络id,服务器ip,进行测试。只有参与部署的开发者有权访问。 -## 测试公网 -测试公网:类似 tron 的 31号的网络,所有人都可以访问,使用。 -## RPC -远程过程调用 -## 可扩展性 -可扩展性是波长网络具备的特性之一。具备可扩展性意味着,一个系统或网络有能力处理日益增多的工作量,或者有潜力通过拓展具备这种能力。 -## 存储层 -TRON的技术团队为TRON设计了独特的分布式存储协议,包括区块存储和状态存储。在存储层的设计中,TRON引入了图数据库的思想,来更便捷的满足现实世界多样性数据存储的需求。 -## Sun -简称S,以前的drop,TRX的最小单位。 -## 超级代表 -超级代表是TRON网络上的记账人,一共27个。他们负责对网络上广播出来的交易数据进行验证,并打包进区块中。超级代表的信息是在TRON网络上公开的,所有人都可以获取这些信息,最便捷的方式是大家去[TRON的区块链浏览器](https://tronscan.org/#/)查看超级代表列表及其信息。 -## 吞吐量 -高吞吐量是波场主网具备的特性之一,也称TPS,波场网络每秒可以容纳的交易总数量。 -## 时间戳 -该区块产生的近似时间,精确到秒的UNIX时间戳。 -## TKC -通证设定。 -## Token(Asset) -在波场文档中,Asset同等与token -## 交易 -指token在各个账户之间进行转账的过程。 -## 交易广播 -交易信息在区块链网络中“广播”,并由节点验证即确认的过程。 -## TRON Power -TRON Power(TP)在冻结资金后获取,TRON网络中的每一个账户都具有选举权,可以通过投票选出自己认同的超级代表。 投票需要TRON Power(TP),你的TRON Power(TP)的多少由当前冻结资金决定。TRON Power(TP)的计算方法:每冻结1TRX,就可以获得1单位TRON Power(TP)。在解冻后,你没有了冻结的资产,相应地失去了所有的TRON Power(TP),因此以前的投票会失效。你可以通过重新冻结并投票来避免投票失效。 -##TVM(TRON Virtual Machine) -波场虚拟机(Tron Virtual Machine,简称TVM),是Tron团队为了满足自身生态发展的需求,开发出的轻量级架构、图灵完备的虚拟机,旨在为全球百万级的开发者提供一个高效、简单、稳定、安全、且容易优化的区块链专用系统。 - - - - - - - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272BUG-BOUNTY\350\256\241\345\210\222/\346\263\242\345\234\272\344\270\273\347\275\221BUG-BOUNTY\350\256\241\345\210\222.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272BUG-BOUNTY\350\256\241\345\210\222/\346\263\242\345\234\272\344\270\273\347\275\221BUG-BOUNTY\350\256\241\345\210\222.md" deleted file mode 100644 index 304daacb..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272BUG-BOUNTY\350\256\241\345\210\222/\346\263\242\345\234\272\344\270\273\347\275\221BUG-BOUNTY\350\256\241\345\210\222.md" +++ /dev/null @@ -1,9 +0,0 @@ -# 波场主网Bug-Bounty计划已经转移到HackerOne - -https://hackerone.com/tronfoundation - - - - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/One_Page.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/One_Page.md" deleted file mode 100644 index 2617e169..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/One_Page.md" +++ /dev/null @@ -1,54 +0,0 @@ -# 什么是TRON - -波场TRON以推动互联网去中心化为己任,致力于为去中心化互联网搭建基础设施。旗下的TRON协议是全球最大的基于区块链的去中心化应用操作系统协议之一,为协议上的去中心化应用运行提供高吞吐,高扩展,高可靠性的底层公链支持。 - -## TRON的优势 - -+ 高吞吐 - -在TRON的共识机制下,有限的高计算性能节点被用户选为网络维护节点,从而保证了整体网络的TPS维持在可接受的程度之上,实现了高吞吐的特点。TRON独有的共识机制使得TRON网络的TPS远远超出Bitcoin、Ethereum等。 - -高TPS间接保证了TRON上所有运算的低延迟,可以使转账速度更快,赶上现有支付方式例如VISA、SWIFT的速度,从而使得日常支付成为可能。 - -+ 易扩展 - -得益于高效的智能合约,以及智能合约的无限可能性,TRON具有极大的可扩展性,丰富多彩的各种应用可以部署于TRON上。 - -另外优良数据库结构和账户系统的结合,TRON能更加方便的实现复杂的模型、设计,对开发十分友好,且保证了极高TPS的可能性。同时还使得TRON网络能够支持大量用户,对于现在已经成熟运行的各种应用、网站、服务等,能够轻松地转移到TRON网络上,使得已存的模式获得区块链技术领域的提升,从而更加具有与现存机构进行竞争的可能性。 - -+ 高可靠性 - -TRON致力于打造更加去中心化的共识机制。去中心化程度越高,整体的网络结构、用户资产,及内在价值也就更加可靠,更加值得信赖。同时,TRON的共识机制相比POW模式,能够极大地节省能源。 - -+ 低费用 - -TRON网络将会采取极低运算费用的设计,从而使得部署于TRON上的各种应用更加容易扩展用户,更加具有商业操控性。 - -+ 易于使用 - -TRON团队充分调研了用户的需求和期望,专注于打造更易于使用的区块链产品。 - -## 核心设计 - -+ 独有的共识机制 - -TRON采用改良过的POS共识机制。在TRON的共识机制约定下,全球用户自发部署TRON网络节点,并由所有TRON用户投票选择出N个代表节点,选出的各代表节点之间权力平等,共同协作完成TRON网络上的计算任务。由于用户天然为自己的利益考虑,用户会自发的选择更高性能的,同时趋向于去中心化的分布式节点。 - -+ 高效的智能合约 - - TRON的高效智能合约基于以下几点得以实现: - - + TRON支持JAVA开发,具有成熟的开发者社区,开发效率高,支持场景众多。 - + 共识机制的高效。 - + TRON具有良好的数据库结构以及账户系统,可以更好地帮助用户将复杂的想法、模型转化为应用实体。 - -## 愿景、未来 - -因为TRON的诸多优点,我们旨在以TRON为地基,打造一个人人均可参与,人人均会收益的生态圈平台,我们称之为TRON生态。 - -+ 用户使用TRON网络及其上面部署的各种DApp的功能,能够减少各种成本,提高生活便利性,获得财富回报。 -+ 开发者可以在TRON网络上部署DApp,扩展业务范围,宣传自己的理念、价值观。 -+ 网络维护节点为TRON网络的运转提供支持,并从中获得报酬。 - -不管是用户,开发者,还是TRON网络的维护节点,所有人都将共同参与TRON平台生态圈的建设,为TRON生态的繁荣做出贡献并从中收获回报。 - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/\346\263\242\345\234\272\346\211\213\345\206\214.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/\346\263\242\345\234\272\346\211\213\345\206\214.md" deleted file mode 100644 index 0a2aba76..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/\346\263\242\345\234\272\346\211\213\345\206\214.md" +++ /dev/null @@ -1,126 +0,0 @@ -# TRON - -## 核心架构 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Architecture.png) - -TRON采用了三层体系架构,分别为存储层,核心层和应用层。 - -+ 存储层 - - TRON的技术团队为TRON设计了独特的分布式存储协议,包括区块存储和状态存储。 - 在存储层的设计中,TRON引入了图数据库的思想,来更便捷的满足现实世界多样性数据存储的需求。 - -+ 核心层 - - TRON包含智能合约,账户管理,共识等模块。TRON将会实现基于堆栈式的虚拟机,并且采用优化过的指令集。 - 为了让开发者更好的开发DApp,TRON采用Java语言作为合约语言,后续会加入更多的高级语言支持。 - 另外为了满足TRON独特的需求,TRON的共识机制在DPOS基础上做了一定的创新。 - -+ 应用层 - - 开发者可以使用接口来方便的实现丰富的DApp和个性化钱包。 - 波场的协议完全使用google protobuf来定义,天然的支持多语言扩展。 - -## 共识机制 - -+ 基于DPOS改良过的共识机制 - - POW共识机制一直存在浪费资源、效率低下、TPS不高的问题。这些都与TRON的价值观、定位不吻合。基于我们的设计理念,为了真正实现能用于日常场景的区块链平台,我们选择了POS机制作为TRON的共识机制的基调。TRON的共识机制从DPOS出发。在调查了现有领域的优秀改进想法后,我们对DPOS机制作出改进,以达到我们的需求,从而确定了TRON的共识。 - -+ 共识机制基本原则 - - + 用户会根据自己手里的具有可投票权的币持有量做出带有权重的投票,根据投票结果,按照一定的规则选择出当前的区块生成节点。参照的规则会尽可能的保证区块的生成速度与打包节点数量之间的平衡性。 - + 同时,落选的打包节点、投票给中选者的用户、投票给落选者的用户均可能获得一定量的补偿,以激励他们持续参与之后的竞选流程。 - + 中选节点会按照一定的分配规则依次进行区块的打包并获得最大份额的奖励。 - + 中选节点中的多数会根据投票结果进行选择,剩下的会按照一定的算法保证在余下的其他节点中,所有节点都有可能被选中。 - -## 存储结构 - -+ KhaosDB - - TRON采用的KhaosDB会存储一定时间内所有新产生的分叉链。当发生需要切换主链的情况时,在KhaosDB的支持下,验证节点可以快速切换有效链到新的主链。 - -+ Level DB - - 为了同时满足存取速度和快速开发的需求,TRON会在开发初期采用Level DB。在主网上线后,TRON将会根据实际需求进行数据库的升级,使得TRON具有完全量身定制的数据库。 - -## 数字资产模块 - -+ 配置 - - 数字资产配置。通过该模块,用户可以按照自己的意愿进行自定义的数字资产的定制。 - 可定制的参数包括但不限于资产的名称、缩写、LOGO、总的发行量、TRX兑换比例,开始时间、 结束时间、兑换比例衰减系数、是否可增发、增发形式(一定数目或者一定比率)、增发周期、描述等。 - 用户也可以选择不进行参数的配置。系统会为用户配置默认的参数。 - -+ 发布/部署 - - 参数配置完成后(人为或者系统默认),用户即可选择发布资产。 - 对配置好的并通过验证的数字资产进行部署的各种操作、功能。 - 通过见证节点的验证后,自定义资产就完成了部署。完成部署的资产可以自由的在TRON网络上流通。 - -+ API - API接口主要用于支持客户端的开发。开发者可以在API接口的支持下,开发完全由自己设计的资产发布平台。 - -## 智能合约/虚拟机 - -TRON包含智能合约模块,用户可以开发自己的智能合约,从而定制化的满足用户需求。 -智能合约会运行在虚拟机上,TRON将会实现自己的虚拟机,开发者们可以实现复杂多样的功能,满足定制化需求 。 - -## 第三方应用 - -+ 数字资产部署平台 - - TRON会允许第三方开发自己的平台,并接入TRON网络。利用TRON的数字资产模块进行,第三方平台的用户也可以自行定义自己的数字资产。 - -+ 钱包 - - 可以用于查看TRX及用户持有的其他资产的信息,发起或者接受交易等。 - -+ 区块链浏览器 - - 查看整个TRON的区块记录,节点名单,节点部署、实时运行情况等。 - -## 令牌迁移 - -在TRON网络主网正式部署前,波场基金会会组织由目前的基于以太坊ERC20的令牌向正式的TRON主网代币TRX的迁移,迁移兑换比例为1:1。具体的迁移方式待定,并可能在正式执行前进行细节上的修改。 - -##社区计划 - -社区是一个区块链项目的重要组成部分。我们希望能够激励社区成员的热情,使得所有人充分的参与到波场的建设中来。这也是我们从项目伊始就确定下来,从未改变过的想法。 -社区成员有多种途径能够参与到波场项目中来。广大的开发者可以参与到波场核心的代码编写中来,也可以在我们开放API后进行第三方应用的开发。另外我们还会不定期组织一些竞赛活动,向所有的网络用户征稿,包括但不限于LOGO设计、文章、海报、编程竞赛等形式。 - -+ 提交类型 - - + feat: 新的功能。 - + fix: 漏洞修复。 - + docs: 文档类修改。 - + perf: 能够提高性能的代码修改。 - + refactor: 重构(既不添加新功能也不修复漏洞的代码改变)。 - + style: 文本格式修改(多余的空白, 格式校对, 标点符号遗漏等)。 - + test: 添加缺失的测试用例、修改现存测试用例。 - -+ 奖励计划 - -我们会对为TRON网络及社区的推进、发展做出贡献的人给与奖励。我们会成立一个委员会对所有的贡献者进行详细的评估,根据评估结果给与对应数量的TRX代币、礼品等多种形式的奖励。 - -## 协议 - -TRON使用Google protobuf协议,协议内容涉及到账户,区块,传输多个层面。 - -账户有基本账户、资产发布账户和合约账户三种类型。一个账户包含,账户名称,账户类型,地址,余额,投票,其他资产6种属性。 - -更进一步的,基本账户可以申请成为验证节点,验证节点具有额外的属性,投票统计数目,公钥,URL,以及历史表现等参数。 - -一个区块由区块头和多笔交易构成。区块头包含时间戳,交易字典树的根,父哈希,签名等区块基本信息。 - -交易合约有多种类型,包括账户创建合约、转账合约、资产转账合约、资产投票合约、见证节点投票合约、见证节点创建合约、资产发布合约、部署合约8种类型。 - -每一个交易还包含多个输入与多个输出,以及其他一些相关属性。 - -其中交易内的输入,交易本身,区块头均需签名。 - -传输涉及的协议Inventory主要用于传输中告知接收方传输数据的清单。 - -详细的协议见附属文件。详细协议随着程序的迭代随时都可能发生变化,请以最新的版本为准。 - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/\347\244\276\345\214\272.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/\347\244\276\345\214\272.md" deleted file mode 100644 index 9cb272b5..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\344\273\213\347\273\215/\347\244\276\345\214\272.md" +++ /dev/null @@ -1,92 +0,0 @@ -# Community - -共享,平等,自由,互助是TRON生态社区的一贯宗旨。TRON社区所营造一个共享空间,让所有的支持者,参与者能更方便、全面的获取有关TRON项目的资源和信息。社区不会为所有参与者在获取资源和进行交流方面设置限制,也请大家遵守社区相关规定,积极参与社区建设并注意保持社区网络环境清洁。 - -## Reddit - -TRON [reddit](https://www.reddit.com/r/Tronix/) 社区聚集了大批TRON项目的支持者以及开发者,是社区讨论和头脑风暴最理想的环境。TRON社区倡导最大限度的言论自由,允许任何不同观点,不以营利为目的,希望参与者可以互通有无,功能共同进步。此外,我们创建了reddit分支论坛,为参与者提供更加准确,精细化的社区讨论环境。 - -目前的reddit分支: - -+ [/r/TRXTrading](https://www.reddit.com/r/TRXTrading/) – TRX交易,价格以及市场状况。 -+ [/r/tronsupport](https://www.reddit.com/r/tronsupport/)– 解决关于TRON的问题. - -## Slack - -[slack](https://tronfoundation.slack.com/messages/C6DKKSU8G/details/)则是TRON 技术团队和开发者思想碰撞,交流沟通的平台之一,我们会跟任何在Github上做出贡献的优秀开发者保持联系。通过slack,开发者们可以直接和TRON技术团队成员实时沟通,探讨,解决技术问题。我们会主动邀请或者您申请加入slack。如果您贡献卓越,也有机会称为TRON团队的一份子。
 - -## Gitter Rooms - -通过使用github账户,登陆gitter参与TRON项目的讨论。我们所开放的Gitter频道都围绕特定的资源库等议题组织的。请选择合适的频道与话题,保持讨论话题的相关性。 - -[java-tron](https://github.com/tronprotocol/java-tron) – 关于节点运行,主网,测试网上线相关事宜。 -[wallet-web](https://github.com/tronprotocol/wallet-web) – 社区开发的区块链浏览器和web钱包。 -[wallet-cli](https://github.com/tronprotocol/wallet-cli) – 官方开发的区块链浏览器和web钱包。 - -## TRON Forum - -http://tronsr.org/ - -## TRON Foundation - -波场基金会致力于波场生态的良性的发展,促进新技术和应用的开发,和各个开发者一起协同做大波场生态。 - -面向社区的波场基金会 - -[Official Website](https://tron.network/en.html) -[Twitter](https://twitter.com/tronfoundation) -[Facebook](https://www.facebook.com/TronFoundation) -[Slack](https://tronfoundation.slack.com) -[CoinMarketCap](https://coinmarketcap.com/currencies/tron/) -[Github](https://github.com/tronprotocol) -[Telegram](https://t.me/tronnetworkEN) -[E-mail](service@tron.network) - -我们还为广大用户提供了其他语种的社区平台: - -[TRON SOUTH KOREA]( https://t.me/tronnetworkKR) -[TRON RUSSIA](https://t.me/tronnetworkRU) -[TRON SPAIN](https://t.me/tronnetworkES) -[TRON ARABIC](https://t.me/tronnetworkAR) - -## Contributors - -我们对以下在社区中作出贡献的参与者们深表谢意。 - -TRON Github贡献者: - -[Roy van Kaathoven](https://github.com/Rovak) -[seanrobbins](https://github.com/seanrobbins) -[AhnSinYong](https://github.com/AhnSinYong) -[Jean-Philippe Quéméner](https://github.com/JohnnyQQQQ) -[sdargutev](https://github.com/sdargutev) -[ryukato](https://github.com/ryukato) -[farukonder](https://github.com/farukonder) -[nguyentruongtho](https://github.com/nguyentruongtho) -[Blake Jackson](https://github.com/blaketastic2) -[ruchern](https://github.com/ruchern) -[jun-Sogang](https://github.com/jun-Sogang) -[colbywhite](https://github.com/colbywhite) -[svenanders](https://github.com/svenanders) -[jromero](https://github.com/jromero) -[jungrammer](https://github.com/jungrammer) -[Eyesonly88](https://github.com/Eyesonly88) -[wailo](https://github.com/wailo) -[xiaolin](https://github.com/xiaolin) -[styk-tv](https://github.com/styk-tv) -[khuezy](https://github.com/khuezy) -[jackforest2014](https://github.com/jackforest2014) -[Yangdaidai](https://github.com/Yangdaidai) -[James Michael DuPont](https://github.com/h4ck3rm1k3) -[Kamil Zieliński](https://github.com/KamilZielinski) -[Wendy Sanarwanto](https://github.com/WendySanarwanto) - -TRON 翻译贡献者: - -[fbsobreira](https://crowdin.com/profile/fbsobreira) -[PiterSpain](https://crowdin.com/profile/PiterSpain) -[Dev Obs](https://crowdin.com/profile/devobs1) -[johnsavadkuhi](https://crowdin.com/profile/johnsavadkuhi) -[JYW](https://crowdin.com/profile/JYW) -[J4ck1986](https://crowdin.com/profile/J4ck1986) -[Felix](https://crowdin.com/profile/FlxGut) \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\210\233\344\270\232\350\200\205\345\237\272\351\207\221.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\210\233\344\270\232\350\200\205\345\237\272\351\207\221.md" deleted file mode 100644 index 971a20b6..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\210\233\344\270\232\350\200\205\345\237\272\351\207\221.md" +++ /dev/null @@ -1,53 +0,0 @@ -# 波场创业者基金 - -#### 介绍 - -为了快速支持社区开发者,扩大波场生态圈。解决优秀项目的资金短缺问题,波场将给予10万美金额度的资金支持,用于支持开发者进一步研发和运营。 - -#### 额度及放款 - -单笔额度:$100,000 USD - -放款时间:6-24小时内放款。 - -支付方式:确认创业者及项目参与资格后,波场TRON基金会将用10万美元等额的数字资产支付给开发者。放款后,波场TRON官方渠道会进行参与项目产品公示、资金流向公示。 - -#### 还款方式 - -现有以下两种还款方式: - -+ 如创业者的项目可完成新一轮融资,则按照10万美金在新一轮估值价格的80%中的占比,转化为创业者公司的股权; -+ 波场TRON提供的资金18个月无息,创业者应在18个月无息期内,归还10万美元或者归还时价值10万美金的主流数字资产; - -另外,波场TRON团队此次设立波场创业者基金项目,意在扩大、强壮波场TRON生态网络,不追求短期商业回报。若因客观不可抗原因造成项目失败的,创业者无需偿还本金。 - -#### 申请条件 - -+ 开发者向波场基金会申请,申请的内容需要包括,产品描述、成果展示(包括但不限于产品链接或者安装包APK); - -+ 需要申请者验证软件所有权; - -+ 一切仅通过项目规划和描述的申请者,波场TRON官方将不予回应; - -+ 经审核达标者快速发放支持资金10w美金。该资金直接为可转债; - -+ 审核标准:产品本身已经达到DEMO级别或者更高。项目开发本身态度本着严谨、希望长期发展共建波场TRON生态社区为宜; - -+ 波场创业者基金的资金用途:用来支持申请者进一步的开发或者运营计划。 - -#### 参与项目范围 - -创业者的创业领域包括但不限于基于区块链技术应用场景开发的以下几类: - -+ DApps(涵盖金融、支付、游戏、货币、物联网、能源管理、社交通信等领域); - -+ 查询、转换、协助开发等一些具有实用价值的优秀工具类应用; - -*参与项目需和波场相关 - -#### 申请流程 - -1. 开发者向波场基金会提交申请,申请提交至邮箱loan@tron.network,申请的内容需要包括:产品描述、成果展示(包括但不限于产品链接或者安装包APK)。 - -2. 经审核达标者我们将与您联系,并快速发放支持资金10w美金。该资金直接为可转债。 - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/Tronscan_SP_\346\250\241\346\235\277.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/Tronscan_SP_\346\250\241\346\235\277.md" deleted file mode 100644 index 39e6943b..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/Tronscan_SP_\346\250\241\346\235\277.md" +++ /dev/null @@ -1,86 +0,0 @@ -## 简介 - -超级代表可以通过Tronscan向投票人直接发布信息。 - -超级代表们可以使用此模板,搭建在Troscan的静态页面。个人链接将会在候选人姓名后显示。 - -通过编辑Github库中的文件,超级代表可以管理自己的展示页面。 - -## 使用方法 - -本指南默认您已经注册账户,并有超级代表(候选人)资格。 - -### 第一步:将Github上的模板克隆/创建分支。 - -* 前往 https://github.com/tronscan/tronsr-template -* 对库创建分支 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/fork-repo.png) - -在分叉后,会跳转至您自己本地的tronsr-template库,您可以在此进行修改。 - -## 第二步:编辑模板 - -接下来可以通过修改Github文件对模板进行编辑。 - -* 选择您要编辑的文件。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/github-open-file.png) - -* 进入编辑模式。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/github-edit-file.png) - -* 添加信息。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/edit-team-intro.png) - -文件编辑采用Markdown格式,在https://guides.github.com/features/mastering-markdown/可以找到详细教程。 - -* 更新logo.png和banner.png - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/github-upload-files.png) - -接着选择“选择文件”,并确保您准备上传的图标或横幅图片分别命名为logo.png和banner.png,这样才能覆盖之前同名的占位文件。 - -编辑好模板后,可以在https://tronscan.org上进行发布。 - -## 第三步:在Tronscan发布 - -* 前往https://tronscan.org - -* 登录您的账户,下面的示例使用私钥登录,您也可以选择其他登录方式。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/login-with-private-key.png) - -* 进入账户页面,确认显示“代表”标志 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/open-account.png) - -* 下滑至页面底部,点击“设置Github链接”。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/set-github-link.png) - -* 输入Github用户名,选择“链接Github”。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/input-username.png) - -* 查看您的新页面! - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/view-page.png) - -## 示例 - -下面的示例展示了各文件在页面上对应的展示位置。在Github文件发生变动时,此页面也会即刻更新。 - -![](https://raw.githubusercontent.com/tronscan/docs/master/images/example-page.png) - -## 常见问题 - -* 我已经修改了Github文件,但是tronscan.org上为什么看不到相应变化? - -库中文件通过使用aggressive caching的Github CDN传输,可能需要几分钟的时间,所有变化才能在页面上显示。 - -* 为什么HTML元素在Github可见,但在tronscan.org上不可见? - -安全起见,Tronscan.org会删除所有HTML标签,只有常规的markdown标签允许保留。 \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\344\273\200\344\271\210\346\230\257\350\266\205\347\272\247\344\273\243\350\241\250.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\344\273\200\344\271\210\346\230\257\350\266\205\347\272\247\344\273\243\350\241\250.md" deleted file mode 100644 index fcaeac19..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\344\273\200\344\271\210\346\230\257\350\266\205\347\272\247\344\273\243\350\241\250.md" +++ /dev/null @@ -1,26 +0,0 @@ -# 超级代表 - -## 在波场TRON社区的持币者当中,将存在如下角色: - -1. 持币者,即持有任何数量TRX的个体 -2. 代表,由全体持币者投票选择的个体,票数最高的127名作为代表,每6小时统计一次票数 -3. 超级代表,127名代表中票数最高的27名作为超级代表。超级代表是波场TRON社区的核心治理者,他们将实现波场TRON网络的出块、记账等基础功能,并获取对应收益。 - -## 奖励 - -1. 代表奖励,每6小时,票数排名前127名的代表会获得共计115,200 TRX的代表奖励,这部分奖励将按照票数比例分发。每年总计168,192,000 TRX将会被奖励给代表。 - -2. 超级代表奖励,波场协议网络每3秒中会出一个区块,每个区块将给予超级代表32个TRX奖励,每年总计336,384,000 TRX将会被奖励给超级代表。 - -+ 2021年1月1日前的所有出块奖励和代表奖励都将由波场基金会承担,波场网络不会有任何增发。 - -## 超级代表 - -+ 超级代表的信息是在TRON网络上公开的,所有人都可以获取这些信息,用户可以通过TRON区块链浏览器查看关于超级代表节点的具体信息。详细信息显示如下: - - + 超级节点的账户地址。 - + 该超级节点所获得的投票数。 - + 个人网站的url链接。 - + 该超级节点的总出块数。 - + 该超级节点的总丢失块数。 - + 上一个区块高度。 diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\275\277\347\224\250\346\214\207\345\215\227.md" deleted file mode 100644 index 51a42aa8..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\275\277\347\224\250\346\214\207\345\215\227.md" +++ /dev/null @@ -1,167 +0,0 @@ -# 区块链浏览器使用指南 - -登陆 https://tronscan.org 使用区块链浏览器。 - -## Blockchain模块 - -### 查询区块 - -在这个页面里我们可以查看从创世区块到当前区块的所有信息,包括区块高度,区块年龄,由哪个节点产生的区块,以及区块对应的字节大小。同时我们也可以使用Block的搜索框去定位查询我们想了解的区块高度以及我们想了解的超级节点。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查看区块.png) - -### 查询交易 - -在此页面我们可以查询所有的交易记录,从哪个地址发送到哪个地址接受,该笔交易的TRX数额,每笔交易记录于哪个区块高度,对应的哈希值,及对应的产生时间。同时我们也可以使用Transaction的搜索框去定位我们想了解的交易,通过搜索交易的哈希值即可以查询我们想要了解的交易。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查询账户.png) - -### 查询账户 - -在此页面我们可以查询所有持有TRX用户的地址,以及对应的持有数量,持有占比。账户排序按照持有TRX数量多少从多到少进行排列,非常直观。同时我们也可以使用搜索框去查询我们想要了解的地址持仓情况。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查询账户.png) - -### 查看地址/交易统计数据 - -在这个统计界面,我们可以看到,TRX持仓前25的地址占比,过去一小时之内TRX的转移情况,过去一小时之内TRX的交易情况,以及区块大小随时间变化的统计。同时Tronscan未来会添加更多直观的统计数据,供用户方便的查询。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查看地址交易统计数据.png) - -### 查看区块直播 - -区块直播是Tronscan独有的一个功能,在这里我们可以查看实时的交易记录,实时的投票情况,以及资产参与、token创建,节点情况等。同时我们可以通过筛选功能,去选择我们想要观看的直播内容。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/blockchain模块/查看区块直播.png) - -### 查看节点信息 - -该页面显示了节点的数量以及分布最多节点的国家。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/节点信息/数量与分布.png) - -该页面从地理分布来看所有波场节点的地点分布,各地区波场的节点密集程度,给用户一个直观的节点分布感受。因为内置的谷歌地图,用户也可放大缩小地图,去了解节点的详细地理信息。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/节点信息/地图分布.png) - -该页面显示了所有节点的IP地址,主机名称,区块高度,GRPC,GRPC m/s 和上次更新时间。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/节点信息/节点信息.png) - -## 查看SR和SR候选信息 - -用户可以查看SR列表和SR候选列表的上一个出块、出块数、丢失块数、状态、出块率以及投票数。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/SP和SP候选信息/SP信息.png) -![](https://github.com/ybhgenius/Documentation/blob/master/images/Blockchain-Explorer/SP和SP候选信息/SP候选信息.png) - -用户可以点击相应SP和SP候选的相关链接,查看详细信息。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/SP和SP候选信息/查看详细信息.png) - -## 关于代币 - -用户可以参与其他代币,概览代币列表以及创建属于自己的代币。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/三大模块.png) - -参与代币时,只需点击participate,输入相应TRX数量,即可参与其他代币。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/参与代币.png) - -用户也可以浏览所有代币信息。包括名称、总供应量,总已发行量和代币注册时间。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/代币概览.png) - -用户也可以参与创建代币。 点击"create"进入资产创建页面。填写相关信息,点击"Issue Token"即可发布资产。 - -创建波场生态系统中的代币简便快捷。只需填写相应参数,即可发行资产。相应参数如下: - -+ 发行资产的名称 -+ 发行数量 -+ 资产描述 -+ 个人网站地址:可供使用者更多去了解关于资产的相关信息。 -+ 与TRX兑换汇率 -+ 发行参与周期:资产发行的周期,在此周期内用户可使用TRX兑换发行资产。 - -发行资产的手续费为1024个TRX。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/创建代币1.png) -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/关于代币/创建代币2.png) - -## 查看TRX最新市场资讯。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/市场资讯/市场资讯.png) - -## 关于投票 - -### 1. 打开波场区块链浏览器,创建或登录钱包。 - - https://tronscan.org/#/ - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png) - -### 2. 输入密码。(密码会加密私钥,需要密码和私钥来登录钱包) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png) - -### 3. 下载加密密钥。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png) - -### 4. 保存你的私钥,可以复制保存。打印保存。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png) - -### 5. 注册成功进入账户页面。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png) - -### 6. 只有拥有TRX时才能投票,账户页面底部可领取10000TRX进行投票。每个账户只能申请一次TRX,领取成功后可去WALLET中查看账户详情。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png) - -### 7. 投票前需要冻结TRX,才能为超级代表投票。 - -+ ACCOUNT中点击FREEZE按钮。 -+ 输入冻结数量。 -+ 勾选确认冻结XXXRTX至少三天。 -+ 点击FREEZE BALANCE冻结TRX。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png) - -**冻结说明** - -冻结仅限于TRX,冻结TRX带来两个效果:获得J和bandwidth,J是投票使用。发生解冻操作时,以前的投票会失效,可以通过重新冻结并投票来避免失效。解冻后bandwidth不会清空,下次冻结时,新冻结部分bandwidth将进行累加 - -### 8. 投票给超级代表,导航栏中点击VOTES进入投票页面,点击START VOTING开始投票。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png) - -### 9. 选择“超级代表”进行投票,投票页面,输入投票数量,点击SUBMIT VOTES提交,提示投票成功。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png) - -### 10. RESET清空当前已选“超级代表”投票数量。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png) - -**投票说明** - -输入投票数量就可以投票,投票需要拥有J,J可以通过冻结资金获得,每冻结1TRX可以获得1单位的J。一单位的J可以投一票。在解冻后,以前的投票会失效,可以通过重新冻结并投票来避免失效。投票数不超过总J即可投票成功,对单个代表的投票数没有限制,投票成功消耗10^5bandwidth,距离上次合约(投票、转账、转移资产和冻结)超过10s则不需要消耗bandwidth。若J不足跳转提示账户冻结金额不足。只记录最后一次投票,(最后一次投票会覆盖之前的所有投票) - -**投票规则** -+ 用户的最高投票数必须少于或者等于手持TRX的数量。 -+ 每个用户可多次投票给多个候选人。 -+ 每6小时更新超级代表列表。 -+ 投票操作均不消耗TRX。 - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\345\206\205\347\275\256\351\222\261\345\214\205\344\275\277\347\224\250\346\225\231\347\250\213.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\345\206\205\347\275\256\351\222\261\345\214\205\344\275\277\347\224\250\346\225\231\347\250\213.md" deleted file mode 100644 index 10a12a81..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\345\206\205\347\275\256\351\222\261\345\214\205\344\275\277\347\224\250\346\225\231\347\250\213.md" +++ /dev/null @@ -1,29 +0,0 @@ -# 浏览器钱包指南 - -## 1. 打开波场区块链浏览器,创建或登录钱包。 - - https://tronscan.org/#/ - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1_ZH.png) - -## 2. 输入密码。 - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2_ZH.png) - -## 3. 下载加密密钥。(密码会加密私钥,需要密码和私钥来登录钱包)。 - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3_ZH.png) - -## 4. 保存你的私钥,可以复制保存、打印保存。 注册成功进入账户页面(图3-3) - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4_ZH.png) - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png) - -## 5. 注册成功进入账户页面。 - -![](https://github.com/tronprotocol/Documentation/blob/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6_ZH.png) - -## 6. 注意事项: - 私钥代表着账户的绝对控制权。请一定保管好你的私钥,避免遗失或者泄露给其他人。 - 地址(公钥)是你用来接收转账的,可以放心的交给其他人。 \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\346\212\225\347\245\250\346\214\207\345\215\227.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\346\212\225\347\245\250\346\214\207\345\215\227.md" deleted file mode 100644 index ce06eaeb..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\346\212\225\347\245\250\346\214\207\345\215\227.md" +++ /dev/null @@ -1,70 +0,0 @@ -# 浏览器投票指南 - -## 1. 打开波场区块链浏览器,创建或登录钱包。 - - https://tronscan.org/#/ - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/1.png) - -## 2. 输入密码。下载加密密钥。(密码会加密私钥,需要密码和私钥来登录钱包) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/2.png) - -## 3. 下载加密密钥。(密码会加密私钥,需要密码和私钥来登录钱包)。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/3.png) - -## 4. 保存你的私钥,可以复制保存。打印保存。 注册成功进入账户页面(图3-3) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/4.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/5.png) - -## 5. 注册成功进入账户页面。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/6.png) - -## 6. 只有拥有TRX时才能投票,目前仅测试网可以支持免费领取TRX,登陆测试网https://test.tronscan.org/#/,账户页面底部可领取10000TRX进行投票。每个账户只能申请一次TRX,领取成功后可去WALLET中查看账户详情。
 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/testnet.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/7.png) - -##7. 投票前需要冻结TRX,才能为超级代表投票。 - -+ ACCOUNT中点击FREEZE按钮。 -+ 输入冻结数量。 -+ 勾选确认冻结XXXRTX至少三天。 -+ 点击FREEZE BALANCE冻结TRX。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/8.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/9.png) - -**冻结说明** - -冻结仅限于TRX,冻结TRX带来两个效果:获得股权和带宽,股权是投票使用。发生解冻操作时,以前的投票会失效,可以通过重新冻结并投票来避免失效。解冻后带宽不会清空,下次冻结时,新冻结部分带宽将进行累加 - -## 8. 投票给超级代表,导航栏中点击VOTES进入投票页面,点击START VOTING开始投票。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/10.png) - -## 9. 选择“超级代表”进行投票,投票页面,输入投票数量,点击SUBMIT VOTES提交,提示投票成功。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/11.png) - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/12.png) - -## 10. RESET清空当前已选“超级代表”投票数量。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/Guide_for_voting_on_Blockchain_Explorer/13.png) - -**投票说明** - -输入投票数量就可以投票,投票需要拥有股权,股权可以通过冻结资金获得,每冻结1TRX可以获得1单位的股权。一单位的股权可以投一票。在解冻后,以前的投票会失效。投票数不超过总股权即可投票成功,对单个代表的投票数没有限制。若股权不足跳转提示账户冻结金额不足。只记录最后一次投票,(最后一次投票会覆盖之前的所有投票) - -**投票规则** -+ 用户的最高投票数必须少于或者等于持有并冻结的TRX的数量。
 -+ 每个用户可多次投票给多个候选人。 -
+ 每6小时更新超级代表列表。
 -+ 投票操作均不消耗TRX。 diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\246\202\344\275\225\347\224\263\350\257\267\346\210\220\344\270\272\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\246\202\344\275\225\347\224\263\350\257\267\346\210\220\344\270\272\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211.md" deleted file mode 100644 index bfe7aef6..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\214\272\345\235\227\351\223\276\346\265\217\350\247\210\345\231\250\344\273\213\347\273\215/\345\246\202\344\275\225\347\224\263\350\257\267\346\210\220\344\270\272\350\266\205\347\272\247\344\273\243\350\241\250\345\200\231\351\200\211.md" +++ /dev/null @@ -1,17 +0,0 @@ -# 如何申请成为超级代表候选 - -+ 登陆 https://tronscan.org 使用区块链浏览器。 - -+ 点击"账户"。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/竞选超级代表/点击账户.jpg) - -+ 点击"申请成为超级代表候选"。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/竞选超级代表/申请成为超级代表候选.jpg) - -+ 填写个人网站地址并勾选注意事项。 - -![](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Blockchain-Explorer/竞选超级代表/填写网站地址并勾选.jpg) - -注意:申请成为超级代表候选需要支付9999个TRX作为手续费。 \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\346\223\215\344\275\234\347\261\273\345\236\213\350\257\264\346\230\216.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\346\223\215\344\275\234\347\261\273\345\236\213\350\257\264\346\230\216.md" deleted file mode 100644 index c1f02f79..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\346\223\215\344\275\234\347\261\273\345\236\213\350\257\264\346\230\216.md" +++ /dev/null @@ -1,403 +0,0 @@ - -## 交易的合约类型 - -合约支持多种类型,是TRON网络中的基本单位。下面详细介绍每种合约及参数。\ -[1.创建账户 AccountCreateContract](#1) \ -[2.转账 TransferContract](#2)\ -[3.转账发布的Token TransferAssetContract](#3)\ -[4.投票超级节点 VoteWitnessContract](#4)\ -[5.创建超级节点候选人 WitnessCreateContract](#5)\ -[6.发布Token AssetIssueContract](#6)\ -[7.更新超级节点候选人URL WitnessUpdateContract](#7)\ -[8.购买发行的Token ParticipateAssetIssueContract](#8)\ -[9.更新账户 AccountUpdateContract](#9)\ -[10.冻结资产 FreezeBalanceContract](#10)\ -[11.解冻资产 UnfreezeBalanceContract](#11)\ -[12.提取奖励 WithdrawBalanceContract](#12)\ -[13.解冻发布的Token UnfreezeAssetContract](#13)\ -[14.更新通证参数 UpdateAssetContract](#14)\ -[15.创建提议 ProposalCreateContract](#15)\ -[16.赞成提议 ProposalApproveContract](#16)\ -[17.删除提议 ProposalDeleteContract](#17)\ -[18.设置账户ID SetAccountIdContract](#18)\ -[19.创建智能合约 CreateSmartContract](#19)\ -[20.触发智能合约 TriggerSmartContract](#20)\ -[21.更新合约 UpdateSettingContract](#21)\ -[22.创建交易所 ExchangeCreateContract](#22)\ -[23.给交易所注资 ExchangeInjectContract](#23)\ -[24.从交易所撤资 ExchangeWithdrawContract](#24)\ -[25.在交易所交易 ExchangeTransactionContract](#25)\ - - -##

1.创建账户 AccountCreateContract

- - `AccountCreatContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `account_address`: 将要创建的账户地址。 - `type`:账户类型——比如:_0_ 代表的账户类型是`Normal`。 - - message AccountCreateContract { - bytes owner_address = 1; - bytes account_address = 2; - AccountType type = 3; - } - -##

2.转账 TransferContract

- - `TransferContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `to_address`: 目标账户地址。 - `amount`:转账金额,单位为 sun。 - - message TransferContract { - bytes owner_address = 1; - bytes to_address = 2; - int64 amount = 3; - } - - -##

3.转账发布的Token TransferAssetContract

- - `TransferAssetContract`包含4种参数: - `asset_name`:发布Token的名称。 - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `to_address`: 目标账户地址。 - `amount`:转账Token的数量。 - - message TransferAssetContract { - bytes asset_name = 1; - bytes owner_address = 2; - bytes to_address = 3; - int64 amount = 4; - } - - -##

4.投票超级节点 VoteWitnessContract

- - `VoteWitnessContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `vote_address`: 超级节点候选人的地址。 - `vote_count`:投给超级节点候选人的票数。 - `votes`:超级节点候选人列表。 - `support`:是否支持,这里应该是恒为true,暂未使用该参数。 - - message VoteWitnessContract { - message Vote { - bytes vote_address = 1; - int64 vote_count = 2; - } - bytes owner_address = 1; - repeated Vote votes = 2; - bool support = 3; - } - - -##

5.创建超级节点候选人 WitnessCreateContract

- - `WitnessCreateContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `url`: 超级节点后续人网址。 - - message WitnessCreateContract { - bytes owner_address = 1; - bytes url = 2; - } - - -##

6.发布Token AssetIssueContract

- - `AssetIssueContract`包含17种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `name`:发布Token的名称——比如:_“SiCongcontract”_。 - `abbr`: 。 - `total_supply`:发行总的token数量——比如:_100000000_。 - `frozen_supply`:冻结Token的数量和冻结时间列表。 - `trx_num`:对应TRX数量——比如:_232241_。 - `num`: 对应的自定义资产数目。 - `start_time`:开始时间——比如:_20170312_。 - `end_time`:结束时间——比如:_20170512_。 - `order`:相同asset_name时,order递增,默认初始值为0。 - `vote_score`:合约的评分——比如:_12343_。 - `description`:Token的描述——比如:_”trondada”_。 - `url`:Token的url地址链接。 - `free_asset_net_limit`:每个账户可以使用的免费带宽(转移该资产时使用)。 - `public_free_asset_net_limit`:所有账户可以使用的免费带宽(转移该资产时使用)。 - `public_free_asset_net_usage`:所有账户使用免费带宽(转移该资产时使用)。 - `public_latest_free_net_time`:最近一次转移该Token使用免费带宽的时间。 - - message AssetIssueContract { - message FrozenSupply { - int64 frozen_amount = 1; - int64 frozen_days = 2; - } - bytes owner_address = 1; - bytes name = 2; - bytes abbr = 3; - int64 total_supply = 4; - repeated FrozenSupply frozen_supply = 5; - int32 trx_num = 6; - int32 num = 8; - int64 start_time = 9; - int64 end_time = 10; - int64 order = 11; // the order of tokens of the same name - int32 vote_score = 16; - bytes description = 20; - bytes url = 21; - int64 free_asset_net_limit = 22; - int64 public_free_asset_net_limit = 23; - int64 public_free_asset_net_usage = 24; - int64 public_latest_free_net_time = 25; - } - - -##

7.更新超级节点候选人URL WitnessUpdateContract

- - `WitnessUpdateContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `update_url`: 超级节点更新后的url。 - - message WitnessUpdateContract { - bytes owner_address = 1; - bytes update_url = 12; - } - -##

8.购买发行的Token ParticipateAssetIssueContract

- - `ParticipateAssetIssueContract`包含4种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `to_address`:发行Token所有者地址。 - `account_name`: 发行Token的名称,包括Token名称和order - `amount`:购买发行Token使用TRX的数量,单位是 sun。 - - message ParticipateAssetIssueContract { - bytes owner_address = 1; - bytes to_address = 2; - bytes asset_name = 3; - int64 amount = 4; - } - -##

9.更新账户 AccountUpdateContract

- - `AccountUpdateContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `account_name`: 账户名称——比如: _"SiCongsaccount”_。 - - // Update account name. Account name is not unique now. - message AccountUpdateContract { - bytes account_name = 1; - bytes owner_address = 2; - } - -##

10.冻结资产 FreezeBalanceContract

- - `FreezeBalanceContract`包含4种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `frozen_balance`:冻结资产的数量。 - `frozen_duration`:冻结资产的时间段。 - `resource`: 冻结TRX获取资源的类型。 - `receiver_address` :接收资源的账户。 - - message FreezeBalanceContract { - bytes owner_address = 1; - int64 frozen_balance = 2; - int64 frozen_duration = 3; - ResourceCode resource = 10; - bytes receiver_address = 15; - } - -##

11.解冻资产 UnfreezeBalanceContract

- - `UnfreezeBalanceContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `resource`: 解冻资源的类型。 - `receiver_address` :接收资源的账户。 - - message UnfreezeBalanceContract { - bytes owner_address = 1; - ResourceCode resource = 10; - bytes receiver_address = 13; - } - -##

12.提取奖励 WithdrawBalanceContract

- - `WithdrawBalanceContract`包含1种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - - message WithdrawBalanceContract { - bytes owner_address = 1; - } - -##

13.解冻发布的Token UnfreezeAssetContract

- - `UnfreezeAssetContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - - message UnfreezeAssetContract { - bytes owner_address = 1; - } - -##

14.更新通证参数 UpdateAssetContract

- - `UpdateAssetContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `description`: 通证的描述。 - `url`:通证的Url。 - `new_limit`:每个调用者可以消耗Bandwidth point的限制。 - `new_public_limit`: 所有调用者可以消耗Bandwidth points的限制。 - - message UpdateAssetContract { - bytes owner_address = 1; - bytes description = 2; - bytes url = 3; - int64 new_limit = 4; - int64 new_public_limit = 5; - } - -##

15.创建提议 ProposalCreateContract

- - `ProposalCreateContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `parameters`: 提议。 - - message ProposalCreateContract { - bytes owner_address = 1; - map parameters = 2; - } - -##

16.赞成提议 ProposalApproveContract

- - `ProposalApproveContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `proposal_id`: 提议的Id。 - `is_add_approval`:是否赞成提议。 - - message ProposalApproveContract { - bytes owner_address = 1; - int64 proposal_id = 2; - bool is_add_approval = 3; // add or remove approval - } - -##

17.删除提议 ProposalDeleteContract

- - `ProposalDeleteContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `proposal_id`: 提议ID。 - - message ProposalDeleteContract { - bytes owner_address = 1; - int64 proposal_id = 2; - } - -##

18.设置账户ID SetAccountIdContract

- - `SetAccountIdContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `account_id`: 账户Id。 - - // Set account id if the account has no id. Account id is unique and case insensitive. - message SetAccountIdContract { - bytes account_id = 1; - bytes owner_address = 2; - } - - -##

19.创建智能合约 CreateSmartContract

- - `CreateSmartContract`包含2种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `new_contract`: 智能合约。 - - message CreateSmartContract { - bytes owner_address = 1; - SmartContract new_contract = 2; - } - -##

20.触发智能合约 TriggerSmartContract

- - `TriggerSmartContract`包含4种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `contract_address`: 合约地址。 - `call_value`:TRX的值。 - `data`:操作参数。 - - message TriggerSmartContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 call_value = 3; - bytes data = 4; - } - -##

21.更新合约 UpdateSettingContract

- - `UpdateSettingContract`包含3种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `contract_address`: 合约地址。 - `consume_user_resource_percent`:将要更新的账户消耗资源的百分比。 - - message UpdateSettingContract { - bytes owner_address = 1; - bytes contract_address = 2; - int64 consume_user_resource_percent = 3; - } - -##

22.创建交易所 ExchangeCreateContract

- - `ExchangeCreateContract`包含5种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `first_token_id`: 第1种token的id 。 - `first_token_balance`:第1种token的balance。 - `second_token_id`:第2种token的id。 - `second_token_balance`:第2种token的balance。 - - message ExchangeCreateContract { - bytes owner_address = 1; - bytes first_token_id = 2; - int64 first_token_balance = 3; - bytes second_token_id = 4; - int64 second_token_balance = 5; - } - -##

23.给交易所注资 ExchangeInjectContract

- - `ExchangeInjectContract`包含4种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `exchange_id`: 交易对的id。 - `token_id`:要注资的token的id。 - `quant`:要注资的token的金额。 - - message ExchangeInjectContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - } - -##

24.从交易所撤资 ExchangeWithdrawContract

- - `ExchangeWithdrawContract`包含4种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `exchange_id`: 交易对的id。 - `token_id`:要撤资的token的id。 - `quant`:要撤资的token的金额。 - - message ExchangeWithdrawContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - } - -##

25.在交易所交易 ExchangeTransactionContract

- - `ExchangeTransactionContract`包含4种参数: - `owner_address`:合约持有人地址——比如: _“0xu82h…7237”_。 - `exchange_id`: 交易对的id。 - `token_id`:要卖出的token的id。 - `quant`:要卖出的token的金额。 - - message ExchangeTransactionContract { - bytes owner_address = 1; - int64 exchange_id = 2; - bytes token_id = 3; - int64 quant = 4; - } \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\346\230\216\347\273\206.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\346\230\216\347\273\206.md" deleted file mode 100644 index 3635ec27..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\346\230\216\347\273\206.md" +++ /dev/null @@ -1,9 +0,0 @@ -手续费明细 -=== - | 交易类型 | 费用 | - | :---: | :---: | - | 创建 witness | 9999 TRX | - | 发行 token | 1024 TRX | - | 创建 account | 0.1 TRX | - | 创建 exchange | 1024 TRX | - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\347\256\200\344\273\213.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\347\256\200\344\273\213.md" deleted file mode 100644 index 009bb4cf..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\344\272\244\346\230\223\347\256\200\344\273\213.md" +++ /dev/null @@ -1,214 +0,0 @@ -交易 -=== - -[1.交易基本结构](#1) \ -[2.交易费](#2) \ -[3.交易签名流程](#3) - - -##

1.交易基本结构

-Tron网络中的账户包含三中,普通账户,Token账户和合约账户。 - -- 普通账户:可以进行各种基本操作。 -- Token账户:由普通账户发布Token的账户,目前没有使用。 -- 合约账户:智能合约的账户,由普通账户创建,并可以被触发的账户。 - -账户基本结构 - - message Account { - /* frozen balance */ - message Frozen { - int64 frozen_balance = 1; // 冻结TRX的金额,单位Sun - int64 expire_time = 2; // 冻结资金到期时间 - } - bytes account_name = 1; // 账户的名称 - AccountType type = 2; // 账户的类型 - // the create address - bytes address = 3; // 账户地址 - // the trx balance - int64 balance = 4; // 账户中TRX的余额 - // the votes - repeated Vote votes = 5; // 投票各个超级节点候选人的票数 - // the other asset owned by this account - map asset = 6;// 其他资产的名称+order 和余额的映射列表 - // latest asset operation time - - // the frozen balance - repeated Frozen frozen = 7; // 冻结TRX的列表 - // bandwidth, get from frozen - int64 net_usage = 8; // 通过冻结TRX获取Bandwidth points的使用量 - - // this account create time - int64 create_time = 0x09; // 账户创建时间 - // this last operation time, including transfer, voting and so on. //FIXME fix grammar - int64 latest_opration_time = 10; // 账户最后操作时间,包括转账,投票等 - // witness block producing allowance - int64 allowance = 0x0B; // 获取的奖励 - // last withdraw time - int64 latest_withdraw_time = 0x0C; // 最近一次提取奖励时间 - // not used so far - bytes code = 13; - bool is_witness = 14; // 是否是超级节点候选人 - bool is_committee = 15; // 是否是委员会成员 - // frozen asset(for asset issuer) - repeated Frozen frozen_supply = 16; // 冻结发布资产列表 - // asset_issued_name - bytes asset_issued_name = 17; // 该账户发布资产的名称,一个账户智能发布一种资产 - map latest_asset_operation_time = 18; - - int64 free_net_usage = 19; // 免费Bandwidth points的使用量 - map free_asset_net_usage = 20; // 操作每种发布资产使用免费Bandwidth points使用量 - int64 latest_consume_time = 21; // 最近一次使用 冻结TRX获取到Bandwidth points 的时间 - int64 latest_consume_free_time = 22; // 最近一次使用免费Bandwidth points的时间 - - bytes account_id = 23; // 账户ID - - message AccountResource { - // energy resource, get from frozen - int64 energy_usage = 1; // 通过冻结TRX获取Energy的使用量 - // the frozen balance for energy - Frozen frozen_balance_for_energy = 2; // 为获取Energy冻结的TRX的数量 - int64 latest_consume_time_for_energy = 3; // 最近一次消费冻结TRX获取到Energy的时间 - - // storage resource, get from market - int64 storage_limit = 6; // 存储消耗Energy最大使用量限制 - int64 storage_usage = 7; // 存储消耗Energy的量 - int64 latest_exchange_storage_time = 8; - } - AccountResource account_resource = 26; // 账户资源概况信息 - - bytes codeHash = 30; - } - -交易基本结构 - - message Transaction { - message Contract { - enum ContractType { - AccountCreateContract = 0; - TransferContract = 1; - TransferAssetContract = 2; - VoteAssetContract = 3; - VoteWitnessContract = 4; - WitnessCreateContract = 5; - AssetIssueContract = 6; - WitnessUpdateContract = 8; - ParticipateAssetIssueContract = 9; - AccountUpdateContract = 10; - FreezeBalanceContract = 11; - UnfreezeBalanceContract = 12; - WithdrawBalanceContract = 13; - UnfreezeAssetContract = 14; - UpdateAssetContract = 15; - ProposalCreateContract = 16; - ProposalApproveContract = 17; - ProposalDeleteContract = 18; - SetAccountIdContract = 19; - CustomContract = 20; - // BuyStorageContract = 21; - // BuyStorageBytesContract = 22; - // SellStorageContract = 23; - CreateSmartContract = 30; - TriggerSmartContract = 31; - GetContract = 32; - UpdateSettingContract = 33; - ExchangeCreateContract = 41; - ExchangeInjectContract = 42; - ExchangeWithdrawContract = 43; - ExchangeTransactionContract = 44; - } - ContractType type = 1; - google.protobuf.Any parameter = 2; - bytes provider = 3; - bytes ContractName = 4; - } - - message Result { - enum code { - SUCESS = 0; - FAILED = 1; - } - enum contractResult { - DEFAULT = 0; - SUCCESS = 1; - REVERT = 2; - BAD_JUMP_DESTINATION = 3; - OUT_OF_MEMORY = 4; - PRECOMPILED_CONTRACT = 5; - STACK_TOO_SMALL = 6; - STACK_TOO_LARGE = 7; - ILLEGAL_OPERATION = 8; - STACK_OVERFLOW = 9; - OUT_OF_ENERGY = 10; - OUT_OF_TIME = 11; - JVM_STACK_OVER_FLOW = 12; - UNKNOWN = 13; - } - int64 fee = 1; - code ret = 2; - contractResult contractRet = 3; - - int64 withdraw_amount = 15; - int64 unfreeze_amount = 16; - } - - message raw { - bytes ref_block_bytes = 1; - int64 ref_block_num = 3; - bytes ref_block_hash = 4; - int64 expiration = 8; - repeated authority auths = 9; - // data not used - bytes data = 10; - //only support size = 1, repeated list here for extension - repeated Contract contract = 11; - // scripts not used - bytes scripts = 12; - int64 timestamp = 14; - int64 fee_limit = 18; - } - - raw raw_data = 1; - // only support size = 1, repeated list here for muti-sig extension - repeated bytes signature = 2; // 交易发起者的签名列表,目前只支持一个 - repeated Result ret = 5; - } - - -##

2.交易费

- -在Tron网络中的交易总体来说是免费的,但因系统资源的限制,为保证公平公正的原则,对网络中的带宽(Bandwidth points),CPU和存储资源有一定的限制。 - -- 普通交易仅消耗Bandwidth points,可以通过冻结TRX获取一定量的Bandwidth points,也可以使用账户中的免费Bandwidth points。当Bandwidth points不足时,会烧TRX。 -- 智能合约的操作不仅要消耗Bandwidth points,还会消耗Energy。与Bandwidth points一样,可以通过冻结TRX可以获取一定量的Energy。当Energy不足时,会烧TRX。 -- 所有的查询交易是完全免费的,不消耗Bandwidth points,也不消耗Energy。 - - -##

3.交易签名流程

- -## 一、步骤 - -1. 取交易的rawdata,转成byte[]格式。 -2. 对rawdata进行sha256运算。 -3. 用交易每个合约中地址对应的私钥(现在一般就是一个合约,一个私钥),对sha256的结果进行签名。 -4. 把签名结果添加到交易中。 -  -## 二、签名算法 - -1, ECDSA算法,SECP256K。 -2, 签名示例数据 - - priKey:::8e812436a0e3323166e1f0e8ba79e19e217b2c4a53c970d4cca0cfb1078979df
        - pubKey::04a5bb3b28466f578e6e93fbfd5f75cee1ae86033aa4bbea690e3312c087181eb366f9a1d1d6a437a9bf9fc65ec853b9fd60fa322be3997c47144eb20da658b3d1
        - hash:::159817a085f113d099d3d93c051410e9bfe043cc5c20e43aa9a083bf73660145
        - r:::38b7dac5ee932ac1bf2bc62c05b792cd93c3b4af61dc02dbb4b93dacb758123f
        - s:::08bf123eabe77480787d664ca280dc1f20d9205725320658c39c6c143fd5642d
        - v:::0 - - 注意:签名结果应该是65字节。 r 32字节, s 32字节,v 1个字节。 - -3, fullnode节点收到交易后会进行验签,由hash 和 r、s、v计算出一个地址,与合约中的地址进行比较,相同则为验签通过。 -  -## 三、代码示例 - - public static Transaction sign(Transaction transaction, ECKey myKey) {
 Transaction.Builder transactionBuilderSigned = transaction.toBuilder();

 byte[] hash = sha256(transaction.getRawData().toByteArray());
 List listContract = transaction.getRawData().getContractList();
 for (int i = 0; i < listContract.size(); i++) {
 ECDSASignature signature = myKey.sign(hash);
 ByteString bsSign = ByteString.copyFrom(signature.toByteArray());
 transactionBuilderSigned.addSignature(
 bsSign);//Each contract may be signed with a different private key in the future.
 } diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\206\273\347\273\223\344\270\216\346\212\225\347\245\250.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\206\273\347\273\223\344\270\216\346\212\225\347\245\250.md" deleted file mode 100644 index 3a67ccb9..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\206\273\347\273\223\344\270\216\346\212\225\347\245\250.md" +++ /dev/null @@ -1,168 +0,0 @@ -# 冻结/解冻资金 -[1.为什么要冻结资金](#1) \ -[2.冻结/解冻机制](#2) \ -[3.投票](#3) \ -[4.资源委派](#4) - -##

1.为什么要冻结资金

- -设置冻结资金的机制有2个出发点: -+ 防止恶意的垃圾交易阻塞网络,造成交易确认缓慢的问题 -+ 防止恶意投票 - - -##

2.冻结/解冻机制

- -冻结资金后,你将获得对应数量的TRON Power(TP)、Bandwidth Points和CPU资源。 -**注意** 冻结时需要指定获取Bandwidth或CPU其中的一种,默认为Bandwidth -TRON Power(TP)可以用来投票,bandwidth points和CPU用于交易。TRON Power(TP)及bandwidth points、CPU的使用及计算规则在后文中介绍。 - -冻结的资金会进入你的冻结账户,无法用于交易。 - -当临时需要更多的TRON Power(TP)或bandwidth时,可以追加冻结资金,从而获取追加部分的TRON Power(TP)与bandwidth。此时解冻时间推迟到最后一次冻结操作的3天后。 - -+ 冻结与解冻命令如下: - -``` -freezebalance amount time resource -amount:冻结资金,单位是sun。amount最小为 1,000,000 sun, 即1TRX -time:冻结时间,冻结资金到解冻资金的时间为3天 -resource:冻结获取的资源,0为Bandwidth Point,1为Energy。默认为0 - -unfreezebalance resource -resource:解冻失去的资源,0为Bandwidth Point,1为Energy。默认为0 -``` - -+ 示例: - - `freezebalance 10_000_000 3 0` - -+ 解冻命令如下: - - `unfreezebalance 0` - -##

3.投票

- -TRON网络中的每一个账户都具有选举权,可以通过投票选出自己认同的超级代表。 投票需要TRON Power(TP),你的TRON Power(TP)的多少由当前冻结资金决定。 - -TRON Power(TP)的计算方法:每冻结1TRX,就可以获得1单位TRON Power(TP)。 - -在解冻后,你没有了冻结的资产,相应地失去了所有的TRON Power(TP),因此以前的投票会失效。你可以通过重新冻结并投票来避免投票失效。 - -注意: 波场网络只记录你最后一次投票的状态,也就是说你的每一次投票都会覆盖以前所有的投票效果 - -+ 示例: - -``` -freezebalance 10,000,000 3 // 冻结了10TRX,获取了10单位TRON Power(TP) -votewitness witness1 4 witness2 6 // 同时给witness1投了4票,给witness2投了6票 -votewitness witness1 3 witness2 7 // 同时给witness1投了3票,给witness2投了7票 -``` - -以上命令的最终结果是给witness1投了3票,给witness2投了7票 - -##

4.资源委派

- -冻结资金后,可以将获得Bandwidth Points和CPU资源给其他账户使用,TRON Power(TP)依然属于原账户。 - -该命令与第一节中命令类似,仅增加receiverAddress字段。 -+ 冻结与解冻命令如下: - -``` -freezebalance amount time resource receiverAddress -amount:冻结资金,单位是sun。amount最小为 1,000,000 sun, 即1TRX -time:冻结时间,冻结资金到解冻资金的时间为3天 -resource:冻结获取的资源,0为Bandwidth Point,1为Energy。默认为0 -receiverAddress:接收资源的账户 - -unfreezebalance resource receiverAddress -resource:解冻失去的资源,0为Bandwidth Point,1为Energy。默认为0 -receiverAddress:接收资源的账户 - -``` - -+ 示例: - - `freezebalance 10_000_000 3 0 address` - -+ 解冻命令如下: - - `unfreezebalance 0 address` - -+ 账户资源字段 - - - - ``` - Account { - int64 acquired_delegated_frozen_balance_for_bandwidth = 41; - int64 delegated_frozen_balance_for_bandwidth = 42; - message AccountResource { - int64 acquired_delegated_frozen_balance_for_energy = 4; - int64 delegated_frozen_balance_for_energy = 5; - } - } - ``` - - -`acquired_delegated_frozen_balance_for_bandwidth` :其他账户委派给该账户的Bandwidth资源 \ -`delegated_frozen_balance_for_bandwidth` : 该账户委派给其他账户的Bandwidth资源\ -`acquired_delegated_frozen_balance_for_energy`:其他账户委派给该账户的CPU资源\ -`delegated_frozen_balance_for_energy`:该账户委派给其他账户的CPU资源 - -+ 查询账户资源委派信息 - -**场景1:查询账户给哪些账户委派了资源** - -step0:获得要查询的账户的地址。\ -step1:通过`GetDelegatedResourceAccountIndex`接口,查询获得所有与该账户发生资源委派的其他地址。 - - rpc GetDelegatedResourceAccountIndex (BytesMessage) returns (DelegatedResourceAccountIndex) {}; - - message DelegatedResourceAccountIndex { - bytes account = 1; - repeated bytes fromAccounts = 2; - repeated bytes toAccounts = 3; - } - -`BytesMessage`:查询的地址 \ -`account`:查询的地址 \ -`fromAccounts`:从哪些账户中获得了资源 \ -`toAccounts`:给哪些账户中委派了资源 - - -**场景2:查询账户给某个账户委派了多少资源** - -step0:两个查询的地址,address1、address2。\ -step1:通过`GetDelegatedResource`接口,查询获得address1给address2委派的资源。 - - rpc GetDelegatedResource (DelegatedResourceMessage) returns (DelegatedResourceList) { - }; - - message DelegatedResourceMessage { - bytes fromAddress = 1; - bytes toAddress = 2; - } - - message DelegatedResourceList { - repeated DelegatedResource delegatedResource = 1; - } - - message DelegatedResource { - bytes from = 1; - bytes to = 2; - int64 frozen_balance_for_bandwidth = 3; - int64 frozen_balance_for_energy = 4; - int64 expire_time_for_bandwidth = 5; - int64 expire_time_for_energy = 6; - } - -`DelegatedResourceList`:只包含一个元素 \ -`from`:发起资源委派的地址\ -`to`:接受资源委派的地址\ -`frozen_balance_for_bandwidth`:委派的带宽\ -`frozen_balance_for_energy`:委派的energy\ -`expire_time_for_bandwidth`:委派的带宽解冻时间\ -`expire_time_for_energy`:委派的energy解冻时间 - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\210\233\345\273\272\350\264\246\346\210\267.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\210\233\345\273\272\350\264\246\346\210\267.md" deleted file mode 100644 index 42b85d4a..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\210\233\345\273\272\350\264\246\346\210\267.md" +++ /dev/null @@ -1,13 +0,0 @@ -创建账户 -=== - -您可以随意注册离线密钥对(包含地址和私钥),但是这个密钥对不会被TRON网络记录。 -要想使这个密钥对成为TRON网络中的账户,需要其他已经存在于TRON网络的账户调用以下3种api之一: -- 直接调用创建账户api -- 给新地址转TRX -- 给新地址转任意一种token - -交易被网络确认后,您就可以在TRON网络中查询到地址对应的账户的信息了。创建账户会消耗冻结获取的带宽,带宽不足则烧掉创建者的固定金额的TRX,目前为0.1TRX。 - -**【注意】** Odyssey3.0上线后,经委员会通过后,创建账户烧掉创建者的固定金额的TRX,默认是0.1TRX,不消耗带宽。 - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\244\232\351\207\215\347\255\276\345\220\215.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\244\232\351\207\215\347\255\276\345\220\215.md" deleted file mode 100644 index 340066c4..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\345\244\232\351\207\215\347\255\276\345\220\215.md" +++ /dev/null @@ -1,206 +0,0 @@ -多重签名 -=== - -[1.背景](#1) \ -[2.概念说明](#2) \ -[2.1 结构说明](#2.1) \ -[2.2 Owner权限](#2.2)\ -[2.3 Witness权限](#2.3)\ -[2.4 Active权限](#2.4)\ -[2.5 费用](#2.4)\ -[3.API](#3) \ -[3.1 修改权限](#3.1)\ -[3.2 执行合约](#3.2)\ -[4.其他问题](#4) - -##

1.背景

- -**注意:V3.5版本后支持** - -目前TRON的所有交易签名,都是用的同一个私钥完成。没有权限分级,也不能实现多人共同控制账户。因此,设计并实现多重签名功能,每个权限可以对应多个私钥。 - - https://github.com/tronprotocol/TIPs/issues/16 - -##

2.概念说明

- -该方案共包含三种权限级别,owner、witness以及active权限,其中owner权限具有执行所有合约的权限,witness权限用于超级代表出块,active是自定义权限(可以组合权限集合),以下将详细说明。 - -###

2.1 结构说明

- -**1. Account修改** - - message Account { - ... - Permission owner_permission = 31; - Permission witness_permission = 32; - repeated Permission active_permission = 33; - } - -在账户结构中新增三个权限属性,分别是 owner_permission、witness_permission 和 active_permission,其中 active_permission 是个列表,可以指定最多8个。 - - -**2. ContractType修改** - - message Transaction { - message Contract { - enum ContractType { - AccountCreateContract = 0; - ... - AccountPermissionUpdateContract = 46; - } - } - } - } - -新增一种交易类型 AccountPermissionUpdateContract,用于更新账户权限。 - -**3. AccountPermissionUpdateContract** - - message AccountPermissionUpdateContract { - bytes owner_address = 1; - Permission owner = 2; - Permission witness = 3; - repeated Permission actives = 4; - } - -`AccountPermissionUpdateContract`\ -`owner_address`:待修改权限的账户的地址\ -`owner`:修改后的 owner 权限,覆盖\ -`witness`:修改后的 witness 权限(如果是 witness ),覆盖\ -`actives`:修改后的 actives 权限,覆盖 - -该接口是覆盖原账户权限,因此,如果只想修改owner权限,witness(如果是witnss)及actives的也需要设置。 - - -**4. Permission** - - message Permission { - enum PermissionType { - Owner = 0; - Witness = 1; - Active = 2; - } - PermissionType type = 1; - int32 id = 2; - string permission_name = 3; - int64 threshold = 4; - int32 parent_id = 5; - bytes operations = 6; - repeated Key keys = 7;// - } - -`PermissionType`: 权限类型,目前仅支持三种权限\ -`id`: 值由系统自动设置,Owner id=0, Witness id=1, Active id 从2开始递增分配。在执行合约时, -通过该id来指定使用哪个权限,如使用owner权限,即将id设置为0。\ -`permission_name`: 权限名称,由用户设定\ -`threshold`: 阈值,只有当参与签名的权重之和超过域值才允许做相应的操作。\ -`parent_id`:目前只能为0 \ -`operations`:共32字节(256位),每位代表一个合约的权限,为1时表示拥有该合约的权限。 -如`operations=0x0100...00(十六进制),即100...0(二进制)`时,查看Transaction.ContractType,合约AccountCreateContract的值为0, -即表示该permission只拥有执行AccountCreateContract的权限\ -`keys`:共同拥有该权限的地址及权重,最多允许5个key。 - -**5. Key** - - message Key { - bytes address = 1; - int64 weight = 2; - } -`address`:拥有该权限的地址 -`weight`:该地址对该权限拥有权重 - -**6. Transaction修改** - - message Transaction { - ... - int32 Permission_id = 5; - } - -在交易中增加 `Permission_id`字段,与`Permission.id`相对应,用于指定使用哪个权限。默认为0,即owner权限。 -不允许为1,因为witness权限仅用于出块,不用于对交易进行签名。 - -###

2.2 Owner权限

-OwnerPermission是账户的最高权限,用于控制用户的所有权、调整权限结构,Owner权限也可以执行所有合约。 - -Owner权限具有以下特性:\ -1、拥有OwnerPermission的地址可以修改OwnerPermission。\ -2、当OwnerPermission为空时,默认采用该账户的地址具有owner权限。\ -3、账户新建时,自动将该账户的地址填充到OwnerPermission中,并默认域值为1,keys中仅包含该账户地址且权重为1。\ -4、当执行合约时未指定permissionId时, 默认采用OwnerPermission。 - - -###

2.3 Witness权限

-超级代表可使用该权限,管理出块节点。非witness账户无该权限。 - -使用场景示例:一个超级代表在云服务器上部署出块程序,为了账户安全,此时可以将出块权限赋予另一个地址。由于该地址仅具有出块权限,无TRX转出权限,即使该服务器上私钥被泄密,也不会出现TRX丢失。 - -Witness出块节点的配置:\ -1、未修改witness权限时,无需特殊配置。\ -2、修改witness权限后的出块节点,需要在重新配置,配置项如下: - -``` -#config.conf - -// Optional.The default is empty. -// It is used when the witness account has set the witnessPermission. -// When it is not empty, the localWitnessAccountAddress represents the address of the witness account, -// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account. -// When it is empty,the localwitness is configured with the private key of the witness account. -//可选项,默认为空。 -//用于当witness账户设置了witnessPermission。 -//当该值不为空时,localWitnessAccountAddress代表witness账户的地址,localwitness是witnessPermission中的地址的私钥。 -//当该值为空时,localwitness配置为witness账户的私钥。 - -//localWitnessAccountAddress = - -localwitness = [ - f4df789d3210ac881cb900464dd30409453044d2777060a0c391cbdf4c6a4f57 -] - -``` - - -###

2.4 Active权限

-Active权限,用于提供一个权限的组合,比如提供一个只能执行创建账户、转账功能的权限。 - -Active权限有以下特性:\ -1、拥有OwnerPermission的地址可以修改Active权限\ -2、拥有执行AccountPermissionUpdateContract权限的地址也能够修改Active权限\ -1、最多支持8个组合。\ -1、permission的id从2开始自动递增。 - - -###

2.5 费用

- - -1、使用更新账户权限时,即AccountPermissionUpdate 合约,收取100TRX。\ -2、使用多重签名的交易时,即交易中包括两个及两个以上签名的交易,除交易费用外,另收取1TRX。\ -3、可通过提议,修改以上费用。 - -##

3.API

- -###

3.1 修改权限

-`AccountPermissionUpdateContract`,修改权限步骤如下: - -1、使用接口`getaccount`查询账户,并获取原权限\ -2、修改permission\ -3、创建合约,签名\ -4、发送交易 - -###

3.2 执行合约

- -1、创建交易\ -2、用户A签名,将签名后交易通过其他方式发送给B。\ -3、用户B签名,将签名后交易通过其他方式发送给C。\ -…\ -n、最后一个完成签名的用户,将交易广播到节点。\ -n+1、验证多重签名的权重之和大于域值则接受交易,否则拒绝交易 - -代码示例: - -https://github.com/tronprotocol/wallet-cli/blob/multi_sign_V2/src/main/java/org/tron/demo/MultiSignDemo.java - -##

4.其他问题

-1、兼容性说明 - - \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\345\216\273\344\270\255\345\277\203\345\214\226\344\272\244\346\230\223\346\211\200.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\345\216\273\344\270\255\345\277\203\345\214\226\344\272\244\346\230\223\346\211\200.md" deleted file mode 100644 index d269b43d..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\345\216\273\344\270\255\345\277\203\345\214\226\344\272\244\346\230\223\346\211\200.md" +++ /dev/null @@ -1,104 +0,0 @@ -# 波场去中心化交易所 -[1.什么是交易对(Exchange)](#1)\ -[2.创建交易对](#2)\ -[3.交易(Transaction)](#3)\ -[4.注资(Inject)](#4)\ -[5.撤资(withdraw)](#5) - -##

1.什么是交易对(Exchange)

- -TRON网络原生支持去中心化交易所。去中心化交易所由多个交易对构成。一个交易对(Exchange)是token与token之间,或者token与TRX之间的交易市场(Exchange Market)。 -任何账户都可以创建任何token之间的交易对,即使TRON网络中已经存在相同的交易对。交易对的买卖与价格波动遵循Bancor协议。 -TRON网络规定,所有交易对中的两个token的权重相等,因此它们数量(balance)的比率即是它们之间的价格。 -举一个简单的例子,假设一个交易对包含ABC和DEF两种token,ABC的balance为1000万,DEF的balance为100万,由于权重相等,因此10 ABC = 1 DEF,也就是说,当前ABC对于DEF的价格为10ABC/DEF。 - -##

2.创建交易对

-任何账户都可以创建任何token之间的交易对。创建交易对的手续费是1024TRX,这个手续费会被TRON网络烧掉。 -创建交易对相当于为该交易对注入(inject)原始资本,因此创建者账户中要拥有该交易对的初始balance。当创建成功后,会立即从创建者账户中扣除这两个token的balance。 -创建交易对的合约是ExchangeCreateContract,该合约有4个参数: -- first_token_id,第1种token的id -- first_token_balance,第1种token的balance -- second_token_id,第2种token的id -- second_token_balance,第2种token的balance - -其中token的id由token的name得到,具体概念请参见token发行相关部分的文档。如果交易对中包含TRX,则使用"_"表示TRX的id。需要注意的是,TRX的单位是sun,即10-6 TRX。 -例子: -` -ExchangeCreate abc 10000000 _ 1000000000000 -` -该交易会创建abc与TRX之间的交易对,初始balance分别为10000000个abc和1000000000000 sun(1000000TRX), -如果创建者没有足够的abc和TRX,则交易对创建失败;否则创建者账户中立即扣除相应的abc和TRX,交易对创建成功,可以开始交易。 - -##

3.交易(Transaction)

-任何账户都可以在任何交易对中进行交易。交易量和价格完全遵循Bancor协议。也就是说,一个账户在交易时,交易的对象是exchange。交易是即时的,不需要挂单和抢单,只要有足够的token,就可以交易成功。 -交易的合约是ExchangeTransactionContract,该合约有3个参数: - - exchange_id,交易对的id,TRON网络会根据交易对创建时间顺序给每个交易对唯一的id - - token_id,要卖出的token的id - - quant,要卖出的token的金额 - - expected,期望得到的另一个token的最小金额。如果小于此数值,交易不会成功 - -例子: -我们在刚刚创建的abc与TRX的交易对中进行交易,假设此交易对id为1,当前交易对中abc balance为10000000,TRX balance为1000000,如果期望花100个TRX买到至少990个abc,则 -` -ExchangeTransaction 1 _ 100 990 -` -其中"_"表示TRX,即向交易对卖出100个TRX。如果成功,该交易会使得交易对中增加100个TRX,并根据Bancor协议计算出减少的abc的数量,交易对创建者的账户中abc和TRX的数量会相应地增加和减少。 - - -##

4.注资(Inject)

-当一个交易对其中1种token的balance很小时,只需要很小的交易量就会造成很大的价格波动,这不利于正常交易。为了避免这种情况,该交易对的创建者可以选择向该交易对注资(inject)。 -一个交易对只能由该交易对的创建者来注资。注资不需要手续费。 -注资需要指定一种token以及注资金额,TRON网络会自动根据当前交易对中两种token的比例,计算出另一个token所需的金额,从而保证注资前后,交易对中两个token的比例相同,价格没有变化。 -与创建交易对相同,注资要求创建者拥有足够多的两种token的balance。 -注资的合约是ExchangeInjectContract,该合约有3个参数: - - - exchange_id,交易对的id - - token_id,要注资的token的id - - quant,要注资的token的金额 - -例子: -我们对刚刚创建的abc与TRX的交易对进行注资,假设此交易对id为1(TRON网络中第1个交易对),当前交易对中abc balance为10000000,TRX balance为1000000,如果要增加10%的abc,则 -` -ExchangeInject 1 abc 1000000 -` -如果成功,该交易会使得交易对中增加1000000个abc,并增加100000个TRX,交易对创建者的账户中abc和TRX的数量会相应地减少。 - -##

5.撤资(withdraw)

-一个交易对中的所有资产都是创建者的。创建者可以随时撤资(withdraw),把交易对中的token赎回到自身账户中。一个交易对只能由该交易对的创建者来撤资。撤资不需要手续费。 -和注资一样,撤资需要指定一种token以及撤资金额,TRON网络会自动根据当前交易对中两种token的比例,计算出另一个token撤资的金额,从而保证撤资前后,交易对中两个token的比例相同,价格没有变化。 -【风险提示】撤资前后价格没有变化,但是价格波动会更大 -撤资的合约是ExchangeWithdrawContract,该合约有3个参数: - - exchange_id,交易对的id - - token_id,要撤资的token的id - - quant,要撤资的token的金额 - -例子: -我们对之前创建的abc与TRX的交易对进行撤资,假设此交易对id为1,当前交易对中abc balance为10000000,TRX balance为1000000,如果要赎回10%的abc,则 -` -ExchangeWithdraw 1 abc 1000000 -` -如果成功,该交易会使得交易对中减少1000000个abc,以及减少100000个TRX,交易对创建者的账户中abc和TRX的数量会相应地增加。 - -### 6、查询交易对及价格信息 -#### 6.1、 查询交易 -有三个查询交易对的接口,包括:查询所有交易对信息(ListExchanges)、分页查询交易对信息(GetPaginatedExchangeList)(Odyssey-v3.1.1暂不支持),查询指定交易对信息(GetExchangeById)。 -相关api详情,请查询[波场RPC-API说明](波场钱包RPC-API.md)。 - -#### 6.2、 计算当前价格 -交易中token的当前价格信息的计算过程:\ -假设 first_token 当前的价格为 100 Sun,first_token_balance 为1000_000,second_token_balance 为2000_000,\ -second_token 当前的价格为 first_token*first_token_balance/second_token_balance = 50 Sun \ -first_token的价格可有"first_token&&TRX"交易对计算获得。 - -#### 6.3、 计算交易获得token量 -交易中花费first_token置换获得的second_token的数量的计算过程:\ -假设 sellTokenQuant是要卖出的first_token的金额,buyTokenQuant是要买入的second_token的金额。 - -supply = 1_000_000_000_000_000_000L;\ -supplyQuant = -supply * (1.0 - Math.pow(1.0 + (double) sellTokenQuant/(firstTokenBalance + sellTokenQuant), 0.0005)); \ -buyTokenQuant = (long)balance * (Math.pow(1.0 + (double) supplyQuant / supply, 2000.0) - 1.0); - -注意:由于网络其他账户发生交易,价格可能发生变化。 - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\350\264\271\347\224\250\346\250\241\345\236\213.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\350\264\271\347\224\250\346\250\241\345\236\213.md" deleted file mode 100644 index cb0c2585..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\350\264\271\347\224\250\346\250\241\345\236\213.md" +++ /dev/null @@ -1,122 +0,0 @@ -波场费用模型 -=== - -TRON网络中的资源有3种:带宽,CPU和存储。得益于波场独有的内存模型,TRON网络中的存储资源几乎是无限的。 -但是过多无关紧要的交易仍然会消耗过多的带宽和CPU资源时,导致导致系统阻塞,影响正常交易的处理确认。 -为了保持交易的相对公平,波场网络引入了Bandwidth point 和 Energy 两种资源。 -其中带宽消耗的是Bandwidth Point,而CPU消耗的是Energy。 -**注意** -- 普通交易仅消耗Bandwidth points -- 智能合约的操作不仅要消耗Bandwidth points,还会消耗Energy - - -[1.Bandwidth Points](#1)\ -[1.1 Bandwidth Points的来源](#1.1)\ -[1.2 Bandwidth Points的消耗](#1.2)\ -[1.3 Bandwidth Points的计算规则](#1.3)\ -[2.Energy](#2)\ -[2.1 Energy的获取](#2.1)\ -[2.2 Energy的消耗](#2.2)\ -[2.3 Energy的计算规则](#2.3) -[3.资源上限自适应变更](#3)\ - -##

1.Bandwidth Points

- -交易以字节数组的形式在网络中传输及存储,一条交易消耗的Bandwidth Points = 交易字节数 * Bandwidth Points费率。当前Bandwidth Points费率 = 1。 - -如一条交易的字节数组长度为200,那么该交易需要消耗200 Bandwidth Points。 - -**注意** 由于网络中总冻结资金以及账户的冻结资金随时可能发生变化,因此账户拥有的Bandwidth Points不是固定值。 - -###

1.1 Bandwidth Points的来源

- -Bandwidth Points的获取分两种: - -- 一种是通过冻结TRX获取的Bandwidth Points, 额度 = 为获取Bandwidth Points冻结的TRX / 整个网络为获取Bandwidth Points冻结的TRX 总额 * 43_200_000_000。 -也就是所有用户按冻结TRX平分固定额度的Bandwidth Points。 - -- 还有一种是每个账号每天有固定免费额度的带宽,为5000。 - -###

1.2 Bandwidth Points的消耗

- -除了查询操作,任何交易都需要消耗bandwidth points。 - -还有一种情况,如果是转账,包括普通转账或发行Token转账,如果目标账户不存在,转账操作则会创建账户并转账,只会扣除创建账户消耗的Bandwidth Points,转账不会再消耗额外的Bandwidth Points。 - -###

1.3 Bandwidth Points的计算规则

- -Bandwidth Points是一个账户1天内能够使用的总字节数。一定时间内,整个网络能够处理的Bandwidth为确定值。 - -如果交易需要创建新账户,Bandwidth Points消耗如下: - - 1、尝试消耗交易发起者冻结获取的Bandwidth Points。如果交易发起者Bandwidth Points不足,则进入下一步。 - - 2、尝试消耗交易发起者的TRX,这部分烧掉0.1TRX。 - -如果交易是发行Token转账,Bandwidth Points消耗如下: - - 1、依次验证 发行Token资产总的免费Bandwidth Points是否足够消耗,转账发起者的Token剩余免费Bandwidth Points是否足够消耗, - Token发行者冻结TRX获取Bandwidth Points剩余量是否足够消耗。如果满足则扣除Token发行者的Bandwidth Points,任意一个不满足则进入下一步。 - - 2、尝试消耗交易发起者冻结获取的Bandwidth Points。如果交易发起者Bandwidth Points不足,则进入下一步。 - - 3、尝试消耗交易发起者的免费Bandwidth Points。如果免费Bandwidth Points也不足,则进入下一步。 - - 4、尝试消耗交易发起者的TRX,交易的字节数 * 10 sun。 - -如果交易普通交易,Bandwidth Points消耗如下: - - 1、尝试消耗交易发起者冻结获取的Bandwidth Points。如果交易发起者Bandwidth Points不足,则进入下一步。 - - 2、尝试消耗交易发起者的免费Bandwidth Points。如果免费Bandwidth Points也不足,则进入下一步。 - - 3、尝试消耗交易发起者的TRX,交易的字节数 * 10 sun。 - - -##

2.Energy

- -智能合约的创建和运行需要消耗CPU资源,用于确定智能合约在虚拟机执行过程中消耗的系统时间,单位为Energy。 - -###

2.1 Energy的获取

- -Energy只能通过冻结TRX获取,获取的Energy额度 = 为获取Energy冻结的TRX / 整个网络为获取Energy冻结的TRX 总额 * 50_000_000_000。 -也就是所有用户按冻结TRX平分固定额度的Energy。 - -例如,假设当前网络中为了Energy而冻结的TRX总量为1000_000_000TRX,一个账户冻结了1000TRX,占总冻结量的百万分之一,即32400Energy。 -一条合约执行如果需要花费324Energy,那么用户可以触发100次该合约。 - -**注意** -- 由于网络中总冻结量以及账户的冻结量随时可能发生变化,因此账户拥有的CPU资源不是固定值。 -- 冻结资金不可同时获得Bandwidth Points 与Energy,即如果指定冻结TRX获得bandwidth,Energy不会变化。 - -###

2.2 Energy的消耗

- -只有智能合约的创建和执行都需要消耗Energy,普通合约的执行不消耗Energy。 - -消耗的Energy,根据智能合约中定义的百分比,由智能合约所有者和调用者共同提供;如果智能合约所有者Energy不足,剩余的都由调用者提供。 - -###

2.3 Energy的计算规则

- -Energy的消耗规则如下: - - 1、根据智能合约中设定的百分比参数,扣除智能合约所有者通过冻结TRX获取的的Energy,不足的部分由调用者提供。 - - 2、尝试消耗交易发起者冻结获取的Energy。如果不足,有多少扣多少,然后进入下一步。 - - 3、尝试消耗交易发起者的TRX,消耗的TRX = 所需Energy * 10 sun(该值根据委员会决议的提案会浮动)。 - - -##

3.资源上限自适应变更

-注意:该功能尚未开启 - -为降低网络的使用成本,在网络资源低利用率的情况下,自适应的增加用户的可用资源。目前仅支持通过冻结获得的 Energy。 - Bandwidth不支持自适应变更。 - -通过调整Energy上限的方式,调整每个账户拥有的资源量。网络中原有字段"当前Energy上限",现在新增字段"目标Energy上限"。 - -每1分钟统计一次网络中Energy使用量,当使用量大于1min内的"目标Energy上限",增加"当前Energy上限"。增加比例为1/1000。 -反之,当使用量小于1min内的"目标Energy上限",减少"当前Energy上限"。减小比例为1/100。 - - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\351\200\232\350\257\201.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\351\200\232\350\257\201.md" deleted file mode 100644 index 4afdcd0b..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\351\200\232\350\257\201.md" +++ /dev/null @@ -1,15 +0,0 @@ -波场通证 -=== - -### 发行通证 - -在TRON网络,每个账户都可以轻松便捷地发行通证,会消耗1024TRX。发行通证的时候可以对多笔通证锁仓。 -发行通证的时候需要指定token名称、发行总量、兑换比例、发行日期、描述、网址、每账户最多消耗带宽值,总带宽消耗值以及token冻结量。 - -+ 示例: - -`assetissue abc 1000000 1 1 2018-5-31 2018-6-30 abcdef a.com 1000 1000000 200000 180 300000 365` - -以上命令的发行了名为abc的通证,发行总量为100万,abc与TRX的兑换比例为1:1,发行日期为2018-5-31至2018-6-30,描述为abcdef,网址为a.com, -每个账户每天的token转账最多消耗自己1000 bandwidth points,整个网络每天最多消耗自己1000000 bandwidth points。其中20万锁仓180天,30万锁仓365天。 - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\351\222\261\345\214\205RPC-API.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\351\222\261\345\214\205RPC-API.md" deleted file mode 100644 index cca5b7c5..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\346\263\242\345\234\272\351\222\261\345\214\205RPC-API.md" +++ /dev/null @@ -1,1109 +0,0 @@ -# 波场钱包RPC-API - -[API的具体定义请参考](#API的具体定义请参考)\ -[你可能需要经常用到的如下几个API](#你可能需要经常用到的如下几个API)\ - -[1. 获取账户信息](#1)\ -[2. 转让波场币](#2)\ -[3. 广播交易](#3)\ -[4. 创建账户](#4)\ -[5. 更新账户](#5)\ -[6. 投票](#6)\ -[7. 通证发行](#7)\ -[8. 查询超级代表候选人列表](#8)\ -[9. 申请成为超级代表候选人](#9)\ -[10. 更新超级代表候选人信息](#10)\ -[11. 转让通证](#11)\ -[12. 参与通证发行](#12)\ -[14. 查询所有通证列表](#14)\ -[13. 查询所有节点](#13)\ -[15. 查询某个账户发行的通证列表](#15)\ -[16. 按通证名称查询通证信息](#16)\ -[17. 查询当前时间有效发行的通证列表](#17)\ -[18. 获取当前区块](#18)\ -[19. 按照高度获取区块](#19)\ -[20. 获取交易总数](#20)\ -[21. 通过ID查询交易](#21)\ -[22. 通过时间查询交易(已删除)](#22)\ -[23. 通过地址查询所有发起交易](#23)\ -[24. 通过地址查询所有接收交易](#24)\ -[25. 锁定资金](#25)\ -[26. 解除资金锁定](#26)\ -[27. 赎回出块奖励](#27)\ -[28. 解冻通证](#28)\ -[29. 查询下次维护时刻](#29)\ -[30. 查询交易信息](#30)\ -[31. 根据ID查询区块](#31)\ -[32. 更新通证](#32)\ -[33. 分页查询通证列表](#33)\ -[34. 对交易进行签名](#34)\ -[35. 创建地址和秘钥](#35)\ -[36. TRX快捷转账](#36)\ -[37. 生成地址和私钥](#37)\ -[38. 转让波场币2](#38)\ -[39. 更新账户2](#39)\ -[40. 投票2](#40)\ -[41. 通证发行2](#41)\ -[42. 更新超级代表候选人信息2](#42)\ -[43. 创建账户2](#43)\ -[44. 申请成为超级代表候选人2](#44)\ -[45. 转让通证2](#45)\ -[46. 参与通证发行2](#46)\ -[47. 锁定资金2](#47)\ -[48. 解除资金锁定2](#48)\ -[49. 解冻通证2](#49)\ -[50. 赎回出块奖励2](#50)\ -[51. 更新通证2](#51)\ -[52. 获取当前区块2](#52)\ -[53. 按照高度获取区块2](#53)\ -[54. 分页获取区块2](#54)\ -[55. 查询最后区块2](#55)\ -[57. 通过地址查询所有发起交易2](#57)\ -[58. 通过地址查询所有接收交易2](#58)\ -[59. 创建交易对](#59)\ -[60. 交易所注资](#60)\ -[61. 交易所撤资](#61)\ -[62. 交易所交易](#62)\ -[63. 查询所有交易对](#63)\ -[64. 查询指定交易对](#64)\ -[65. 分页查询交易对](#65)\ -[66. 创建提议](#66)\ -[67. 赞成提议](#67)\ -[68. 删除提议](#68)\ -[69. 查询所有提议](#69)\ -[70. 分页查询提议](#70)\ -[71. 查询指定提议](#71) \ -[72. 查询资源委派账户索引](#72) \ -[73. 查询资源委派的详细信息](#73) \ -[74. 通证快捷转账](#74) \ -[75. 通证快捷转账(通过私钥)](#75) - - -##

API的具体定义请参考

- -https://github.com/tronprotocol/java-tron/blob/develop/src/main/protos/api/api.proto - -##

你可能需要经常用到的如下几个API

- -1. 如何获取账号基本信息(类比比特币 getinfo) -GetAccount -2. 如何获取余额(类比比特币:getbalance) -GetAccount -3. 如何生成一个地址(类比比特币:getnewaddress) -可以在本地生成一个地址 -可以通过一个已经存在的账号给一个新地址转账从而在区块链上生成一个新地址,通过CreateTransaction(TransferContract)完成 -4. 如何获取一个地址的历史交易(类比比特币:listtransactions) -GetTransactionsFromThis -GetTransactionsToThis -5. 如何校验地址具有正确的格式 -+ 本地校验:经过decode58check后,会得到一个长度是21的byte数组,第一个字节是0x41(mainnet) 或者 0xa0(testnet). -+ 如果想要验证一个地址是否存在于区块链上,请求API GetAccount。 - -##

1. 获取账户信息

- -1.1 接口声明 -rpc GetAccount (Account) returns (Account) {}; -1.2 提供节点 -fullnode、soliditynode。 -1.3 参数说明 -Account:只需要输入address即可。 -1.4 返回值 -Account:返回账户所有的详细信息。 -1.5 功能说明 -查询余额列表。从返回的Account中可以展示所有的资产信息。 - -##

2. 转让波场币

- -2.1 接口声明 -rpc CreateTransaction (TransferContract) returns (Transaction) {}; -2.2 提供节点 -fullnode。 -2.3 参数说明 -TransferContract:包含提供方地址、接收方地址、金额,其中金额的单位为sun。 -2.4 返回值 -Transaction:返回包含转账合约的交易,钱包签名后再请求广播交易。 -2.5 功能说明 -转账。创建一个转账的交易。 - -##

3. 广播交易

- -3.1 接口声明 -rpc BroadcastTransaction (Transaction) returns (Return) {}; -3.2 提供节点 -fullnode。 -3.3 参数说明 -Transaction:已经由钱包签名的交易。波场中需要改变区块链状态的操作都封装在交易中。 -3.4 返回值 -Return:成功或失败。广播交易前会预执行交易,返回其结果。注意:返回成功不一定保证交易成功。 -3.5 功能说明 -转账、投票、发行通证、参与通证发行等。将已签名的交易信息,发送到节点,由节点验证后广播到网络中。 - -##

4. 创建账户

- -4.1 接口声明 -rpc CreateAccount (AccountCreateContract) returns (Transaction){}; -4.2 提供节点 -fullnode。 -4.3 参数说明 -AccountCreateContract:包含账户类型、账户地址。 -4.4 返回值 -Transaction:返回包含创建账户的交易,钱包签名后再请求广播交易。 -4.5 功能说明 -创建账号并写入区块链。应该先离线生成一个地址,再通过该API激活该地址。 - -##

5. 更新账户

- -5.1 接口声明 -rpc UpdateAccount (AccountUpdateContract) returns (Transaction){}; -5.2 提供节点 -fullnode。 -5.3 参数说明 -AccountUpdateContract:包含账户名称、账户地址。 -5.4 返回值 -Transaction:返回包含更新账户的交易,钱包签名后再请求广播交易。 -5.5 功能说明 -更新账户名称。 - -##

6. 投票

- -6.1 接口声明 -rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction){}; -6.2 提供节点 -fullnode。 -6.3 参数说明 -VoteWitnessContract:包含投票人地址和一个投票对象列表(最多不能超过30个投票对象),包含候选人地址和投票数。 -6.4 返回值 -Transaction:返回包含投票的交易,钱包签名后再请求广播交易。 -6.5 功能说明 -投票功能。只能对超级代表候选人进行投票,投票总数量不能大于账户锁定资金的数量,参见25 锁定资金。 - -##

7. 通证发行

- -7.1 接口声明 -rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) {}; -7.2 提供节点 -fullnode。 -7.3 参数说明 -AssetIssueContract:包含发行人地址、通证名称、总发行量、波场币vs通证汇兑比例、开始时间、结束时间、衰减率、投票分数、详细描述、url、每账户最多消耗带宽值,总带宽消耗值以及token冻结资产。 -7.4 返回值 -Transaction:返回通证发行的交易,钱包签名后再请求广播交易。 -7.5 功能说明 -发行通证。所有人都可以发行通证,发行通证会消耗1024个trx。发行通证后,在有效期内任何人都可以参与通证发行,用trx按照比例兑换通证。 -+ 示例: - -`assetissue password abc 1000000 1 1 2018-5-31 2018-6-30 abcdef a.com 1000 1000000 200000 180 300000 365` - -以上命令的发行了名为abc的资产,发行总量为100万,abc与TRX的兑换比例为1:1,发行日期为2018-5-31至2018-6-30,描述为abcdef,网址为a.com, -每个账户每天的token转账最多消耗自己1000 bandwidth points,整个网络每天最多消耗自己1000000 bandwidth points。其中20万锁仓180天,30万锁仓365天。 - - -##

8. 查询超级代表候选人列表

- -8.1 接口声明 -rpc ListWitnesses (EmptyMessage) returns (WitnessList) {}; -8.2 提供节点 -fullnode、soliditynode。 -8.3 参数说明 -EmptyMessage:空。 -8.4 返回值 -WitnessList: Witness的列表。所有超级代表的候选人详细信息。 -8.5 功能说明 -投票前要查询所有候选人,并且展示出详细信息,供用户选择投票。 - -##

9. 申请成为超级代表候选人

- -9.1 接口声明 -rpc CreateWitness (WitnessCreateContract) returns (Transaction) {}; -9.2 提供节点 -fullnode。 -9.3 参数说明 -WitnessCreateContract:包含账户地址、Url。 -9.4 返回值 -Transaction:返回包含申请成为候选人的交易,钱包签名后再请求广播交易。 -9.5 功能说明 -每个波场用户都可以申请成为超级代表候选人。要求账户在区块链上已经创建。 - -##

10. 更新超级代表候选人信息

- -10.1 接口声明 -rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) {}; -10.2 提供节点 -fullnode。 -10.3 参数说明 -WitnessUpdateContract:包含账户地址、Url。 -10.4 返回值 -Transaction:返回包含更新候选人信息的交易,钱包签名后再请求广播交易。 -10.5 功能说明 -更新超级代表的url。 - -##

11. 转让通证

- -11.1 接口声明 -rpc TransferAsset (TransferAssetContract) returns (Transaction){}; -11.2 提供节点 -fullnode。 -11.3 参数说明 -TransferAssetContract:包含通证名称、提供方地址、接收方地址、通证数量。 -11.4 返回值 -Transaction:返回包含转让通证的交易,钱包签名后再请求广播交易。 -11.5 功能说明 -转让通证。创建一个转让通证的交易。 - -##

12. 参与通证发行

- -12.1 接口声明 -rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction){}; -12.2 提供节点 -fullnode。 -12.3 参数说明 -ParticipateAssetIssueContract:包含参与方地址、发行方地址、通证名称、参与金额,其中金额的单位为sun。 -12.4 返回值 -Transaction:返回包含参与通证发行的交易,钱包签名后再请求广播交易。 -12.5 功能说明 -参与通证发行。 - - -##

13. 查询所有节点

- -13.1 接口声明 -rpc ListNodes (EmptyMessage) returns (NodeList) {}; -13.2 提供节点 -fullnode、soliditynode。 -13.3 参数说明 -EmptyMessage:空。 -13.4 返回值 -NodeList:Node的列表,包含ip和端口。 -13.5 功能说明 -列举所有在线的节点ip和端口。 - -##

14. 查询所有通证列表

- -14.1 接口声明 -rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) {}; -14.2 提供节点 -fullnode、soliditynode。 -14.3 参数说明 -EmptyMessage:空 -14.4 返回值 -AssetIssueList: AssetIssueContract的列表。所有已发行通证详细信息。 -14.5 功能说明 -全部通证列表。展示所有通证,供用户选择参与。 - -##

15. 查询某个账户发行的通证列表

- -15.1 接口声明 -rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) {}; -15.2 提供节点 -fullnode、soliditynode。 -15.3 参数说明 -Account:只需要输入address即可 -15.4 返回值 -AssetIssueList: AssetIssueContract的列表。 -15.5 功能说明 -查询某个账户发行的所有通证。 - -##

16. 按通证名称查询通证信息

- -16.1 接口声明 -rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) {}; -16.2 提供节点 -fullnode、soliditynode。 -16.3 参数说明 -BytesMessage:通证名称。 -16.4 返回值 -AssetIssueContract:通证详细信息。 -16.5 功能说明 -按照通证名称查询通证。通证名称在波场中确保唯一。 - -##

17. 查询当前时间有效发行的通证列表

- -17.1 接口声明 -rpc GetAssetIssueListByTimestamp (NumberMessage) returns (AssetIssueList){}; -17.2 提供节点 -soliditynode。 -17.3 参数说明 -NumberMessage:当前时间。相对于1970年的毫秒数。 -17.4 返回值 -AssetIssueList: AssetIssueContract的列表。所有正在发行的通证详细信息。 -17.5 功能说明 -全部通证列表。展示当前发行通证,供用户选择参与。 - -##

18. 获取当前区块

- -18.1 接口声明 -rpc GetNowBlock (EmptyMessage) returns (Block) {}; -18.2 提供节点 -fullnode、soliditynode。 -18.3 参数说明 -EmptyMessage:空。 -18.4 返回值 -Block:当前区块信息。 -18.5 功能说明 -获取当前最新的区块。 - -##

19. 按照高度获取区块

- -19.1 接口声明 -rpc GetBlockByNum (NumberMessage) returns (Block) {}; -19.2 提供节点 -fullnode、soliditynode。 -19.3 参数说明 -NumberMessage:区块高度。 -19.4 返回值 -Block:区块信息。 -19.5 功能说明 -获取指定高度的区块,如果找不到则返回创世区块。 - -##

20. 获取交易总数

- -20.1 接口声明 -rpc TotalTransaction (EmptyMessage) returns (NumberMessage) {}; -20.2 提供节点 -fullnode、soliditynode。 -20.3 参数说明 -EmptyMessage:空。 -20.4 返回值 -NumberMessage:交易总数。 -20.5 功能说明 -获取交易的总数量。 - -##

21. 通过ID查询交易

- -21.1 接口声明 -rpc getTransactionById (BytesMessage) returns (Transaction) {}; -21.2 提供节点 -soliditynode。 -21.3 参数说明 -BytesMessage:交易ID,也就是其Hash值。 -21.4 返回值 -Transaction:被查询的交易。 -21.5 功能说明 -通过ID查询交易的详细信息,ID就是交易数据的Hash值。 - -##

22. 通过时间查询交易(已删除)

- -22.1 接口声明 -rpc getTransactionsByTimestamp (TimeMessage) returns (TransactionList) {}; -22.2 提供节点 -soliditynode。 -22.3 参数说明 -TimeMessage:包含开始时间和结束时间。 -22.4 返回值 -TransactionList:交易列表。 -22.5 功能说明 -通过起止时间查询所有发生的交易。 - -##

23. 通过地址查询所有发起交易(新版本将不再支持)

- -23.1 接口声明 -rpc getTransactionsFromThis (Account) returns (TransactionList) {}; -23.2 提供节点 -soliditynode。 -23.3 参数说明 -Account:发起方账户,只需要地址。 -23.4 返回值 -TransactionList:交易列表。 -23.5 功能说明 -通过账户地址查询所有发起的交易。 -23.6 备注说明 -该接口在新版本节点中将不再提供,如需要该功能,可以使用中心节点提供的接口,47.90.247.237:8091/walletextension/gettransactionsfromthis, -使用参考getTransactionsFromThis。 - -##

24. 通过地址查询所有接收交易(新版本将不再支持)

- -24.1 接口声明 -rpc getTransactionsToThis (Account) returns (NumberMessage) {}; -24.2 提供节点 -soliditynode。 -24.3 参数说明 -Account:接收方账户,只需要地址。 -24.4 返回值 -TransactionList:交易列表。 -24.5 功能说明 -通过账户地址查询所有其它账户发起和本账户有关的交易。 -24.6 备注说明 -该接口在新版本节点中将不再提供,如需要该功能,可以使用中心节点提供的接口,47.90.247.237:8091/walletextension/gettransactionstothis, -使用参考getTransactionsToThis。 - -##

25. 锁定资金

- -25.1 接口声明 -rpc FreezeBalance (FreezeBalanceContract) returns (Transaction) {}; -25.2 提供节点 -fullnode。 -25.3 参数说明 -FreezeBalanceContract:包含地址、锁定资金、锁定时间。目前锁定时间只能是3天。 -25.4 返回值 -Transaction:返回包含资金的交易,钱包签名后再请求广播交易。 -25.5 功能说明   -锁定资金将带来两个收益: -a.获得带宽。 -b.获得投票的权利。 - -##

26. 解除资金锁定

- -26.1 接口声明 -rpc UnfreezeBalance (UnfreezeBalanceContract) returns (Transaction) {}; -26.2 提供节点 -fullnode。 -26.3 参数说明 -UnfreezeBalanceContract:包含地址。 -26.4 返回值 -Transaction:返回交易,钱包签名后再请求广播交易。 -26.5 功能说明   -锁定资金3天之后才允许解除锁定。解除锁定,将清除投票记录和带宽。 - -##

27. 赎回出块奖励

- -27.1 接口声明 -rpc WithdrawBalance (WithdrawBalanceContract) returns (Transaction) {}; -27.2 提供节点 -fullnode。 -27.3 参数说明 -WithdrawBalanceContract:包含地址。 -27.4 返回值 -Transaction:返回交易,钱包签名后再请求广播交易。 -27.5 功能说明   -本接口仅提供给超级代表。超级代表记账成功后,将获得奖励,奖励不直接增加到账户余额上。每24小时允许提取一次到账户余额。 - -##

28. 解冻通证

- -28.1 接口声明 -rpc UnfreezeAsset (UnfreezeAssetContract) returns (Transaction) {}; -28.2 提供节点 -fullnode。 -28.3 参数说明 -UnfreezeAssetContract:包含地址。 -28.4 返回值 -Transaction:返回交易,钱包签名后再请求广播交易。 -28.5 功能说明 -通证发行者解冻发行时冻结的通证。 - -##

29. 查询下次维护时刻

- -29.1 接口声明 -rpc GetNextMaintenanceTime (EmptyMessage) returns (NumberMessage) {}; -29.2 提供节点 -fullnode。 -29.3 参数说明 -EmptyMessage:无需参数 -29.4 返回值 -NumberMessage:下次维护时刻 -29.5 功能说明 -获取下次维护时刻 - -##

30. 查询交易信息

- -30.1 接口声明 -rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) {}; -30.2 提供节点 -soliditynode。 -30.3 参数说明 -BytesMessage:交易ID -30.4 返回值 -TransactionInfo:交易信息 -30.5 功能说明 -查询交易的费用、所在区块、所在区块时间戳 - -##

31. 根据ID查询区块

-31.1 接口声明 -rpc GetBlockById (BytesMessage) returns (Block) {}; -31.2 提供节点 -fullnode。 -31.3 参数说明 -BytesMessage:区块ID -31.4 返回值 -Block:区块 -31.5 功能说明 -根据输入的区块的ID查询区块 - -##

32. 更新通证

-32.1 接口声明 -rpc UpdateAsset (UpdateAssetContract) returns (Transaction) {}; -32.2 提供节点 -fullnode。 -32.3 参数说明 -UpdateAssetContract:包括通证发行者的地址、通证的描述、通证的url、每账户最多消耗带宽值、总带宽消耗值 -32.4 返回值 -Transaction:返回交易,钱包签名后再请求广播交易。 -32.5 功能说明 -只能由通证发行者发起,更新通证的描述、通证的url、每账户最多消耗带宽值、总带宽消耗值 - -##

33. 分页查询通证列表

-33.1 接口声明 -rpc GetPaginatedAssetIssueList (PaginatedMessage) returns (AssetIssueList) {}; -33.2 提供节点 -fullnode、soliditynode。 -33.3 参数说明 -PaginatedMessage:起始查询下标 (从下标0开始计算), 一页所取得的通证个数 -33.4 返回值 -AssetIssueList: AssetIssueContract的分页列表,发行通证详细信息。 -33.5 功能说明 -分页通证列表。分页展示通证,供用户选择参与。 - -##

34. 对交易进行签名

-34.1 接口说明 -rpc GetTransactionSign (TransactionSign) returns (Transaction) {}; -34.2 提供节点 -fullnode -34.3 参数说明 -TransactionSign:待签名Transaction对象和签名用的private key -34.4 返回值 -Transaction:签名的Transaction对象 - -##

35. 创建地址和秘钥

-35.1 接口说明 -rpc CreateAdresss (BytesMessage) returns (BytesMessage) {}; -35.2 提供节点 -fullnode -35.3 参数说明 -BytesMessage:Passphrase -35.4 返回值 -BytesMessage:地址 - -##

36. TRX快捷转账

-36.1 接口说明 -rpc EasyTransfer (EasyTransferMessage) returns (EasyTransferResponse) {}; -36.2 提供节点 -fullnode -36.3 参数说明 -EasyTransferMessage:转账用的密码,toAddress,转账的数量 -36.4 返回值 -EasyTransferResponse:转账创建的transaction,交易ID,以及广播的结果result - -##

37. 生成地址和私钥

-37.1 接口说明 -rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) {}; -37.2 提供节点 -fullnode, soliditynode -37.3 参数说明 -EmptyMessage:空 -37.4 返回值 -AddressPrKeyPairMessage:生成地址,生成私钥 -37.5 功能说明 -可用于生成地址和私钥,请务必仅在受信断网节点调用,以免私钥外泄 - -##

38. 转让波场币2

-38.1 接口声明 -rpc CreateTransaction2 (TransferContract) returns (TransactionExtention) {}; -38.2 提供节点 -fullnode。 -38.3 参数说明 -TransferContract:包含提供方地址、接收方地址、金额,其中金额的单位为sun。 -38.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -38.5 功能说明 -转账。创建一个转账的交易。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

39. 更新账户2

- -39.1 接口声明 -rpc UpdateAccount2 (AccountUpdateContract) returns (TransactionExtention){}; -39.2 提供节点 -fullnode。 -39.3 参数说明 -AccountUpdateContract:包含账户名称、账户地址。 -39.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -39.5 功能说明 -更新账户名称。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

40. 投票2

- -40.1 接口声明 -rpc VoteWitnessAccount2 (VoteWitnessContract) returns (TransactionExtention){}; -40.2 提供节点 -fullnode。 -40.3 参数说明 -VoteWitnessContract:包含投票人地址和一个投票对象列表(最多不能超过30个投票对象),包含候选人地址和投票数。 -40.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -40.5 功能说明 -投票功能。只能对超级代表候选人进行投票,投票总数量不能大于账户锁定资金的数量,参见25 锁定资金。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

41. 通证发行2

- -41.1 接口声明 -rpc CreateAssetIssue2 (AssetIssueContract) returns (TransactionExtention) {}; -41.2 提供节点 -fullnode。 -41.3 参数说明 -AssetIssueContract:包含发行人地址、通证名称、总发行量、波场币vs通证汇兑比例、开始时间、结束时间、衰减率、投票分数、详细描述、url、每账户最多消耗带宽值,总带宽消耗值以及token冻结资产。 -41.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -41.5 功能说明 -发行通证。所有人都可以发行通证,发行通证会消耗1024个trx。发行通证后,在有效期内任何人都可以参与通证发行,用trx按照比例兑换通证。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -+ 示例: - -`assetissue password abc 1000000 1 1 2018-5-31 2018-6-30 abcdef a.com 1000 1000000 200000 180 300000 365` - -以上命令的发行了名为abc的资产,发行总量为100万,abc与TRX的兑换比例为1:1,发行日期为2018-5-31至2018-6-30,描述为abcdef,网址为a.com, -每个账户每天的token转账最多消耗自己1000 bandwidth points,整个网络每天最多消耗自己1000000 bandwidth points。其中20万锁仓180天,30万锁仓365天。 - -##

42. 更新超级代表候选人信息2

- -42.1 接口声明 -rpc UpdateWitness2 (WitnessUpdateContract) returns (TransactionExtention) {}; -42.2 提供节点 -fullnode。 -42.3 参数说明 -WitnessUpdateContract:包含账户地址、Url。 -42.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -42.5 功能说明 -更新超级代表的url。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

43. 创建账户2

- -43.1 接口声明 -rpc CreateAccount2 (AccountCreateContract) returns (TransactionExtention){}; -43.2 提供节点 -fullnode。 -43.3 参数说明 -AccountCreateContract:包含账户类型、账户地址。 -43.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -43.5 功能说明 -创建账号并写入区块链。应该先离线生成一个地址,再通过该API激活该地址。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

44. 申请成为超级代表候选人2

- -44.1 接口声明 -rpc CreateWitness2 (WitnessCreateContract) returns (TransactionExtention) {}; -44.2 提供节点 -fullnode。 -44.3 参数说明 -WitnessCreateContract:包含账户地址、Url。 -44.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -44.5 功能说明 -每个波场用户都可以申请成为超级代表候选人。要求账户在区块链上已经创建。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

45. 转让通证2

- -45.1 接口声明 -rpc TransferAsset2 (TransferAssetContract) returns (TransactionExtention){}; -45.2 提供节点 -fullnode。 -45.3 参数说明 -TransferAssetContract:包含通证名称、提供方地址、接收方地址、通证数量。 -45.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -45.5 功能说明 -转让通证。创建一个转让通证的交易。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

46. 参与通证发行2

- -46.1 接口声明 -rpc ParticipateAssetIssue2 (ParticipateAssetIssueContract) returns (TransactionExtention){}; -46.2 提供节点 -fullnode。 -46.3 参数说明 -ParticipateAssetIssueContract:包含参与方地址、发行方地址、通证名称、参与金额,其中金额的单位为sun。 -46.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -46.5 功能说明 -参与通证发行。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

47. 锁定资金2

- -47.1 接口声明 -rpc FreezeBalance2 (FreezeBalanceContract) returns (TransactionExtention) {}; -47.2 提供节点 -fullnode。 -47.3 参数说明 -FreezeBalanceContract:包含地址、锁定资金、锁定时间。目前锁定时间只能是3天。 -47.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -47.5 功能说明   -锁定资金将带来两个收益: -a.获得带宽。 -b.获得投票的权利。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

48. 解除资金锁定2

- -48.1 接口声明 -rpc UnfreezeBalance2 (UnfreezeBalanceContract) returns (TransactionExtention) {}; -48.2 提供节点 -fullnode。 -48.3 参数说明 -UnfreezeBalanceContract:包含地址。 -48.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -48.5 功能说明   -锁定资金3天之后才允许解除锁定。解除锁定,将清除投票记录和带宽。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

49. 解冻通证2

- -49.1 接口声明 -rpc UnfreezeAsset2 (UnfreezeAssetContract) returns (TransactionExtention) {}; -49.2 提供节点 -fullnode。 -49.3 参数说明 -UnfreezeAssetContract:包含地址。 -49.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -49.5 功能说明 -通证发行者解冻发行时冻结的通证。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

50. 赎回出块奖励2

- -50.1 接口声明 -rpc WithdrawBalance2 (WithdrawBalanceContract) returns (TransactionExtention) {}; -50.2 提供节点 -fullnode。 -50.3 参数说明 -WithdrawBalanceContract:包含地址。 -50.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -50.5 功能说明   -本接口仅提供给超级代表。超级代表记账成功后,将获得奖励,奖励不直接增加到账户余额上。每24小时允许提取一次到账户余额。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

51. 更新通证2

-51.1 接口声明 -rpc UpdateAsset2 (UpdateAssetContract) returns (TransactionExtention) {}; -51.2 提供节点 -fullnode。 -51.3 参数说明 -UpdateAssetContract:包括通证发行者的地址、通证的描述、通证的url、每账户最多消耗带宽值、总带宽消耗值 -51.4 返回值 -TransactionExtention:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -51.5 功能说明 -只能由通证发行者发起,更新通证的描述、通证的url、每账户最多消耗带宽值、总带宽消耗值 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

52. 获取当前区块2

- -52.1 接口声明 -rpc GetNowBlock2 (EmptyMessage) returns (BlockExtention) {}; -52.2 提供节点 -fullnode、soliditynode。 -52.3 参数说明 -EmptyMessage:空。 -52.4 返回值 -BlockExtention:当前区块信息,包含区块id。 -52.5 功能说明 -获取当前最新的区块。 - -##

53. 按照高度获取区块2

- -53.1 接口声明 -rpc GetBlockByNum2 (NumberMessage) returns (BlockExtention) {}; -53.2 提供节点 -fullnode、soliditynode。 -53.3 参数说明 -NumberMessage:区块高度。 -53.4 返回值 -BlockExtention:区块信息,包含区块id。 -53.5 功能说明 -获取指定高度的区块,如果找不到则返回创世区块。 - -##

54. 分页获取区块2

- -54.1 接口声明 -rpc GetBlockByLimitNext2 (BlockLimit) returns (BlockListExtention) {}; -54.2 提供节点 -fullnode -54.3 参数说明 -BlockLimit:区块起止范围。 -54.4 返回值 -BlockListExtention:区块列表。 -54.5 功能说明 -根据范围查询区块,用与分页查询所有区块。 - -##

55. 查询最后区块2

- -55.1 接口声明 -rpc GetBlockByLatestNum2 (NumberMessage) returns (BlockListExtention) {}; -55.2 提供节点 -fullnode -55.3 参数说明 -NumberMessage:需要查询的区块数量。 -55.4 返回值 -BlockListExtention:区块列表。 -55.5 功能说明 -查询最后的一定数量的区块。 - -##

56. 对交易进行签名2

-56.1 接口说明 -rpc GetTransactionSign2 (TransactionSign) returns (TransactionExtention) {}; -56.2 提供节点 -fullnode -56.3 参数说明 -TransactionSign:待签名Transaction对象和签名用的private key -56.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -56.5 功能说明 -使用API对交易进行签名。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -##

57. 通过地址查询所有发起交易2

- -57.1 接口声明 -GetTransactionsFromThis2 (AccountPaginated) returns (TransactionListExtention) {}; -57.2 提供节点 -soliditynode。 -57.3 参数说明 -AccountPaginated:发起方账户地址及查询范围。 -57.4 返回值 -TransactionListExtention:交易列表。 -57.5 功能说明 -通过账户地址查询所有发起的交易。 - -##

58. 通过地址查询所有接收交易2

- -58.1 接口声明 -rpc GetTransactionsFromThis2 (AccountPaginated) returns (TransactionListExtention) {}; -58.2 提供节点 -soliditynode。 -58.3 参数说明 -AccountPaginated:发起方账户地址及查询范围。 -58.4 返回值 -TransactionListExtention:交易列表。 -58.5 功能说明 -通过账户地址查询所有其它账户发起和本账户有关的交易。 - -##

59. 创建交易对

- -59.1 接口声明 -rpc ExchangeCreate (ExchangeCreateContract) returns (TransactionExtention) {}; -59.2 提供节点 -fullnode。 -59.3 参数说明 -first_token_id,第1种token的id -first_token_balance,第1种token的balance -second_token_id,第2种token的id -second_token_balance,第2种token的balance -59.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -59.5 功能说明 -创建交易对 - - -##

60. 交易所注资

- -60.1 接口声明 -rpc ExchangeInject (ExchangeInjectContract) returns (TransactionExtention) {}; -60.2 提供节点 -fullnode。 -60.3 参数说明 -exchange_id:交易对id -token_id:注资的token的id -quant:注资数量 -60.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -60.5 功能说明 -对交易对进行注资 - -##

61. 交易所撤资

- -61.1 接口声明 -rpc ExchangeWithdraw (ExchangeWithdrawContract) returns (TransactionExtention) {}; -61.2 提供节点 -fullnode。 -61.3 参数说明 -exchange_id:交易对id -token_id:撤资的token的id -quant:撤资数量 -61.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -61.5 功能说明 -对交易对进行撤资 - - -##

62. 交易所交易

- -62.1 接口声明 -rpc ExchangeTransaction (ExchangeTransactionContract) returns (TransactionExtention) {}; -62.2 提供节点 -fullnode。 -62.3 参数说明 -exchange_id:交易对id -token_id:撤资的token的id -quant:撤资数量 -expected:期望得到的另一个token的最小金额 -62.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -62.5 功能说明 -交易 - -##

63. 查询所有交易对

- -63.1 接口声明 -rpc ListExchanges (EmptyMessage) returns (ExchangeList) {}; -63.2 提供节点 -fullnode。 -63.3 参数说明 -无 -63.4 返回值 -ExchangeList:所有交易对。 -63.5 功能说明 - -##

64. 查询指定交易对

- -64.1 接口声明 -rpc GetExchangeById (BytesMessage) returns (Exchange) {}; -64.2 提供节点 -fullnode。 -64.3 参数说明 -value:交易对id -64.4 返回值 -Exchange:交易对。 -64.5 功能说明 - -##

65. 分页查询交易对

- -65.1 接口声明 -rpc GetPaginatedExchangeList (PaginatedMessage) returns (ExchangeList) {}; -65.2 提供节点 -fullnode。 -65.3 参数说明 -offset:偏移量 -limit:个数限制 -65.4 返回值 -Exchange:交易对。 -65.5 功能说明 - -##

66. 创建提议

- -66.1 接口声明 -rpc ProposalCreate (ProposalCreateContract) returns (TransactionExtention) {}; -66.2 提供节点 -fullnode。 -66.3 参数说明 -parameters:提议参数 -66.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -66.5 功能说明 - -##

67. 赞成提议

- -67.1 接口声明 -rpc ProposalApprove (ProposalApproveContract) returns (TransactionExtention) {}; -67.2 提供节点 -fullnode。 -67.3 参数说明 -proposal_id :提议id -is_add_approval :赞成或取消赞成 -67.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -67.5 功能说明 - -##

68. 删除提议

- -68.1 接口声明 -rpc ProposalDelete (ProposalDeleteContract) returns (TransactionExtention) {}; -68.2 提供节点 -fullnode。 -68.3 参数说明 -proposal_id :提议id -68.4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -68.5 功能说明 - -##

69. 查询所有提议

- -69.1 接口声明 -rpc ListProposals (EmptyMessage) returns (ProposalList) {}; -69.2 提供节点 -fullnode。 -69.3 参数说明 -无 -69.4 返回值 -ProposalList:提议列表 -69.5 功能说明 - -##

70. 分页查询提议

- -70.1 接口声明 -rpc GetPaginatedProposalList (PaginatedMessage) returns (ProposalList) {}; -70.2 提供节点 -fullnode。 -70.3 参数说明 -offset:偏移量 -limit:个数限制 -70.4 返回值 -ProposalList:提议列表 -70.5 功能说明 - -##

71. 查询指定提议

- -71.1 接口声明 -rpc GetProposalById (BytesMessage) returns (Proposal) {}; -71.2 提供节点 -fullnode。 -71.3 参数说明 -proposal_id :提议id -71.4 返回值 -ProposalList:提议列表 -71.5 功能说明 - -##

72. 查询资源委派账户索引

- -72.1 接口声明 -rpc GetDelegatedResourceAccountIndex (BytesMessage) returns (DelegatedResourceAccountIndex) { };\ -72.2 提供节点 -fullnode。 -72.3 参数说明 -BytesMessage :查询的账户地址\ -72.4 返回值 -account:查询的地址 \ -fromAccounts:从哪些账户中获得了资源 \ -toAccounts:给哪些账户中委派了资源\ -72.5 功能说明 - -##

73. 查询资源委派的详细信息

- -73.1 接口声明 -rpc GetDelegatedResource (DelegatedResourceMessage) returns (DelegatedResourceList) { - };\ -73.2 提供节点 -fullnode。 -73.3 参数说明 -fromAddress :资源委派发起地址 \ -toAddress :资源委派接受地址\ -73.4 返回值 -DelegatedResourceList:只包含一个元素 \ -from:发起资源委派的地址\ -to:接受资源委派的地址\ -frozen_balance_for_bandwidth:委派的带宽\ -frozen_balance_for_energy:委派的energy\ -expire_time_for_bandwidth:委派的带宽解冻时间\ -expire_time_for_energy:委派的energy解冻时间\ -73.5 功能说明 - -##

74. 通证快捷转账

- -74.1 接口说明 -rpc EasyTransferAsset (EasyTransferAssetMessage) returns (EasyTransferResponse) {}; -74.2 提供节点 -fullnode -74.3 参数说明 -EasyTransferAssetMessage:转账用的密码,toAddress,通证ID,转账的数量 -74.4 返回值 -EasyTransferResponse:转账创建的transaction,交易ID,以及广播的结果result - -##

75. 通证快捷转账(通过私钥)

- -75.1 接口说明 -rpc EasyTransferAssetByPrivate (EasyTransferAssetByPrivateMessage) returns (EasyTransferResponse) {}; -75.2 提供节点 -fullnode -75.3 参数说明 -EasyTransferAssetByPrivateMessage:转账用的私钥,toAddress,通证ID,转账的数量 -75.4 返回值 -EasyTransferResponse:转账创建的transaction,交易ID,以及广播的结果result diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\350\266\205\347\272\247\344\273\243\350\241\250\344\270\216\345\247\224\345\221\230\344\274\232.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\350\266\205\347\272\247\344\273\243\350\241\250\344\270\216\345\247\224\345\221\230\344\274\232.md" deleted file mode 100644 index 673c0fa9..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\350\266\205\347\272\247\344\273\243\350\241\250\344\270\216\345\247\224\345\221\230\344\274\232.md" +++ /dev/null @@ -1,117 +0,0 @@ - -[1.超级代表](#1)\ -[1.1 申请成为超级代表候选人规则](#1.1)\ -[1.2 选举超级代表](#1.2)\ -[1.3 奖励](#1.3)\ -[2.委员会](#2)\ -[2.1 什么是委员会](#2.1)\ -[2.2 创建提议](#2.2)\ -[2.3 对提议进行投票](#2.3)\ -[2.4 取消提议](#2.4) - -#

1.超级代表

- -##

1.1 申请成为超级代表候选人规则

- - 在TRON网络中,任何账户都可以申请成为超级代表候选人,都有机会成为超级代表。每个账户都可以投票给超级代表候选人,获取投票数最高的27个超级代表候选人就是超级代表。就具有出链块的权利。 - 投票统计每6小时统计一次,超级代表也就每6个小时变更一次。 - - 为了防止恶意攻击,成为超级代表候选人也需要一定代价的。TRON网络将直接烧掉申请者账户9999TRX。申请成功后,您就可以竞选超级代表了。 - -##

1.2 选举超级代表

- - 投票需要TRON Power(TP),你的TRON Power(TP)的多少由当前冻结资金决定。TRON Power(TP)的计算方法:每冻结1TRX,就可以获得1单位TRON Power(TP)。 - - TRON网络中的每一个账户都具有选举权,可以通过投票选出自己认同的超级代表了。 - - 在解冻后,你没有了冻结的资产,相应地失去了所有的TRON Power(TP),因此以前的投票会失效。你可以通过重新冻结并投票来避免投票失效。 - -注意: 波场网络只记录你最后一次投票的状态,也就是说你的每一次投票都会覆盖以前所有的投票效果 - -+ 示例: - -``` -freezebalance 10,000,000 3 // 冻结了10TRX,获取了10单位TRON Power(TP) -votewitness witness1 4 witness2 6 // 同时给witness1投了4票,给witness2投了6票 -votewitness witness1 3 witness2 7 // 同时给witness1投了3票,给witness2投了7票 -``` - -以上命令的最终结果是给witness1投了3票,给witness2投了7票 - -##

1.3 奖励

- -1. 票数奖励,每6小时,票数排名前127名的超级代表会获得共计115,200 TRX的票数奖励,这部分奖励将按照票数比例分发。每年的票数奖励总计168,192,000 TRX。 - -2. 出块奖励,波场协议网络每3秒中会出一个区块,每个区块将给予超级代表32个TRX奖励,每年总计336,384,000 TRX将会被奖励给超级代表。 - -+ 超级代表每次出块完成后,出块奖励都会发到超级代表的子账号当中,超级代表不能直接使用这部分资产,但可以查询。 每24h允许一次提取操作。从该子账号转移到超级代表的账户中。 - -#

2.委员会

- -###

2.1 什么是委员会

-委员会用于修改Tron网络动态参数,如出块奖励、交易费用等等。委员会由当前的27个超级代表组成。每个超级代表都具有提议权、对提议的投票权, -当提议获得19个代表及以上的赞成票时,该提议获得通过,并在下个维护期内进行网络参数修改。 - -###

2.2 创建提议

-只有超级代表对应账户具有提议权,其他账户无法创建提议。允许修改的网络动态参数以及编号如下( [min,max] ): -- 0: MAINTENANCE_TIME_INTERVAL, [3 * 27* 1000 ,24 * 3600 * 1000] //修改超级代表调整时间间隔,目前为6 * 3600 * 1000ms -- 1: ACCOUNT_UPGRADE_COST, [0,100 000 000 000 000 000] //修改账户升级为超级代表的费用,目前为9999_000_000 Sun -- 2: CREATE_ACCOUNT_FEE, [0,100 000 000 000 000 000] // 修改创建账户费用,目前为100_000Sun -- 3: TRANSACTION_FEE, [0,100 000 000 000 000 000] // 修改TRX抵扣带宽的费用,目前为10Sun/byte -- 4: ASSET_ISSUE_FEE, [0,100 000 000 000 000 000] // 修改资产发行费用,目前为1024_000_000 Sun -- 5: WITNESS_PAY_PER_BLOCK, [0,100 000 000 000 000 000] // 修改超级代表出块奖励,目前为32_000_000 Sun -- 6: WITNESS_STANDBY_ALLOWANCE, [0,100 000 000 000 000 000] // 修改分给前127名超级代表候选人的奖励,115_200_000_000 Sun -- 7: CREATE_NEW_ACCOUNT_FEE_IN_SYSTEM_CONTRACT, []// 修改系统创建账户的费用,目前为0 Sun -- 8: CREATE_NEW_ACCOUNT_BANDWIDTH_RATE, // 提议7、8,组合使用,用于修改创建账户时对资源或TRX的消耗 -- 9: ALLOW_CREATION_OF_CONTRACTS, // 用于控制虚拟机功能的开启 -- 10: REMOVE_THE_POWER_OF_THE_GR // 用于清除GR的创世票数 -- 11: ENERGY_FEE, [0,100 000 000 000 000 000] //sun -- 12: EXCHANGE_CREATE_FEE, [0,100 000 000 000 000 000] //sun -- 13: MAX_CPU_TIME_OF_ONE_TX, [0, 1000] //ms -- 14: ALLOW_UPDATE_ACCOUNT_NAME, // 用于允许用户更改昵称以及昵称同名,目前为0,表示不允许 -- 15: ALLOW_SAME_TOKEN_NAME, // 用于允许创建相同名称的token,目前为0,表示不允许 -- 16: ALLOW_DELEGATE_RESOURCE, // 用于允许资源委派,目前为0,表示不允许 -- 18: ALLOW_TVM_TRANSFER_TRC10, // 用于允许虚拟机转TRC10,0表示不允许 -- 19: TOTAL_ENERGY_LIMIT, // 用于修改ENERGY总量 -- 20: ALLOW_MULTI_SIGN, // 用于多重签名,目前为0,表示不允许 (V3.5) -- 21: ALLOW_ADAPTIVE_ENERGY, // 用于允许ENERGY总量自适应调整,目前为0,表示不允许 (V3.5) -- 22: UPDATE_ACCOUNT_PERMISSION_FEE, // 用于修改账户权限费用,目前为100TRX (V3.5) -- 23: MULTI_SIGN_FEE, // 用于修改多重签名费用,目前为1TRX (V3.5) - - -+ API: -` -createproposal id0 value0 ... idN valueN -id0_N: 参数编号 -value0_N: 新参数值 -` - -注:Tron网络中,1 TRX = 1000_000 Sun。 - -###

2.3 对提议进行投票

-提议仅支持投赞成票,不投票代表不赞同。从提议创建时间开始,3天时间内为提议的有效期。超过该时间范围,该提议如果没有获得足够的 -赞成票,该提议失效。允许取消之前投的赞成票。 - - -+ API: -` -approveProposal id is_or_not_add_approval -id: 提议Id,根据提议创建时间递增 -is_or_not_add_approval: 赞成或取消赞成 -` - -###

2.4 取消提议

-提议创建者,能够在提议生效前,取消提议。 - -+ API: -` -deleteProposal proposalId -id: 提议Id,根据提议创建时间递增 -` - -### 查询提议 - -以下接口可以查询提议,包括: -查询所有提议信息(ListProposals)、分页查询提议信息(GetPaginatedProposalList),查询指定提议信息(GetProposalById)。 -相关api详情,请查询[波场RPC-API说明](波场钱包RPC-API.md)。 - \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\350\275\254\350\256\251\346\263\242\345\234\272\345\270\201\345\217\212TRC10\346\216\245\345\217\243\350\257\264\346\230\216.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\350\275\254\350\256\251\346\263\242\345\234\272\345\270\201\345\217\212TRC10\346\216\245\345\217\243\350\257\264\346\230\216.md" deleted file mode 100644 index 5cfd6762..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\345\215\217\350\256\256/\350\275\254\350\256\251\346\263\242\345\234\272\345\270\201\345\217\212TRC10\346\216\245\345\217\243\350\257\264\346\230\216.md" +++ /dev/null @@ -1,306 +0,0 @@ -转让波场币及TRC10接口说明 -=== - -# 转让波场币 -## RPC - -1 接口声明 -`rpc CreateTransaction2 (TransferContract) returns (TransactionExtention) {}; ` - -2 提供节点 -fullnode。 -3 参数说明 -`TransferContract`:包含提供方地址、接收方地址、金额,其中金额的单位为sun。 -4 返回值 -`TransactionExtention`:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -5 功能说明 -转账。创建一个转账的交易。\ -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -## HTTP - -`/wallet/createtransaction\` - -Function:Creates a transaction of transfer. If the recipient address does not exist, a corresponding account will be created on the blockchain.\ -demo: \ -`curl -X POST http://127.0.0.1:8090/wallet/createtransaction -d '{"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount": 1000 }'` - -Parameters:\ -`To_address` is the transfer address, converted to a hex string;\ -`owner_address` is the transfer transfer address, converted to a hex string\ -`amount` is the transfer amount\ - -Return value:Transaction contract data - - -# 转让TRC10 - -## RPC -1 接口声明 -`rpc TransferAsset2 (TransferAssetContract) returns (TransactionExtention){};` -2 提供节点 -fullnode。 -3 参数说明 -`TransferAssetContract`:包含TRC10名称、提供方地址、接收方地址、TRC10数量。 -4 返回值 -`TransactionExtention`:返回交易、交易ID、操作结果等。钱包对交易签名后再请求广播交易。 -5 功能说明 -转让TRC10。创建一个转让TRC10的交易。 -注意,凡带xxx2的接口,与xxx接口功能相同,只是返回值增加更详细的提示。如果result的result值为false,则message为错误提示,transaction和txid字段忽略。constant_result只和职能合约调用有关,其他交易忽略。 - -## HTTP - -`/wallet/transferasset` - -Function:Transfer Token\ -demo:\ -`curl -X POST http://127.0.0.1:8090/wallet/transferasset -d '{"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "asset_name": "6173736574497373756531353330383934333132313538", "amount": 100}'` - -Parameters:\ -`Owner_address` is the address of the withdrawal account, converted to a hex string;\ -`To_address` is the recipient address,converted to a hex string;\ -`asset_name` ,this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format.\ -`Amount` is the amount of token to transfer - -Return value:Token transfer Transaction raw data - -# 参与TRC10 - -## RPC -1 接口声明 -rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction){}; -2 提供节点 -fullnode。 -3 参数说明 -ParticipateAssetIssueContract:包含参与方地址、发行方地址、通证名称、参与金额,其中金额的单位为sun。 -4 返回值 -Transaction:返回包含参与通证发行的交易,钱包签名后再请求广播交易。 -5 功能说明 -参与通证发行。 - -## HTTP - -`/wallet/participateassetissue` - -Function:Purchase a Token\ -demo:\ -`curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ -"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"amount":100, -"asset_name":"3230313271756265696a696e67" -}'` - -Parameters:\ -`to_address` is the address of the Token issuer,converted to a hex string\ -`owner_address` is the address of the Token owner,converted to a hex string\ -`amount` is the number of tokens created\ -`asset_name` ,this field is token name before the proposal ALLOW_SAME_TOKEN_NAME is active, otherwise it is token id and token is should be in string format.\ - -Return value:Token creation Transaction raw data - - -# 创建交易对 - -## RPC - -1 接口声明 -rpc ExchangeCreate (ExchangeCreateContract) returns (TransactionExtention) {}; -2 提供节点 -fullnode。 -3 参数说明 -first_token_id,第1种token的id -first_token_balance,第1种token的balance -second_token_id,第2种token的id -second_token_balance,第2种token的balance -4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -5 功能说明 -创建交易对 - -## HTTP - -`wallet/exchangecreate\` -作用:创建交易对\ -`demo:curl -X POST http://127.0.0.1:8090/wallet/exchangecreate -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", 、 -"first_token_id":token_a, "first_token_balance":100, "second_token_id":token_b,"second_token_balance":200}`\ -参数说明:\ -`first_token_id` :第1种token的id\ -`first_token_balance`:第1种token的balance\ -`second_token_id` : 第2种token的id\ -`second_token_balance`:第2种token的balance\ -返回值:创建交易对的transaction。 - -# 交易所注资 - -## RPC - -1 接口声明 -rpc ExchangeInject (ExchangeInjectContract) returns (TransactionExtention) {}; -2 提供节点 -fullnode。 -3 参数说明 -exchange_id:交易对id -token_id:注资的token的id -quant:注资数量 -4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -5 功能说明 -对交易对进行注资 - -## HTTP - -`wallet/exchangeinject`\ -作用:给交易对注资,注资后可以防止交易对价格波动太大\ -`demo:curl -X POST http://127.0.0.1:8090/wallet/exchangeinject -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100}`\ - -参数说明:\ -`owner_address`:交易对创建者的地址,hexString格式\ -`exchange_id`:交易对id\ -`token_id`: token的id,一般情况是token的name,需要是hexString格式\ -`quant`:注资token的数量\ -返回值:注资的transaction。 - -# 交易所撤资 - -## RPC - -1 接口声明 -rpc ExchangeWithdraw (ExchangeWithdrawContract) returns (TransactionExtention) {}; -2 提供节点 -fullnode。 -3 参数说明 -exchange_id:交易对id -token_id:撤资的token的id -quant:撤资数量 -4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -5 功能说明 -对交易对进行撤资 - -## HTTP - -`wallet/exchangewithdraw`\ -作用:对交易对撤资,撤资后容易引起交易对价格波动太大。\ -`demo:curl -X POST http://127.0.0.1:8090/wallet/exchangewithdraw -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100}`\ -参数说明:\ -`owner_address`:是交易对创建者的地址,hexString格式\ -`exchange_id`:交易对id\ -`token_id`: token的id,一般情况是token的name,需要是hexString格式\ -`quant`:撤资token的数量\ -返回值:撤资的transaction - -# 交易所交易 - -## RPC - -1 接口声明 -rpc ExchangeTransaction (ExchangeTransactionContract) returns (TransactionExtention) {}; -2 提供节点 -fullnode。 -3 参数说明 -exchange_id:交易对id -token_id:撤资的token的id -quant:撤资数量 -expected:期望得到的另一个token的最小金额 -4 返回值 -TransactionExtention:返回签名后的交易、交易ID、操作结果等。 -5 功能说明 -交易 - -## HTTP - -`wallet/exchangetransaction\` -作用:参与交易对交易。\ -`demo:curl -X POST http://127.0.0.1:8090/wallet/exchangetransaction -d {"owner_address":"419844f7600e018fd0d710e2145351d607b3316ce9", "exchange_id":1, "token_id":"74726f6e6e616d65", "quant":100,"expected":10}`\ -参数说明:\ -`owner_address`:是交易对创建者的地址,hexString格式\ -`exchange_id`:交易对id\ -`token_id`: 卖出的token的id,一般情况是token的name,需要是hexString格式\ -`quant`:卖出token的数量\ -`expected`:期望买入token的数量\ -返回值:token交易的transaction - -# 查询所有交易对 - -## RPC - -1 接口声明 -rpc ListExchanges (EmptyMessage) returns (ExchangeList) {}; -2 提供节点 -fullnode。 -3 参数说明 -无 -4 返回值 -ExchangeList:所有交易对。 -5 功能说明 - -## HTTP - -`wallet/listexchanges`\ -作用:查询所有交易对\ -`demo:curl -X POST http://127.0.0.1:8090/wallet/listexchanges`\ -参数说明:\ -返回值:所有交易对 - -# 查询指定交易对 - -## RPC - -1 接口声明 -rpc GetExchangeById (BytesMessage) returns (Exchange) {}; -2 提供节点 -fullnode。 -3 参数说明 -value:交易对id -4 返回值 -Exchange:交易对。 -5 功能说明 - -## HTTP - -`wallet/getexchangebyid`\ -作用:根据id查询交易对\ -`demo:curl -X POST http://127.0.0.1:8090/wallet/getexchangebyid -d {"id":1}`\ -参数说明:\ -`id`:交易对id\ -返回值:交易对 - - -# 特别说明 - -在"ALLOW_SAME_TOKEN_NAME"提议通过后,账户及接口发生一些变化,这里特别说明。 - -## account账户变化 - - message Account { - ... - // the other asset owned by this account - map asset = 6; - - // the other asset owned by this account,key is assetId - map assetV2 = 56; - } - -在提议生效前,账户拥有的TRC10的数量在asset属性中描述,并以TRC10的name为key。 -在提议生效后,在account中增加assetV2,并以id为key。原asset中的asset自动映射到assetV2 -中,并自动生成id。可以使用原getAssetByName接口,查询到TRC10,并记录下id。 - -## GetAssetIssueByName 接口变化 -在提议生效前,通过该接口查询TRC10,输入参数为TRC10的name,在提议生效后建议采用 GetAssetIssueById 来查询。 - -` - rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) { - } - ` - - - -## GetAssetIssueById 接口变化 - -在提议生效后,采用GetAssetIssueById来查询TRC10详细信息,输入参数为TRC10的id。 - -` - rpc GetAssetIssueById (BytesMessage) returns (AssetIssueContract) { - } -` \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233/\347\254\254\344\270\200\345\261\212\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233/\347\254\254\344\270\200\345\261\212\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233.md" deleted file mode 100644 index e95c92d0..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233/\347\254\254\344\270\200\345\261\212\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233.md" +++ /dev/null @@ -1,129 +0,0 @@ -# TRON 编程大赛 - -**2018年4月17日-2018年6月5日** - -让创作者尽情享受区块链技术的魅力 -让思维火花尽情碰撞 -在合作与竞争中进行技术革新 -参与开发者编程大赛获得$1,000,000奖励 - -**波场编程大赛是基于区块链技术,结合波场自身去中心化的技术特点,致力于为全球社区成员和开发者所举办的开发盛宴。** - -波场为全球开发者和社区成员们提供国际一流的区块链技术开发平台与交流机会, 并助力他们开发适配于波场主网的第三方应用,为TRON生态的建设与繁荣奉献力量。 - -我们将为开发适配于波场TRON主网的基于Win、Mac、iOS/Android平台的钱包,嵌入Google Chrome的钱包,以及区块浏览器这五类应用的优胜者颁发奖励。 - -## 大赛规则 - -1, 报名将于2018年4月17日开始。报名和提交代码截止时间为2018年5月31日23时59分(北京时间)。 - -2, 参赛者以个人或者小组的形式(不限人数),报名参加比赛。 - -3, 每名参赛者(个人或小组)可以分别报名参加五个奖项的比赛。 - -4, 参赛者须基于TRON区块链进行开发, 且开发适配于波场TRON主网的以下五类应用: - - 1) 基于Windows平台的钱包(需包含离线签名功能和投票功能); - 2) 基于MAC平台的钱包(需包含投票功能,有离线签名功能更佳。); - 3) 基于IOS / Android平台的钱包(需包含离线签名功能和投票功能); - 4) 嵌入Google Chrome的钱包 (需包含投票功能); - 5) 区块浏览器。 - - **注: - - TRON相关代码及技术文档详见: https://github.com/tronprotocol - -5, 开发者可以在TRON社区自由组队交流讨论,协同创作。推荐交流平台为波场官方论坛:http://tronsr.org/,以及波场官方Slack:https://tronfoundation.slack.com/。 - -6, 提交作品代码时间为:2018年4月17日至2018年5月31日,截止时间前未提交代码的视为放弃比赛。 - -7, 提交的作品必须包含可执行程序及代码。 - -## 奖项设置 - -奖金总奖池为$1,000,000。 - -我们将设立五个奖项,每个奖项的第一名将获得一笔高额奖金: - -1. 基于Windows平台的钱包(需包含离线签名功能):$180,000. -2. 基于MAC平台的钱包(有离线签名功能更佳):$180,000. -3. 基于IOS / Android平台的钱包(需包含离线签名功能):$180,000. -4. 嵌入Google Chrome的钱包:$180,000. -5. 区块浏览器:$280,000. - -另外,凡是我们认为属于完成品的作品,都将自动获得波场创业者基金$100,000借款支持的资格,详情见https://github.com/tronprotocol/Documentation/blob/master/中文文档/波场创业者基金.md。 - - -## 大赛流程 - -2018.4.17-开始报名 - -2018.5.31-作品提交截止 - -2018.6.5-公布获奖名单 - -奖励将在结果公布后1个月内发放 - -## 评委组 - -孙宇晨Justin Sun:波场CEO - -陈志强Lucien Chen:波场CTO - -赵宏Marcus Zhao:波场技术总监 - -## 参与方式 - -请通过TRON官网进入编程大赛页面报名与提交作品。 - -## 报名流程 - -+ Step 1. 请在2018年5月31日之前将报名表提交至邮箱program@tron.network,邮件标题请按照命名规范“报名_个人/团队名称_参赛项目”(例如:“报名_TRON team_区块浏览器”),否则将被我们视为垃圾邮件导致报名失败: - - 报名表 - - |类型|具体信息| - |---|---| - |个人/团队名称*| - |国家*| - |联系人姓名*| - |邮箱*| - |电话(带区号)*| - |项目名称*| - |项目类别(单选)*|( )Windows钱包;( )Mac钱包;( )iOS/Android钱包;( )嵌入Google Chrome钱包;( )区块浏览器;| - - 注:带*号的为必填项 - -+ Step 2. 成功报名后我们将给报名邮箱发送一封成功报名的邮件: - - 您已成功报名波场编程大赛,请您于2018年5月31日23时59分之前将作品提交至program@tron.network,超时将视为放弃比赛,谢谢您的积极参与! - - ## 作品提交 - -+ Step 1. 请在2018年5月31日之前将作品和提交作品表一同发送至邮箱program@tron.network,邮件标题请按照命名规范“提交作品_个人/团队名称_参赛项目”(例如:“提交作品_TRON team_区块浏览器”),否则将被我们视为垃圾邮件导致作品提交失败; - - 提交作品表 - - |类型|具体信息| - |---|---| - |个人/团队名称*| - |国家*| - |联系人姓名*| - |邮箱*| - |电话*(带区号)| - |项目名称*| - |项目类别*(单选)|( )Windows钱包;( )Mac钱包;( )iOS/Android钱包;( )嵌入Google Chrome钱包;( )区块浏览器;| - |作品展示*(可以是作品链接、安装包等形式。)|若为安装包等其他形式,请以附件形式发送。| - |Github*| - |视频介绍| - |附件名称| - - 注:带*号的为必填项 - -+ Step 2. 成功报名后我们将给报名邮箱发送一封成功提交作品的邮件: - - 您已成功提交作品,我们将仔细审核您提交的内容,波场编程大赛将于2018年6月5日公布比赛结果,谢谢您的积极参与!
 - - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233/\347\274\226\347\250\213\345\244\247\350\265\233\345\217\202\344\270\216\350\200\205\350\257\204\345\256\241\346\240\207\345\207\206.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233/\347\274\226\347\250\213\345\244\247\350\265\233\345\217\202\344\270\216\350\200\205\350\257\204\345\256\241\346\240\207\345\207\206.md" deleted file mode 100644 index ed9583e7..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\263\242\345\234\272\347\274\226\347\250\213\345\244\247\350\265\233/\347\274\226\347\250\213\345\244\247\350\265\233\345\217\202\344\270\216\350\200\205\350\257\204\345\256\241\346\240\207\345\207\206.md" +++ /dev/null @@ -1,110 +0,0 @@ - -# 编程大赛参与者评审标准 - -对于参与编程大赛的团队以及开发者,我们将根据以下标准为你们打分,此项打分将直接关系到最后的评选: - -* __重要项:__ - -1. 原创项目: - - 参赛项目必须是你的原创项目,不可有抄袭行为。 - -2. 项目的适用性: - - 这个项目是否使用于波场主链。 - -3. 钱包项目是否有投票功能: - - 钱包项目必须要有头票功能,者将直接涉及到你是否可以获奖。 - -4. 基于Win、iOS/Android的钱包项目是否有离线签名功能: - - 基于Windows、iOS/Android平台的钱包项目必须要有离线签名功能,基于Mac平台的钱包项目若有离线签名功能更佳。 - -* __加分项__ - - -1. 比赛精神: - - 参赛者/团队不存在严重违反比赛规则和文明比赛精神的行为。 - -2. 团队积极性: - - 参赛团队是否积极与波场官方进行沟通,我们会根据你们回复邮件、在Slack里与我们沟通的积极性等来进行评审。 - -3. 功能性: - - 项目的功能完善程度,是否缺少某些功能,使用起来是否方便。 - -4. 项目的创新: - - 项目的创造力以及独特性。 - -5. 项目扩展性: - - 这个项目是否有发展的潜力。 - - -### 评审表 - - ------------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
团队名称重要项加分项
原创适用性投票功能
(钱包)
离线签名
(Win、
iOS/Android
钱包)
比赛精神积极性功能性创新扩展性
- - -表格说明: - - 1. 重要项直接关系到您是否获奖。 - - 2. 同时,若您满足加分项,你的项目将提高获奖可能。 diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\265\213\350\257\225\347\216\257\345\242\203\346\220\255\345\273\272/\345\246\202\344\275\225\345\273\272\347\253\213\350\212\202\347\202\271.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\265\213\350\257\225\347\216\257\345\242\203\346\220\255\345\273\272/\345\246\202\344\275\225\345\273\272\347\253\213\350\212\202\347\202\271.md" deleted file mode 100644 index 826b8cf8..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\265\213\350\257\225\347\216\257\345\242\203\346\220\255\345\273\272/\345\246\202\344\275\225\345\273\272\347\253\213\350\212\202\347\202\271.md" +++ /dev/null @@ -1,402 +0,0 @@ -# 如何建立节点 - -## 准备 dependencies - -* JDK 1.8 (JDK 1.9+ 暂不支持) -* Linux Ubuntu 系统 (e.g. Ubuntu 16.04.4 LTS),确保系统中已经下载 [__Oracle JDK 8__](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04), 而不是 __Open JDK 8__ 。 如果你使用 __Open JDK 8__ 创建源代码, 你会得到如下信息 [__Build Failed__](https://github.com/tronprotocol/java-tron/issues/337) 。 - -## 获得代码 - -* 终端使用Git,请参见 [Setting up Git](https://help.github.com/articles/set-up-git/) 和 [Fork a Repo](https://help.github.com/articles/fork-a-repo/) 相关文章。 -* 开发分支: the newnest code -* 主分支: 比开发分支更加稳定,命令行输入: - -```bash -git clone https://github.com/tronprotocol/java-tron.git -git checkout -t origin/master -``` - -* 如果你使用Mac系统,请下载 **[GitHub for Mac](https://mac.github.com/)** then **[fork and clone our repository](https://guides.github.com/activities/forking/)**。 - -* 如果你不是使用Git,点击 [Download the ZIP](https://github.com/tronprotocol/java-tron/archive/develop.zip)。 - -## 从源代码中创建 - -* 终端创建 - -```bashit -cd java-tron -./gradlew build -``` - -* 建立 executable JAR - -```bash -./gradlew clean shadowJar -``` - -* 在 [IntelliJ IDEA](https://www.jetbrains.com/idea/) (community version 可使用)中创建: - - 1. 打开 IntelliJ. 选择 `File` -> `Open`,然后找到已经克隆的 java-tron 文件夹。右下方点击`Open` 按键。 - 2. 查看`Import Project from Gradle` 目录下的`Use auto-import`。在 `Gradle JVM` 选项中选择 JDK 1.8。 然后点击 `OK`。 - 3. IntelliJ 会打开项目开始 gradle 同步,该过程会花费你几分钟的时间,这取决于你的网速和 IntelliJ 配置。 - 4. 安装Lombok插件,选择`Preferences`->`Plugins`->`Browse repositories`,搜索"Lombok",然后安装即可,同时设置`Preferences` -> `Compiler` -> `Annotation Processors` -> `Enable annotation processing`勾选。 - 5. 同步完成后,选择 `Gradle` -> `Tasks` -> `build`,然后双击 `build` 选项。 - - -# 运行 - -## 运行私人测试网 - -### 如何运行全节点 - -* 需要修改 config.conf - 1. genesis.block.witnesses 取代你的个人地址。 - 2. seed.node ip.list 代替个人的 ip list。 - -* 终端 - -```bash -./gradlew run -``` - -* 使用 executable JAR - -```bash -cd build/libs -java -jar java-tron.jar -``` - -* 在 IntelliJ IDEA - 1. 建立完成之后,在 project structure view panel中查找 `FullNode` ,路径为 `java-tron/src/main/java/org.tron/program/FullNode`. - 2. 选择 `FullNode`,点击并选择 `Run 'FullNode.main()'`,然后 `FullNode` 开始运行。 - -### 如何运行超节点 -* 使用主分支 -* 需要修改 config.conf - 1. genesis.block.witnesses 代替个人地址。 - 2. seed.node.ip.list 取代个人 ip list。 - 3. 第一个超级节点开始运行时 ,needSyncCheck 应该设置为 false。 - 4. 设置 p2pversion 为 61。 - -* 使用 executable JAR(建议) - -```bash -cd build/libs -java -jar java-tron.jar -p yourself private key --witness -c yourself config.conf(Example:/data/java-tron/config.conf) -Example: -java -jar java-tron.jar -p 650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812 --witness -c /data/java-tron/config.conf - -``` - -* 在终端 config.conf localwitness 添加私钥 -```bash -./gradlew run -Pwitness=true -``` - -
-Show Output - -```bash -> ./gradlew run -Pwitness=true - -> Task :generateProto UP-TO-DATE -Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead. - -> Task :run -20:39:22.749 INFO [o.t.c.c.a.Args] private.key = 63e62a71ed39e30bac7223097a173924aad5855959de517ff2987b0e0ec89f1a -20:39:22.816 WARN [o.t.c.c.a.Args] localwitness size must be one, get the first one -20:39:22.832 INFO [o.t.p.FullNode] Here is the help message.output-directory/ -三月 22, 2018 8:39:23 下午 org.tron.core.services.RpcApiService start -信息: Server started, listening on 50051 -20:39:23.706 INFO [o.t.c.o.n.GossipLocalNode] listener message -20:39:23.712 INFO [o.t.c.o.n.GossipLocalNode] sync group = a41d27f10194c53703be90c6f8735bb66ffc53aa10ea9024d92dbe7324b1aee3 -20:39:23.716 INFO [o.t.c.s.WitnessService] Sleep : 1296 ms,next time:2018-03-22T20:39:25.000+08:00 -20:39:23.734 WARN [i.s.t.BootstrapFactory] Env doesn't support epoll transport -20:39:23.746 INFO [i.s.t.TransportImpl] Bound to: 192.168.10.163:7080 -20:39:23.803 INFO [o.t.c.n.n.NodeImpl] other peer is nil, please wait ... -20:39:25.019 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:25.067+08:00] -20:39:25.019 INFO [o.t.c.s.WitnessService] ScheduledWitness[448d53b2df0cd78158f6f0aecdf60c1c10b15413],slot[1946] -20:39:25.021 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:25.021 INFO [o.t.c.s.WitnessService] Sleep : 4979 ms,next time:2018-03-22T20:39:30.000+08:00 -20:39:30.003 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:30.052+08:00] -20:39:30.003 INFO [o.t.c.s.WitnessService] ScheduledWitness[6c22c1af7bfbb2b0e07148ecba27b56f81a54fcf],slot[1947] -20:39:30.003 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:30.003 INFO [o.t.c.s.WitnessService] Sleep : 4997 ms,next time:2018-03-22T20:39:35.000+08:00 -20:39:33.803 INFO [o.t.c.n.n.NodeImpl] other peer is nil, please wait ... -20:39:35.005 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:35.054+08:00] -20:39:35.005 INFO [o.t.c.s.WitnessService] ScheduledWitness[48e447ec869216de76cfeeadf0db37a3d1c8246d],slot[1948] -20:39:35.005 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:35.005 INFO [o.t.c.s.WitnessService] Sleep : 4995 ms,next time:2018-03-22T20:39:40.000+08:00 -20:39:40.005 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T17:57:20.001+08:00],now[2018-03-22T20:39:40.055+08:00] -20:39:40.010 INFO [o.t.c.d.Manager] postponedTrxCount[0],TrxLeft[0] -20:39:40.022 INFO [o.t.c.d.DynamicPropertiesStore] update latest block header id = fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2 -20:39:40.022 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 97, 116, 101, 115, 116, 95, 98, 108, 111, 99, 107, 95, 104, 101, 97, 100, 101, 114, 95, 104, 97, 115, 104], BytesCapsule is org.tron.core.capsule.BytesCapsule@2ce0e954 -20:39:40.023 INFO [o.t.c.d.DynamicPropertiesStore] update latest block header number = 140 -20:39:40.024 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 97, 116, 101, 115, 116, 95, 98, 108, 111, 99, 107, 95, 104, 101, 97, 100, 101, 114, 95, 110, 117, 109, 98, 101, 114], BytesCapsule is org.tron.core.capsule.BytesCapsule@83924ab -20:39:40.024 INFO [o.t.c.d.DynamicPropertiesStore] update latest block header timestamp = 1521722380001 -20:39:40.024 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 97, 116, 101, 115, 116, 95, 98, 108, 111, 99, 107, 95, 104, 101, 97, 100, 101, 114, 95, 116, 105, 109, 101, 115, 116, 97, 109, 112], BytesCapsule is org.tron.core.capsule.BytesCapsule@ca6a6f8 -20:39:40.024 INFO [o.t.c.d.Manager] updateWitnessSchedule number:140,HeadBlockTimeStamp:1521722380001 -20:39:40.025 WARN [o.t.c.u.RandomGenerator] index[-3] is out of range[0,3],skip -20:39:40.070 INFO [o.t.c.d.TronStoreWithRevoking] Address is [73, 72, -62, -24, -89, 86, -39, 67, 112, 55, -36, -40, -57, -32, -57, 61, 86, 12, -93, -115], AccountCapsule is account_name: "Sun" -address: "IH\302\350\247V\331Cp7\334\330\307\340\307=V\f\243\215" -balance: 9223372036854775387 - -20:39:40.081 INFO [o.t.c.d.TronStoreWithRevoking] Address is [41, -97, 61, -72, 10, 36, -78, 10, 37, 75, -119, -50, 99, -99, 89, 19, 47, 21, 127, 19], AccountCapsule is type: AssetIssue -address: ")\237=\270\n$\262\n%K\211\316c\235Y\023/\025\177\023" -balance: 420 - -20:39:40.082 INFO [o.t.c.d.TronStoreWithRevoking] Address is [76, 65, 84, 69, 83, 84, 95, 83, 79, 76, 73, 68, 73, 70, 73, 69, 68, 95, 66, 76, 79, 67, 75, 95, 78, 85, 77], BytesCapsule is org.tron.core.capsule.BytesCapsule@ec1439 -20:39:40.083 INFO [o.t.c.d.Manager] there is account List size is 8 -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 448d53b2df0cd78158f6f0aecdf60c1c10b15413 -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 548794500882809695a8a687866e76d4271a146a -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 48e447ec869216de76cfeeadf0db37a3d1c8246d -20:39:40.084 INFO [o.t.c.d.Manager] there is account ,account address is 55ddae14564f82d5b94c7a131b5fcfd31ad6515a -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is 6c22c1af7bfbb2b0e07148ecba27b56f81a54fcf -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is 299f3db80a24b20a254b89ce639d59132f157f13 -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is abd4b9367799eaa3197fecb144eb71de1e049150 -20:39:40.085 INFO [o.t.c.d.Manager] there is account ,account address is 4948c2e8a756d9437037dcd8c7e0c73d560ca38d -20:39:40.085 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 34, -63, -81, 123, -5, -78, -80, -32, 113, 72, -20, -70, 39, -75, 111, -127, -91, 79, -49], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@4cb4f7fb -20:39:40.086 INFO [o.t.c.d.TronStoreWithRevoking] Address is [41, -97, 61, -72, 10, 36, -78, 10, 37, 75, -119, -50, 99, -99, 89, 19, 47, 21, 127, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@7be2474a -20:39:40.086 INFO [o.t.c.d.TronStoreWithRevoking] Address is [72, -28, 71, -20, -122, -110, 22, -34, 118, -49, -18, -83, -16, -37, 55, -93, -47, -56, 36, 109], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@3e375891 -20:39:40.086 INFO [o.t.c.d.TronStoreWithRevoking] Address is [68, -115, 83, -78, -33, 12, -41, -127, 88, -10, -16, -82, -51, -10, 12, 28, 16, -79, 84, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@55d77b83 -20:39:40.090 INFO [o.t.c.d.Manager] countWitnessMap size is 0 -20:39:40.091 INFO [o.t.c.d.TronStoreWithRevoking] Address is [41, -97, 61, -72, 10, 36, -78, 10, 37, 75, -119, -50, 99, -99, 89, 19, 47, 21, 127, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@310dd876 -20:39:40.092 INFO [o.t.c.d.TronStoreWithRevoking] Address is [72, -28, 71, -20, -122, -110, 22, -34, 118, -49, -18, -83, -16, -37, 55, -93, -47, -56, 36, 109], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@151b42bc -20:39:40.092 INFO [o.t.c.d.TronStoreWithRevoking] Address is [108, 34, -63, -81, 123, -5, -78, -80, -32, 113, 72, -20, -70, 39, -75, 111, -127, -91, 79, -49], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@2d0388aa -20:39:40.092 INFO [o.t.c.d.TronStoreWithRevoking] Address is [68, -115, 83, -78, -33, 12, -41, -127, 88, -10, -16, -82, -51, -10, 12, 28, 16, -79, 84, 19], WitnessCapsule is org.tron.core.capsule.WitnessCapsule@478a55e7 -20:39:40.101 INFO [o.t.c.d.TronStoreWithRevoking] Address is [-3, 48, -95, 97, 96, 113, 95, 60, -95, -91, -68, -83, 24, -24, 25, -111, -51, 111, 71, 38, 90, 113, -127, 91, -46, -55, 67, 18, -101, 37, -116, -46], BlockCapsule is BlockCapsule{blockId=fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2, num=140, parentId=dadeff07c32d342b941cfa97ba82870958615e7ae73fffeaf3c6a334d81fe3bd, generatedByMyself=true} -20:39:40.102 INFO [o.t.c.d.Manager] save block: BlockCapsule{blockId=fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2, num=140, parentId=dadeff07c32d342b941cfa97ba82870958615e7ae73fffeaf3c6a334d81fe3bd, generatedByMyself=true} -20:39:40.102 INFO [o.t.c.s.WitnessService] Block is generated successfully, Its Id is fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2,number140 -20:39:40.102 INFO [o.t.c.n.n.NodeImpl] Ready to broadcast a block, Its hash is fd30a16160715f3ca1a5bcad18e81991cd6f47265a71815bd2c943129b258cd2 -20:39:40.107 INFO [o.t.c.s.WitnessService] Produced -20:39:40.107 INFO [o.t.c.s.WitnessService] Sleep : 4893 ms,next time:2018-03-22T20:39:45.000+08:00 -20:39:43.805 INFO [o.t.c.n.n.NodeImpl] other peer is nil, please wait ... -20:39:45.002 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T20:39:45.001+08:00],now[2018-03-22T20:39:45.052+08:00] -20:39:45.003 INFO [o.t.c.s.WitnessService] ScheduledWitness[48e447ec869216de76cfeeadf0db37a3d1c8246d],slot[1] -20:39:45.003 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:45.003 INFO [o.t.c.s.WitnessService] Sleep : 4997 ms,next time:2018-03-22T20:39:50.000+08:00 -20:39:50.002 WARN [o.t.c.d.Manager] nextFirstSlotTime:[2018-03-22T20:39:45.001+08:00],now[2018-03-22T20:39:50.052+08:00] -20:39:50.003 INFO [o.t.c.s.WitnessService] ScheduledWitness[6c22c1af7bfbb2b0e07148ecba27b56f81a54fcf],slot[2] -20:39:50.003 INFO [o.t.c.s.WitnessService] It's not my turn -20:39:50.003 INFO [o.t.c.s.WitnessService] Sleep : 4997 ms,next time:2018-03-22T20:39:55.000+08:00 - -``` - -
- -* 在 IntelliJ IDEA - -
- - -打开 configuration panel: - - - -![](docs/images/program_configure.png) - -
- -
- - -在 `Program arguments` 选项,填充 `--witness`: - - - -![](docs/images/set_witness_param.jpeg) - -
- -然后再次运行 `FullNode::main()`。 - -### 运行多节点 - -运行多节点时,需要在 `seed.node.ip.list`中的 `config.conf` 明确种子节点的IP: -对于私人测试网,IP由个人管理。 - -## 运行本地节点并连接公共测试网 - -* 确保版本号与测试网版本号保持一致。如果不一致,请在 config.conf 文件中修改 node.p2p.version ,然后删除 out-directory (如果存在的话)。 - -### 运行全节点 - -* 终端 - -```bash -./gradlew run -``` - -* 使用 executable JAR - -```bash -cd build/libs -java -jar java-tron.jar -``` - -与私人测试网方法一样,不同的是 `config.conf` 中的IP由TRON官方告知。 - -### 运行超级节点 - -* 使用 executable JAR(建议) - -```bash -cd build/libs -java -jar java-tron.jar -p yourself private key --witness -c yourself config.conf(Example:/data/java-tron/config.conf) -Example: -java -jar java-tron.jar -p 650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812 --witness -c /data/java-tron/config.conf - -``` - -与私人测试网方法一样,不同的是 `config.conf` 中的IP由TRON官方告知。 - -
-Correct output - -```bash - -20:43:18.138 INFO [main] [o.t.p.FullNode](FullNode.java:21) Full node running. -20:43:18.486 INFO [main] [o.t.c.c.a.Args](Args.java:429) Bind address wasn't set, Punching to identify it... -20:43:18.493 INFO [main] [o.t.c.c.a.Args](Args.java:433) UDP local bound to: 10.0.8.146 -20:43:18.495 INFO [main] [o.t.c.c.a.Args](Args.java:448) External IP wasn't set, using checkip.amazonaws.com to identify it... -20:43:19.450 INFO [main] [o.t.c.c.a.Args](Args.java:461) External address identified: 47.74.147.87 -20:43:19.599 INFO [main] [o.s.c.a.AnnotationConfigApplicationContext](AbstractApplicationContext.java:573) Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@124c278f: startup date [Fri Apr 27 20:43:19 CST 2018]; root of context hierarchy -20:43:19.972 INFO [main] [o.s.b.f.a.AutowiredAnnotationBeanPostProcessor](AutowiredAnnotationBeanPostProcessor.java:153) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring -20:43:20.380 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:244) update latest block header timestamp = 0 -20:43:20.383 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:252) update latest block header number = 0 -20:43:20.393 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:260) update latest block header id = 00 -20:43:20.394 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:265) update state flag = 0 -20:43:20.559 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.567 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.568 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.568 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.569 INFO [main] [o.t.c.c.TransactionCapsule](TransactionCapsule.java:83) Transaction create succeeded! -20:43:20.596 INFO [main] [o.t.c.d.Manager](Manager.java:300) create genesis block -20:43:20.607 INFO [main] [o.t.c.d.Manager](Manager.java:306) save block: BlockCapsule -[ hash=00000000000000007b7a4241e41e57a9d4ca98217af86b8f3f6ac93f2bf11716 -number=0 -parentId=0000000000000000000000000000000000000000000000000000000000000000 -witness address= -generated by myself=true -generate time=1970-01-01 08:00:00.0 -merkle root=b5d2071118f2a33ac0ec377d947aabb4a8a3ddbe36d1a01cdbc38f58863de7c0 -txs size=5 -tx: {0:TransactionCapsule -[ hash=33d5385f666b0411a2e5829f57d26d7bf0a80b92865f732bd918a2b821bd14be -contract list:{ [0] type: TransferContract -from address=[B@7fe7c640 -to address=[B@4c4748bf -transfer amount=10000000000000000 -} -] -1:TransactionCapsule -[ hash=df936c9c026ee969781db8a20a2644c7b29688199a342047ce96b4d8bc79b32c -contract list:{ [0] type: TransferContract -from address=[B@7ce97ee5 -to address=[B@32c8e539 -transfer amount=15000000000000000 -} -] -2:TransactionCapsule -[ hash=96d505f8496585dab8e8300dfead6f395ab94f150861ffec3679314e257a0888 -contract list:{ [0] type: TransferContract -from address=[B@73dce0e6 -to address=[B@5a85c92 -transfer amount=10000000000000000 -} -] -3:TransactionCapsule -[ hash=950fece7e1a1a70cac971b68c3aadbd14163465aa079bf4d51d1ce5820d7f02d -contract list:{ [0] type: TransferContract -from address=[B@32811494 -to address=[B@4795ded0 -transfer amount=-9223372036854775808 -} -] -4:TransactionCapsule -[ hash=43dbd16a80393835f2bda8c71dc8ede389900425f3a328c16366c63a975ddb26 -contract list:{ [0] type: TransferContract -from address=[B@2eced48b -to address=[B@47c4ecdc -transfer amount=15000000000000000 -} -] -}] -20:43:20.607 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:252) update latest block header number = 0 -20:43:20.609 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:260) update latest block header id = 00000000000000007b7a4241e41e57a9d4ca98217af86b8f3f6ac93f2bf11716 -20:43:20.609 INFO [main] [o.t.c.d.DynamicPropertiesStore](DynamicPropertiesStore.java:244) update latest block header timestamp = 0 -20:43:20.631 INFO [main] [o.t.c.w.WitnessController](WitnessController.java:64) initWits shuffled addresses:a055ddae14564f82d5b94c7a131b5fcfd31ad6515a -20:43:20.814 INFO [main] [o.t.c.c.a.Args](Args.java:415) New nodeID generated: d5294e129edcb5c648af927bf9b66d61ae11b356dca0b193d85a7c8771b0e8b211e603e3608542bf521456ff1371ad7a2400b6126bc0b1f872af7f479c55afe9 -20:43:20.815 INFO [main] [o.t.c.c.a.Args](Args.java:416) Generated nodeID and its private key stored in output-directory/database/nodeId.properties -20:43:20.861 INFO [main] [NodeManager](NodeManager.java:96) homeNode : Node{ host='47.74.147.87', port=18888, id=d5294e129edcb5c648af927bf9b66d61ae11b356dca0b193d85a7c8771b0e8b211e603e3608542bf521456ff1371ad7a2400b6126bc0b1f872af7f479c55afe9} -20:43:20.861 INFO [main] [NodeManager](NodeManager.java:97) bootNodes : size= 11 -20:43:21.054 INFO [PeerServerThread] [PeerServer](PeerServer.java:86) TCP listener started, bind port 18888 -20:43:21.073 INFO [main] [o.t.p.FullNode](FullNode.java:47) ******** application shutdown ******** -20:43:21.090 WARN [main] [o.t.c.s.WitnessService](WitnessService.java:268) WitnessCapsule[[B@620aa4ea] is not in witnessStore -20:43:21.146 WARN [PeerServerThread] [i.n.b.ServerBootstrap](Slf4JLogger.java:146) Unknown channel option 'SO_KEEPALIVE' for channel '[id: 0xfbdea61d]' -20:43:21.182 INFO [UDPListener] [UDPListener](UDPListener.java:104) Discovery UDPListener started, bind port 18888 -20:43:21.183 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:159) Reading Node statistics from PeersStore: 0 nodes. -20:43:21.227 INFO [main] [o.t.c.s.RpcApiService](RpcApiService.java:100) Server started, listening on 50051 -20:43:21.233 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.16.55:18888, id=791191e1], size=1 -20:43:21.234 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.18.49:18888, id=e82c773d], size=2 -20:43:21.234 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 18.188.111.53:18888, id=96db4efd], size=3 -20:43:21.235 INFO [main] [o.t.c.n.n.NodeImpl](NodeImpl.java:595) other peer is nil, please wait ... -20:43:21.235 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 54.219.41.56:18888, id=a9f6b900], size=4 -20:43:21.235 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 35.169.113.187:18888, id=80c10f5e], size=5 -20:43:21.236 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 34.214.241.188:18888, id=df0b9f01], size=6 -20:43:21.236 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.146.147:18888, id=976440e3], size=7 -20:43:21.237 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.254.144.25:18888, id=e22a29e9], size=8 -20:43:21.238 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.91.246.252:18888, id=c1dbf350], size=9 -20:43:21.241 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.91.216.69:18888, id=07cc3858], size=10 -20:43:21.241 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 39.106.220.120:18888, id=e9c9ffda], size=11 -20:43:21.278 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 39.106.220.120:18888, id=e9c9ffda] new Node{ host='39.106.220.120', port=18888, id=ffaba569088f7497e60c5d4b9a9c110151f09be6e17e448e92086cb8336e1602aa42abd59a6dd0fdbdcfd78bb9360e3574866ae5a624dd8445d4906f0245c75d}, size =11 -20:43:21.285 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.91.246.252:18888, id=c1dbf350] new Node{ host='47.91.246.252', port=18888, id=aed3688f52718c895d3181eb8223f6556f0689f6515862fb08e70200b5970aae7f6c97fc304946630db595c3f9d75a5e056496045e536dc55a1a143ccc49925d}, size =11 -20:43:21.287 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.91.216.69:18888, id=07cc3858] new Node{ host='47.91.216.69', port=18888, id=b45aa0d92931e47cb6a3d3ef5f8fd3ba88c74413d7ea539175d1466bff875900e15390a52599b504830d6cb7e7e2d9c68412e23434dbced7b13230914af2276e}, size =11 -20:43:21.435 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.16.55:18888, id=791191e1] new Node{ host='47.254.16.55', port=18888, id=1a70d710248c6832b5bce762bd8dd09e0bb401a3e57c360db7d502c6e80b023226f0540635a72c6f1589d134568d4dc2fe1e9ff49a66601d924d28fdc12303a9}, size =11 -20:43:21.445 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.18.49:18888, id=e82c773d] new Node{ host='47.254.18.49', port=18888, id=28da8efcc5f2d7c7ddc74487b99ef232fe4a97c2eb6b8bcc32edc97d1d4ef357eb8d2347e824ff898fe7936efae70f0b29861dec8c22923a40998230cf1db08f}, size =11 -20:43:21.454 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 34.214.241.188:18888, id=df0b9f01] new Node{ host='34.214.241.188', port=18888, id=7380f11f7b1ed4a715c41131ffb66234cef21d83973aef89f75d3cea7036b221dea1acbf580e8df4a315845faf25e94d3ffc3c02507f687931ebac9725f59961}, size =11 -20:43:21.480 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 18.188.111.53:18888, id=96db4efd] new Node{ host='18.188.111.53', port=18888, id=23de133437c136b856b2a6906ff21fb6fe74736efc0496a8f7850460a9a600ee6f02d79d7ca15954f69b36411e36e96ec70c5a1c0d4891db0ffb70db19503a23}, size =11 -20:43:21.503 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 35.169.113.187:18888, id=80c10f5e] new Node{ host='35.169.113.187', port=18888, id=156dc977b34fa77a1377e5c4f9e2862f34b2c5309f9d86220b5dd4200383f4fb1859c3de90a8acecf9d91edff697a8f0a59346a239e3d5e269aed0b0186c8bc5}, size =11 -20:43:21.533 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.144.25:18888, id=e22a29e9] new Node{ host='47.254.144.25', port=18888, id=273eb89021d9741f0ff47c99c4e03d88776606acf39c970d7549512baf8444166883016e3c0859f7df3042fcfebf52b0af3d6cb216145b677eba10c6161c0cbc}, size =11 -20:43:21.543 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:202) Change node: old NodeHandler[state: Discovered, node: 47.254.146.147:18888, id=976440e3] new Node{ host='47.254.146.147', port=18888, id=1868f20b346420dcc1826551cc1427df36313f21fb077ba714210beb270b05a865516d53a734ccdd00468e23d21f1beef6c12299e7a4eda40408bf242ba6a2f8}, size =11 -20:43:21.729 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:141) Try Produce Block -20:43:21.792 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:107) Not sync -20:43:22.047 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:10846, id=d456c5af], size=12 -20:43:22.048 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:10846, id=d456c5af], size=13 -20:43:22.048 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:23018, id=d456c5af], size=14 -20:43:22.049 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 139.162.177.66:18888, id=d689b030], size=15 -20:43:22.049 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 168.235.68.117:18888, id=d04f7fa0], size=16 -20:43:22.049 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 185.101.157.48:18888, id=d00a272a], size=17 -20:43:22.050 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 89.201.166.70:18888, id=d2af1da8], size=18 -20:43:22.050 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.27.171.102:18888, id=c2dbea82], size=19 -20:43:22.051 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 35.197.108.225:18888, id=cb71adfc], size=20 -20:43:22.051 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 128.1.44.16:18888, id=c042b706], size=21 -20:43:22.052 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:43966, id=c6efd4d7], size=22 -20:43:22.053 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:43966, id=c6efd4d7], size=23 -20:43:22.053 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:48162, id=c1958356], size=24 -20:43:22.054 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 127.0.0.1:18888, id=ffaba569], size=25 -20:43:22.054 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 114.247.223.59:65036, id=fb716ca2], size=26 -20:43:22.169 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:15869, id=d80bda91], size=27 -20:43:22.169 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 83.87.113.32:18888, id=f093814a], size=28 -20:43:22.170 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 217.198.124.133:18888, id=e3c811ee], size=29 -20:43:22.170 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 142.227.120.102:18888, id=f49bc300], size=30 -20:43:22.171 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:34900, id=932a6b9d], size=31 -20:43:22.266 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 54.95.77.190:18888, id=d07f46e2], size=32 -20:43:22.266 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 23.239.19.106:18888, id=d3753c48], size=33 -20:43:22.267 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 223.71.166.85:42096, id=d92bec47], size=34 -20:43:22.267 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 173.14.84.113:26307, id=d95e9fe1], size=35 -20:43:22.267 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 195.224.160.13:54631, id=d9a14e17], size=36 -20:43:22.268 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 114.247.223.59:43160, id=dc87d741], size=37 -20:43:22.268 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:42096, id=d92bec47], size=38 -20:43:22.268 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 68.101.240.4:1024, id=dbb7c4a1], size=39 -20:43:22.269 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 47.93.9.236:18888, id=d850df83], size=40 -20:43:22.269 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 119.61.19.34:15837, id=d80bda91], size=41 -20:43:22.269 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 31.146.78.129:1024, id=c2b1d172], size=42 -20:43:22.270 INFO [nioEventLoopGroup-2-1] [NodeManager](NodeManager.java:200) Add new node: NodeHandler[state: Discovered, node: 95.137.168.179:28228, id=c2b1d172], size=43 -20:43:22.295 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:141) Try Produce Block -20:43:22.296 INFO [Thread-5] [o.t.c.s.WitnessService](WitnessService.java:107) Not sync - -``` - -Then observe whether block synchronization success,If synchronization successfully explains the success of the super node \ No newline at end of file diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\265\213\350\257\225\347\216\257\345\242\203\346\220\255\345\273\272/\346\263\242\345\234\272\346\265\213\350\257\225\347\275\221.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\346\265\213\350\257\225\347\216\257\345\242\203\346\220\255\345\273\272/\346\263\242\345\234\272\346\265\213\350\257\225\347\275\221.md" deleted file mode 100644 index 78b9c806..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\346\265\213\350\257\225\347\216\257\345\242\203\346\220\255\345\273\272/\346\263\242\345\234\272\346\265\213\350\257\225\347\275\221.md" +++ /dev/null @@ -1,367 +0,0 @@ -# 波场测试网 - -## 如何连接到测试网 - -latest master branch - -commit master分支最新代码 - -https://test.tronscan.org - - - -## 如何连接到测试网 - -1. 分别修改FullNode和SolidityNode的 `.conf` 文件。 -2. 分别删除FullNode和SolidityNode的数据库output-directory目录 -3. 关键改动 - -``` - p2p { - version = 20180622 - } - - parentHash = "0x9e524e0d6bfbbd25a9bd9cf5c5389f122e2bc2e66a29569d532739a1aa4376ae" -``` - - - -## 启动配置文件 - -``` -net { - type = mainnet -} - -storage { - # Directory for storing persistent data - - db.directory = "database", - index.directory = "index", - - # You can custom these 14 databases' configs: - - # account, account-index, asset-issue, block, block-index, - # block_KDB, peers, properties, recent-block, trans, - # utxo, votes, witness, witness_schedule. - - # Otherwise, db configs will remain default and data will be stored in - # the path of "output-directory" or which is set by "-d" ("--output-directory"). - - # Attention: name is a required field that must be set !!! - properties = [ -// { -// name = "account", -// path = "storage_directory_test", -// createIfMissing = true, -// paranoidChecks = true, -// verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 -// }, -// { -// name = "account-index", -// path = "storage_directory_test", -// createIfMissing = true, -// paranoidChecks = true, -// verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - ] - -} - -node.discovery = { - enable = true - persist = true - bind.ip = "" - external.ip = null -} - -node.backup { - port = 10001 - priority = 8 - members = [ - ] -} - -node { - # trust node for solidity node - # trustNode = "ip:port" - trustNode = "127.0.0.1:50051" - - # expose extension api to public or not - walletExtensionApi = true - - listen.port = 18888 - - connection.timeout = 2 - - tcpNettyWorkThreadNum = 0 - - udpNettyWorkThreadNum = 1 - - # Number of validate sign thread, default availableProcessors / 2 - # validateSignThreadNum = 16 - - active = [ - # Initial active peers - # Sample entries: - # "ip:port", - # "ip:port" - ] - - maxActiveNodes = 30 - - maxActiveNodesWithSameIp = 5 - - minParticipationRate = 0 - - p2p { - version = 20180622 - } - - rpc { - port = 50051 - - # Number of gRPC thread, default availableProcessors / 2 - # thread = 16 - - # The maximum number of concurrent calls permitted for each incoming connection - # maxConcurrentCallsPerConnection = - - # The HTTP/2 flow control window, default 1MB - # flowControlWindow = - - # Connection being idle for longer than which will be gracefully terminated - maxConnectionIdleInMillis = 60000 - - # Connection lasting longer than which will be gracefully terminated - # maxConnectionAgeInMillis = - - # The maximum message size allowed to be received on the server, default 4MB - # maxMessageSize = - - # The maximum size of header list allowed to be received, default 8192 - # maxHeaderListSize = - } - -} - -active.node = [ - # Active establish connection in any case - # Sample entries: - # "ip:port", - # "ip:port" -] - -trust.node = [ - # Passive accept connection in any case - # Sample entries: - # "ip:port", - # "ip:port" -] - -seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes - # example: - # ip.list = [ - # "ip:port", - # "ip:port" - # ] - ip.list = [ -"47.254.144.25:18888", -"47.254.146.147:18888", -"47.254.16.55:18888", -"47.254.18.49:18888", -"52.14.86.232:18888" - ] -} - -genesis.block = { - # Reserve balance - assets = [ - { - accountName = "Zion" - accountType = "AssetIssue" - address = "TNNqZuYhMfQvooC4kJwTsMJEQVU3vWGa5u" - balance = "95000000000000000" - }, - { - accountName = "Sun" - accountType = "AssetIssue" - address = "TWsm8HtU2A5eEzoT8ev8yaoFjHsXLLrckb" - balance = "5000000000000000" - }, - { - accountName = "Blackhole" - accountType = "AssetIssue" - address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip" - balance = "-9223372036854775808" - } - ] - - witnesses = [ - { - address: TVdyt1s88BdiCjKt6K2YuoSmpWScZYK1QF, - url = "http://Alioth.com", - voteCount = 100027 - }, - { - address: TCNVmGtkfknHpKSZXepZDXRowHF7kosxcv, - url = "http://Aries.com", - voteCount = 100026 - }, - { - address: TAbzgkG8p3yF5aywKVgq9AaAu6hvF2JrVC, - url = "http://Cancer.com", - voteCount = 100025 - }, - { - address: TMmmvwvkBPBv3Gkw9cGKbZ8PLznYkTu3ep, - url = "http://Capricorn.com", - voteCount = 100024 - }, - { - address: TBJHZu4Sm86aWHtt6VF6KQSzot8vKTuTKx, - url = "http://Cassiopeia.com", - voteCount = 100023 - }, - { - address: TLvCstA93piBhpdvMggJ9r5b793b6rqdGd, - url = "http://Crux.com", - voteCount = 100022 - }, - { - address: TEf2ADumcubtg9NeNi7bNP14KfvYxKzTDu, - url = "http://Delphinus.com", - voteCount = 100021 - }, - { - address: TTqqbNxnqniyeCFi4aYwQQFHtuMwiBLARo, - url = "http://Dorado.com", - voteCount = 100020 - }, - { - address: TWwJwoqAYvUVjmp5odhwZYgKekBqL3Mbcf, - url = "http://Dubhe.com", - voteCount = 100019 - }, - { - address: TCPKsDZCJDzC83KWcAnHo9b46DN9o4s48y, - url = "http://Eridanus.com", - voteCount = 100018 - }, - { - address: TJnd8wF5ScEvuYq4WnJUyGbg6iS7ibnWrY, - url = "http://Gemini.com", - voteCount = 100017 - }, - { - address: TTZDB64rNpdw8rpEKko5FhB7BMUf5y4JMT, - url = "http://Hercules.com", - voteCount = 100016 - }, - { - address: TVWapNccbdFDqdHjFGnJ8ePancR6HjSned, - url = "http://Leo.com", - voteCount = 100015 - }, - { - address: TUVdiR6bYsuDNB5HWPLyK3ueY6225n5AdJ, - url = "http://Libra.com", - voteCount = 100014 - }, - { - address: TRBQFNJrJJzzgqfnbP9WvAjWd2oCNyqanC, - url = "http://Lupus.com", - voteCount = 100013 - }, - { - address: TBSq7zAhyEyVf96tbQmh6SwBGRiQXJf9sx, - url = "http://Lyra.com", - voteCount = 100012 - }, - { - address: TFZhwKPxqadgLGSwkiD1JeFJgfSMn2BD75, - url = "http://Monoceros.com", - voteCount = 100011 - }, - { - address: TZ6PqKSodEW7yQNYSDS8WoDo8t3SfACV3V, - url = "http://Norma.com", - voteCount = 100010 - }, - { - address: TSiyqwmcqsDBXQmWPZhC4Y5zncECMN61Li, - url = "http://Orion.com", - voteCount = 100009 - }, - { - address: TVnWr8bm3b2gDrJDBTfWXuPXiT1cvZUGan, - url = "http://Pavo.com", - voteCount = 100008 - }, - { - address: TNR2BDkX53rFCvkSg89nK7nfeC6hLN7B5o, - url = "http://Perseus.com", - voteCount = 100007 - }, - { - address: TVw2k1pD3n4ErWnr4uWmjVwsdai8vT5wyn, - url = "http://Phecda.com", - voteCount = 100006 - }, - { - address: THtcGdFXoGWNd9PDrhCradfvcdsQAoNVAC, - url = "http://Phoenix.com", - voteCount = 100005 - }, - { - address: TEZ31xxrECtLmsGvQFnh2quQVxKFoHxqqu, - url = "http://Pyxis.com", - voteCount = 100004 - }, - { - address: TA6ztifHZSkQ5F6KMe73rYRgQ5fBKLPomV, - url = "http://Scutum.com", - voteCount = 100003 - }, - { - address: TXuLKjf8J8aCKgDgA5uczwn1yQNYVPLocY, - url = "http://Taurus.com", - voteCount = 100002 - }, - { - address: TAihbgDWBK1QTS5gsk7evWDy2nhpkmkGZJ, - url = "http://Volans.com", - voteCount = 100001 - } - ] - - timestamp = "0" #2017-8-26 12:00:00 - - parentHash = "0x9e524e0d6bfbbd25a9bd9cf5c5389f122e2bc2e66a29569d532739a1aa4376ae" -} - -localwitness = [ -] - -#localwitnesskeystore = [ -# "src/main/resources/localwitnesskeystore.json" -#] - -block = { - needSyncCheck = true # first node : false, other : true - maintenanceTimeInterval = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms) -} -``` - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/Energy\346\266\210\350\200\227\346\234\272\345\210\266.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/Energy\346\266\210\350\200\227\346\234\272\345\210\266.md" deleted file mode 100644 index 83a3ed4c..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/Energy\346\266\210\350\200\227\346\234\272\345\210\266.md" +++ /dev/null @@ -1,81 +0,0 @@ - -## ENERGY 消耗机制 - -### 名词解释 - - 合约创建者 : 即创建合约的账户 - - 合约调用者 : 即调用合约的账户 - - Energy : 智能合约运行时每一步指令都需要消耗一定的资源,资源的多少用energy的值来衡量。 - - Freeze : 冻结,即将持有的trx锁定,无法进行交易,作为抵押,并以此获得免费使用energy的权利。 - 具体计算与全网所有账户冻结有关,可参考相关部分计算。 - - Feelimit : 用户在调用或者创建智能合约时,指定的最高可接受的trx费用消耗,包含消耗冻结获得资源的trx - 和消耗用户本身持有的trx两部分,优先使用冻结资源。 - - CallValue: 用户在智能合约调用或创建时给智能合约本身的账户转账的trx数量,在判断feelimit的时候会抛去这部分的值。 - - consume_user_resource_percent: - 对于一个智能合约来说,付费是由两大部分组成的。一部分是合约开发者付费, - 另一部分是由合约调用者支付。这个值是调用者付费的比例 - - origin_energy_limit: - 开发者设置的在一次合约调用过程中自己消耗的energy的上限,必须大于0。 - 对于之前老的合约,没有提供设置该值的参数,会存成0,但是会按照1000万energy上限计算, - 开发者可以通过updateEnergyLimit接口重新设置该值,设置新值时也必须大于0 - - - -### Energy消耗 -顺序如下: - -1. 按照合约中设置的比例消耗合约创建者冻结的Energy,若不足优先扣除合约创建者剩余所有Energy,剩余消耗需调用者提供 -1. 调用者消耗顺序(优先消耗调用者冻结获取的Energy,为保证合约可正常执行,不足部分通过销毁TRX相抵) -1. 若创建者无冻结Energy资源,则所有消耗需调用者提供 - - -### 相关接口 - -##### getTransactionInfoById 查询包含合约调用或合约创建结果的交易信息 -``` -getTransactionInfoById needs 1 parameter, transaction id -``` -相关字段 - -``` -energy_usage: //本次合约调用者消耗的Energy数量 -0 -energy_fee: //本次合约调用者消耗TRX数量(SUN) -120 -origin_energy_usage: //本次合约创建者提供的Energy数量 -0 -energy_usage_total: //本次合约总共消耗的Energy数量(包含energy_usage,origin_energy_usage 和energy_fee对应的Energy数量) -252 -net_usage: //本次合约消耗的Bandwidth(不包含NetFee对应的) -0 -net_fee: //本次合约因Bandwidth不足消耗的TRX -0 -``` -##### FreezeBalance 冻结获得带宽或能量 -``` -freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 ENERGY] -``` - -### 使用说明 - -部署合约和调用合约的过程中需传入参数 "fee_limit" - -本次执行总共消耗的Energy所对应的TRX数量 - -对应关系: - -``` -已冻结Energy部分:(冻结的balance数量/冻结获得总共的Energy)*消耗Energy数量 -销毁TRX获得Energy部分:按照比例消耗的TRX数量 -``` - -#### 注意事项: -详见 [异常处理](异常处理.md) - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/TVM\345\212\237\350\203\275\347\211\271\346\200\247\346\226\207\346\241\243.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/TVM\345\212\237\350\203\275\347\211\271\346\200\247\346\226\207\346\241\243.md" deleted file mode 100644 index 904553ee..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/TVM\345\212\237\350\203\275\347\211\271\346\200\247\346\226\207\346\241\243.md" +++ /dev/null @@ -1,207 +0,0 @@ -# Tron virtual machine 功能特性介绍及基于Tron的solidity语言使用文档 - -Tron virtual machine 基于以太坊 solidity 语言实现,兼容以太坊虚拟机的特性,但基于tron自身属性也有部分的区别。 - -## I 智能合约 -波场虚拟机运行的智能合约兼容以太坊智能合约特性,以protobuf的形式定义合约内容: - - message SmartContract { - message ABI { - message Entry { - enum EntryType { - UnknownEntryType = 0; - Constructor = 1; - Function = 2; - Event = 3; - Fallback = 4; - } - message Param { - bool indexed = 1; - string name = 2; - string type = 3; - // SolidityType type = 3; - } - enum StateMutabilityType { - UnknownMutabilityType = 0; - Pure = 1; - View = 2; - Nonpayable = 3; - Payable = 4; - } - - bool anonymous = 1; - bool constant = 2; - string name = 3; - repeated Param inputs = 4; - repeated Param outputs = 5; - EntryType type = 6; - bool payable = 7; - StateMutabilityType stateMutability = 8; - } - repeated Entry entrys = 1; - } - bytes origin_address = 1; - bytes contract_address = 2; - ABI abi = 3; - bytes bytecode = 4; - int64 call_value = 5; - int64 consume_user_resource_percent = 6; - string name = 7; - } - -origin_address: 合约创建者地址 - -contract_address: 合约地址 - -abi:合约所有函数的接口信息 - -bytecode:合约字节码 - -call_value:随合约调用传入的trx金额 - -consume_user_resource_percent:程序开发人员与调用程序者的资源扣费百分比 - -name:合约名称(token名称) - -通过另外两个grpc message类型 CreateSmartContract 和 TriggerSmartContract 来创建和使用smart contract - - -## II 合约函数的使用 - -1. constant function和非constant function - -函数调用从对链上属性是否有更改可分为两种:constant function 和 非constant function。 -Constant function 是指用 view/pure/constant 修饰的函数。会在调用的节点上直接返回结果,并不以一笔交易的形式广播出去。 -非constant function是指需要依托一笔交易的形式被广播的方法调用。函数会改变链上数据的内容,比如转账,改变合约内部变量的值等等。 - ->注意,如果在合约内部使用create指令(CREATE instruction),即使用view/pure/constant来修饰这个动态创建的合约合约方法,这个合约方法仍会被当作非constant function,以交易的形式来处理。 - -2. 消息调用 (message calls) - -消息调用可以向其他的合约发起函数调用,也可以向合约的账户或非合约的账户转帐trx。 与普通的波场triggercontract类似, 消息调用也有调用的发起者,接受者,数据,转账金额,扣费,以及返回值等属性。每一个消息调用都可以递归的生成新的消息调用。 -合约可以决定在其内部的消息调用中,对于剩余的 energy ,应发送和保留多少。如果在内部消息调用时发生了OutOfEnergyException -异常(或其他任何异常),会返回false,但不会以异常的形式抛出。此时,只有与该内部消息调用一起发送的gas会被消耗掉,如果不表明消息调用所传入的费用call.value(energy),则会扣掉所有的剩余energy。 - - -3. 委托调用/代码调用和库 (delegatecall/callcode/libary) - -有一种特殊类型的消息调用,被称为 委托调用(delegatecall) 。它和一般的消息调用的区别在于,目标地址的代码将在发起调用的合约的上下文中执行,并且msg.sender 和msg.value 不变。 这意味着一个合约可以在运行时从另外一个地址动态加载代码。存储、当前地址和余额都指向发起调用的合约,只有代码是从被调用地址获取的。 这使得 Solidity 可以实现”库“能力:可复用的代码库可以放在一个合约的存储上,如用来实现复杂的数据结构的库。 - -4. CREATE 指令 (CREATE instruction) - -另一个与合约调用相关的是调用指令集的时候使用CREATE指令。这个指令将会创建一个新的合约并生成新的地址。与以太坊的创建唯一的不同在于波场新生成的地址使用的是传入的本次智能合约交易id与调用的nonce的哈希组合。和以太坊不同,这个nonce的定义为本次根调用开始创建的合约序号。即如果有多次的 CREATE指令调用,从1开始,顺序编号每次调用的合约。详细请参考代码。还需注意,与deploycontract的grpc调用创建合约不同,CREATE的合约并不会保存合约的abi。 - -5. 内置功能属性及内置函数 (Odyssey-v3.1.1及之后的版本暂时不支持TVM内置函数) - -1)TVM兼容solidity语言的转账形式,包括: -伴随constructor调用转账 -伴随合约内函数调用转账 -transfer/send/call/callcode/delegatecall函数调用转账 - ->注意,波场的智能合约与波场系统合约的逻辑不同,如果转账的目标地址账户不存在,不能通过智能合约转账的形式创建目标地址账户。这也是与以太坊的不同点。 - -2)不同账户为超级节点投票 (Odyssey-v3.1.1及之后的版本暂时不支持) - -3)超级节点获取所有奖励 (Odyssey-v3.1.1及之后的版本暂时不支持) - -4)超级节点通过或否定提案 (Odyssey-v3.1.1及之后的版本暂时不支持) - -5)超级节点提出提案 (Odyssey-v3.1.1及之后的版本暂时不支持) - -6)超级节点删除提案 (Odyssey-v3.1.1及之后的版本暂时不支持) - -7)波场byte地址转换为solidity地址 (Odyssey-v3.1.1及之后的版本暂时不支持) - -8)波场string地址转换为solidity地址 (Odyssey-v3.1.1及之后的版本暂时不支持) - -9)向目标账户地址发送token转账 (Odyssey-v3.1.1及之后的版本暂时不支持) - -10)查询目标账户地址的指定token的数量 (Odyssey-v3.1.1及之后的版本暂时不支持) - -11)兼容所有以太坊内置函数 - ->注意: -波场2)- 10)为波场自己的内置函数 具体中文文档请参看:https://github.com/tronprotocol/Documentation/blob/master/中文文档/虚拟机/虚拟机内置函数.md - ->以太坊 RIPEMD160 函数不推荐使用,波场返回的是一个自己的基于sha256的hash结果,并不是准确的以太坊RIPEMD160。以后会考虑删除这个函数。 - -## III 合约地址在solidity语言的使用 - -以太坊虚拟机地址为是20字节,而波场虚拟机解析地址为21字节。 -### 1. 地址转换 -在solidity中使用的时候需要对波场地址做如下处理 (推荐): - - /** - * @dev convert uint256 (HexString add 0x at beginning) tron address to solidity address type - * @param tronAddress uint256 tronAddress, begin with 0x, followed by HexString - * @return Solidity address type - */ - function convertFromTronInt(uint256 tronAddress) public view returns(address){ - return address(tronAddress); - } -这个和在以太坊中其他类型转换成address类型语法相同。 -### 2. 地址判等 -solidity中有地址常量判断,如果写的是21字节地址编译器会报错,只用写20字节地址即可,如: -``` - function compareAddress(address tronAddress) public view returns (uint256){ - // if (tronAddress == 0x41ca35b7d915458ef540ade6068dfe2f44e8fa733c) { // compile error - if (tronAddress == 0xca35b7d915458ef540ade6068dfe2f44e8fa733c) { // right - return 1; - } else { - return 0; - } - } -``` -tronAddress从wallet-cli传入是0000000000000000000041ca35b7d915458ef540ade6068dfe2f44e8fa733c这个21字节地址,即正常的波场地址时,是会返回1的,判断正确。 -### 3. 地址赋值 -solidity中有地址常量的赋值,如果写的是21字节地址编译器会报错,只用写20字节地址即可,solidity中后续操作直接利用这个20位地址,波场虚拟机内部做了补位操作。如: -``` - function assignAddress() public view { - // address newAddress = 0x41ca35b7d915458ef540ade6068dfe2f44e8fa733c; // compile error - address newAddress = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c; - // do something - } -``` -如果想直接使用string 类型的波场地址(如TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm)请参考内置函数的两种地址转换方式 (见II-4-7,II-4-8)。 - -## IV 与以太坊有区别的特殊常量 - -1 货币 - -类似于solidity对ether的支持,波场虚拟机的代码支持的货币单位有trx和sun,其中1trx = 1000000sun,大小写敏感,只支持小写。目前tron-studio支持trx和sun,在remix中,不支持trx和sun,如果使用ether、finney等单位时,注意换算(可能会发生溢出错误)。 -我们推荐使用tron-studio代替remix进行tron智能合约的编写。 - -2 区块相关 - -• block.blockhash(uint blockNumber) returns (bytes32):指定区块的区块哈希——仅可用于最新的 256 个区块且不包括当前区块;而 blocks 从 0.4.22 版本开始已经不推荐使用,由 blockhash(uint blockNumber) 代替 - -• block.coinbase (address): 产当前区块的超级节点地址 - -• block.difficulty (uint): 当前区块难度,波场不推荐使用,设置恒为0 - -• block.gaslimit (uint): 当前区块 gas 限额,波场暂时不支持使用, 暂时设置为0 - -• block.number (uint): 当前区块号 - -• block.timestamp (uint): 当前区块以秒计的时间戳 - -• gasleft() returns (uint256):剩余的 gas - -• msg.data (bytes): 完整的 calldata - -• msg.gas (uint): 剩余 gas - 自 0.4.21 版本开始已经不推荐使用,由 gesleft() 代替 - -• msg.sender (address): 消息发送者(当前调用) - -• msg.sig (bytes4): calldata 的前 4 字节(也就是函数标识符) - -• msg.value (uint): 随消息发送的 sun 的数量 - -• now (uint): 目前区块时间戳(block.timestamp) - -• tx.gasprice (uint): 交易的 gas 价格,波场不推荐使用,设置值恒为0 - -• tx.origin (address): 交易发起者(完全的调用链) - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/TVM\350\260\203\347\224\250\347\273\223\346\236\234\350\247\243\346\236\220\350\257\264\346\230\216.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/TVM\350\260\203\347\224\250\347\273\223\346\236\234\350\247\243\346\236\220\350\257\264\346\230\216.md" deleted file mode 100644 index 79ce3391..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/TVM\350\260\203\347\224\250\347\273\223\346\236\234\350\247\243\346\236\220\350\257\264\346\230\216.md" +++ /dev/null @@ -1,197 +0,0 @@ -# Tron virtual machine 调用结果说明 - -# 概述 -当调用getTransactionInfoById接口得到contractResult后,需要开发者自行解析结果。 - -getTransactionById接口用于获取交易上链后的状态。对于智能合约而言,ret字段为此合约是否执行成功的记录,失败结果有多种情况。 - -此说明用于对getTransactionById的ret字段和getTransactionInfoById的contractResult字段结果的解释和分析。 - -# getTransactionInfoById结果实例 - - txid: - 33ebb296d6c884127343d6e4fe3ad7a162559b55aa1f24f3a5247e02e1fd234b - fee: - 17200 - blockNumber: - 2758043 - blockTimeStamp: - 1538201871000 - result: - SUCCESS - resMessage: - - contractResult: - 0000000000000000000000000000000000000000000000000000000000000009 - contractAddress: - TVMCU221WnGfTBcCo7RMQ3X6rf9X1FKTUk - logList: - - receipt: - EnergyUsage: - 0 - EnergyFee(SUN): - 17200 - OriginEnergyUsage: - 0 - EnergyUsageTotal: - 172 - NetUsage: - 280 - NetFee: - 0 - -txid: 包含调用合约方法信息的交易id - -fee: 本次调用的花费,单位sun - -blockNumber: 打包交易的区块编号 - -blockTimeStamp: 打包交易区块的时间戳 - -result: 交易执行的状态结果 - -resMessage: 交易失败时返回的信息 - -contractResult: 合约调用返回的结果 - -contractAddress: 调用的合约地址 - -logList: 如果有事件等打出的log信息 - -receipt: 包含5个字段,见https://github.com/tronprotocol/Documentation/blob/master/中文文档/虚拟机/Energy消耗机制.md - -# contractResult详解 -contractResult字段显示了合约调用的直接返回结果,由HexString的形式展示。以每64个16进制字符(32bytes)为一个字,根据返回值类型分别显示。 - -A. 定长变量 - -实例1. 单返回值 uint: - -``` -function foo() returns(uint256){...}; -contractResult: -000000000000000000000000000000000000000000000000000000000000000b -解析: -返回为uint256类型10进制 11 -``` - - -实例2. 多返回值 (bytes8,uint256): - -``` -function createTest() public returns(bytes8,uint256){return (11,1);} - contractResult:000000000000000b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 -解析: - 000000000000000b000000000000000000000000000000000000000000000000 bytes8结果 - 0000000000000000000000000000000000000000000000000000000000000001 uint256结果 -``` - - - -B. 不定长变量 - -实例3. 多返回值及数组(bytes8,uint256[],string) - - function bar() public returns(bytes8,uint256[],string){ - uint256[] memory a= new uint256[](10); - a[0]=1; - string memory s ="tron"; - return (11,a,s); - } - - contractResult:000000000000000b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000474726f6e00000000000000000000000000000000000000000000000000000000 - - 解析: - 000000000000000b000000000000000000000000000000000000000000000000 第一个定长bytes8参数的数值 - 0000000000000000000000000000000000000000000000000000000000000060 第二个非定长变量(数组)的指针位置 - 00000000000000000000000000000000000000000000000000000000000001c0 第三个非定长变量(string) - 000000000000000000000000000000000000000000000000000000000000000a 第二个变量的长度 (10) - 0000000000000000000000000000000000000000000000000000000000000001 第二个变量的第0位的值 (1) - 0000000000000000000000000000000000000000000000000000000000000000 第二个变量的第1位的值 (0) - 0000000000000000000000000000000000000000000000000000000000000000 第二个变量的第2位的值 (0) - 0000000000000000000000000000000000000000000000000000000000000000 ... - 0000000000000000000000000000000000000000000000000000000000000000 ... - 0000000000000000000000000000000000000000000000000000000000000000 ... - 0000000000000000000000000000000000000000000000000000000000000000 ... - 0000000000000000000000000000000000000000000000000000000000000000 ... - 0000000000000000000000000000000000000000000000000000000000000000 ... - 0000000000000000000000000000000000000000000000000000000000000000 第二个变量的第9位的值 (0) - 0000000000000000000000000000000000000000000000000000000000000004 第三个非定长变量的长度(4) - 74726f6e00000000000000000000000000000000000000000000000000000000 16进制的ascii码,对应"tron" - -# getTransactionById结果实例 - -```shell -gettransactionbyid acf1815ceef75bb1c9ccce5bc8439aee8a34ca7bc2b4649d34ed1f3bc6a7de74 - -hash:f6134b6dd5d3e7cffc62c52bff9deae19c92973b0a8ae7904d8d4472a87ef0e3 -txid:acf1815ceef75bb1c9ccce5bc8439aee8a34ca7bc2b4649d34ed1f3bc6a7de74 -raw_data: -{ -ref_block_bytes: 9002 -ref_block_hash: ca65eb0f6f0764a7 -contract: -{ -contract 0 ::: -[ -contract_type: TriggerSmartContract -owner_address: TRxSunZ8cjJRZdub5dsDjSgGeCqq5ycAXR -contract_address: TEV3mQuXubrbTzc2MApZvvH6btKJ4eZh41 -call_value:0 -data:67e0badb -] - -} -timestamp: Tue Oct 16 20:13:24 CST 2018 -fee_limit: 10000000 -} -signature: -{ -signature 0 :5d8d6c366ee9335a211e9a5c3cac6b4ad904d6b9a8aa7f098f7b2165f7df54a74c4c846de709d654a71ef17090e3a1461541f99190ce58e0fb2c6f14ae0a788c00 -} -ret: -{ -result: 0 ::: -[ -code ::: SUCESS -] -} - -``` - -hash:交易的HASH值 - -txid:本交易的交易id - -raw_data:交易内容的具体内容 - -signature:交易签名信息 - -ret:交易执行基本结果(是否成功及扣费情况) - -# ret详解 - -ret字段记录该交易执行的节本结果信息。 - -``` -code ::: SUCESS -``` - -code: 交易执行是否成功,除标识成功的SUCESS外还有以下几种表示失败的结果 - -``` -REVERT //合约中执行回退操作 -BAD_JUMP_DESTINATION //合约中指令跳转异常 -OUT_OF_MEMORY //合约中使用TVM虚拟机的memory超过3M -STACK_TOO_SMALL //合约中指令STACK存储参数异常 -STACK_TOO_LARGE //合约中指令STACK存储参数异常 -ILLEGAL_OPERATION //合约中执行到非法指令 -STACK_OVERFLOW //合约过程中TVM堆栈使用超过1024 -OUT_OF_ENERGY //合约执行过程中fee_limit提供的ENERGY不足 -OUT_OF_TIME //合约执行时间超过50ms -JVM_STACK_OVER_FLOW //合约过程中发生JVM栈溢出 -``` - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\345\274\202\345\270\270\345\244\204\347\220\206.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\345\274\202\345\270\270\345\244\204\347\220\206.md" deleted file mode 100644 index 23399dbb..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\345\274\202\345\270\270\345\244\204\347\220\206.md" +++ /dev/null @@ -1,186 +0,0 @@ -# 执行合约时,会出现四种类型的异常: -1. Assert-style异常 -2. Require-style异常 -3. Validation-style异常 -4. VMillegal-style异常 - -# Assert-style异常 -下列情况将会产生一个assert-style异常,会抛出invalid opcode错误,消耗所有的Energy(包括当前为止已经消耗的Energy和未消耗的Energy) -1. 如果你访问数组的索引太大或为负数(例如 x[i] 其中 i >= x.length 或 i < 0) -2. 如果你访问固定长度 bytesN 的索引太大或为负数 -3. 如果你用零当除数做除法或模运算(例如 5 / 0 或 23 % 0 ) -4. 如果你移位负数位 -5. 如果你将一个太大或负数值转换为一个枚举类型 -6. 如果你调用未被初始化的内部函数类型变量 -7. 如果你调用assert的参数(表达式)最终结果是false -8. 合约执行过程中超时 -9. 发生JVMStackOverFlowException -10. 发生OutOfMem异常,即内存超过了3M -11. 合约运行过程中,发生了加法等溢出 - -# Require-style异常 -下列情况将会产生一个require-style异常,会抛出revert错误,仅仅消耗当前为止已经消耗的energy,不包括未消耗的Energy -1. 调用throw -2. 如果你调用require的参数(表达式)最终结果为false -3. 如果你通过消息调用某个函数,但该函数没有正确结束(比如该函数耗尽了 Energy,或者本身抛出一个异常)。如果调用函数时没有指定Energy,会把所有Energy都传进去,表面看来会消耗所有Energy,只有设置了Energy值,才能看出差别。该函数不包括低级别的操作call、send、 delegatecall或者callcode 。低级操作不会抛出异常,而通过返回 false 来指示失败。 -4. 如果你使用new关键字创建合约,但合约没有正确创建(因为创建合约时无法指定Energy,会把所有Energy都传进去,表面看来会消耗所有Energy) -5. 如果你的合约通过一个没有payable修饰符的公有函数(包括构造函数、fallback函数和一般的公有函数)接收TRX -6. transfer() 失败 -7. 调用revert() -8. 到达最大函数栈深64 - -注:assert-style和require-style这两种情况下,都会导致TVM 回退。回退的原因是不能继续安全地执行,因为没有实现预期的效果。 因为我们想保留交易的原子性,所以最安全的做法是回退所有更改。但是会进行扣费。 - -# Validation-style异常 -下列情况将会产生一个validation-style异常,该类异常下交易不上链,也不会消耗任何Energy -1. 当前版本不支持虚拟机 -2. 创建合约的时候,合约名字超出32字节 -3. 创建合约的时候,消耗调用者资源的比例不在[0, 100]之间 -4. 创建合约的时候,新生成的合约地址发生了hash冲突,即合约地址已经生成过 -5. callvalue不为0,如果发生余额不足 -6. feeLimit不在合法范围之内 -7. 向不支持constant的节点发送了constant的请求 -8. trigger的合约在数据库中不存在 - -# VMillegal-style异常 -下列情况会发生一个VMillegal-style异常,该类异常交易不会上链,但是会在网络层惩罚发送该交易的节点,断开连接一段时间。 -1. 创建合约的时候,OwnerAddress和OriginAddress不相等 -2. 广播了一个constant请求 - -# 异常处理流程 -1. 入口是go() -异常都会在go()里面接住并且处理,不会传到go()外面。 - -

-public void go() {
-
-    try {
-      vm.play(program);
-
-      result = program.getResult();
-
-      // 如果有Exception或者Revert
-      // 注意:
-      // Exception是程序中抛出设置的
-      // Revert是虚拟机编译器提前写进bytecode的,通过跳转到达
-      if (result.getException() != null || result.isRevert()) {
-
-        if (result.getException() != null) {
-          // 如果是Exception,会消耗所有Energy
-          program.spendAllEnergy();
-          // 设置runtimeError表示错误内容的字段
-          runtimeError = result.getException().getMessage();
-          // 接着抛出异常
-          throw result.getException();
-        } else {
-          // 如果是Revert且没有Exception的话,仅仅设置runtimeError表示错误内容的字段
-          runtimeError = "REVERT opcode executed";
-        }
-
-        // 只要出现Exception或者Revert,就不会commit,即虚拟机执行过程中所有的状态改变不会落库
-
-      } else {
-        // 没有Exception和Revert,则commit,即虚拟机执行过程中所有的状态改变会落库
-        deposit.commit();
-      }
-    }
-    catch (JVMStackOverFlowException e) {
-        // TVM或者JVM,JVMStackOverFlowException,标记异常
-        // JVMStackOverFlowException异常只会在go()里面接住,里面使用call调用的合约发生的JVMStackOverFlowException异常,或者多次重复往下调用的JVMStackOverFlowException,在play()里面不会接住,只会在这里统一接住。
-        result.setException(e);
-        runtimeError = result.getException().getMessage();
-    }
-    // catch住所有能抛出的内容
-    catch (Throwable e) {
-      // 如果异常未知,则标记
-      if (Objects.isNull(result.getException())) {
-        result.setException(new RuntimeException("Unknown Throwable"));
-      }
-      // 保证runtimeError有值
-      if (StringUtils.isEmpty(runtimeError)) {
-        runtimeError = result.getException().getMessage();
-      }
-
-    }
-  }
-  // 在go()函数之后,result.getException()不会被使用了,而runtimeError会填写进transactionInfo中
-
- -2. play()函数 -play()函数是虚拟机真正执行的地方,有三个地方会调用到play(),go()(上面已经说明了)、callToAddress()(CALL指令会调用,也就是合约里面调用其他合约的时候)、createContract()(CREATE指令,也就是在合约里面创建合约的时候)。后两者不会做接住异常的处理,play里面的往外抛出的异常,在后两者里面会继续往外抛出。 -

-// play里面会捕捉住所有的RuntimeException,会向外抛出JVMStackOverFlowException异常(包括StackOverflowError)
-  public void play(Program program) {
-    try {
-      // 一条op一条op的执行虚拟机
-      while (!program.isStopped()) {
-        // step会先接住RuntimeException,扣完Energy再抛出
-        // 这时会停止循环
-        this.step(program);
-      }
-    }
-    catch (JVMStackOverFlowException e) {
-      // 向外抛出JVMStackOverFlowException异常
-      throw new JVMStackOverFlowException();
-    } catch (RuntimeException e) {
-      if (StringUtils.isEmpty(e.getMessage())) {
-        // 将step()函数抛出的RuntimeException放进program.result.exception,而不是往外抛出
-        program.setRuntimeFailure(new RuntimeException("Unknown Exception"));
-      } else {
-        program.setRuntimeFailure(e);
-      }
-    } catch (StackOverflowError soe) {
-      // 向外抛出JVMStackOverFlowException异常
-      throw new JVMStackOverFlowException();
-    } finally {
-    }
-  }
-
- -3.step()函数 - -

-// step会先接住RuntimeException,扣完Energy再抛出
-// 注意,这里面抛出的异常都是RuntimeException
-public void step(Program program) {
-  try {
-    // 如果op非法,则抛出IllegalOperationException,其实是在bytecode中提前写好了Invalid,assert-style操作会跳转到Invalid
-    OpCode op = OpCode.code(program.getCurrentOp());
-    if (op == null) {
-      throw Program.Exception.invalidOpCode(program.getCurrentOp());
-    }
-    switch (op) {
-      // 1. 先计算出该op需要的Energy
-
-      // 2. 扣费,不够,则抛出OutOfEnergyException异常
-      program.spendEnergy(energyCost, op.name());
- 
-      // 3. 检测CPU时间,超时,则抛出OutOfResourceException异常
-      program.checkCPUTimeLimit(op.name());
-
-      // 4. 实际执行OP
-      // 这里面重点是CREATE指令和CALL指令
-      // 里面的步骤都是类似的:
-      // 4.1 深度到了,会push 0 到stack,return
-      // 4.2 有value的话,余额不足,则push 0 到stack,return
-      // 4.3 有value的话,transfer失败,抛出RuntimeException类型的异常
-      // 4.4 (需要执行的话)执行虚拟机
-      // 4.5 执行虚拟机的结果,有exception,不会抛出任何Exception,只会扣除所有Energy,并且push 0 到stack
-      // 4.6 执行虚拟机的结果,有revert,则会返还Energy,并且push 0 到stack
-      // 4.7 成功执行,会返还Energy,push 1 到stack
-
-      // 注意:
-      // revert操作,以及exception之后,怎么处理,是虚拟机bytecode决定的,有的会revert,有的会invalid
-      // callToPrecompile失败,会直接抛出RuntimeException类型的异常
-   }
- } catch (RuntimeException e) {
-   // step会先接住RuntimeException,扣完Energy再抛出
-   program.spendAllEnergy();
-   // 停止循环
-   program.stop();
-    // 抛出异常
-    throw e;
-  } finally {
-  }
-}
-
diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204Dapp\345\274\200\345\217\221\347\216\257\345\242\203.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204Dapp\345\274\200\345\217\221\347\216\257\345\242\203.md" deleted file mode 100644 index 179b041a..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\346\220\255\345\273\272\350\207\252\345\267\261\347\232\204Dapp\345\274\200\345\217\221\347\216\257\345\242\203.md" +++ /dev/null @@ -1,156 +0,0 @@ -# 搭建自己的Dapp开发环境 -Version 0.1 - -## 介绍 -我们目前可以基于波场的私有链搭建智能合约开发环境,不消耗公链上的资源,可以节约开发成本。波场对以太坊虚拟机具有较高的兼容性,大部分基于Solidity的智能合约都可以直接运行在波场上。基于波场的智能合约,可以提供高的TPS,以及针对大多数场景下的免费使用权限,对整个智能合约开发生态具有重要的意义。目前底层虚拟机部分已经基本开发完毕,围绕虚拟机的周边生态正在逐步建立中,包括各种开发工具等。本文介绍一种比较初级的开发方式来部署合约,以及与合约交互。 - -## 前提条件 - -### 合约运行的网络 - -由于在波场网络协议中,部署和调用合约都需要消耗相应的资源(内存,CPU,存储等),所以建议开发者在搭建自己的私有网络进行智能合约的调试和测试,在确认合约可用之后,再将合约部署在测试网或主网之上。搭建私有网络可参考[Deployment of FullNode(PrivateNet: Just one witness node) on the one host.](https://github.com/tronprotocol/TronDeployment) - -该私有链的产块节点的地址:TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY - -Witness私钥:da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0 - -注意:如果要支持constant的请求,需要在配置文件config.conf中填写:supportConstant = true,默认是false。 -``` -vm = { - supportConstant = true - minTimeRatio = 0.0 - maxTimeRatio = 5.0 -} -``` -另外两项,minTimeRatio是指接收到超时的智能合约交易时,验证合约时设定的超时时间比例(该比例乘以默认时间,当前是50ms即为最后的超时时间);maxTimeRatio是指接受到未超时的智能合约交易时,验证合约时设定的超时时间比例。 - -### 钱包客户端 - -wallet-cli是波场网络的命令行钱包,开发者可以使用wallet-cli在主网上进行合约的部署和发布,以及其他相关的操作。 - -## 智能合约的开发 -编写智能合约,我们暂时推荐使用[Remix](http://remix.ethereum.org/)进行编译、调试等前期的开发工作。 -当合约开发完成之后,可以把合约复制到[SimpleWebCompiler](https://github.com/tronprotocol/tron-demo/tree/master/SmartContractTools/SimpleWebCompiler)中进行编译,获取ABI和ByteCode。 -我们提供一个简单的数据存取的合约代码示例,以这个示例来说明编译、部署、调用的步骤。 -``` -pragma solidity ^0.4.0; -contract DataStore { - - mapping(uint256 => uint256) data; - - function set(uint256 key, uint256 value) public { - data[key] = value; - } - - function get(uint256 key) view public returns (uint256 value) { - value = data[key]; - } -} -``` - -### 启动私有链 -确保前提条件中,私有链已经在本地部署完成。可以检查FullNode/logs/tron.log中,是否有持续产块的log信息出现:“Produce block successfully” - -### 开发智能合约 -把上述代码复制到remix中编译,调试,确保代码的逻辑是自己需要的,编译通过,没有错误 - -### 在SimpleWebCompiler编译得到ABI和ByteCode -因为波场的编译器与以太坊的编译略有差异,正在与Remix集成中,所以临时采用改方案获取ABI和ByteCode,而不是通过Remix直接获取ABI和ByteCode。 -把上述代码复制到SimpleWebCompiler中,点击Compile按钮,获取ABI和ByteCode。 - -### 通过Wallet-cli部署智能合约 -下载Wallet-Cli,文件然后编译。 -``` -shell -# 下载源代码 -git clone https://github.com/tronprotocol/wallet-cli -cd wallet-cli -# 编译 -./gradlew build -cd build/libs -``` -> Note:wallet-cli 默认的配置会连接本地127.0.0.1:50051的 fullnode,如果开发者需要连接不同的其他节点或者端口可在 config.conf 文件中进行修改 - -启动wallet-cli - -``` -java -jar wallet-cli.jar -``` -启动之后,可在命令中交互式输入指令。导入私钥,并查询余额是否正确 -```Shell -importwallet -<输入你自己的设定的钱包密码2次> -<输入私钥:da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0> -login -<输入你自己的设定的钱包密码> -getbalance -``` -部署合约 - - -``` -Shell -# 合约部署指令 -DeployContract contract_name ABI byteCode constructor params isHex fee_limit consume_user_resource_percent origin_energy_limit value token_value token_id(e.g: TRXTOKEN, use # if don't provided) - -# 参数说明 -contract_name:自己制定的合约名 -ABI:从SimpleWebCompiler中获取到的 ABI json 数据 -bytecode:从SimpleWebCompiler中获取到的二进制代码 -constructor:部署合约时,会调用构造函数,如果需要调用,就把构造函数的参数类型填写到这里,例如:constructor(uint256,string),如果没有,就填写一个字符# -params:构造函数的参数,使用逗号分隔开来,例如 1,"test" ,如果没有构造函数,就填写一个字符# -isHex: 输入参数是否转为十六进制 -fee_limit:本次部署合约消耗的TRX的上限,单位是SUN(1 SUN = 10^-6 TRX),包括CPU资源、STORAGE资源和可用余额的消耗 -consume_user_resource_percent:指定的使用该合约用户的资源占比,是[0, 100]之间的整数。如果是0,则表示用户不会消耗资源。如果开发者资源消耗完了,才会完全使用用户的资源。 -origin_energy_limit: 开发者设置的在一次合约调用过程中自己消耗的energy的上限,必须大于0。对于之前老的合约,没有提供设置该值的参数,会存成0,但是会按照1000万energy上限计算,开发者可以通过updateEnergyLimit接口重新设置该值,设置新值时也必须大于0 -value:在部署合约时,给该合约转账金额 -token_value: 转trc10 token的个数 -token_id: 转trc10 token的tokenid -library:address,library:address,...:如果合约包含library,则需要在部署合约的时候指定library的地址,具体见下文;没有library的话则不需要填写。 - -# 运行例子 -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 1 0 0 # -部署成功会显示Deploy the contract successfully -``` - -得到合约的地址 -``` -Your smart contract address will be: <合约地址> - -# 在本例中 -Your smart contract address will be: TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 -``` - -调用合约存储数据、查询数据 -``` -Shell -# 调用合约指令 -TriggerContract contract_address method args isHex fee_limit value token_value token_id(e.g: TRXTOKEN, use # if don't provided) - -# 参数说明 -contract_address:即之前部署过合约的地址,格式 base58,如:TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 -method:调用的函数签名,如set(uint256,uint256)或者 fool(),参数使用','分割且不能有空格 -args:如果非十六进制,则自然输入使用','分割且不能有空格,如果是十六进制,直接填入即可 -is_hex:输入参数是否为十六进制,false 或者 true -fee_limit:和deploycontract的时候类似,表示本次部署合约消耗的TRX的上限,单位是SUN(1 SUN = 10^-6 TRX),包括CPU资源、STORAGE资源和可用余额的消耗。 -value:在部署合约时,给该合约转账金额 -token_value: 转trc10 token的个数 -token_id: 转trc10 token的tokenid - -# 调用的例子 -## 设置 mapping 1->1 -triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256,uint256) 1,1 false 1000000 0 0 # - -## 取出 mapping key = 1的 value -triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 get(uint256) 1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000 -``` - -如果调用的函数是 constant 或 view,wallet-cli 将会直接返回结果 - -如果包含library,则需要在部署合约之前先部署library,部署完library之后,知道了library地址,将地址填进。 -``` -# 比如使用remix生成的合约,bytecode是 -608060405234801561001057600080fd5b5061013f806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f75dac5a14610046575b600080fd5b34801561005257600080fd5b5061005b610071565b6040518082815260200191505060405180910390f35b600073__browser/oneLibrary.sol.Math3__________<\b>634f2be91f6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156100d357600080fd5b505af41580156100e7573d6000803e3d6000fd5b505050506040513d60208110156100fd57600080fd5b81019080805190602001909291905050509050905600a165627a7a7230582052333e136f236d95e9d0b59c4490a39e25dd3a3dcdc16285820ee0a7508eb8690029 -``` -之前部署的library地址是:TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 -那么部署的时候,需要将 browser/oneLibrary.sol.Math3:TSEJ29gnBkxQZR3oDdLdeQtQQykpVLSk54 作为deploycontract的参数。 diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\344\273\213\347\273\215.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\344\273\213\347\273\215.md" deleted file mode 100644 index 4bacf167..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\344\273\213\347\273\215.md" +++ /dev/null @@ -1,93 +0,0 @@ -# Tron虚拟机TVM - -波场虚拟机(Tron Virtual Machine, 简称TVM),是Tron团队为了满足自身生态发展的需求,开发出的轻量级架构、图灵完备的虚拟机, 旨在为全球百万级的开发者提供一个高效、简单、稳定、安全、且容易优化的区块链专用系统。 - -TVM能无缝对接现有的开发者生态,并且能满足DPOS共识机制的要求。TVM前期兼容以太坊虚拟机环境。开发者无需学习新的编程语言,就能用 Solidity 等编程语言在熟悉的 Remix 环境中进行智能合约的开发、调试、编译。Tron智能合约编写完毕后,上传到Tron主网当中,在超级代表节点的TVM虚拟机执行,同时保持了对虚拟机外系统环境的隔离性。 - -此外,TVM 引进了带宽的概念。不同于以太坊EVM的gas消耗模式,Tron系统中的转账和智能合约的操作是免费的,不需要消耗任何代币,所以原则上在TVM中可执行的计算总量不受代币总量限制。 - -## TVM设计原则 - -1. 轻量级 -TVM采用轻量级的虚拟机构架,旨在节省运行空间,减少资源耗费及保证系统性能。 -2. 稳定、安全性 -TVM采用了严谨的设计规范,低粒度的底层操作码,保证了每个计算步骤的精确性,最大程度消除产生歧义的空间。 同时出于安全性的考量,TVM的转账与运行合约均不需要消耗代币,只会消耗带宽,避免了针对类似以太坊gas消耗模式的攻击。在保证了每个操作计算步骤的确定性的同时,也保证了带宽消耗的稳定性。 -3. 兼容性 -目前,TVM能完美兼容以太坊EVM,并在未来兼容更多主流的VM。因此, 以太坊上的智能合约,能直接运行到TVM上,无缝对接现有的开发者生态,提高开发者的开发效率。开发者无需学习新的编程语言,就能用Solidity 等主流编程语言在熟悉的Remix环境中进行智能合约的开发、调试、编译,将极大缩减开发成本。 -4. 开发人员友好性 -TVM的带宽消耗模式减少了合约的开发成本。让开发者可以把更多精力放在合约代码的逻辑本身。同时,TVM提供了对开发者友好的一站式的部署、触发、查看智能合约的接口。 - -Tron Wallet-CLI中添加了以下对接接口, -+ deploycontract(password, contractAddress, ABI, code, data, value) -+ triggercontract(password, contractAddress, selector, data, value) -+ getcontract(contractAddress) - -开发人员可直接调用,完成对智能合约的部署,触发,查看。 - -## TVM的运行过程 -![Tron Virtual Machine的工作流程](https://raw.githubusercontent.com/ybhgenius/Documentation/master/images/Virtual_Machine/虚拟机.png) - -这张图整体描述了Tron Virtual Machine的工作流程: -Tron智能合约的编译 ---> 虚拟机的执行、计算引擎  ---->虚拟机对外的互操作层 - -简单来说,上面的流程依次是: -1. 目前Tron虚拟机主要兼容Solidity。编译器将Solidity智能合约翻译成TVM可以识别并执行的字节码。 -2. 在虚拟机中,通过一条条的操作指令码实现对虚拟机栈中数据的操作处理,这个过程相当于实现对一个基于堆栈的有限状态机的逻辑处理。 -3. 虚拟机通过互操作模块实现对区块链数据的访问,以及对外部数据的接口层的调用。 -
 -## TVM的发展方向 - -1. 构建更加友好的调试工具 -Tron团队将努力构建完善的调试工具,建立用于调试的标准符号格式或是数据格式。提升开发者在TVM的开发、调试效率。 -2. 满足更加多样化的任务处理需求 -和以太坊上每个操作消耗gas不同,Tron虚拟机对业务的处理并不收费,每个操作只是先占据带宽,并且在交易后的一段时间后释放。开发者们只用相当小的成本 便可设计更加复杂逻辑的智能合约。我们深信,除了数字货币交易的应用场景外,未来的智能合约也能在游戏开发,金融市场风险建模,科学计算等领域发挥重要作用。Tron虚拟机的设计具有先天的满足多样化任务场景的能力,并且在对处理速度,响应时间,对浮点数的支持上作进一步的优化。 -3. 增加即时编译速度、整合WebAssembly。 -增加即时编译的速度能够对本地代码进行更优化地编译,更快速地解读运行代码。 -同时,Tron将考虑基于WebAssembly(简称WASM)进一步优化TVM虚拟机。WebAssembly 目前由 Apple、Google、 Microsoft和Mozilla牵头,为突破Web浏览器性能瓶颈而设计,并可由 C/C++ 等语言编译产生。WebAssembly应用在区块链场景上,可以提高基于Web的DApp的性能。实现整合了WASM的TVM,将会满足未来复杂业务场景对接区块链应用的高性能、高吞吐量要求。 - -## 智能合约简介 - -1. 编译合约 -合约编译地址:https://remix.ethereum.org -2. 获取ABI和字节码 -以如下合约为例: -``` -pragma solidity^0.4.11; - -contract Tron { - uint256 tron; - constructor() public { } - - - function set(uint256 number) public returns(bool){ - tron = number; - return true; - } -} - -ABI: -[{“constant":false,"inputs":[{"name":"number","type":"uint256"}],"name":"set","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] - - -ByteCode:608060405234801561001057600080fd5b5060c48061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b1146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506086565b604051808215151515815260200191505060405180910390f35b600081600081905550600190509190505600a165627a7a723058209791df3f67e9af451c35d7ae55bda5e352764f6a38ea23fa850b1c1fe1bc72e90029 -``` - -3. 部署合约 -wallet-cli-vm的分支: https://github.com/tronprotocol/wallet-cli/tree/wallet-cli-vm -java-tron-vm的分支:https://github.com/tronprotocol/java-tron/tree/develop_vm -Password: 钱包客户端密码 -ContractAddress: 自定义合约地址(需要满足波场地址格式要求) -ABI:接口描述 -Code: 字节码 -Data: 初始化函数参数相关 -Value: 保留 -deploycontract(Password, ContractAddress, ABI, Code, Data, Value) -4. 调用合约 -Selector:函数选择器 -Data:参数相关 -triggercontract(Password, ContractAddress, Selector, Data, Value) -5. 查询合约 - getcontract(ContractAddress) - - - diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\345\206\205\347\275\256\345\207\275\346\225\260.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\345\206\205\347\275\256\345\207\275\346\225\260.md" deleted file mode 100644 index 4bf71566..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\345\206\205\347\275\256\345\207\275\346\225\260.md" +++ /dev/null @@ -1,263 +0,0 @@ -## 波场虚拟机内置函数文档 (@deprecated 此文档已过期,出于安全性考虑,新版本中不做支持,将考虑以其他方式实现) - - -### 1.超级节点投票 -地址: 0x0000000000000000000000000000000000000000000000000000000000010001 - -输入参数:超级节点地址,投票数目 - -返回值:用汇编可以得到执行成功与否 - -Solidity例子: - - address public voteContractAddress= 0x10001; - /** - * @dev vote for a witness. - * @param witnessAddr witness address - * @param voteValue the vote amount - */ - function voteForSingleWitness (address witnessAddr, uint256 voteValue) public{ - voteContractAddress.delegatecall(witnessAddr,voteValue); - } - -### 2.冻结账户 (暂时取消了对本函数的支持) -地址: 0x0000000000000000000000000000000000000000000000000000000000010002 - -输入参数:冻结金额,冻结时间 - -返回值:用汇编可以得到执行成功与否 - -Solidity例子: - - //address public freezeBalanceAddress = 0x10002; - /** - * don't test now, not support - * @dev freeze balance for an account. Should be an normal account, not a contract account. - */ - // function freezeBalance(uint256 frozen_Balance,uint256 frozen_Duration) public { - // freezeBalanceAddress.delegatecall(frozen_Balance,frozen_Duration); - // } - -### 3.取消冻结账户 (暂时取消了对本函数的支持) -地址: 0x0000000000000000000000000000000000000000000000000000000000010003 - -输入参数:冻结金额,冻结时间 - -返回值:用汇编可以得到执行成功与否 - -Solidity例子: - - //address public unFreezeBalanceAddress = 0x10003; - /** - * don't test now, not support - * @dev unFreezeBalance for an account. Should be an normal account, not a contract account. - */ - // function unFreezeBalance() public { - // unFreezeBalanceAddress.delegatecall(); - // } - -### 4.超级节点获取所有奖励 -地址: 0x0000000000000000000000000000000000000000000000000000000000010004 - -输入参数:无 - -返回值:用汇编可以得到执行成功与否 - -Solidity例子: - - //address public withdrawBalanceAddress = 0x10004; - /** - * @dev withdraw all rewards for a witness, caller should be witness itself - */ - function withdrawBalance() public { - withdrawBalanceAddress.delegatecall(); - } - - -### 5.超级节点通过或否定提案 -地址: 0x0000000000000000000000000000000000000000000000000000000000010005; - -输入参数:提案表决id,是否通过 - -返回值:用汇编可以得到执行成功与否 - -Solidity例子: - - address public approveProposalAddress = 0x10005; - /** - * @dev approve a proposal - * @param id proposalId - * @param isApprove approve or not - */ - function approveProposal(uint256 id, bool isApprove) public { - approveProposalAddress.delegatecall(id,isApprove); - } - -### 6.超级节点提出提案 -地址: 0x0000000000000000000000000000000000000000000000000000000000010006; - -输入参数:提案的键值对32位byte数组,数组大小一定是偶数个,key,value交替[key1,value1,key2,value2...keyN,valueN] - -返回值:用汇编可以得到生成的id - -Solidity例子: - - address public createProposalAddress = 0x10006; - /** - * @dev create a proposal - * @param data bytes32 array of proposal key, value pair (key1,value1,key2,value2....keyN,valueN) - * keyi is bytes32 - * valuei is also bytes32 - */ - function createProposal(bytes32 [] data) public { - createProposalAddress.delegatecall(data); - } - - -### 7.超级节点删除提案 -地址: 0x0000000000000000000000000000000000000000000000000000000000010006; - -输入参数:提案的键值对32位byte数组,数组大小一定是偶数个,key,value交替[key1,value1,key2,value2...keyN,valueN] - -返回值:用汇编可以得到删除成功与否 - -Solidity例子: - - address public deleteProposalAddress = 0x10007; - /** - * @dev for proposal creator to delete a proposal - * @param id proposalId - */ - function deleteProposal(uint256 id) public{ - deleteProposalAddress.delegatecall(id); - } - - -### 8.波场byte地址转换为solidity地址 -地址: 0x0000000000000000000000000000000000000000000000000000000000010008; - -输入参数:波场的byte32位地址 - -返回值:用汇编可以得到对应的类型为solidity地址的变量值 - -Solidity例子: - - address public convertFromTronAddress = 0x10008; - /** - * @dev convert bytes32 tronAddress to Solidity address type - * @param tronAddress bytes32 tronAddress - * @return outputAddr Solidity address type - */ - function convertFromTronBytes32Address(bytes32 tronAddress) public view returns(address outputAddr){ - bytes32[1] memory input; - input[0] = tronAddress; - address[1] memory output; - assembly{ - if iszero(call(200, 0x10008, 0, input, 0x20, output, 0x20)) { - revert(0, 0) - } - } - outputAddr = output[0]; - } - - - - -### 9.波场string地址转换为solidity地址 -地址: 0x0000000000000000000000000000000000000000000000000000000000010009; - -输入参数:波场的字符串类型地址 - -返回值:用汇编可以得到对应的类型为solidity地址的变量值 - -Solidity例子: - - address public convertFromBase58TronAddress = 0x10009; - /** - * @dev base58 string tron address to solidity address type - * @param address58 tron address represented as base58 string - * @return solidity address type - */ - function convertAddress(string address58) public constant returns(address outputAddr){ - bytes32[2] memory input ; - input[0] = stringToBytes32(substring(address58,0,32)); - input[1] = stringToBytes32(substring(address58,32,34)); - address[1] memory output; - assembly{ - if iszero(call(200, 0x10009, 0, input, 0x22, output, 0x20)) { - revert(0, 0) - } - } - outputAddr = output[0]; - } - - function substring(string str, uint startIndex, uint endIndex) constant returns (string) { - bytes memory strBytes = bytes(str); - bytes memory result = new bytes(endIndex-startIndex); - for(uint i = startIndex; i < endIndex; i++) { - result[i-startIndex] = strBytes[i]; - - } - return string(result); - } - - function stringToBytes32(string str) public constant returns (bytes32 result) { - string memory source =str ; - if (bytes(source).length == 0) { - return 0x0; - } - assembly { - result := mload(add(source, 32)) - } - } - - -### 10.向目标账户地址发送token转账 -地址: 0x000000000000000000000000000000000000000000000000000000000001000a; - -输入参数: 转token地址,token转账大小(以token为单位),token名称 - -返回值:用汇编可以得到转token成功与否 - -Solidity例子: - - address public transferAssetAddress = 0x1000a; - /** - * @dev transferAsset transfer specific number of token asset to targetAddress - * @param toAddress targetAddress transfer token to - * @param amount transfer token amount - * @param name token name - */ - function transferAsset(address toAddress, uint256 amount, string name) public { - transferAssetAddress.delegatecall(toAddress,amount,bytes(name)); - } - -### 11.查询目标账户地址的指定token的数量 -地址: 0x000000000000000000000000000000000000000000000000000000000001000b; - -输入参数: 需查询token的账户地址,token名称 - -返回值:用汇编可以得到账户所持token的数量 - -Solidity例子: - - address public getTransferAssetBalanceAddress = 0x1000b; - /** - * @dev getAssetBalance get targetAddress specific token balance - * @param targetAddress current checking address - * @param name token name - * @return token balance for targetAddress - */ - function getAssetBalance(address targetAddress, string name) public constant returns(uint256 assetBalance) { - bytes32 nameBytes32 = stringToBytes32(name); - assembly{ - let x := mload(0x40) //Find empty storage location using "free memory pointer" - mstore(x,targetAddress) //Place first argument directly next to signature - mstore(add(x,0x20),nameBytes32) //Place second argument next to first, padded to 32 bytes - if iszero(call(200, 0x1000b, 0, x, 0x40, add(x,0x40), 0x20)) { - revert(0, 0) - } - assetBalance := mload(add(x,0x40)) //Assign output value to assetBalance - mstore(0x40,add(x,0x60)) // Set storage pointer to empty space - } - } diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\345\255\230\345\202\250.md" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\345\255\230\345\202\250.md" deleted file mode 100644 index b64fadd0..00000000 --- "a/\344\270\255\346\226\207\346\226\207\346\241\243/\350\231\232\346\213\237\346\234\272/\350\231\232\346\213\237\346\234\272\345\255\230\345\202\250.md" +++ /dev/null @@ -1,49 +0,0 @@ -## 虚拟机存储 - -TVM作为一种运行于tron协议上的虚拟机,需要能够和链上的数据做交互,为智能合约提供访问链的状态的能力。 - -智能合约能够访问到的链上数据可以分为两类: - -1. 区块链的数据,比如账户数据,投票数据,资产发行等 -2. 智能合约数据:storage - - - -### 链上数据访问 - -在虚拟机的运行时,常常也需要访问到链已有的数据,如果账户数据,资产发行数据等。在tron的实现中,为了避免频繁对磁盘上的数据进行访问,每一个智能合约启动都会创建相应链数据库的cache。一次合约的执行,同一个key最多只会在LevelDB上访问两次,首次读取和更新数据(包括删除key) - -#### Storage - -Storage是为了保存智能合约的状态。每一份合约都拥有一份自己的Storage(可能为空),在Solidity中,主要通过`SLOAD`和`STORE`对Storage数据进行访问和持久化。 - -Storage所存放的数据为多个KV对,storage-key和storage-value,KV均为一个word(在solidity中,为32byte) - -在Solidity中,不同的数据类型的有相应的规则确定其结构,具体可见[文档](https://solidity.readthedocs.io/en/v0.4.24/miscellaneous.html#layout-of-state-variables-in-storage),Storage的Key的逻辑结构由Solidity语言所决定,对于不同的合约可能出现一样的storage-key,故无法将storage直接按照其逻辑结构存放在我们现有的数据库(LevelDB)当中,也为了能够更加有效与链进行结合,Storage在链上的物理存储必须进行相应的设计。 - -由于在智能合约中对storage的访问常常只是访问其中一部分的storage-key,故并不需要将每次将一个合约中的所有Storage全部载入内存,只需要按需访问即可。为了达到这种细粒度的访问,需要将每个合约中storage-key具有全局唯一性才能够将其存放在同一个数据库中。 - -storage-key的逻辑结构决定其后16字节可以确保在同一个合约当中storage-key的唯一性。所以可以采用将合约地址的hash和storage-key的后16字节拼接组成全局唯一的key。组成逻辑如下: - -``` -input: 32-byte addrress hash, 32-byte storage-key -output: [前 16-bytes of address hash : 后 16-bytes of storage-key] - -example1 -input: -address base58: TGtZHTi4FZHjoNzcLcD36BnAX6FMSpLaKq -address hex : 414BE7BB5E1D250BEAF39ADB69F73527071E303375 -address hash : a59e620dbf248894f097d9a6e5bcb6a2e72ab51b3d0ec19219c45be0dfc0b47d -storage-key : bbbbbb5be78dbadf6c4e817c6d170bbb47e9916f8f6cc4607c5f3819ce98497b -output: -最终组合的key为 : a59e620dbf248894f097d9a6e5bcb6a247e9916f8f6cc4607c5f3819ce98497b - -example2 -input: -address base58: TGtZHTi4FZHjoNzcLcD36BnAX6FMSpLaKq -address hex : 414BE7BB5E1D250BEAF39ADB69F73527071E303375 -address hash : a59e620dbf248894f097d9a6e5bcb6a2e72ab51b3d0ec19219c45be0dfc0b47d -storage-key : 0000000000000000000000000000000000000000000000000000000000000001 -output: -最终组合的key为 : a59e620dbf248894f097d9a6e5bcb6a200000000000000000000000000000001 -``` diff --git "a/\344\270\255\346\226\207\346\226\207\346\241\243/\351\222\261\345\214\205\346\265\213\350\257\225\347\224\250\344\276\213.numbers" "b/\344\270\255\346\226\207\346\226\207\346\241\243/\351\222\261\345\214\205\346\265\213\350\257\225\347\224\250\344\276\213.numbers" deleted file mode 100644 index 90be4809..00000000 Binary files "a/\344\270\255\346\226\207\346\226\207\346\241\243/\351\222\261\345\214\205\346\265\213\350\257\225\347\224\250\344\276\213.numbers" and /dev/null differ