diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml new file mode 100644 index 00000000..c95c2fb9 --- /dev/null +++ b/.github/workflows/laravel.yml @@ -0,0 +1,36 @@ +name: Laravel + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + laravel-tests: + + runs-on: ubuntu-latest + + steps: + - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e + with: + php-version: '8.0' + - uses: actions/checkout@v3 + - name: Copy .env + run: php -r "file_exs('.env') || copy('.env.example', '.env');" + - name: look but no touch + Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + - name: Create Database + run: | + mkdir -p database + touch database/database.sqlite + - name: Execute tests (Unit and Feature tests) via PHPUnit + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: vendor/bin/phpunit 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_Event_Subscribe/Tron-event_description.md b/English_Documentation/TRON_Event_Subscribe/Tron-event_description.md new file mode 100644 index 00000000..1912a594 --- /dev/null +++ b/English_Documentation/TRON_Event_Subscribe/Tron-event_description.md @@ -0,0 +1,85 @@ + + +> Trigger 类别 + +可支持订阅的Event类型: + + - transactionTrigger: transaction事件,区块时触发 + - blockTrigger: 区块事件,提交区块时触发 + - contractLogTrigger: 智能合约日志 + - contractEventTrigger:智能合约事件 + + +> Filter定义 + +只针对智能合约日志、事件的订阅,具体包括如下字段: + +fromBlock: 起始区块高度,可以设置为"", "earliest"或者具体的区块高度。 +toBlock: 结束区块高度,可以设置为"","latest"或者具体的区块高度。 +contractAddress:智能合约地址列表 +contractTopics:智能合约主题列表 +**注意**: 不支持历史数据查询。 + + +> 交易Log + +交易信息用TransactionLogTrigger表示,包括如下参数: + + - transactionId, transaction哈希 + - blockHash, 交易发生的区块hash + - blockNumber,交易发生的block number + - energyUsage, 能量使用 + - energyFee,能量费用 + - originEnergyUsage origin energy usage + - energyUsageTotal, total energy usage total + + +> 智能合约Log + +智能合约日志对象用ContractLogTrigger表示,包括如下参数: + + - transactionId, transaction id + - contractAddress: 合约地址 + - callerAddress:合约调用者地址 + - blockNumber: 交易所在的块号 + - blockTimestamp: 交易所在块的打包时间 + - contractTopics: Solidity 语言中 Log 能够输出的 topic 列表 + - data: Solidity 语言中,Log 能够输出的 data + - removed,如果日志已被删除则为true,有效日志则为false + + +> 智能合约Event + + - transactionId, transaction id + - contractAddress: 合约地址 + - callerAddress:合约调用者地址 + - blockNumber: 交易所在的块号 + - blockTimestamp: 交易所在块的打包时间 + - eventSignature: Event 的签名字符串 + - topicMap: Solidity 语言中 Event 能够输出的 topic名称 => topic 值的映射 + - data: Solidity 语言中, Event 能够输出的 data 字段 + - removed,如果日志已被删除则为true,有效日志则为false + + +> Trigger触发 + + - 区块事件的触发,区块插入时创建blockTrigger + - 交易事件的触发,交易执行之前创建transactionTrigger + - 智能合约日志的触发,在合约执行并且解析之后创建contractLogTrigger + - 智能合约事件的触发,在合约执行并且解析之后创建contractEventTrigger + + +> Trigger发送 + +java-tron以异步方式将Trigger发送给插件,Trigger必须满足Filter的条件。 + +如下所示是一个Filter,Trigger的blockNumber必须在fromBlock与toBlock之间,contractAddresses必须是addressA,topics必须包括topicA,只有满足条件的Trigger才会被发送。 + +fromBlock: 0x1000000 + +toBlock: 0x1200000 + +contractAddresses: "addressA" + +contractTopics: "TopicA" + diff --git a/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md b/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md index e8af6813..dc079615 100644 --- a/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md +++ b/English_Documentation/TRON_Event_Subscribe/Tron-eventsubscribe.md @@ -1,6 +1,6 @@ # 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. +TRON has implemented the event subscription mechanism to support developer community, we have finished the testing. The featured has been released on version 3.5 of Java-tron, and developers could start experiencing now. ## 2. New features @@ -11,12 +11,13 @@ TRON has implemented the event subscription mechanism to support developer commu 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) +- [java-tron](https://github.com/tronprotocol/java-tron) master branch - [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 +- TIP: https://github.com/tronprotocol/TIPs/issues/12 +- Description: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/Tron-event_description.md ## 5. event plugin - kafka plugin: https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Event_Subscribe/eventplugin_deploy.md diff --git a/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md b/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md index 497557ad..0988d9a7 100644 --- a/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md +++ b/English_Documentation/TRON_Event_Subscribe/tron-eventquery.md @@ -134,7 +134,6 @@ 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 ``` @@ -161,7 +160,7 @@ 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 +Function: get latest block number ``` subpath: $baseUrl/blocks/latestSolidifiedBlockNumber @@ -170,3 +169,73 @@ none Example: https://api.tronex.io/blocks/latestSolidifiedBlockNumber ``` +Function: get contract log list +``` +subpath: $baseUrl/contractlogs + +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/contractlogs +``` +Function: get contract log list based on transactionId +``` +subpath: $baseUrl/contractlogs/transaction/{transactionId} + +parameters +transactionId + +Example: https://api.tronex.io/contractlogs/transaction/{transactionId} +``` +Function: post abi string and get contract log list based on transactionId(release on 3.6) +``` +subpath: $baseUrl/contract/transaction/{transactionId} + +parameters +transactionId +body: +abi: user self upload abi + +Example: https://api.tronex.io/contract/transaction/{transactionId} +``` +Function: get contract log list based on contractAddress +``` +subpath: $baseUrl/contractlogs/contract/{contractAddress} + +parameters +contractAddress + +Example: https://api.tronex.io/contractlogs/contract/{contractAddress} +``` +Function: post abi string and get contract log list based on contractAddress(release on 3.6) +``` +subpath: $baseUrl/contract/contractAddress/{contractAddress} + +parameters +contractAddress +abi: user self upload abi + +Example: https://api.tronex.io/contract/contractAddress/{contractAddress} +``` +Function: get contract log list based on uniqueId +``` +subpath: $baseUrl/contractlogs/uniqueId/{uniqueId} + +parameters +uniqueId + +Example: https://api.tronex.io/contractlogs/uniqueId/{uniqueId} +``` +Function: post abi string and get contract log list based on uniqueId(release on 3.6) +``` +subpath: $baseUrl/contract/uniqueId/{uniqueId} + +parameters +uniqueId +abi: user self upload abi + +Example: https://api.tronex.io/contract/uniqueId/{uniqueId} +``` diff --git a/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md b/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md index 558baac7..c0593041 100644 --- a/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md +++ b/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md @@ -455,7 +455,7 @@ EasyTransferResponse: the transaction of a transfer and the result of broadcasti ## 37. Generate address and private key 37.1 Interface statement -rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) {}; +rpc DeployContract (CreateSmartContract) returns (TransactionExtention) {};\ 37.2 Nodes FullNode and SolidityNode. 37.3 Parameters @@ -464,3 +464,27 @@ EmptyMessage: null. 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. + +//todo:translate https://github.com/tronprotocol/Documentation/edit/master/中文文档/波场协议/波场钱包RPC-API.md + +## 80. Deploy a smart contract +80.1 Interface statement +rpc DeployContract (CreateSmartContract) returns (TransactionExtention) {};\ +80.2 Nodes +FullNode. +80.3 Parameters +CreateSmartContract: message type for creating a new smart contract, including owner_address(transaction sender address), new_contract(a SmartContract Object), call_token_value(trc10), token_id(trc10) \ +>new_contract: origin_address(contract deployer address), contract_address, abi, bytecode, call_value(trx), consume_user_resource_percent(user energy consume percentage), name(contract name), origin_energy_limit(the energy limit developer willing to afford for a trigger operation). + +80.4 Returns +TransactionExtention: a message type contains transaction, transaction_id, constant_result and on-block result. + +## 81. Trigger a smart contract +81.1 Interface statement +rpc TriggerContract (TriggerSmartContract) returns (TransactionExtention) {};\ +81.2 Nodes +FullNode. +81.3 Parameters +TriggerSmartContract: message type for triggering an existing contract, including owner_address(transaction sender address), contract_address, call_value(trx), data(triggered function signature and parameter), call_token_value(trc10), token_id(trc10)\ +81.4 Returns +TransactionExtention: a message type contains transaction, transaction_id, constant_result and on-block result. diff --git a/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD b/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD index c3461d15..38dcfd7d 100644 --- a/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD +++ b/English_Documentation/TRON_Virtual_Machine/TRC10_IN_SMARTCONTRACT.MD @@ -84,7 +84,9 @@ contract transferTokenContract { - **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. +- @deprecated **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. + +- In Odyssey_v3.5 tokenId is NOT allowed to be 0 in this function. So, the function is only related to trc10 token. ## 3.4 address.tokenBalance(trcToken) returns(uint256 tokenAmount)native function @@ -92,7 +94,9 @@ contract transferTokenContract { - 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. +- @deprecated **IMPORTANT**: Query tokenBalance(0) doesn't represent trx balance, instead it will return 0. + +- In Odyssey_v3.5 tokenId is NOT allowed to be 0 in tokenBalance(trcToken) function. ## 3.5 msg.tokenvalue & msg.tokenid @@ -100,7 +104,8 @@ contract transferTokenContract { - msg.tokenid, represent the token id in current msg call, default 0. -- **IMPORTANT**: msg.tokenid = 0 doesn't represent trx in current version. +- **IMPORTANT**: msg.tokenid = 0 is just a default value, means no token transferring. + # 4 solidity compiler diff --git a/README.md b/README.md index f9420c38..2dd6f23e 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,4 @@ -# Documentation +#### This documentation project is DEPRECATED, if you want to update or add a new documentation, please go to our new documentation project: +- [documentation-en](https://github.com/tronprotocol/documentation-en) (https://github.com/tronprotocol/documentation-en) +-github.com/tronprotocol/documentation-en [documentation-zh](https://github.com/tronprotocol/documentation-zh) -#### Please visit the new [TRON Developers Hub](https://developers.tron.network/) for detailed guides, interactive APIs, and much more! - -# Documentation Guide - -+ 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). -+ If you want to know more about TRON Wallet, please check out [Android Wallet](https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/Android_Wallet/Guide_to_Android_Wallet.md). -+ If you want to know more about the programming contest, please check out [TRON programming contest](https://github.com/tronprotocol/Documentation/tree/master/English_Documentation/TRON_Programming_Contest). -+ If you want to know more about the TRX migration, please check out [TRX](https://github.com/tronprotocol/Documentation/tree/master/TRX). -+ 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). - - - - -# 文档 - -# 文档指引 - -+ 如果你想了解波场的发展进程以及最新动态,请查看[波场介绍](https://github.com/tronprotocol/Documentation/tree/master/中文文档/波场介绍)相关文档。 -+ 如果你想了解波场的相关技术协议,请查看[波场协议](https://github.com/tronprotocol/Documentation/tree/master/中文文档/波场协议)相关文档。 -+ 如果你想了解有关超级节点、投票和发行资产的相关信息,请查看[波场区块链浏览器](https://github.com/tronprotocol/Documentation/tree/master/中文文档/波场区块链浏览器介绍)。 -+ 如果你想了解关于波场钱包的相关信息,请查看[Android钱包使用指导](https://github.com/tronprotocol/Documentation/blob/master/中文文档/Android钱包/Android钱包使用指导.md)。 -+ 如果你想了解编程大赛,请查看[波场编程大赛](https://github.com/tronprotocol/Documentation/tree/master/中文文档/波场编程大赛)。 -+ 如果你想了解波场TRX迁移,请查看[TRX](https://github.com/tronprotocol/Documentation/tree/master/TRX)相关文档。 -+ 对于波场虚拟机的更多信息,请查看[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/TRX/Official_Public_Node.md b/TRX/Official_Public_Node.md index 2b306bf0..a1f0a0a6 100644 --- a/TRX/Official_Public_Node.md +++ b/TRX/Official_Public_Node.md @@ -3,50 +3,50 @@ * P2P network port: 18888 * HTTP port : 8090 ``` -54.236.37.243 +3.225.171.164 52.53.189.99 18.196.99.16 34.253.187.192 -52.56.56.149 +18.133.82.227 35.180.51.163 54.252.224.209 -18.228.15.36 +18.231.27.82 52.15.93.92 34.220.77.106 -13.127.47.162 +15.207.144.3 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 +15.222.19.181 +18.209.42.127 +3.218.137.187 +34.237.210.82 +13.228.119.63 +18.139.193.235 +18.141.79.38 +18.139.248.26 ``` # Solidity Node -* GRPC port: 50051 +* GRPC port: 50061 * 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 +3.225.171.164 +52.53.189.99 +18.196.99.16 +34.253.187.192 +18.133.82.227 +35.180.51.163 +54.252.224.209 +18.231.27.82 +52.15.93.92 +34.220.77.106 +15.207.144.3 +13.124.62.58 +15.222.19.181 +18.209.42.127 +3.218.137.187 +34.237.210.82 +13.228.119.63 +18.139.193.235 +18.141.79.38 +18.139.248.26 ``` diff --git a/TRX/Rocksdb_vs_Leveldb.md b/TRX/Rocksdb_vs_Leveldb.md new file mode 100644 index 00000000..e38c1532 --- /dev/null +++ b/TRX/Rocksdb_vs_Leveldb.md @@ -0,0 +1,56 @@ +# ROCKSDB VS LEVELDB + +## 1、Tuning the Database。 + + +| Comparison item | leveldb | rocksdb | +| ------ | ------ | ------| +|stage |Compilation phase,can not be modified| Runtime phase,can be modified +|number of parameter |few| more +|Tuning difficulty |difficulty to tune because of lacking log |easy to tune based on rich log + +Some tuning parameters of rocksdb supported in java-tron are listed as follows, it is helpful to different stage using different parameters. + +block sync stage + +| Machine configuration| level_number | compactThreads | level0FileNumCompactionTrigger | block size | target File | level 1 size | level multiplier | target File Multiplier | description | +| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------| ------ | +|16 cores,32G RAM| 7 | 16| 4 |64k| 256MB| 256MB| 10| 1| It is recommanded to turn up the parameter "compactThreads" and "level0FileNumCompactionTrigger" for more fast speed of writing data to database| +|8 cores,16G RAM | 7 | 8 |4| 64k| 256MB| 256MB| 10| 1| It is recommanded to turn up the parameter "compactThreads" and "level0FileNumCompactionTrigger" for more fast speed of writing data to database| + + +block advertise stage + +| Machine configuration | level_number | compactThreads | level0FileNumCompactionTrigger | block size | target File | level 1 size | level multiplier | target File Multiplier | description | +| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------| ------ | +|16 cores,32G RAM| 7| 8| 2| 64k| 256MB| 256MB| 10| 1| It is recommanded to turn down the parameter "compactThreads" and "level0FileNumCompactionTrigger" for more fast speed of reading data to database| +|8 cores,16G RAM| 7| 4| 2| 64k| 256MB| 256MB| 10| 1| It is recommanded to turn down the parameter "compactThreads" and "level0FileNumCompactionTrigger" for more fast speed of reading data to database| + + +note:these are just parameters we suggested on some specific machine,you should tune the parameters according to the logs of database running。 + +## 2、a ".sst" file in rocksdb can stores more data than the leveldb, so it may ocuppy less storage space。 + +|database size | sst files amount of leveldb| sst files amount of rocksdb| +|-----|-----|-----| +|8.8GB| 3023| 968| + +|the same block height|leveldb| rocksdb| +|-----|-----|-----| +|block height:7930000| 142GB |126GB| + +## 3、Supporting for database backup。 + +leveldb can not support for database backup when the application is running。 + +rocksdb can support for database backup when the application is running and it just need a few seconds. + +|block height| database size| backup used time +|-----|-----|-----| +|block height: 4900000| 27GB |1 second| +|block height: 7900000| 126GB| 1.4 second| + + +Rocksdb provides a rich set of configuration parameters to allow nodes to tune according to their own machine configuration. The database occupies less disk space than leveldb. It only takes a few seconds to back up hundreds of GB data when the program is running and does not require the node to stop running. + + diff --git a/TRX/Solidity_and_Full_Node_Deployment_EN.md b/TRX/Solidity_and_Full_Node_Deployment_EN.md index b5671813..40d5b829 100644 --- a/TRX/Solidity_and_Full_Node_Deployment_EN.md +++ b/TRX/Solidity_and_Full_Node_Deployment_EN.md @@ -63,12 +63,12 @@ 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 + 00:01:14.073 INFO [nioEventLoopGroup-6-28] [o.t.c.n.TronNetDelegate](TronNetDelegate.java:176) Success process block Num:9171046,ID:00000000008bf06616a0895f515a91fda077e2c7c762b902f2e84414d536ca39. ## SolidityNode - 12:00:40.691 INFO [pool-17-thread-1] [o.t.p.SolidityNode](SolidityNode.java:88) sync solidity block, lastSolidityBlockNum:209671, remoteLastSolidityBlockNum:211823 - + 20:06:10.866 INFO [Thread-14] [app](SolidityNode.java:142) Get last remote solid blockNum: 0, remoteBlockNum: 0, cost: 4 + # 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. diff --git a/TRX/Tron-http.md b/TRX/Tron-http.md index acac3d7c..27a61492 100644 --- a/TRX/Tron-http.md +++ b/TRX/Tron-http.md @@ -109,17 +109,36 @@ demo:curl -X POST http://127.0.0.1:8091/walletsolidity/listexchanges Parameters: None Return value:List of all exchanges -/walletextension/gettransactionsfromthis +/walletextension/gettransactionsfromthis(The new version will no longer be supported) 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 +demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionsfromthis -d '{"account" + : {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10,"startTime": 1546099200000, "endTime": 1552028828000}' +Parameters:Address is the account address, converted to a hex string; offset is the index of the +starting transaction,Can't be greater than 10000, otherwise an error; limit is the number of +transactions expected to be returned;This value may be adjusted. If limit>50 or +offset+limit>10000, adjust to limit<=50 and offset+limit<=10000, startTime: Start time; endTime: End time; + get the transaction from startTime to endTime] . If not set, the default will gets the transaction in the last 7 days. +Return value:Transactions list sort by creation time, total: the maximum number of transactions +for paging from startTime to endTime, rangeTotal:the total transactions from startTime to endTime. +Remarks:This interface will no longer be available in the new version of the node. If you need +this function, you can use the interface provided by the central node, 47.90.247 +.237:8091/walletextension/gettransactionsfromthis,Reference getTransactionsFromThis + +/walletextension/gettransactionstothis(The new version will no longer be supported) 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 +demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionstothis -d '{"account" : + {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10,"startTime": 1546099200000, "endTime": 1552028828000}' +Parameters:Address is the account address, converted to a hex string; offset is the index of the +starting transaction,Can't be greater than 10000, otherwise an error; limit is the number of +transactions expected to be returned;This value may be adjusted. If limit>50 or +offset+limit>10000, adjust to limit<=50 and offset+limit<=10000, startTime: Start time; endTime: +End time; get the transaction from startTime to endTime]. If not set, the default will gets the +transaction in the last 7 days.Return value:Transactions list sort by creation time, total: the maximum number of transactions for paging from startTime to endTime, rangeTotal:the total transactions from startTime to endTime. +Return value:Transactions list sort by creation time, total: the maximum number of transactions +for paging from startTime to endTime, rangeTotal:the total transactions from startTime to endTime. +Remarks:This interface will no longer be available in the new version of the node. If you need +this function, you can use the interface provided by the central node, 47.90.247 +.237:8091/walletextension/gettransactionstothis,Reference gettransactionstothis ``` @@ -577,4 +596,52 @@ contract_address:要修改的合约的地址 origin_energy_limit:创建者设置的,在一次合约执行或创建过程中创建者自己消耗的最大的energy 返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction +wallet/accountpermissionupdate +作用:更新用户权限(用于多重签名) +demo: curl -X POST http://127.0.0.1:8090/wallet/accountpermissionupdate -d '{"owner_address":"41ffa9466d5bf6bb6b7e4ab6ef2b1cb9f1f41f9700","owner":{"type":0,"permission_name":"owner","threshold":2,"keys":[{"address":"41F08012B4881C320EB40B80F1228731898824E09D","weight":1},{"address":"41DF309FEF25B311E7895562BD9E11AAB2A58816D2","weight":1},{"address":"41BB7322198D273E39B940A5A4C955CB7199A0CDEE","weight":1}]},"actives":[{"type":2,"permission_name":"active0","threshold":3,"operations":"7fff1fc0037e0000000000000000000000000000000000000000000000000000","keys":[{"address":"41F08012B4881C320EB40B80F1228731898824E09D","weight":1},{"address":"41DF309FEF25B311E7895562BD9E11AAB2A58816D2","weight":1},{"address":"41BB7322198D273E39B940A5A4C955CB7199A0CDEE","weight":1}]}]}' +参数说明: +owner_address:待修改权限的账户的地址\ +owner:修改后的 owner 权限\ +witness:修改后的 witness 权限(如果是 witness )\ +actives:修改后的 actives 权限 +permission.PermissionType: 权限类型,目前仅支持三种权限\ +permission.id: 值由系统自动设置,Owner id=0, Witness id=1, Active id 从2开始递增分配。在执行合约时, +通过该id来指定使用哪个权限,如使用owner权限,即将id设置为0。\ +permission.permission_name: 权限名称,由用户设定,长度限制为32字节\ +permission.threshold: 阈值,只有当参与签名的权重之和超过域值才允许做相应的操作。要求小于Long类型的最大值\ +permission.parent_id:目前只能为0 \ +permission.operations:共32字节(256位),每位代表一个合约的权限,为1时表示拥有该合约的权限。 +如`operations=0x0100...00(十六进制),即100...0(二进制)`时,查看proto中Transaction.ContractType定义,合约AccountCreateContract的id为0, +即表示该permission只拥有执行AccountCreateContract的权限,可以使用"active权限中operations的计算示例"计算获得。\ +permission.keys:共同拥有该权限的地址及权重,最多允许5个key。 +permission.key.address:拥有该权限的地址 +permission.key.weight:该地址对该权限拥有权重 + +返回值:TransactionExtention, TransactionExtention中包含增加签名后的交易Transaction + + +wallet/addtransactionsign +作用:增加签名(用于多重签名) +demo: curl -X POST http://127.0.0.1:8090/wallet/addtransactionsign -d '{"transaction": "TransferContract", "privateKey": "permissionkey1"}' +参数说明: +transaction:交易,TransferContract需要替换成实际交易信息 +privateKey:私钥,permissionkey1需要替换成实际签名的私钥 +返回值:TransactionExtention, TransactionExtention中包含增加签名后的交易Transaction + +wallet/getapprovedlist +作用:查询已签名地址(用于多重签名) +demo: curl -X POST http://127.0.0.1:8090/wallet/getapprovedlist -d '{"transaction"}' +参数说明: +transaction:交易,需要替换成实际交易信息 +返回值:TransactionApprovedList, TransactionApprovedList包含已签名的地址,交易 + +wallet/getsignweight +作用:查询交易签名权重(用于多重签名) +demo: curl -X POST http://127.0.0.1:8090/wallet/getsignweight -d '{"transaction"}' +参数说明: +transaction:交易,需要替换成实际交易信息 +返回值:TransactionSignWeight, TransactionSignWeight包含结果result,表示交易的签名是否满足权限阈值。 + + + ``` diff --git a/TRX_CN/Official_Public_Node.md b/TRX_CN/Official_Public_Node.md index 2b306bf0..aad42f5e 100644 --- a/TRX_CN/Official_Public_Node.md +++ b/TRX_CN/Official_Public_Node.md @@ -3,50 +3,42 @@ * P2P network port: 18888 * HTTP port : 8090 ``` -54.236.37.243 +3.225.171.164 52.53.189.99 18.196.99.16 34.253.187.192 -52.56.56.149 +18.133.82.227 35.180.51.163 54.252.224.209 -18.228.15.36 +18.231.27.82 52.15.93.92 34.220.77.106 -13.127.47.162 +15.207.144.3 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 +15.222.19.181 +18.209.42.127 +3.218.137.187 +34.237.210.82 ``` # Solidity Node -* GRPC port: 50051 +* GRPC port: 50061 * 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 +3.225.171.164 +52.53.189.99 +18.196.99.16 +34.253.187.192 +18.133.82.227 +35.180.51.163 +54.252.224.209 +18.231.27.82 +52.15.93.92 +34.220.77.106 +15.207.144.3 +13.124.62.58 +15.222.19.181 +18.209.42.127 +3.218.137.187 +34.237.210.82 ``` diff --git a/TRX_CN/Rocksdb_vs_Leveldb.md b/TRX_CN/Rocksdb_vs_Leveldb.md new file mode 100644 index 00000000..997c4feb --- /dev/null +++ b/TRX_CN/Rocksdb_vs_Leveldb.md @@ -0,0 +1,57 @@ +# Rocksdb和Leveldb的对比 + +## 1、数据库引擎参数调优。 + + +| 对比项 | leveldb | rocksdb | +| ------ | ------ | ------| +|阶段 |编译阶段,参数设定好之后不能修改| 运行阶段,参数可以随时修改 +|参数数量 |较少| 更多 +调优难度 |缺少日志,分析起来繁琐 |日志丰富,便于查找性能瓶颈 + + +下面列举了java-tron中使用rocksdb引擎支持的数据库调优参数,针对不同的区块处理阶段进行优化。 + +同步模式阶段 + +| 机器配置 | level_number | compactThreads | level0FileNumCompactionTrigger | block size | target File | level 1大小 | level multiplier | target File Multiplier | 说明 | +| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------| ------ | +|16核32G内存| 7 | 16| 4 |64k| 256MB| 256MB| 10| 1| 此时区块数据集中写入,调高compactThreads和level0FileNumCompactionTrigger的值有利于数据写入更快。| +|8核16G内存 | 7 | 8 |4| 64k| 256MB| 256MB| 10| 1| 此时区块数据集中写入,调高compactThreads和level0FileNumCompactionTrigger的值有利于数据写入更快。| + + +广播模式阶段 + +| 机器配置 | level_number | compactThreads | level0FileNumCompactionTrigger | block size | target File | level 1大小 | level multiplier | target File Multiplier | 说明 | +| ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------| ------ | +|16核32G内存| 7| 8| 2| 64k| 256MB| 256MB| 10| 1| 此时更多的是数据读取,调降compactThreads和level0FileNumCompactionTrigger的值有利于提高数据读取效率。| +|8核16G内存| 7| 4| 2| 64k| 256MB| 256MB| 10| 1| 此时更多的是数据读取,调降compactThreads和level0FileNumCompactionTrigger的值有利于提高数据读取效率。| + + +注:以上为我们给出的建议优化参数,可参考rocksdb运行时记录的日志对不同配置的机器进行相应的参数优化。 + +## 2、rocksdb数据库单个sst文件存储的数据更多,占用磁盘的总空间更少。 + +|数据库文件大小| leveldb sst文件数量| rocksdb sst文件数量| +|-----|-----|-----| +|8.8G| 3023个| 968个| + +|同一区块高度数据库|leveldb| rocksdb| +|-----|-----|-----| +|7930000区块| 142G |126G| +## 3、对于数据备份的支持。 + +leveldb不支持运行时的数据备份。 + +rocksdb支持在运行时进行数据备份,备份的时间仅需要几秒钟。 + +|区块高度| 数据库大小| 备份时间 +|-----|-----|-----| +|4900000| 27G |1秒| +|7900000| 126G| 1.4秒| + + +rocksdb提供丰富了配置参数允许节点根据自身机器配置进行调优,节点数据库占用的磁盘空间相比于leveldb更少,在程序运行时备份上百G数据只需要几秒而且不需要节点停止运行。 + + + diff --git a/TRX_CN/Tron-doc.md b/TRX_CN/Tron-doc.md index 80b55432..bb6dd002 100644 --- a/TRX_CN/Tron-doc.md +++ b/TRX_CN/Tron-doc.md @@ -260,6 +260,96 @@ Tron网络采用Peer-to-Peer(P2P)的网络架构,网络中的节点地位对 node.discovery.enable: ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/fix_http/TRX_CN/figures/discovery_enable.png) +## 4.7 数据库引擎 +### 4.7.1 rocksdb +#### 4.7.1.1 config配置说明 + 使用rocksdb作为数据存储引擎,需要将db.engine配置项设置为"ROCKSDB" + ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/master/TRX_CN/figures/db_engine.png) + 注意: rocksdb只支持db.version=2, 不支持db.version=1。 + rocksdb支持的优化参数如下: + ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/master/TRX_CN/figures/rocksdb_tuning_parameters.png) + +#### 4.7.1.2 使用rocksdb数据备份功能 + 选择rocksdb作为数据存储引擎,可以使用其提供的运行时数据备份功能。 + ![image](https://raw.githubusercontent.com/tronprotocol/Documentation/master/TRX_CN/figures/db_backup.png) + 注意: FullNode可以使用数据备份功能;为了不影响SuperNode的产块性能,数据备份功能不支持SuperNode,但是SuperNode的备份服务节点可以使用此功能。 +#### 4.7.1.3 leveldb数据转换为rocksdb数据 + leveldb和rocksdb的数据存储架构并不兼容,请确保节点始终使用同一种数据引擎。我们提供了数据转换脚本,用于将leveldb数据转换到rocksdb数据。 + 使用方法: +```text + cd 源代码根目录 + ./gradlew build #编译源代码 + java -jar build/libs/DBConvert.jar #执行数据转换指令 +``` + 注意:如果节点的数据存储目录是自定义的,运行DBConvert.jar时添加下面2个可选参数。 +
+ src_db_path:指定LevelDB数据库路径源,默认是 output-directory/database +
+ dst_db_path:指定RocksDB数据库路径,默认是 output-directory-dst/database +
+ 例如,如果节点是像这样的脚本运行的: + ```text + nohup java -jar FullNode.jar -d your_database_dir & + ``` + 那么,你应该这样运行数据转换工具DBConvert.jar: + ```text + java -jar build/libs/DBConvert.jar your_database_dir/database output-directory-dst/database + ``` + 注意:必须停止节点的运行,然后再运行数据转换脚本。 + 如果不希望节点停止时间太长,可以在节点停止后先将leveldb数据目录output-directory拷贝一份到新的目录下,然后恢复节点的运行。 +
+ 在新目录的上级目录中执行DBConvert.jar并指定参数`src_db_path`和`dst_db_path` 。 + 例如: + ```text + cp -rf output-directory /tmp/output-directory + cd /tmp + java -jar DBConvert.jar output-directory/database output-directory-dst/database + ``` + 整个的数据转换过程可能需要10个小时左右。 + + #### 4.7.1.4 leveldb database convert to rocksdb database (english verison) + You must only use one db engine(leveldb or rocksdb) throughout the life cycle of node because rocksdb's data structure is incompatible with the leveldb's. + A convert tool is provided to convert the leveldb data to rocksdb data and the usage of tool is described in the following。 + + How to use: + ```text + cd [source code directory of java-tron] + ./gradlew build # build the code + java -jar build/libs/DBConvert.jar # run the jar + ``` + note: you can run DBConvert.jar with two additional parameters if your node is started up with specified location of database directory. +
+ src_db_path:source of leveldb directory. The default value is output-directory/database +
+ dst_db_path:destination of rocksdb directory. The default value is output-directory-dst/database +
+ for example,if you run a node with the script: + ```text + nohup java -jar FullNode.jar -d your_database_dir & + ``` + you should run the DBConvert.jar like this: + ```text + java -jar build/libs/DBConvert.jar your_database_dir/database output-directory-dst/database + ``` + It is emphasized that you must stop the node before running the DBConvert.jar + you can copy the leveldb database dir to a new dir and then recover the node running. +
+ After that, run DBConvert.jar with parameters `src_db_path` and `dst_db_path` in the parent directory of new directory. + for example, + ```text + cp -rf output-directory /tmp/output-directory + cd /tmp + java -jar DBConvert.jar output-directory/database output-directory-dst/database + ``` +
+ It may cost about 10 hours to finish the data convert. + +#### 4.7.1.5 rocksdb与leveldb的对比 +你可以查看以下文档获取详细的信息: +
+[rocksdb与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 智能合约 ## 5.1 Tron智能合约介绍 @@ -1087,20 +1177,24 @@ buyTokenQuant = (long)balance * (Math.pow(1.0 + (double) supplyQuant / suppl 相关api详情,请查询[Tron-http](Tron-http.md)。 -# 10 钱包介绍 -## 10.1 wallet-cli功能介绍 +# 10 多重签名 +详细信息请参考 +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 钱包介绍 +## 11.1 wallet-cli功能介绍 请参考: https://github.com/tronprotocol/wallet-cli/blob/master/README.md -## 10.2 计算交易ID +## 11.2 计算交易ID 对交易的RawData取Hash。 ``` Hash.sha256(transaction.getRawData().toByteArray()) ``` -## 10.3 计算blockID +## 11.3 计算blockID block id是块高度和块头raw_data的hash的混合,具体是计算出块头中raw_data的hash。用 块的高度替换该hash中的前8个byte。具体代码如下: ``` @@ -1112,7 +1206,7 @@ private byte[] generateBlockId(long blockNum, byte[] blockHash) {
 
} ``` -## 10.4 如何本地构造交易 +## 11.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) { @@ -1155,7 +1249,7 @@ public static Transaction createTransaction(byte[] from, byte[] to, long amount) return refTransaction; } ``` -## 10.5 相关demo +## 11.5 相关demo 本地构造交易、签名的demo请参考 diff --git a/TRX_CN/Tron-eventsubscribe_CN.md b/TRX_CN/Tron-eventsubscribe_CN.md index 3a01aeb4..ae9853c8 100644 --- a/TRX_CN/Tron-eventsubscribe_CN.md +++ b/TRX_CN/Tron-eventsubscribe_CN.md @@ -1,6 +1,6 @@ # 波场事件订阅机制 ## 1. 项目背景 -为了更好支持开发者社区,波场正式推出事件订阅机制,已完成内部测试,随Java-tron 3.5版本正式上线。现阶段为beta版,开发者们可以开始体验了。 +为了更好支持开发者社区,波场正式推出事件订阅机制,在3.5版本中已经上线,开发者目前可进行新功能体验。 ## 2. 主要功能: 1. 事件plugin的支持,目前已支持kafka、mongodb两种插件,开发者也可以根据自己的需求定制自己的事件插件。 @@ -8,7 +8,7 @@ 3. 事件查询服务tron-eventquery,波场提供的线上Event查询服务,开发者可通过http方式查询最近七天的trigger信息,查询地址为: https://api.tronex.io。 ## 3. github项目 -- [java-tron](https://github.com/tronprotocol/java-tron) develop分支 (目前为3.5 beta版本) +- [java-tron](https://github.com/tronprotocol/java-tron) master分支 - [eventplugin](https://github.com/tronprotocol/event-plugin) master分支 - [tron-eventquery](https://github.com/tronprotocol/tron-eventquery) master分支 diff --git a/TRX_CN/Tron-http.md b/TRX_CN/Tron-http.md index 84c6af16..5a520722 100644 --- a/TRX_CN/Tron-http.md +++ b/TRX_CN/Tron-http.md @@ -1,10 +1,10 @@ # TRON内置http接口说明 # hexString和base58check转码demo -java: +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 +https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php # SolidityNode接口说明 @@ -24,7 +24,7 @@ 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 +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getassetissuelist 参数说明: 返回值:所有Token列表 @@ -61,7 +61,7 @@ demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getnowblock /walletsolidity/getblockbynum 作用:按照高度查询block -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbynum -d '{"num" : 100}' +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getblockbynum -d '{"num" : 100}' 参数说明:num是块的高度 返回值:指定高度的block @@ -73,7 +73,7 @@ demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactionbyid -d ' /walletsolidity/gettransactioncountbyblocknum(Odyssey-v3.2开始支持) 作用:查询特定block上transaction的个数 -demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioncountbyblocknum -d '{"num" : 100}' +demo: curl -X POST http://127.0.0.1:8091/walletsolidity/gettransactioncountbyblocknum -d '{"num" : 100}' 参数说明:num是块的高度. 返回值e:transaction的个数. @@ -99,7 +99,7 @@ toAddress:代理对象的账户地址,hexString格式 作用:查看一个账户的资源代理情况 demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getdelegatedresourceaccountindex -d ' { -"value": "419844f7600e018fd0d710e2145351d607b3316ce9", +"value": "419844f7600e018fd0d710e2145351d607b3316ce9", }' 参数说明: value:是要查询的账户地址,hexString格式 @@ -120,23 +120,31 @@ 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列表 +demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionsfromthis -d '{"account" +: {"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10,"startTime": 1546099200000, "endTime": 1552028828000}' +参数说明:address是账号地址,需要是hexString格式;offset是起始交易的index,不能大于10000,否则报错;limit是期望返回的交易数量,最大为50 +,这个值可能会调整。当limit>50,或offset+limit>10000时,调整后满足limit<=50且offset+limit<=10000,startTime +:起始时间,endTime:结束时间,获取[startTime,endTime]时间段的交易。如果不传递,默认获取获取最近7天内的交易 +返回值:Transaction列表,按交易创建时间的降序排列,total在[startTime,endTime]时间段内允许分页的最大交易数,rangeTotal在[startTime, +endTime]时间段内的所有交易数。 备注:该接口在新版本节点中将不再提供,如需要该功能,可以使用中心节点提供的接口,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列表 +demo: curl -X POST http://127.0.0.1:8091/walletextension/gettransactionstothis -d '{"account" : +{"address" : "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}, "offset": 0, "limit": 10,"startTime": 1546099200000, "endTime": 1552028828000}' +参数说明:address是账号地址,需要是hexString格式;offset是起始交易的index;limit是期望返回的交易数量,最大为50,这个值可能会调整。当limit>50 +,或offset+limit>10000时,调整后满足limit<=50且offset+limit<=10000,startTime:起始时间,endTime +:结束时间,获取[startTime,endTime]时间段的交易。如果不传递,默认获取获取最近7天内的交易 +返回值:Transaction列表,按交易创建时间的降序排列,total在[startTime,endTime]时间段内允许分页的最大交易数,rangeTotal在[startTime, +endTime]时间段内的所有交易数。 备注:该接口在新版本节点中将不再提供,如需要该功能,可以使用中心节点提供的接口,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 +demo: curl -X GET http://127.0.0.1:8091/wallet/getnodeinfo 参数说明:无 返回值:当前节点的信息NodeInfo ``` @@ -175,7 +183,7 @@ demo:curl -X POST http://127.0.0.1:8090/wallet/updateaccount -d '{"account_na wallet/votewitnessaccount 作用:对超级代表进行投票 demo:curl -X POST http://127.0.0.1:8090/wallet/votewitnessaccount -d '{ -"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", +"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "votes": [{"vote_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "vote_count": 5}] }' 参数说明:owner_address是投票人地址,需要是hexString格式;votes.vote_address是被投票的超级代表的地址,需要是hexString格式;vote_count是投票数量 @@ -204,7 +212,7 @@ owner_address发行人地址;name是token名称;abbr是token简称;total_s wallet/updatewitness 作用:修改witness的url demo:curl -X POST http://127.0.0.1:8090/wallet/updatewitness -d '{ -"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", +"owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", "update_url": "007570646174654e616d6531353330363038383733343633" }' 参数说明:owner_address是创建人地址,需要是hexString格式;update_url是更新的官网的url,需要是hexString格式; @@ -233,7 +241,7 @@ wallet/easytransfer 作用:快捷转账,该api存在泄漏密码的风险,请确保在安全的环境中调用该api。调用该api前请先调用createAddress生成地址。 demo:curl -X POST http://127.0.0.1:8090/wallet/easytransfer -d '{ "passPhrase": "your password", -"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", "amount":100 }' 参数说明:passPhrase是用户密码,需要是hexString格式;toAddress是转入地址,需要是hexString格式;amount是转账trx数量 @@ -243,8 +251,8 @@ 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", +"toAddress": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", +"assetId": "1000001", "amount":100 }' 参数说明:passPhrase是用户密码,需要是hexString格式;toAddress是转入地址,需要是hexString格式;assetId是通证的ID;amount是转账通证数量,单位是通证的最小单位。 @@ -261,8 +269,8 @@ wallet/participateassetissue 作用:参与token发行 demo:curl -X POST http://127.0.0.1:8090/wallet/participateassetissue -d '{ "to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0", -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", -"amount":100, +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"amount":100, "asset_name":"3230313271756265696a696e67" }' 参数说明: @@ -277,11 +285,11 @@ asset_name是token的名称,需要是hexString格式 wallet/freezebalance 作用:冻结trx,获取带宽,获取投票权 demo:curl -X POST http://127.0.0.1:8090/wallet/freezebalance -d '{ -"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", +"owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", "frozen_balance": 10000, "frozen_duration": 3, "resource" : "BANDWIDTH", -"receiveraddress":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" +"receiver_address":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" }' 参数说明: owner_address是冻结trx账号的地址,需要是hexString格式 @@ -297,16 +305,22 @@ wallet/unfreezebalance demo:curl -X POST http://127.0.0.1:8090/wallet/unfreezebalance -d '{ "owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", "resource": "BANDWIDTH", -"receiveraddress":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" +"receiver_address":"414332f387585c2b58bc2c9bb4492bc1f17342cd1" }' 参数说明: owner_address是解冻trx账号的地址,需要是hexString格式 resource可以是BANDWIDTH或者ENERGY -receiverAddress表示受委托账户的地址 + + + + + + +ress表示受委托账户的地址 返回值:解冻trx的transaction 【注意】资源委托功能需要委员会开启 -walle/unfreezeasset +wallet/unfreezeasset 作用:解冻已经结束冻结期的Token demo:curl -X POST http://127.0.0.1:8090/wallet/unfreezeasset -d '{ "owner_address":"41e472f387585c2b58bc2c9bb4492bc1f17342cd1", @@ -425,7 +439,7 @@ demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioninfobyid -d '{"va /wallet/gettransactioncountbyblocknum(Odyssey-v3.2开始支持) 作用:查询特定block上transaction的个数 -demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioncountbyblocknum -d '{"num" : 100}' +demo: curl -X POST http://127.0.0.1:8090/wallet/gettransactioncountbyblocknum -d '{"num" : 100}' 参数说明:num是块的高度. 返回值e:transaction的个数. @@ -530,7 +544,7 @@ origin_energy_limit: 创建者设置的,在一次合约执行或创建过程 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"}' +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"}' 参数说明: contract_address,hexString格式 function_selector,函数签名,不能有空格 @@ -545,7 +559,7 @@ wallet/getcontract demo: curl -X POST http://127.0.0.1:8090/wallet/getcontract -d '{"value":"4189139CB1387AF85E3D24E212A008AC974967E561"}' 参数说明: value:合约地址,hexString格式 -返回值:SmartContract,智能合约的内容 +返回值:SmartContract,智能合约的内容 wallet/proposalcreate 作用:创建提案 @@ -649,13 +663,13 @@ 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 +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 +demo: curl -X GET http://127.0.0.1:8090/wallet/getnodeinfo 参数说明:无 返回值:当前节点的信息NodeInfo @@ -681,7 +695,7 @@ wallet/getdelegatedresource(Odyssey-v3.2开始支持) 作用:查看一个账户代理给另外一个账户的资源情况 demo: curl -X POST http://127.0.0.1:8090/wallet/getdelegatedresource -d ' { -"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9", +"fromAddress": "419844f7600e018fd0d710e2145351d607b3316ce9", "toAddress": "41c6600433381c731f22fc2b9f864b14fe518b322f" }' 参数说明: @@ -693,15 +707,9 @@ wallet/getdelegatedresourceaccountindex(Odyssey-v3.2开始支持) 作用:查看一个账户给哪些账户代理了资源 demo: curl -X POST http://127.0.0.1:8090/wallet/getdelegatedresourceaccountindex -d ' { -"value": "419844f7600e018fd0d710e2145351d607b3316ce9", +"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/figures/db_backup.png b/TRX_CN/figures/db_backup.png new file mode 100644 index 00000000..dd0442c8 Binary files /dev/null and b/TRX_CN/figures/db_backup.png differ diff --git a/TRX_CN/figures/db_engine.png b/TRX_CN/figures/db_engine.png new file mode 100644 index 00000000..65c39ac0 Binary files /dev/null and b/TRX_CN/figures/db_engine.png differ diff --git a/TRX_CN/figures/rocksdb_tuning_parameters.png b/TRX_CN/figures/rocksdb_tuning_parameters.png new file mode 100644 index 00000000..c7041b05 Binary files /dev/null and b/TRX_CN/figures/rocksdb_tuning_parameters.png differ 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\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" index 340066c4..9fdda9dc 100644 --- "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" @@ -11,7 +11,7 @@ [3.API](#3) \ [3.1 修改权限](#3.1)\ [3.2 执行合约](#3.2)\ -[4.其他问题](#4) +[4.其他](#4) ##

1.背景

@@ -65,11 +65,11 @@ `AccountPermissionUpdateContract`\ `owner_address`:待修改权限的账户的地址\ -`owner`:修改后的 owner 权限,覆盖\ -`witness`:修改后的 witness 权限(如果是 witness ),覆盖\ -`actives`:修改后的 actives 权限,覆盖 +`owner`:修改后的 owner 权限\ +`witness`:修改后的 witness 权限(如果是 witness )\ +`actives`:修改后的 actives 权限 -该接口是覆盖原账户权限,因此,如果只想修改owner权限,witness(如果是witnss)及actives的也需要设置。 +该接口是覆盖原账户权限,因此,如果只想修改owner权限,witness(如果是witnss账户)及actives的也需要设置。 **4. Permission** @@ -92,12 +92,12 @@ `PermissionType`: 权限类型,目前仅支持三种权限\ `id`: 值由系统自动设置,Owner id=0, Witness id=1, Active id 从2开始递增分配。在执行合约时, 通过该id来指定使用哪个权限,如使用owner权限,即将id设置为0。\ -`permission_name`: 权限名称,由用户设定\ -`threshold`: 阈值,只有当参与签名的权重之和超过域值才允许做相应的操作。\ +`permission_name`: 权限名称,由用户设定,长度限制为32字节\ +`threshold`: 阈值,只有当参与签名的权重之和超过域值才允许做相应的操作。要求小于Long类型的最大值\ `parent_id`:目前只能为0 \ `operations`:共32字节(256位),每位代表一个合约的权限,为1时表示拥有该合约的权限。 -如`operations=0x0100...00(十六进制),即100...0(二进制)`时,查看Transaction.ContractType,合约AccountCreateContract的值为0, -即表示该permission只拥有执行AccountCreateContract的权限\ +如`operations=0x0100...00(十六进制),即100...0(二进制)`时,查看proto中Transaction.ContractType定义,合约AccountCreateContract的id为0, +即表示该permission只拥有执行AccountCreateContract的权限,可以使用"active权限中operations的计算示例"计算获得。\ `keys`:共同拥有该权限的地址及权重,最多允许5个key。 **5. Key** @@ -166,14 +166,14 @@ Active权限,用于提供一个权限的组合,比如提供一个只能执 Active权限有以下特性:\ 1、拥有OwnerPermission的地址可以修改Active权限\ 2、拥有执行AccountPermissionUpdateContract权限的地址也能够修改Active权限\ -1、最多支持8个组合。\ -1、permission的id从2开始自动递增。 +3、最多支持8个组合。\ +4、permission的id从2开始自动递增。\ +5、账户新建时,自动创建一个Active权限,并将该账户的地址填充到其中,默认域值为1,keys中仅包含该账户地址且权重为1。 ###

2.5 费用

- -1、使用更新账户权限时,即AccountPermissionUpdate 合约,收取100TRX。\ +1、使用更新账户权限时,即 AccountPermissionUpdate 合约,收取100TRX。\ 2、使用多重签名的交易时,即交易中包括两个及两个以上签名的交易,除交易费用外,另收取1TRX。\ 3、可通过提议,修改以上费用。 @@ -186,12 +186,93 @@ Active权限有以下特性:\ 2、修改permission\ 3、创建合约,签名\ 4、发送交易 + +**http-demo** +``` +http://{{host}}:{{port}}/wallet/accountpermissionupdate + + +{ + "owner_address": "41ffa9466d5bf6bb6b7e4ab6ef2b1cb9f1f41f9700", + "owner": { + "type": 0, + "permission_name": "owner", + "threshold": 2, + "keys": [{ + "address": "41F08012B4881C320EB40B80F1228731898824E09D", + "weight": 1 + }, + { + "address": "41DF309FEF25B311E7895562BD9E11AAB2A58816D2", + "weight": 1 + }, + { + "address": "41BB7322198D273E39B940A5A4C955CB7199A0CDEE", + "weight": 1 + } + ] + }, + "witness": { + "type": 1, + "permission_name": "witness", + "threshold": 1, + "keys": [{ + "address": "41F08012B4881C320EB40B80F1228731898824E09D", + "weight": 1 + } + ] + }, + "actives": [{ + "type": 2, + "permission_name": "active0", + "threshold": 3, + "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000", + "keys": [{ + "address": "41F08012B4881C320EB40B80F1228731898824E09D", + "weight": 1 + }, + { + "address": "41DF309FEF25B311E7895562BD9E11AAB2A58816D2", + "weight": 1 + }, + { + "address": "41BB7322198D273E39B940A5A4C955CB7199A0CDEE", + "weight": 1 + } + ] + }] +} + +参数字段的定义及限制,请查看"2.1 结构说明"。 + +``` + +**active权限中operations的计算示例** + +``` java +public static void main(String[] args) { + + //指定需要支持的合约id(查看proto中Transaction.ContractType定义),这里包含除AccountPermissionUpdateContract(id=46)以外的所有合约 + Integer[] contractId = {0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 30, 31, + 32, 33, 41, 42, 43, 44, 45}; + List list = new ArrayList<>(Arrays.asList(contractId)); + byte[] operations = new byte[32]; + list.forEach(e -> { + operations[e / 8] |= (1 << e % 8); + }); + + //7fff1fc0037e0000000000000000000000000000000000000000000000000000 + System.out.println(ByteArray.toHexString(operations)); +} +``` + ###

3.2 执行合约

-1、创建交易\ -2、用户A签名,将签名后交易通过其他方式发送给B。\ -3、用户B签名,将签名后交易通过其他方式发送给C。\ +1、创建交易,与非多重签名交易的构建过程相同\ +2、指定Permission_id,默认为0,表示owner-permission, demo见https://github.com/tronprotocol/wallet-cli/commit/ff9122f2236f1ce19cbb9ba9f0494c8923a3d10c#diff-a63fa7484f62fe1d8fb27276c991a4e3R211 \ +3、用户A签名,将签名后交易通过其他方式发送给B。\ +4、用户B签名,将签名后交易通过其他方式发送给C。\ …\ n、最后一个完成签名的用户,将交易广播到节点。\ n+1、验证多重签名的权重之和大于域值则接受交易,否则拒绝交易 @@ -199,8 +280,46 @@ n+1、验证多重签名的权重之和大于域值则接受交易,否则拒 代码示例: https://github.com/tronprotocol/wallet-cli/blob/multi_sign_V2/src/main/java/org/tron/demo/MultiSignDemo.java + -##

4.其他问题

-1、兼容性说明 +###

3.3 其他新增接口

+接口详细说明,请查看Tron-http.md与波场钱包RPC-API.md \ +1、增加签名 +``` +curl -X POST http://127.0.0.1:8090/wallet/addtransactionsign -d '{"transaction": "TransferContract", "privateKey": "permissionkey1"}' + +rpc AddSign (TransactionSign) returns (TransactionExtention) {} +``` +2、查询已签名地址 +``` +curl -X POST http://127.0.0.1:8090/wallet/getapprovedlist -d '{"transaction"}' + +rpc GetTransactionApprovedList(Transaction) returns (TransactionApprovedList) { } +``` + +3、查询交易签名权重 +``` +curl -X POST http://127.0.0.1:8090/wallet/getsignweight -d '{"transaction"}' + +rpc GetTransactionSignWeight (Transaction) returns (TransactionSignWeight) {} +``` - \ No newline at end of file +##

4.其他

+ +1、支持多重签名后,创建账户时有什么变化?\ +在升级到V3.5版本后,并且多重签名提议生效后,创建账户时将自动生成owner-permission以及一个active-permission, +其中owner-permission中仅包含一个key,权限及阈值都为1。active-permission中也包含一个key,权限及阈值都为1,并且 +operations为"7fff1fc0037e0000000000000000000000000000000000000000000000000000",表示支持除 +AccountPermissionUpdateContract以外的所有操作。 + + + + + + + + + + + + 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" index cca5b7c5..0f962a56 100644 --- "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" @@ -77,6 +77,12 @@ [73. 查询资源委派的详细信息](#73) \ [74. 通证快捷转账](#74) \ [75. 通证快捷转账(通过私钥)](#75) +[76. 更新用户权限(用于多重签名)](#76) +[77. 增加签名(用于多重签名)](#77) +[78. 查询已签名地址(用于多重签名)](#78) +[79. 查询交易签名权重(用于多重签名)](#79) \ +[80. 部署智能合约 ](#80)\ +[81. 执行智能合约 ](#81) ##

API的具体定义请参考

@@ -400,9 +406,15 @@ rpc getTransactionsFromThis (Account) returns (TransactionList) {}; 23.2 提供节点 soliditynode。 23.3 参数说明 -Account:发起方账户,只需要地址。 +Account:发起方账户,只需要地址。 +offset: 分页的起始值,大于10000将提示错误。 +limit: 分页大小,最大为50,这个值可能会调整。当limit>50,或offset+limit>10000时,调整后满足limit<=50且offset+limit<=10000 +startTime:起始时间。 +endTime: 结束时间,获取[startTime,endTime]时间段的交易。 23.4 返回值 -TransactionList:交易列表。 +TransactionList:交易列表,按照交易创建时间的降序排列。 +total: 在[startTime,endTime]时间段内允许分页的最大交易数。 +rangeTotal: 在[startTime,endTime]时间段内的所有交易数,则默认返回最近7天的数据。 23.5 功能说明 通过账户地址查询所有发起的交易。 23.6 备注说明 @@ -417,8 +429,14 @@ rpc getTransactionsToThis (Account) returns (NumberMessage) {}; soliditynode。 24.3 参数说明 Account:接收方账户,只需要地址。 +offset: 分页的起始值,大于10000将提示错误。 +limit: 分页大小,最大为50,这个值可能会调整。当limit>50,或offset+limit>10000时,调整后满足limit<=50且offset+limit<=10000 +startTime:起始时间。 +endTime: 结束时间,获取[startTime,endTime]时间段的交易,如果不传递,则默认返回最近7天的数据。 24.4 返回值 -TransactionList:交易列表。 +TransactionList:交易列表,按照交易创建时间的降序排列。 +total: 在[startTime,endTime]时间段内允许分页的最大交易数。 +rangeTotal: 在[startTime,endTime]时间段内的所有交易数。 24.5 功能说明 通过账户地址查询所有其它账户发起和本账户有关的交易。 24.6 备注说明 @@ -1107,3 +1125,77 @@ fullnode EasyTransferAssetByPrivateMessage:转账用的私钥,toAddress,通证ID,转账的数量 75.4 返回值 EasyTransferResponse:转账创建的transaction,交易ID,以及广播的结果result + +##

76. 更新用户权限(用于多重签名)

+ +76.1 接口说明 +rpc AccountPermissionUpdate (AccountPermissionUpdateContract) returns (TransactionExtention) {}\ +76.2 提供节点 +fullnode +76.3 参数说明 +owner_address:待修改权限的账户的地址\ +owner:修改后的 owner 权限\ +witness:修改后的 witness 权限(如果是 witness )\ +actives:修改后的 actives 权限 + +76.4 返回值 +TransactionExtention:转账创建的transaction,交易ID,以及广播的结果result + + + + +##

77. 增加签名(用于多重签名)

+ +77.1 接口说明 +rpc AddSign (TransactionSign) returns (TransactionExtention) {}\ +77.2 提供节点 +fullnode +77.3 参数说明 +TransactionSign:交易,私钥 +77.4 返回值 +TransactionExtention:转账创建的transaction,交易ID,以及广播的结果result + +##

78. 查询已签名地址(用于多重签名)

+ +78.1 接口说明 +rpc GetTransactionApprovedList(Transaction) returns (TransactionApprovedList) {}\ +78.2 提供节点 +fullnode +78.3 参数说明 +Transaction:交易\ +78.4 返回值 +TransactionApprovedList:已签名的地址,交易 + +##

79. 查询交易签名权重(用于多重签名)

+ +79.1 接口说明 +rpc GetTransactionSignWeight (Transaction) returns (TransactionSignWeight) {}\ +79.2 提供节点 +fullnode +79.3 参数说明 +Transaction:交易\ +79.4 返回值 +TransactionSignWeight:结果result(交易的签名是否满足权限阈值) + +##

80. 部署智能合约

+ +80.1 接口说明 +rpc DeployContract (CreateSmartContract) returns (TransactionExtention) {};\ +80.2 提供节点 +fullnode +80.3 参数说明 +CreateSmartContract:提供创建合约信息的交易类型对象,包含owner_address(交易发送者地址), new_contract(SmartContract类型对象), call_token_value(trc10), token_id(trc10) 4个参数\ +附new_contract: smartcontract信息,包括,origin_address(合约部署者地址), contract_address(合约地址,默认为空),abi,bytecode,call_value(trx放入合约数量),consume_user_resource_percent(调用合约时用户方需支付的energy占所有花费比例), name(合约名字), origin_energy_limit(开发者愿意帮助用户支付的最高energy数量) \ +80.4 返回值 +TransactionExtention:展示交易执行结果的信息类型对象,包含transaction, transaction_id, constant_result 以及 on-block result. + +##

81. 执行智能合约

+ +81.1 接口说明 +rpc TriggerContract (TriggerSmartContract) returns (TransactionExtention) {};\ +81.2 提供节点 +fullnode +81.3 参数说明 +TriggerSmartContract:提供执行合约信息的交易类型对象,包含owner_address(交易发送者地址), contract_address, call_value(随交易打入合约的trx数量), data(被调用的方法的签名及参数), call_token_value(trc10数量), token_id(trc10 id) 6个参数\ +81.4 返回值 +TransactionExtention:展示交易执行结果的信息类型对象,包含transaction, transaction_id, constant_result 以及 on-block 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" index 673c0fa9..c70c7557 100644 --- "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" @@ -77,6 +77,7 @@ votewitness witness1 3 witness2 7 // 同时给witness1投了3票,给witness2 - 21: ALLOW_ADAPTIVE_ENERGY, // 用于允许ENERGY总量自适应调整,目前为0,表示不允许 (V3.5) - 22: UPDATE_ACCOUNT_PERMISSION_FEE, // 用于修改账户权限费用,目前为100TRX (V3.5) - 23: MULTI_SIGN_FEE, // 用于修改多重签名费用,目前为1TRX (V3.5) +- 26: ALLOW_TVM_CONSTANTINOPLE, // 支持波场虚拟机0.5.4的新功能(create2、位移指令、extcodehash指令等)(V3.6) + API: @@ -114,4 +115,4 @@ id: 提议Id,根据提议创建时间递增 以下接口可以查询提议,包括: 查询所有提议信息(ListProposals)、分页查询提议信息(GetPaginatedProposalList),查询指定提议信息(GetProposalById)。 相关api详情,请查询[波场RPC-API说明](波场钱包RPC-API.md)。 - \ No newline at end of file +