diff --git a/docs/clients/tron-grid.md b/docs/clients/tron-grid.md deleted file mode 100644 index cb5921bbb..000000000 --- a/docs/clients/tron-grid.md +++ /dev/null @@ -1,148 +0,0 @@ -# TronGrid - -The up-to-date TronGrid API Documentation is at [https://developers.tron.network/docs/tron-grid-intro](https://developers.tron.network/docs/tron-grid-intro). - -## Introduction - -TronGrid provides TRON clients running in the cloud, so you don't have to run one yourself to work with TRON on your next project. - -TronGrid offers an easy to use hosted API, load balanced full nodes, secure and reliable developer tools with direct access to the TRON Network. - -TronGrid uses a set of NodeJS apps to talk with Redis and PostgreSQL to provide a simple, fast and reliable query interface for the TRON API. - -TronGrid supports 2 types of api: - -- FullNode & SolidityNode api - -TronGrid supports all the FullNode and SolidityNode api calls, you only need to add the url: `https://api.trongrid.io/`, like: - -`https://api.trongrid.io/wallet/getnowblock` - -- TronGrid v3 (TG3) api version - -As this is the first iteration of the improved TronGrid, it starts with v1. -Example: `https://api.trongrid.io/v1` - -**Parameters, Queries, & Return Values** - -- Addresses in TG3 can be passed in base58 or hex formats. -- Query parameters can be passed in camelCase or snake_case. -- All returned JSON properties will be in snake_case (at the first level at least). -- **NB:** In this document, we will primarily use base58 and snake_case formats. - -## Account APIs - -1. Get Account Info By Address -*API:* -`https://api.trongrid.io/v1/accounts/:address` -*Params:* -address: The account’s address in base58 or hex format (0x... and 41...) -*Options:* -`only_confirmed` Shows only the situation at latest confirmed block.`true` | `false` default `false`. -*Example:* -`https://api.trongrid.io/v1/accounts/TLCuBEirVzB6V4menLZKw1jfBTFMZbuKq7?only_confirmed=false` - - -2. Get Transactions By Account Address -*API:* -`https://api.trongrid.io/v1/accounts/:address/transactions` -*Params:* -address: The account’s address. -*Options:* -`only_confirmed` Shows only confirmed. `true` | `false` default `false`. -`only_unconfirmed` Shows only unconfirmed. `true` | `false` default `false`. -`only_to` Only transaction to address. `true` | `false` default `false`. -`only_from` Only transaction from address. `true` | `false` default `false`. -`limit` The requested number of transaction per page. Default `20`. Max `200`. -`fingerprint` The fingerprint of the last transaction returned by the previous page. -`order_by` Pre sorts the results during the query. `order_by=block_number,asc`, `order_by=block_timestamp,desc`. `min_block_timestamp` The minimum transaction timestamp default `0`. `max_block_timestamp` The maximum transaction timestamp default `now`. - -*Example:* -`https://api.trongrid.io/v1/accounts/TLCuBEirVzB6V4menLZKw1jfBTFMZbuKq/transactions?only_to=true&only_from=true` - - -3. Get Account Resources By Address -*API:* -`https://api.trongrid.io/v1/accounts/:address/resources` -*Params:* -address: The account’s address. -*Example:* -`https://api.trongrid.io/v1/accounts/TLCuBEirVzB6V4menLZKw1jfBTFMZbuKq/resources` - -## Asset APIs - -1. Get All Assets -*API:* -`https://api.trongrid.io/v1/assets` -*Options:* -`order_by` Sorts the results. Accepted fields: `total_supply,asc` | `total_supply,desc`, `start_time,asc` | `start_time,desc`, `end_time,asc` | `end_time,desc`, `id,asc` | `id,desc`. Example: `order_by=total_supply,asc`. - -2. Get Assets By Identifier -*API:* -`https://api.trongrid.io/v1/assets/:identifier` -*Params:* -identifier: The identifier to be used to retrieve the asset. It can be the ID of the asset, or the issuer address. - -3. Get Assets By Name -*API:* -`https://api.trongrid.io/v1/assets/:name/list` -*Params:* -name: The name of the asset. -*Options:* -`limit` The requested number of assets per page. Default `20`. Max `200`. When there is a pagination, the minimum limit is set to `20`. -`fingerprint` The fingerprint of the last asset returned by the previous page. -`order_by` Pre sorts the results during the query. `order_by=total_supply,asc` (starts from the rarest token). `order_by=start_time,desc` (starts from the most recent ICO). - -## Block APIs - -1. Returns Events By Block Identifier -*API:* -`https://api.trongrid.io/v1/blocks/:identifier/events` -*Params:* -identifier: It can be either latest, a block number or a block id. - -## Contract APIs - -1. Get Events By Contract Address -*API:* -`https://api.trongrid.io/v1/contracts/:address/events` -*Params:* -address: The address of the deployed contract. -*Options:* -`only_confirmed` Shows only confirmed. `true` | `false` default `false`. -`only_unconfirmed` Shows only unconfirmed. `true` | `false` default `false`. -`event_name` The name of the event. -`block_number` The block number for which the events are required. -`min_block_timestamp` The minimum block timestamp default `0`. -`max_block_timestamp` The maximum block timestamp default `now`. -`limit` For pagination. Limit 20. -`fingerprint` The fingerprint of last event retrieved in the page. -`order_by` Sort the events. Accepted values: `block_timestamp,asc`, `block_timestamp,desc`(default). - -2. Get Transactions By Contract Address -*API:* -`https://api.trongrid.io/v1/contracts/:address/transactions` -*Params:* -address: The address of the deployed contract. -*Options:* -`only_confirmed` Shows only confirmed. `true` | `false` default `false`. -`only_unconfirmed` Shows only unconfirmed. `true` | `false` default `false`. -`min_block_timestamp` The minimum block timestamp default `0`. -`max_block_timestamp` The maximum block timestamp default `now`. -`limit` For pagination. Limit `20`. -`fingerprint` The fingerprint of last event retrieved in the page. -`order_by` Sort the events. Accepted values: `block_timestamp,asc`, `block_timestamp,desc` (default). - -## Transaction APIs - -1. Get Events By Transaction ID -*API:* -`https://api.trongrid.io/v1/transactions/:id/events` -*Params:* -id: The id of the transaction. - -2. Get Transaction By Transaction ID -*API:* -`https://api.trongrid.io/v1/transactions/:id/events` -*Params:* -id: The id of the transaction. diff --git a/docs/contracts/trc20.md b/docs/contracts/trc20.md deleted file mode 100644 index 6714d06dd..000000000 --- a/docs/contracts/trc20.md +++ /dev/null @@ -1,243 +0,0 @@ -# TRC-20 - -TRC‌-20 is a technical standard used for smart contracts on the TRON blockchain for implementing tokens with the TRON Virtual Machine (TVM). It is fully compatible to ERC‌-20. - -## Implementation Rules - -**3 Optional Items** - -- Token Name - -```text -string public constant name = “TRONEuropeRewardCoin”; -``` - -- Token Abbreviation - -```text -string public constant symbol = “TERC”; -``` - -- Token Precision - -```text -uint8 public constant decimals = 6; -``` - -**6 Required Items** - -```text - -contract TRC20 { - function totalSupply() constant returns (uint theTotalSupply); - function balanceOf(address _owner) constant returns (uint balance); - function transfer(address _to, uint _value) returns (bool success); - function transferFrom(address _from, address _to, uint _value) returns (bool success); - function approve(address _spender, uint _value) returns (bool success); - function allowance(address _owner, address _spender) constant returns (uint remaining); - event Transfer(address indexed _from, address indexed _to, uint _value); - event Approval(address indexed _owner, address indexed _spender, uint _value); -} - -``` - -- totalSupply() - -This function returns the total supply of the token. - - -- balanceOf() - -This function returns the token balance of the specific account. - - -- transfer() - -This function is used to transfer an amount of tokens from the smart contract to a specific address. - - -- approve() - -This function is used to authorize the third party (like a DAPP smart contract) to transfer token from the token owner’s account. - - -- transferFrom() - -This function is used to allow the third party to transfer token from an owner account to a receiver account. The owner account must be approved to be called by the third party. - - -- allowance() - -This function is used to query the remaining amount of tokens the third party can transfer. - -**2 Event Functions** - -When token is successfully transferred, it has to trigger Transfer Event. - -```text -event Transfer(address indexed _from, address indexed _to, uint256 _value) -``` - -When approval() is successfully called, it has to trigger Approval Event. - -```text -event Approval(address indexed _owner, address indexed _spender, uint256 _value) -``` - -## Example - -```text -pragma solidity ^0.4.16; - -interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } - -contract TokenTRC20 { - // Public variables of the token - string public name; - string public symbol; - uint8 public decimals = 18; - // 18 decimals is the strongly suggested default, avoid changing it - uint256 public totalSupply; - - // This creates an array with all balances - mapping (address => uint256) public balanceOf; - mapping (address => mapping (address => uint256)) public allowance; - - // This generates a public event on the blockchain that will notify clients - event Transfer(address indexed from, address indexed to, uint256 value); - - // This notifies clients about the amount burnt - event Burn(address indexed from, uint256 value); - - /** - * Constructor function - * - * Initializes contract with initial supply tokens to the creator of the contract - */ - function TokenTRC20( - uint256 initialSupply, - string tokenName, - string tokenSymbol - ) public { - totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount - balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens - name = tokenName; // Set the name for display purposes - symbol = tokenSymbol; // Set the symbol for display purposes - } - - /** - * Internal transfer, only can be called by this contract - */ - function _transfer(address _from, address _to, uint _value) internal { - // Prevent transfer to 0x0 address. Use burn() instead - require(_to != 0x0); - // Check if the sender has enough - require(balanceOf[_from] >= _value); - // Check for overflows - require(balanceOf[_to] + _value >= balanceOf[_to]); - // Save this for an assertion in the future - uint previousBalances = balanceOf[_from] + balanceOf[_to]; - // Subtract from the sender - balanceOf[_from] -= _value; - // Add the same to the recipient - balanceOf[_to] += _value; - emit Transfer(_from, _to, _value); - // Asserts are used to use static analysis to find bugs in your code. They should never fail - assert(balanceOf[_from] + balanceOf[_to] == previousBalances); - } - - /** - * Transfer tokens - * - * Send `_value` tokens to `_to` from your account - * - * @param _to The address of the recipient - * @param _value the amount to send - */ - function transfer(address _to, uint256 _value) public { - _transfer(msg.sender, _to, _value); - } - - /** - * Transfer tokens from other address - * - * Send `_value` tokens to `_to` on behalf of `_from` - * - * @param _from The address of the sender - * @param _to The address of the recipient - * @param _value the amount to send - */ - function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { - require(_value <= allowance[_from][msg.sender]); // Check allowance - allowance[_from][msg.sender] -= _value; - _transfer(_from, _to, _value); - return true; - } - - /** - * Set allowance for other address - * - * Allows `_spender` to spend no more than `_value` tokens on your behalf - * - * @param _spender The address authorized to spend - * @param _value the max amount they can spend - */ - function approve(address _spender, uint256 _value) public - returns (bool success) { - allowance[msg.sender][_spender] = _value; - return true; - } - - /** - * Set allowance for other address and notify - * - * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it - * - * @param _spender The address authorized to spend - * @param _value the max amount they can spend - * @param _extraData some extra information to send to the approved contract - */ - function approveAndCall(address _spender, uint256 _value, bytes _extraData) - public - returns (bool success) { - tokenRecipient spender = tokenRecipient(_spender); - if (approve(_spender, _value)) { - spender.receiveApproval(msg.sender, _value, this, _extraData); - return true; - } - } - - /** - * Destroy tokens - * - * Remove `_value` tokens from the system irreversibly - * - * @param _value the amount of money to burn - */ - function burn(uint256 _value) public returns (bool success) { - require(balanceOf[msg.sender] >= _value); // Check if the sender has enough - balanceOf[msg.sender] -= _value; // Subtract from the sender - totalSupply -= _value; // Updates totalSupply - emit Burn(msg.sender, _value); - return true; - } - - /** - * Destroy tokens from other account - * - * Remove `_value` tokens from the system irreversibly on behalf of `_from`. - * - * @param _from the address of the sender - * @param _value the amount of money to burn - */ - function burnFrom(address _from, uint256 _value) public returns (bool success) { - require(balanceOf[_from] >= _value); // Check if the targeted balance is enough - require(_value <= allowance[_from][msg.sender]); // Check allowance - balanceOf[_from] -= _value; // Subtract from the targeted balance - allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance - totalSupply -= _value; // Update totalSupply - emit Burn(_from, _value); - return true; - } -} -``` diff --git a/docs/contracts/tvm.md b/docs/contracts/tvm.md deleted file mode 100644 index 45ddb49d2..000000000 --- a/docs/contracts/tvm.md +++ /dev/null @@ -1,104 +0,0 @@ -# TRON Virtual Machine (TVM) - -TRON Virtual Machine (TVM) is a lightweight, Turing complete virtual machine developed for the TRON's ecosystem. Its goal is to provide millions of global developers with a custom-built blockchain system that is efficient, convenient, stable, secure and scalable. - -TVM can connect seamlessly with existing development ecosystem and supports DPoS. TVM is able to be compatible with EVM environment in the beginning, so that instead of learning a new programming language, developers can develop, debug and compile smart contracts in a Remix environment with Solidity and other languages. Once you’ve built and uploaded your smart contract to TRON’s mainnet, it will be executed on the TVM of the SR node to be isolated from external connections. - -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 - -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) -Developers can call these interfaces to deploy, trigger or check smart contracts. - -## How TVM Works - -![Flowchart of TRON Virtual Machine](https://raw.githubusercontent.com/tronprotocol/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. - -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 - -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. - -## 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 { } - - - 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. 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 - -Selector: function selector -Data: parameters -triggercontract(Password, ContractAddress, Selector, Data, Value) - -5. Check contract -```text - getcontract(ContractAddress) -``` - -The above is an introduction of TRON Virtual Machine and a guide to deployment. We welcome everyone to check out TVM and give us your thoughts and suggestions. We will continue to perfect and update TVM for optimal performance on TRON mainnet. diff --git a/docs/developers/advanced-configuration.md b/docs/developers/advanced-configuration.md deleted file mode 100644 index f95fbcd11..000000000 --- a/docs/developers/advanced-configuration.md +++ /dev/null @@ -1,120 +0,0 @@ -# Advanced Configurations - -we provide some configuration items for LevelDB and gRPC in `config.conf` file, for fine-grained performance tuning. -You may custom these items only if you have deep understanding on them, otherwise keep them as default. - -## LevelDB - -You can custom LevelDB options in the `storage` part of `config.conf`, which looks like: - -``` -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 = "/path/to/account", // relative or absolute path - createIfMissing = true, - paranoidChecks = true, - verifyChecksums = true, - compressionType = 1, // 0 - no compression, 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 - } - ] - -} - -``` - -As shown in the example above, the data of database `account` will be stored in the path of `/path/to/account/database` while the index be stored in `/path/to/account/index`. And, the example also shows our default value of LevelDB options from `createIfMissing` to `maxOpenFiles`. You can just refer to the docs of [LevelDB](https://github.com/google/leveldb/blob/master/doc/index.md#performance) to figure out details of these options. - -## gRPC - -You can custom gPRC options in the `node.rpc` part of `config.conf`, which looks like: - -``` -node { - 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 = - } -} -``` - -## backup -You can custom backup options in the `node.backup` part of `config.conf`, which looks like: -``` -node.backup { - # my priority, each member should use different priority - priority = - # members should use same port - port = - # peer's ip list, can't contain mine - members = [] -} -``` -policy: - -1. the one which synchronized first will become master. -2. if synchronization is completed at the same time, the one with big priority will become master. - -E.g. create backups for node A(192.168.0.100) and node B(192.168.0.100 ): -node A's configuration: -``` -node.backup { - priority = 8 - port = 10001 - members = [ - "192.168.0.101" - ] -} -``` -node B's configuration: -``` -node.backup { - priority = 5 - port = 10001 - members = [ - "192.168.0.100" - ] -} -``` - -You may refer to the source code of `io.grpc.netty.NettyServerBuilder` class to see details or just make a decision according to the brief comments above. diff --git a/docs/developers/contribution.md b/docs/developers/contribution.md deleted file mode 100644 index 59ca5563a..000000000 --- a/docs/developers/contribution.md +++ /dev/null @@ -1,58 +0,0 @@ -# How to contribute - -## Getting Started as TRON Community Developers - -TRON is a global, open-source platform for decentralized applications. - -Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes! - -GitHub is used to track issues and contribute code, suggestions, feature requests or documentation. - -If you'd like to contribute to TRON, please fork, fix, commit and send a pull request (PR) for the maintainers to review and merge into the main base. If you wish to submit more complex changes though, please check up with the core developers first on our channel to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple. - -Your PR will be reviewed according to the Code Review Guidelines. - -We encourage a PR early approach, meaning you create the PR the earliest even without the fix/feature. This will let core developers and other volunteers know you picked up an issue. These early PRs should indicate 'in progress' status. - -** Developer Community ** - -* [java-tron gitter channel](https://gitter.im/tronprotocol/allcoredev) -This channel is for TRON network issues. -* [wallet-cli gitter channel](https://gitter.im/tronprotocol/wallet-cli) -This channel is for the client of TRON network issues. -* [documentation gitter channel](https://gitter.im/tronprotocol/documentation) -This channel is for TRON docunentation issues. -* [tips gitter channel](https://gitter.im/tronprotocol/TIPs) -This channel is for TRON improment proposal issues. - -Check [TRON Incentives Policy](incentives.md) - -## Submitting a TIP - -Please check [Submitting a TIP](./tips.md) - -## Coding java-tron - -Please check [Coding java-tron](./java-tron.md) - -## Reporting Vulnerabilities - -We think highly of all the security bugs in the TRON project seriously. Thank you for improving the security of TRON project. We really appreciate your efforts and responsible disclosure. We will make every effort to acknowledge your contributions. - -Report security bugs at [https://hackerone.com/tronfoundation](https://hackerone.com/tronfoundation) - -A developer from the core devs will follow up the issue. Firstly, we will confirm the bug and determine the affected versions. Secondly, we will try to find any potential similar bugs. Then we will do the fix and prepare for the release. - -After the initial reply to your report is sent, we will try to keep you informed on the progress towards the fix. The core devs may ask you for additional information or guidance. - -If you have suggestions on how this process could be improved, please submit a pull request. - -## Writing Documentation - -There are two documentation repositories: -[documentation-en](https://github.com/tronprotocol/documentation-en) is the English version. -[documentation-zh](https://github.com/tronprotocol/documentation-zh) is the Chinese version. - -We use MkDocs to build documentation project. Documentation source files are written in Markdown, and configured with a single YAML configuration file. - -You can edit or add a documentation file in /docs/ folder. diff --git a/docs/developers/gpg.md b/docs/developers/gpg.md deleted file mode 100644 index eb98586a8..000000000 --- a/docs/developers/gpg.md +++ /dev/null @@ -1,52 +0,0 @@ -This file contains the PGP keys of official support. - -Users: pgp < KEYS -or    gpg --import KEYS -or    gpg --keyserver hkp://keys.gnupg.net --search-keys support@tron.network - -pub  rsa3072  2020-10-20 [SC] -   fingerprint = C07A AC17 C98D 205F 0CE3 0BF9 7F0A F58B 65C7 EEF4 -uid  Tron-Support -sub  rsa3072  2020-10-20 [E] - ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQGNBF+O4sMBDADTV2ymtGL+iZOAqc+U+jG8SLJRZlrw3k0Yc9aPeMvVvikAC7Sl -j+3vTU5JjCYWPmcRqkHo1RyNImZg2GoikMB+y4/kAu/IHYyIbKlXQiC/XDPQ0Gpk -0mq74Df/24DFXBjYm9lpvisavaaVnQOxxwvLdVxBMdKZoZALcmy3dSBHVuqOfqrV -znD5zE6fSpGonCiCZSx34VRCe5rNTBj0DnTjmBo3WzroxkjMqVeXpt8hWmfwUPGb -EjvkopzGk+RtHfZvJrLrDsd3XF0M1iDzHSpBpVTs2kIoEMN2wK6YbMdYJk6mQDs4 -3IH1uEiwNNd+npUDSPX2mUuPDmcZgO2msiXC/SuSSxZ3tEWQQ/g9Uzf5gv494em5 -DNGmoS5EUDnWjv1CtmHsBclxmb1VS72CsxQobnUcQ4LosKJ1eCK6cgOCTbPAtwGf -VitXUZRubwfUmPKEQOaoUoYtdOR50V0aSHfDFnNO3yhyZESUZBtNK9J7JdBTaGdo -Z/TXxUbpNF5ZHrcAEQEAAbQjVHJvbi1TdXBwb3J0IDxzdXBwb3J0QHRyb24ubmV0 -d29yaz6JAc4EEwEIADgWIQTAeqwXyY0gXwzjC/l/CvWLZcfu9AUCX47iwwIbAwUL -CQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRB/CvWLZcfu9GtCDACRsKze6Bk9TJik -bz5IkdUfCBY9I8wCgcjqqO1knC47vwAwSt9GckEMu9LYTrrTzbedgBH0PF3FHFxy -DpnQf9UgQ1AGOLm8H2ZN0W7ZF9wHtDJKjvV4GKIOmIi9tJ57LqqLAaPGbO01DAx4 -0PoEM4257fbKGYnAUUgKZxRJBAMhE8DdlsnQ1qqPeVVxmBFYD8zEjvW0ROfV59FI -OfReFJoCvJoX9LpMGLi1HwichJkcItXwtNAdFbNLJSYc8ZatcmDkkHTwRn2wRHBc -aJOFGjZma2xjkCXB+4QFwjI2ng9Y2HpufwquP0ptUepq7kf1WeFdzChXlIOx+35y -pK67EQxr/ExpIl8Sti2Oe4pPzhOoRVs05y+9ghVQ9rN7/16y7/w3GAZelrvEucM8 -KYPBPIBILu7atuXHDhgeCDfbUIR3npAkFZJpW702BUg8jP/opwGlPvB7+A3+7r0e -zLlwVyfKXTq1SbeaMgUyQ44vJpXBTiz2cqQZ5LC/OJuumw6NgBW5AY0EX47iwwEM -AJjdQnztPlnTydbRf/XgAbNX5dFDE2+T86LW03ke/oHMFWTg3iWoQs/dAh3ucPw7 -imU05mJr4+FrVFmU1NULLfG5T7dEPzPkZYN/pKa7EwBV2alLN6tab7gpS3ABYtnq -GFZSOAGa9dwwhpAmItSG+2nBL76+7fdGmxzUsoGtjbM/m2nrMtuj/04y/aGD6xC8 -6Ncup+syJtjhN2i+98PqNwhlAd9wYrzed8fzUH/84tXAIdKLZS7wdQA6fWyj78nW -I9wMlS5h/QDBsDXDd9/Bv4FgUfIFgLR+K6M6gx6Hl4AyWN1JvWIlvuqPLqcEv3b5 -bZlOCRB5NsuEzLBdEaydN8oEcL9G578o0sAp6qbdza/Mtbq+n1y9FSItuYJxHtZC -RpeICwKgOS48YeLRjvBYhogTT2GqPaoT/a6iMKT4c+MgbvgD487SjagYlf0CJ6PD -ENnjIZfERXgwAFq528CWJjYwF9acjEGQkcJzH5+R3Ev5d/YdlQLFtdUirB4rc/5T -JQARAQABiQG2BBgBCAAgFiEEwHqsF8mNIF8M4wv5fwr1i2XH7vQFAl+O4sMCGwwA -CgkQfwr1i2XH7vSfaQv/f8kcLDn+wCN7egSqt4XXKOpDLyKIB/cczGfRWQG4pZns -3rFjnvqKnYMTkm6vnf0JW8jUgW5V2PxNxVOKC0/KhbYX3QikUqO1wcjr7a4JsOtH -PNZd8SXCRvLLifyw6QkK5FnFNLBA8oV5bej73gpEaSqF0kXZI9UP9dfvCp0R22Zw -48TxEbhj9i8x6pWZ4hckbojGVYqeo3LdTVMA75FXVfFzVoRJgvow0lEXqTKTPASU -PuWejMXfqdN1Vu20IJvCgij7l0RTwK7ushX6a6mX5QAGIb4Qa3UkHGtEgwOJ/QVF -WzjNwu0praNGHqIqirxpBT6ze/Oz47IsSGY727+4Edanz73upPwkt54Rb6wimxKf -MTSixi+cpzJgsVBiJY4VRIuGSq3ITXZjaEoM7Zu6+0KIb19r6PcuP+wMZJPkup0/ -8nrS3HspazsZUq5kz3fFy2MkXv7dXduQN3iqKEtmedcCDCnglnzi0O/Ryl2niqWw -iCwhvZAEFCYiEkUJdk+A -=G5T7 ------END PGP PUBLIC KEY BLOCK----- diff --git a/docs/developers/incentives.md b/docs/developers/incentives.md deleted file mode 100644 index d1267a103..000000000 --- a/docs/developers/incentives.md +++ /dev/null @@ -1,116 +0,0 @@ -# Community Developers Incentives Programme - -Bonus point applies in TRON incentives programme. Developers can earn points by contributing to TRON. - -When a issue (or PR) is closed, it will be added into the reward programme. The core devs will discuss and comment the issue (or PR), the points of a issue (or PR) received will be added in the comment to track. - -You can find your points ranking at [Tronscan](https://tronscan.org/#/developersreward). - -Reward 1: - -At the end of every month, we will calculate all points each developer gets in the current month and who finish in Top 5 will be rewarded with cash. - -At the end of every year, we will calculate all points each developer gets in the current year and who finish in Top 5 will be rewarded with cash. - -The Top 5 developers who win the cash reward will be announced at Tronscan. - -Also, there is a chance to display developers' photos at TRON official website. - -| No. 1 | No. 2 | No. 3 | No. 4 | No. 5 | -|---------|-----------|----------|-----------|-----------| -| 200 USD | 180 USD | 150 USD | 120 ~ 140 USD | 100 ~ 120 USD | - -Reward 2: - -Every developer who participates java-tron's development will be honored with a TRON Honorary Developer Certificate. And we will give a vote of thanks to the developers on TRON official website. - - -The following shows the content you can contribute to. - -## Non-code Related - -** 1. TIP ** - -Description: TRON Improvement Proposal(TIP) -Scope: Any improvement related to TRON ecosystem, like a new feature, TRC, protocol improvement, programming tool, etc. -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 20 | 15 | 10 | < 5 | - -** 2. Documentation ** - -Description: To revise, update and add technical documentation related to TRON network. -Scope: mechanism and algorithm, network architecture and database, contracts and other technical documentation -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 20 | 15 | 10 | < 5 | - -** 3. Issue ** - -Description: Create a topic about a question, enhancement, bug or feature and so on to discuss -Scope: java-tron, TRON ecosystem -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 10 | 8 | 5 | < 2 | - -## Code Related - -** 1. Feature Development ** - -Description: To add new features to TRON network -Scope: java-tron, wallet-cli -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 100 | 80 | 50 | < 20 | - -** 2. Bug Report ** - -Description: To report bugs in online TRON network -Scope: java-tron, wallet-cli -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 20 | 15 | 10 | < 5 | - -**3. Bug Fix** - -Description: To fix bugs in online TRON network -Scope: java-tron, wallet-cli -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 40 | 30 | 20 | < 10 | - -**4. Security Related** - -Description: To find the security risks and enhance the security of TRON network and ecosystem -Scope: java-tron, TRON ecosystem -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 100 | 80 | 50 | < 20 | - -**5. Others** - -Description: Code improvements, etc. -Scope: java-tron, wallet-cli -Points: - -| Critical | High | Medium | Low | -|-----------|-----------|----------|-----------| -| 20 | 15 | 10 | < 5 | - -In order to get 5 (or more) points, the content of a PR should be creative, practical, critical or can reflect significant workload. - -One PR should aim at solving one type of problems, so do not break one type of PR into many small PRs. diff --git a/docs/developers/resources.md b/docs/developers/resources.md deleted file mode 100644 index 26314fd16..000000000 --- a/docs/developers/resources.md +++ /dev/null @@ -1,28 +0,0 @@ -# Resources - -* TRON Official Website -[https://tron.network/](https://tron.network/) - - -* TRON White Paper -[https://tron.network/resources?lng=&name=1](https://tron.network/resources?lng=&name=1) - - -* TRON Blockchain Browser -[https://tronscan.org/](https://tronscan.org/) - - -* TRON Wallet -[https://github.com/tronprotocol/wallet-cli](https://github.com/tronprotocol/wallet-cli) - - -* TRON Zksnark-java-sdk -[https://github.com/tronprotocol/zksnark-java-sdk](https://github.com/tronprotocol/zksnark-java-sdk) - - -* TRON Sun-network -[https://github.com/tronprotocol/sun-network](https://github.com/tronprotocol/sun-network) - - -* TRON Javascript API -[https://github.com/tronprotocol/tronweb](https://github.com/tronprotocol/tronweb) diff --git a/docs/faq/index.md b/docs/faq/index.md deleted file mode 100644 index 9090053b4..000000000 --- a/docs/faq/index.md +++ /dev/null @@ -1,301 +0,0 @@ -# The TRON FAQ - - - -[TOC] - -## Network Design and Protocol - -### How can I generate an account? - -You can use [wallet-cli](https://github.com/tronprotocol/wallet-cli) or [Tronscan](https://tronscan.org/#/wallet/new). - -### What is the network flow? - -Network flow depends on transaction volume. As a reference, the average size of a transaction currently is 200 bytes. - -### After you create a token, how to change its status from 'not started yet' to 'participate'? - -You need to wait till the time reaches the start time of participation you set when create a token. After a token is created, only the token url and description can be modified. - -### Is there a place to see if all the SuperNodes are producing blocks? - -Please refer to [Tronscan](https://tronscan.org/#/sr/representatives) - -### Is the block producing time interval always remain the same? - -The current block producing time interval is 3 seconds. In the future, it may be improved to 1 second. - -### Will the block producing reward reduce half? - -No. - -### If one of the top 27 SuperNodes goes wrong, will it be removed from the SRs list? - -If people stop voting for it, it will drop out of the top 27 SRs. - -### Is there a threshold to become a SR? - -When the amount of votes you get ranks into top 27, you will become a SR. - -### 27 SRs shares the block producing reward equally or by their computing power? - -It has nothing to do with computing power. The reward is a fixed 32 TRX for each block produced. - -### Will there be an over 50% computing power issue in TRON network? - -No. - -### Will voting burns TRX? - -No. - -### How long does SR's power last? - -Every 6 hours, the votes will be counted to check the qualifications of all the SRs. - -### What is the proof of a transaction? - -Transaction hash. - -### Why I Can't stake TRX longer than 3 days - -Staked duration must be 3 days now. It means you can not unstake until the 3 days duration expires. If you don't unstake after 3 days, the staked TRX will remain in staked status until you unstake it. - -### How to watch my account for transactions - -To meet your needs, you can use TRON event subscription plugin. For more detail, please refer to [Event Subscription](../architecture/event.md) - -### How to calculate the transaction fee? - -please refer to [Resource Model](../mechanism-algorithm/resource.md) - -### How to calculate the number of bytes of transactions? - -tx-size = grpcClient.getTransactionById(txId).get().getSerializedSize() + 60 - -### How to reset my vote? - -You need to vote again, set your votes number to 0. - -## Node Configuration - -### If I replace the field value of 'genesis.block.witnesses' with the address generated in [Tronscan](https://tronscan.org/) in config.conf, do I need to delete other addresses? Do I need to delete the field 'url' and 'voteCount'? - -No need to delete other addresses, these addresses will be a part of your net, but if you do not own the private keys of these addresses, they will act like abandoned addresses. -Note: The addresses of Zion、Sun and Blackhole can not be deleted, but can be modified. - -### How can I specify the data storage path when start a node? - -You can add the data storage path when you start the node, like: - -```text -java -jar FullNode.jar -c config.conf -d /data/output -``` - -### Is there any config file option, which I can use for sending logs to stdout? - -Steps to send logs to stdout: - -Download [https://github.com/tronprotocol/java-tron/blob/develop/src/main/resources/logback.xml](https://github.com/tronprotocol/java-tron/blob/develop/src/main/resources/logback.xml) - -Uncomment the configuration: - -appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender" - -Go to the configuration: root level="INFO" -uncomment the configuration: appender-ref ref="STDOUT" -comment the configuration: appender-ref ref="ASYNC" - -Move logback.xml to the same directory with FullNode.jar - -Launch FullNode.jar with additional parameter: --log-config logback.xml, for example: - -```text -java -jar FullNode.jar --log-config logback.xml -``` - -### How to change log level - -The log level is defined in logback.xml. Please set the root level to "ERROR" if you want to filter only error logs. Please refer to the configuration below. - -```xml - - - - - - - - - - - - - - - - - -``` - -### How can I get asset from private net? - -In private network, you can set the initial account balance in config file. Please refer to below settings: - -```text -genesis.block = { - # Reserve balance - assets = [ - { - accountName = "TestA" - accountType = "AssetIssue" - address = "THRR7uvFbRLfNzpKPXEyQa8KCJqi59V59e" - balance = "1000000000000000" - }, - { - accountName = "TestB" - accountType = "AssetIssue" - address = "TBLZaw93rsnLJ1SWTvoPkr7GVg5ixn2Jv1" - balance = "1000000000000000" - }, - { - accountName = "TestC" - accountType = "AssetIssue" - address = "TJg8yZ4Co8RXsHmTWissmSL1VpL7dCybY1" - balance = "1000000000000000" - } - ] -``` - -## Compile and Build - -### java-tron build failed with unit test issue - -Please use './gradlew build -x test' to skip the test cases. - -## Deployment - -### How to test if the deployment works normally, if there is a test api or command like redis: get ping return pong? - -java-tron does not provide a default api to test. Once the service start, grpc commands can be sent. Based on that, there are several ways to test if the deployment is successful. You can also use the following command to test: - -```text -> tail -f logs/tron.log |grep "MyheadBlockNumber" -``` - -### When to deploy private environment, what's the relationship of SuperNode and FullNode? Should I firstly deploy a SuperNode, and then deploy a FullNode? - -Under private environment, there should be at least one SuperNode, there is no amount limit for FullNode. - -### How to know whether my test SuperNode is running or not? - -Using the following command - -```text -> tail -f logs/tron.log |grep "Try Produce Block" -``` - -### Can SolidityNode and FullNode be deployed in one machine? Will they share the data? - -They can be deployed in one machine. You can specify the data storage path in configuration file `db.directory = "database",index.directory = "index"`. You can run FullNode.jar and SolidityNode.jar in different paths to separate the data and log. Remember to change the port in `config.conf`, because two nodes can not work using the same port. SolidityNode is deprecated. Now a FullNode supports all RPCs of a SolidityNode. New developers should deploy FullNode only. - -## Running a Node - -### As under private environment, why the log keeps updating with all other public nodes? What's the difference of private and public environment? - -If it is related to ip list: You need to update 'seed.ip' in config.conf, if it is the same as your public ip, and your computer is connected to the internet, it will try to connect other nodes, even if it fails to connect, the ip list will be stored into DB. If it is related to block and transaction: Under private environment, you need to modify the p2p version and parent hash. If they are the same as MainNet or TestNet, and the computer is connected to internet, the node will sync data from public node. - -### Under private environment, should I submit application information to TRON to become a SR? - -Under private environment, no need to submit application information to TRON to become a SR. - -Ask:Which service port should be public to public network? - -Default port 18888, 50051 - -### At the worst scenario, if the SuperNode can not be connected, the maximum time it allows the SuperNode to recover its service? - -The internet connection recovery time only depends on the recovery of SuperNode itself, has nothing to do with internet situation. - -### Does SolidityNode sync data from FullNode? - -Yes. - -### Does a node have wallet function? - -No, but the node provides wallet rpc api. - -### Why does the block process time take so long? - -java-tron need more RAM to process transactions. - -## Test Net - -### We want to test our SuperNode's performance under test environment, do we need to be voted to become a SR under test environment? - -Yes. Under test environment, we can vote you to become SR. - -### What is the different between Shasta and Test Net? - -to be answered - -### Where can I get the test TRX? - -[http://testnet.tronex.io/join/getJoinPage](http://testnet.tronex.io/join/getJoinPage) - -## Smart Contract - - -## RPC Client and API - -### How to sign transaction from offline node and broadcast to online node? - -You can use [tronweb](https://developers.tron.network/docs/api-sign-flow) - -### How to sync wallet-cli with wallet on Tronscan? - -By using wallet-cli api 'ImportWallet'. - -### Is gateway connected to SolidityNode? - -Gateway can connect to SolidityNode and FullNode. - -### What is the different between 'getTransactionById' and 'getTransactionInfoById'? - -The data they return is from different data modules. 'getTransactionById' focuses on general transaction data, while 'getTransactionInfoById' focuses on transaction fee data. - -### How to broadcast raw transaction? - -You can use 'wallet/broadcasthex'. - -### How to get token balance of an account? - -You can use the following wallet-cli api: - -```text -triggercontract contractaddress balanceOf(address) "youraddress" false 0 0 0 # -``` - -## Error Log - -### What does the following error message mean? - -```text -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 -``` - -This message means your node does not sync with the network. Before producing blocks, it needs to sync data. You can use the following command to check the block height. - -```text -> tail -f logs/tron.log |grep "MyheadBlockNumber" -``` - -## Other Questions - -## My Question is Not Listed Here? - -Feel free to join our community, just open an Issue on github: - -- Github: [tronprotocol/java-tron](https://github.com/tronprotocol/java-tron) diff --git a/docs/introduction/index.md b/docs/introduction/index.md deleted file mode 100644 index 91d5608a6..000000000 --- a/docs/introduction/index.md +++ /dev/null @@ -1,19 +0,0 @@ -# Repository - -## Project Repository - -Github URL: [https://github.com/tronprotocol](https://github.com/tronprotocol). - -- [tronprotocol/java-tron](https://github.com/tronprotocol/java-tron) is the source code of the MainNet. -- [tronprotocol/protocol](https://github.com/tronprotocol/protocol) is the definition of the api and data structure. -- [tronprotocol/wallet-cli](https://github.com/tronprotocol/wallet-cli) is the official command line wallet. -- [tronprotocol/tips](https://github.com/tronprotocol/tips) is the TRON Improvement Proposals. -- [tronprotocol/sun-network](https://github.com/tronprotocol/sun-network) is a project dedicated to building a trustful decentralized sidechain of TRON Main Chain. - -## Configuration File for the Net - -MainNet Configuration: -[GH tronprotocol/TronDeployment/main_net_config.conf](https://github.com/tronprotocol/TronDeployment/blob/master/main_net_config.conf) - -TestNet Configuration: -[GH tronprotocol/TronDeployment/test_net_config.conf](https://github.com/tronprotocol/TronDeployment/blob/master/test_net_config.conf) diff --git a/docs/introduction/overview.md b/docs/introduction/overview.md deleted file mode 100644 index c916df8dd..000000000 --- a/docs/introduction/overview.md +++ /dev/null @@ -1,1167 +0,0 @@ -# Overview - -# 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 definition 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. SRs 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 stake TRX. Every 1 staked TRX accounts for one TRON Power(TP). Every account in TRON network has the right to vote for a super representative candidate. After you unstake your staked 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. - -Example (Using wallet-cli): - -```text -freezebalancev2 10,000,000 3 // stake 10 TRX to get 10 TRON Power(TP) -votewitness SR1 4 SR2 6 // Vote 4 votes for SR1, 6 votes for SR2 -votewitness SR1 3 SR2 7 // Vote 3 votes for SR1, 7 votes for SR2 -``` - -The final output above is: Vote 3 votes for SR1, 7 votes for SR2 - -## 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 transaction 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 9,999,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 1,000 SUN/byte -- 4: ASSET_ISSUE_FEE, [0, 100 000 000 000 000 000] //the fee to issue an asset, currently 1,024,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 1,000,000 SUN -- 8: CREATE_NEW_ACCOUNT_BANDWIDTH_RATE, //the consumption of bandwidth 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 - -Example (Using wallet-cli): -```text -createproposal id value -id: the serial number (0 ~ 18) -value: the parameter value -``` - -Note: In TRON network, 1 TRX = 1,000,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. - -Example (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. - -Example (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 API](../api/http/index.md) - -# 3. Account Model - -## 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 transferred from account to account and it costs bandwidth. An account can also issue a smart contract, apply to become a super representative candidate, vote, etc. All TRON's activities are based on account. - -## 3.2 How to Create an Account - -1. Use a wallet to generate the address and private key. To activate the account, you need to transfer TRX or transfer token to the new created account. - -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 number, public key is a point in the elliptic curve. The process is: first generate a random number d to be the private key, then calculate 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 comes out. Do basecheck to address, here is the final address. All addresses start with 'T'. - -basecheck process: first do sha256 calculation 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](https://github.com/tronprotocol/documentation/blob/master/English_Documentation/Procedures_of_transaction_signature_generation.md) - -# 4. 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/#/sr/representatives). -### 4.1.2 SuperNode Deployment -[SuperNode Deployment](https://github.com/tronprotocol/java-tron/blob/develop/run.md#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 synchronizes solidified block data from the fullNode it specifies. It also provides 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 infrastructure, 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-en/master/images/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** - -- at least two accounts -- at least deploy one SuperNode to produce blocks -- deploy serval FullNodes to synchronize blocks and broadcast transactions -- 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://raw.githubusercontent.com/tronprotocol/tron-deployment/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 - -```shell -nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar --witness -c private_net_config.conf - -command line parameters introduction: ---witness: start witness function. For SuperNode, this parameter is required, 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-en/master/images/localwitness.jpg) - witnesses: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/witness.png) - version: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/p2p_version.png) - enable: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/discovery_enable.png) - - -**4.6.3.2.2 Step 2: FullNode Deployment** - - 1. Download private_net_config.conf - -```shell -wget https://raw.githubusercontent.com/tronprotocol/tron-deployment/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 - - -```shell - nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar -c private_net_config.conf - - command lines parameters - --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-en/master/images/ip_list.png) - p2p.version: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/p2p_version.png) - genesis.block: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/genesis_block.png) - needSyncCheck: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/need_sync_check.png) - node.discovery.enable: - - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/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-en/master/images/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-en/master/images/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 function while running - ![image](https://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/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/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 run 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 contracts. - -### 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 being 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/library - -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 load code 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 definition 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 accounts 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 disapproves 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 - -Stake TRX to get energy. - -Example (Using wallet-cli): - -```text -freezeBalanceV2 frozen_balance [ResourceCode:0 BANDWIDTH,1 ENERGY] -``` - -Stake TRX to get energy, energy obtained = user's TRX staked amount / total amount of staked TRX in TRON * 50,000,000,000. - -Example: - -```text -If there are only two users, A stakes 2 TRX, B stakes 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 stakes 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 -C: 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 stake -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 executed one by one and consume energy. If it reaches the fee limit, commands will fail to be executed, 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 staked 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 can 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 staked 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 staking 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 staking 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://developers.tron.network/docs/vm-exception](https://developers.tron.network/docs/vm-exception) - -**Example 2** - -A has an account with a balance of 90 TRX(90000000 SUN) and 10 TRX staked 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 stakes 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 staking 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 staking 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 staking 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. - - -Assert-style error introduction, refer to [https://developers.tron.network/docs/vm-exception](https://developers.tron.network/docs/vm-exception) - -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 itself. - -To avoid unnecessary lost, 10 - 100 is recommended for consume_user_resource_percent. - -## 5.4 Smart Contract Development Tool - -### 5.4.1 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.2 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.3 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 - -```shell -# download source 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 -## 6.1 Built-in Contracts -Please refer to: -[https://github.com/tronprotocol/documentation/blob/master/English_Documentation/TRON_Protocol/TX_ContractTypes_Update.MD](https://github.com/tronprotocol/documentation/blob/master/English_Documentation/TRON_Protocol/TX_ContractTypes_Update.MD) - -## 6.2 GRPC API Introduction -Please refer to: -[https://github.com/tronprotocol/documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md](https://github.com/tronprotocol/documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md) - -## 6.3 Http API Introduction -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) - -# 7. 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 staked 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. 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 staked TRX in the network and the self-staked TRX amount, the Bandwidth Points an account possesses is not fixed. - -## 8.2.1 How to Get Bandwidth Points - -1. By staking TRX to get Bandwidth Points, Bandwidth Points = the amount of TRX self-staked / the total amount of TRX staked for Bandwidth Points in the network * 43,200,000,000 - -2. Every account has a fixed amount of free Bandwidth Points every day, it is defined in #61 network parameter, user can check the value on tronscan(https://tronscan.org/#/sr/committee). - -### 8.2.2 Bandwidth Points Consumption - -Transactions other than queries consume Bandwidth points. - -A special scenario: When transferring TRX or TRC-10 tokens to an account that does not yet exist, this procedure creates the account prior to the transfer. - -To create an account, a flat charge of 1 TRX is required. If there are insufficient Bandwidth points obtained by TRX staking, an additional 0.1 TRX will be spent. - -Bandwidth points consumption sequence for TRC-10 transfer: - -1. Free Bandwidth points. - -2. TRC-10 issuer's Bandwidth points(if possible.) - -3. Bandwidth points TRX staking. - -4. Bandwidth points obtained by TRX burning, the rate = the number of bytes of the transaction * 1,000 SUN; - -Bandwidth points consumption sequence for other transactions: - -1. Free Bandwidth points. - -2. Bandwidth points TRX staking. - -3. Bandwidth points obtained by TRX burning, the rate = the number of bytes of the transaction * 1,000 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://raw.githubusercontent.com/tronprotocol/documentation-en/master/images/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 stake TRX for Bandwidth or Energy for other accounts. The primary account owns the staked TRX and TRON power, the recipient account owns the Bandwidth or Energy. Like ordinary staking, resource delegation staking is also at least 3 days. - -+ Example(Using wallet-cli) -```text -freezeBalanceV2 frozen_balance [ResourceCode:0 BANDWIDTH,1 ENERGY] [receiverAddress] - -frozen_balance: the amount of TRX to stake (unit SUN) -ResourceCode: 0 for Bandwidth, 1 for Energy -receiverAddress: recipient account address -``` - -## 8.5 Other Fees - -|Type|Fee| -| :------|:------:| -|Create a SR(Super Representative)|9999 TRX| -|Issue a TRC-10 token|1024 TRX| -|Create an account|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. Account Permission Management -Please refer to: -[Account Permission Management](../mechanism-algorithm/multi-signatures.md) - -# 11. Shielded Transaction -Please refer to: -[Shielded Transaction](../mechanism-algorithm/shielded-transaction.md) - -# 12. Wallet Introduction -## 12.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) - -## 12.2 Get Transaction ID - -```text -Hash.sha256(transaction.getRawData().toByteArray()) -``` -## 12.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; - } -``` -## 12.4 How to Build a Transaction Locally -According to the definition of the transaction, you need to fill up all the fields of the transaction. - -You need to set reference 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 reference 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 an overdue transaction, will not be accepted by the Mainnet. - -Way to set reference 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; - } -``` -## 12.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/mechanism-algorithm/dex.md b/docs/mechanism-algorithm/dex.md deleted file mode 100644 index 7dbdbd081..000000000 --- a/docs/mechanism-algorithm/dex.md +++ /dev/null @@ -1,172 +0,0 @@ -# Decentralized Exchange (DEX) - -The TRON network natively supports **Decentralized Exchanges (DEX)**, with its core consisting of multiple trading pairs. This article introduces the basic concepts of trading pairs, creation methods, trading processes, funding and withdrawal mechanisms, and includes common query methods and price calculation methods. - -## What is a Trading Pair - -A trading pair (`Exchange`) represents a trading market between any two TRC-10 tokens, which can be: - -- Between any two TRC-10 tokens. -- Between a TRC-10 token and TRX. - -Any account can create any combination of trading pairs, even if the same combination already exists on the network. All trading pairs on the TRON network follow the **Bancor protocol** for asset exchange, with the default weight of the two tokens being equal. Therefore, the balance ratio of the two tokens in the trading pair represents the current price. - -**Example:** -Suppose a trading pair contains two tokens, ABC and DEF: - -- ABC balance is `10,000,000`. -- DEF balance is `1,000,000`. - -Then the current exchange rate is: 10 ABC = 1 DEF - -## Creating a Trading Pair - -Any account can initiate the creation of a trading pair. **The fee for creating a trading pair is 1024 TRX, which will be burned.** - -When creating a trading pair, the initial balances of the two tokens must be provided, and upon successful creation, the system will automatically deduct the corresponding tokens from the initiator’s account. - -### Contract: `ExchangeCreateContract` - -Parameters are as follows: - -- `first_token_id`: The ID of the first token. -- `first_token_balance`: The initial balance of the first token. -- `second_token_id`: The ID of the second token. -- `second_token_balance`: The initial balance of the second token. - -> **Note:** If TRX is included, use `_` to represent it; the unit for TRX is `sun` (1 TRX = 1,000,000 sun). - -### Example: - -``` -ExchangeCreate abc 10000000 _ 1000000000000 -``` -The above command creates a trading pair between `abc` and `TRX`, with an initial injection of 10,000,000 abc tokens (token precision 0-6) and 1,000,000,000,000 sun (i.e., 1,000,000 TRX). If the account balance is insufficient, the creation transaction will fail. - -## Trading -All accounts can perform instant trades in any trading pair. Trading does not require order placement, and the price and quantity are calculated entirely based on the Bancor protocol. - -### Contract: `ExchangeTransactionContract` -Parameters are as follows: - -- `exchange_id`: The ID of the trading pair (the system assigns a unique ID based on creation time). -- `token_id`: The ID of the token to be sold. -- `quant`: The quantity to be sold. -- `expected`: The minimum quantity of the other token expected to be received (if the actual amount received is less than this value, the transaction fails). - -#### Example: -Suppose the trading pair ID for `abc` and `TRX` is 1, with the current state: - -- abc balance is 10,000,000. -- TRX balance is 1,000,000. - -If a user wishes to spend 100 TRX (100,000,000 sun) to buy at least 990 abc, they execute: -``` -ExchangeTransaction 1 _ 100000000 990 -``` -Upon a successful transaction, the user's TRX balance will **decrease** and their abc balance will **increase**; the trading pair's TRX balance will **increase** and their abc balance will **decrease**. -The actual amount of `abc` received by the user can be queried using the `gettransactioninfobyid` interface, checking the `exchange_received_amount` field. - -## Adding Liquidity (Funding) -When the balance of one token in a trading pair is low, transactions may cause significant price fluctuations. At this point, **the creator of the trading pair can choose to inject more assets** to improve stability. - ->**Funding Guidelines:** -> ->- Only the trading pair creator can perform this action. ->- No fees are required. ->- The system calculates the required amount of the other token based on the current price ratio to maintain the price. - -### Contract: `ExchangeInjectContract` -Parameters are as follows: - -- `exchange_id`: The ID of the trading pair. -- `token_id`: The ID of the token to be injected. -- `quant`: The quantity of the token to be injected. - -### Example: -Suppose the trading pair ID for `abc` and `TRX` is 1, with the current state: - -- `abc` balance is 10,000,000. -- `TRX` balance is 1,000,000. - -If the creator wishes to increase `abc` by 10% (i.e., add 1,000,000 abc), they execute: - -``` -ExchangeInject 1 abc 1000000 -``` -If successful, the trading pair will gain 1,000,000 abc and the corresponding proportion amount of 100,000 TRX, which will be deducted from the creator’s account. - -## Withdrawing Liquidity (Withdraw) -The assets in a trading pair belong entirely to the creator. The creator can withdraw a portion of the assets from the trading pair at any time. - ->**Withdrawal Rules:** ->- Only the trading pair creator can perform this action. ->- No fees are required. ->- The system withdraws the other token in proportion to the current token ratio, ensuring the price remains unchanged but increasing price volatility. - -### Contract: `ExchangeWithdrawContract` -Parameters are as follows: - -- `exchange_id`: The ID of the trading pair. -- `token_id`: The ID of the token to be withdrawn. -- `quant`: The quantity of the token to be withdrawn. - -### Example: -Suppose the trading pair ID for `abc` and `TRX` is 1, with the current state: - -- `abc` balance is 10,000,000. -- `TRX` balance is 1,000,000. - -If the creator wishes to withdraw 10% of abc (i.e., reduce 1,000,000 abc), they execute: - -``` -ExchangeWithdraw 1 abc 1000000 -``` -Upon successful transaction, the trading pair will lose 1,000,000 abc and the corresponding proportion of 100,000 TRX, which will be added to the creator’s account. - -## Queries and Calculations -### Querying Trading Pair Information -TRON provides multiple interfaces for querying trading pairs: - -**1. Query all trading pair information:** `ListExchanges` - -**2. Paginated query of trading pair list:** `GetPaginatedExchangeList` - -**3. Query details of a specific trading pair:** `GetExchangeById` - -For detailed API documentation, refer to [RPC-API ](../api/rpc/index.md). - -### Price Calculation -Suppose in a trading pair: - -- `first_token_price = 100 sun`. -- `first_token_balance = 1,000,000`. -- `second_token_balance = 2,000,000`. - -Then the `second_token_price` is: - -``` -second_token_price = first_token_price * (first_token_balance / second_token_balance) - = 100 * (1,000,000 / 2,000,000) - = 50 sun -``` - -### Exchange Quantity Calculation -Suppose `first_token` is used to exchange for `second_token`: - -- `sellTokenQuant`: The quantity of `first_token` to be sold. -- `buyTokenQuant`: The quantity of `second_token` obtained through exchange. -- `balance`: The current balance of `second_token` in the trading pair. -- `supply`: A fixed constant of `10^18` used in the Bancor protocol formula. - -The calculation process is as follows: - -``` -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)); -``` - ->**Note**: Market prices may fluctuate in real-time due to other trading activities on the network. - -For more interface details, refer to: [HTTP API Documentation](../api/http/index.md). - diff --git a/docs/mechanism-algorithm/shielded-TRC20-contract.md b/docs/mechanism-algorithm/shielded-TRC20-contract.md deleted file mode 100644 index bdc8a09ae..000000000 --- a/docs/mechanism-algorithm/shielded-TRC20-contract.md +++ /dev/null @@ -1,1067 +0,0 @@ -# Shielded TRC-20 Contract - -## Introduction - -TRC-20 token contract allows users to issue and transfer tokens, but it can not guarantee the privacy since it leaks the token ownership. When transferring the token, the source address, destination address, and the token amount are public. The shielded TRC-20 contract ([TIP-135](https://github.com/tronprotocol/tips/blob/master/tip-135.md)) aims to solve this problem and provides users better privacy of token ownership and transactions. - -The shielded TRC-20 contract has three core functions: `mint`, `transfer` and `burn`. - -- `mint` is used to transform the public TRC-20 token to shielded token, which makes token ownership invisible. `mint` has only one transparent input and one shielded output. -- `transfer` is used for shielded token transactions, which can hide the source address, the destination address, and the transaction amount. `transfer` has at most two shielded input and two shielded output. -- `burn` is used to transform the shielded token to the public TRC-20 token. `burn` has only one shielded input, one transparent output and zero or one shielded output. - -The technical implementation is based on zk-SNARK(Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) proof system, which is secure and efficient. - -### Contract Deployment - -1. Use `deployContract` method in the wallet-cli to deploy the TRC-20 contract. - - Note: the deployed TRC-20 contract address of `TokenTRC20` on Nile Testnet is: [TFUD8x3iAZ9dF7NDCGBtSjznemEomE5rP9](https://nile.tronscan.org/#/contract/TFUD8x3iAZ9dF7NDCGBtSjznemEomE5rP9/code). - -2. Use the `deployContract` method to deploy the shielded TRC-20 contract. The shielded TRC-20 contract will bind the TRC-20 contract. The `scalingFactor` is also specified when deploying the shielded TRC-20 contract. For more details about `scalingFactor`, please refer [TIP-135](https://github.com/tronprotocol/tips/blob/master/tip-135.md). - - Note: the deployed shielded TRC-20 contract address of `ShieldedTRC20` on Nile Testnet is: [TPcKtz5TRfP4xUZSos81RmXB9K2DBqj2iu](https://nile.tronscan.org/#/contract/TPcKtz5TRfP4xUZSos81RmXB9K2DBqj2iu/code) and the corresponding `scalingFactor` is set 10. - -### Usage Guide - -1. The sender needs to create an ordianry account by api. The account is used to trigger the shielded TRC-20 contract, so it should has some trx to pay the transaction fee. - -2. The sender should create the shielded address, which is used to send and receive the shielded TRC-20 notes. - -3. The sender calls the api to create shielded TRC-20 contract parameters for `mint`, `transfer` and `burn`. - -4. The sender triggers the shielded TRC-20 contract by using the generated parameters and generates the shielded TRC-20 transaction. - -5. The sender broadcasts the shielded TRC-20 transaction. - -6. The receiver scans to get the received shielded notes. - -The document below describes how to use TRON Shielded TRC-20 contract with http api. - -### Create the account - -**1. Call api: wallet/createaccount to generate the account** - -Method: Post - -Parameters: - -```json -{ - "owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", - "account_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0" -} -``` -Return: - -``` -{ - "visible":false, - "txID":"c43651d448e82e00de3c31d7d34a826af4a6538bc3f5e9abcde11ef25f57d70e", - "raw_data":{ - "contract":[ - { - "parameter":{ - "value":{ - "owner_address":"41d1e7a6bc354106cb410e65ff8b181c600ff14292", - "account_address":"41e552f6487585c2b58bc2c9bb4492bc1f17132cd0" - }, - "type_url":"type.googleapis.com/protocol.AccountCreateContract" - }, - "type":"AccountCreateContract" - }], - "ref_block_bytes":"2bb0", - "ref_block_hash":"e678f7b7e4da198d", - "expiration":1591780749000, - "timestamp":1591780690724 - }, - "raw_data_hex":"0a022bb02208e678f7b7e4da198d40c8dd9aeca92e5a6612640a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74437265617465436f6e7472616374122e0a1541d1e7a6bc354106cb410e65ff8b181c600ff14292121541e552f6487585c2b58bc2c9bb4492bc1f17132cd070a49697eca92e" -} -``` - -### Create the shielded address - -**1. Call api: wallet/getspendingkey to generate the spending key** - -Method: Post - -Parameters: - -```json -null -``` -Return: - -``` -{ - "value": "09124de6a534661ef1cfad0335832445a3b83c08e885881a68a52cf4dc735e68" -} -``` - -**2. Call api: wallet/getexpandedspendingkey to generate the expanded spending key** - -Method: Post - -Parameters: - -```json -{ - "value": "09124de6a534661ef1cfad0335832445a3b83c08e885881a68a52cf4dc735e68" -} -``` -Return: - -``` -{ - "ask": "23d11537676610c287ffcd1bc33d650df37fc90d13bb65356fbc9045cfb91705", - "nsk": "da6542f57f6f730cb31b401b9ca8660589d8a765405c6d6f48fd392ac5360b0a", - "ovk": "e73f5383fdeacbb282db951afba01e607916c8106b316c55544fac84b2efbdc4" -} -``` - -**3. Call api: wallet/getakfromask to generate the ak from ask** - -Method: Post - -Parameters: - -```json -{ - "value" : "23d11537676610c287ffcd1bc33d650df37fc90d13bb65356fbc9045cfb91705" -} -``` - -Return: - -``` -{ - "value": "72b041a8006a02a995c24f5b8531a62008c8c54a1979622dc4ea6f54a506732d" -} -``` - -**4. Call api: wallet/getnkfromnsk to generate the nk from nsk** - -Method: Post - -Parameters: - -```json -{ - "value":"da6542f57f6f730cb31b401b9ca8660589d8a765405c6d6f48fd392ac5360b0a" -} -``` - -Return: - -``` -{ - "value": "2d817ea2e005e174d9291d0bd0605e11cb79e3f5855780521bc300d0636a58df" -} -``` - -**5. Call api: wallet/getincomingviewingkey to generate the incoming viewing key** - -Method: Post - -Parameters: - -```json -{ - "ak": "72b041a8006a02a995c24f5b8531a62008c8c54a1979622dc4ea6f54a506732d", - "nk": "da6542f57f6f730cb31b401b9ca8660589d8a765405c6d6f48fd392ac5360b0a" -} -``` - -Return: - -``` -{ - "ivk": "6896b46a8355ae75896900ac617293d98e1b48fd885ed484a7cbddd566762705" -} -``` -**6. Call api: wallet/getdiversifier to generate the diversifier** - -Method: Post - -Parameters: - -```json -null -``` - -Return: - -``` -{"d": "dd6b441bd5dcb9c25ec41f"} -``` - -**7. Call api: wallet/getzenpaymentaddress to generate shielded payment address** - -Method: Post - -Parameters: - -```json -{ - "ivk":"6896b46a8355ae75896900ac617293d98e1b48fd885ed484a7cbddd566762705", - "d":"dd6b441bd5dcb9c25ec41f" -} -``` - -Return: - -``` -{ - "d": { - "d": "dd6b441bd5dcb9c25ec41f" - }, - "pkD": "297198e7d4a024a3b5ef9b68ed15e7463fbf03e6aa590aa551d7bd0c1cfa828d", - "payment_address": "ztron1m445gx74mjuuyhkyru5hrx886jszfga4a7dk3mg4uarrl0cru649jz4928tm6rqul2pg645hqv5" -} -``` - -**8. Call api: wallet/getnewshieldedaddress to generate all the related keys** - -Method: Post - -Parameters: - -```json -null -``` - -Return: - -``` -{ - "sk": "0bfc211444fa877ba546ffb3a64e8b7aa58dd7bdd23a7b22166e9da923add0e6", - "ask": "264c351e5a154555b1ec7822f9bfc0faa5ced9d75b17ed1552699a20b18f7c07", - "nsk": "ebd5bf67f68de464c8a109b389ff4d07912ebe11e8b3d034cf505b35c8d5a907", - "ovk": "a8fa18b039e2cd8aeb04c8cf299b2bbc43cb5ab4dd67eec8884e3563223e5908", - "ak": "0648c0b20fa5eab112d466f75b174d1c142bf35318d2f50d63c6b3b343c8c397", - "nk": "a45852bb5b9e933266d5fab6062baa456b149329f8081817ef868923f87b2f9d", - "ivk": "9c3eacfe786e67c6f3b567cfcf129dcfdc21347ce6f192cc3ca1e994df570c05", - "d": "987adf3b4d8da446327d17", - "pkD": "09f3c4576c4f836b3472a6a5738606866607a6ffcd1c7299e31ec40455b1cd35", - "payment_address": "ztron1npad7w6d3kjyvvnazuyl83zhd38cx6e5w2n22uuxq6rxvpaxllx3cu5euv0vgpz4k8xn2rsga28" -} -``` - - -### Create shielded TRC-20 contract parameters for `mint` - -**1. Call api: wallet/createshieldedcontractparameters to build the parameters** - -Method: Post - -Parameters: - -```json -{ - "ovk": "1797de3b7f33cafffe3fe18c6b43ec6760add2ad81b10978d1fca5290497ede9", - "from_amount": "5000", - "shielded_receives": { - "note": { - "value": 50, - "payment_address": "ztron15js0jkuxczt8caq5hp59rnh6rgf34sek7vqn9u6ljelxv4nuzz2x9qe3ffm2wzz6ck53yxyhxs6", - "rcm": "74baec30dfac8ed59968955ff245ae002009005194e5b824c35ab88c52e5170e" - } - }, - "shielded_TRC20_contract_address": "41f3392eaa7d38749176e0671dbc6912f8ef956943" -} -``` -Note: 1. the shielded TRC-20 contract should be deployed before calling the api; 2. the `from_amount` is the real value, the `value` in note is the scaled value by `scalingFactor` set in the shielded TRC-20 contract, namely `from_amount` = `value` * `scalingFactor`. In this example, the value of `scalingFactor` is 100; 3. the `rcm` is a random field element with the length of 32 bytes, which should be generated by `GetRcm` api. - -Return: - -```bash -{ - "receive_description": [ - { - "value_commitment": "7e979cc6662a133dabf6cea0b64ef27670a4c30c2fb9dc0ac37444cb80a1f7a8", - "note_commitment": "3e950099a8c9b5ec04e9b68218872edac4c030b37bdb39fe806d7ce124ed1808", - "epk": "e394dab255529e854dcb33fd9602b3be083ece00f98205155c6b26284effc552", - "c_enc": "635b837f9f4908c75bb5f855758ac22ba890f841bc10350820bae483296e9f86d04b92306d2bb0962dc27130325dcf59226232768398bbadda2ac0f8cf2ea7cd96a2c84e69ccd31b373d1d71d87ffc1e8a5fb659a4700e817af75d00eebb6279e5e0681ee32a1baf1a760735f00e5f7641a915876520c7b3b00f257d11c06826b70137dd23a9401eff12af084743cbfbd8ddb203c7493967eee98ddaf32571c1449804bd474a4a9c3a605187537f9244b84a08aae2c49f4e5c514788a8de9292f94b1ce92f8bbb1f6f55eef6afe9116f626977aa15a9b3365edb92db2db3cfd7c350f16f7e3cc650c05e126a73da137a6e0a5982a22545c5c4a7aa4b9e35419db6f3746513d14784eb64a02c0b799ed165fbd6706b6a29d1a7a4148019bb0057a170c9f5d102048b6bd666e8973e6b6443bc220a5b89bcefc24b1d4576214ad5be3d9c75b0edc9e1e6706a967e24e4e64d22909b8fdb7bbcf1068cf2c935b3c6015f31b809ee8d61c9dfe3d79e86c7a705be4d1830534f62ecb719ce69121a9af0c7c34c39cdd5132f4c495e9bd2cc96435c5ee9a975b1a18856a0ec819ca10b3fdbbaf7fc98c063f42d0269433e8627939a9b22878531a6cdc2efcf654041a5a7d16e254f86b9e8b30f089c09e3f4834908338203690a028deee97d4983142b66e9f4e2c7790cc32c06ce43095431798967fa4412734aeaed2ca8d5aeafa6223911b0b07c0421f80fc7da5f2952b2a4354e62f43623598107a5480273d81c518ccd3accc1f435ee8aab875e7ccca59b7d6af9a9046dc75907ab99af0f08e063f771b4e6", - "c_out": "4d073fcfc631e5efe83ad17f74aea9a66993c20ea8b5e9f9d8891fa840d92b18a0b54a5e1fa9af4d8e8ed6449c2c84741c3bc22083aa11576086deca3f9e69b7f17b24abc43cd2d73ae9ff6d9fafea94", - "zkproof": "b2d9af13e41750291b3dedcedca2ce79f369f472e9022b8d88bf77d6a7c799bcc6c90e2dc37b246595f160c06ee78bc185c77e031233b27f0056bd7b9f44487f1008b6e3805734479ee9deae1093f18afcbe2e28fd62b13ebce897790be3567207f3e92b783e07ea7a5d6a3e2c96990c1b36abe0d36869ca826532927f3562d1c2347efe3fd3d77b8c34cfc4b7d2d364a90c4ec4d09d3ce56e75412effa885717e90347705277e65a3075e60c2ccad90c46d0e31e114231b8ca922143258caae" - }], - "binding_signature": "3561b47bd2c2ffde7122db43611ae89af2ae8dc104bc563c6587d6df428b7aa86b52d67a19d8b43b5a668634df494acb4c2eb7d8aea1e074812dd6a5b9cf800d", - "message_hash": "3da3e050660849f7395d10a66fede6fef8a6aa8768957dd92b3993d856d98635", - "trigger_contract_input": "00000000000000000000000000000000000000000000000000000000000013883e950099a8c9b5ec04e9b68218872edac4c030b37bdb39fe806d7ce124ed18087e979cc6662a133dabf6cea0b64ef27670a4c30c2fb9dc0ac37444cb80a1f7a8e394dab255529e854dcb33fd9602b3be083ece00f98205155c6b26284effc552b2d9af13e41750291b3dedcedca2ce79f369f472e9022b8d88bf77d6a7c799bcc6c90e2dc37b246595f160c06ee78bc185c77e031233b27f0056bd7b9f44487f1008b6e3805734479ee9deae1093f18afcbe2e28fd62b13ebce897790be3567207f3e92b783e07ea7a5d6a3e2c96990c1b36abe0d36869ca826532927f3562d1c2347efe3fd3d77b8c34cfc4b7d2d364a90c4ec4d09d3ce56e75412effa885717e90347705277e65a3075e60c2ccad90c46d0e31e114231b8ca922143258caae3561b47bd2c2ffde7122db43611ae89af2ae8dc104bc563c6587d6df428b7aa86b52d67a19d8b43b5a668634df494acb4c2eb7d8aea1e074812dd6a5b9cf800d635b837f9f4908c75bb5f855758ac22ba890f841bc10350820bae483296e9f86d04b92306d2bb0962dc27130325dcf59226232768398bbadda2ac0f8cf2ea7cd96a2c84e69ccd31b373d1d71d87ffc1e8a5fb659a4700e817af75d00eebb6279e5e0681ee32a1baf1a760735f00e5f7641a915876520c7b3b00f257d11c06826b70137dd23a9401eff12af084743cbfbd8ddb203c7493967eee98ddaf32571c1449804bd474a4a9c3a605187537f9244b84a08aae2c49f4e5c514788a8de9292f94b1ce92f8bbb1f6f55eef6afe9116f626977aa15a9b3365edb92db2db3cfd7c350f16f7e3cc650c05e126a73da137a6e0a5982a22545c5c4a7aa4b9e35419db6f3746513d14784eb64a02c0b799ed165fbd6706b6a29d1a7a4148019bb0057a170c9f5d102048b6bd666e8973e6b6443bc220a5b89bcefc24b1d4576214ad5be3d9c75b0edc9e1e6706a967e24e4e64d22909b8fdb7bbcf1068cf2c935b3c6015f31b809ee8d61c9dfe3d79e86c7a705be4d1830534f62ecb719ce69121a9af0c7c34c39cdd5132f4c495e9bd2cc96435c5ee9a975b1a18856a0ec819ca10b3fdbbaf7fc98c063f42d0269433e8627939a9b22878531a6cdc2efcf654041a5a7d16e254f86b9e8b30f089c09e3f4834908338203690a028deee97d4983142b66e9f4e2c7790cc32c06ce43095431798967fa4412734aeaed2ca8d5aeafa6223911b0b07c0421f80fc7da5f2952b2a4354e62f43623598107a5480273d81c518ccd3accc1f435ee8aab875e7ccca59b7d6af9a9046dc75907ab99af0f08e063f771b4e64d073fcfc631e5efe83ad17f74aea9a66993c20ea8b5e9f9d8891fa840d92b18a0b54a5e1fa9af4d8e8ed6449c2c84741c3bc22083aa11576086deca3f9e69b7f17b24abc43cd2d73ae9ff6d9fafea94000000000000000000000000", - "parameter_type": "mint" -} -``` - -The `trigger_contract_input` can be used as the input data to trigger the `mint` function of the shielded token contract. Before triggering the shielded TRC-20 contract, the user should trigger the `approve` method of TRC-20 contract, to authorize the shielded TRC-20 contract to transfer the token from TRC-20 contract to shielded TRC-20 contract. - -Note: when the shielded TRC-20 contract is deployed, it will bind the corresponding TRC-20 contract. - -**2. Call api: wallet/createshieldedcontractparameterswithoutask to build the parameters** - -Method: Post - -Parameters: - -```json -{ - "ovk": "cd361834b3adc06f130de24f7d0c18f92a093cc885d9ce492cc6c02071f7a4f0", - "from_amount": "5000", - "shielded_receives": { - "note": { - "value": 50, - "payment_address": "ztron13lvfnt4rau4ad9mmgztd3aftw49e3amz8gm2kvyzrsaw0ugz2grxwkvcfys5e2gkchj7cnnetjz", - "rcm": "499e73f2f8aaf05fac41a35b8343bde27f6629cbe66d35da5364a99b94a55a06" - } - }, - "shielded_TRC20_contract_address": "41f3392eaa7d38749176e0671dbc6912f8ef956943" -} -``` -Note: the `from_amount` is the real value, the `value` in note is the scaled value by `scalingFactor` set in the shielded TRC-20 contract, namely `from_amount` = `value` * `scalingFactor`. In this example, the value of `scalingFactor` is 100. - -Return: - -```bash -{ - "receive_description": [ - { - "value_commitment": "7e979cc6662a133dabf6cea0b64ef27670a4c30c2fb9dc0ac37444cb80a1f7a8", - "note_commitment": "3e950099a8c9b5ec04e9b68218872edac4c030b37bdb39fe806d7ce124ed1808", - "epk": "e394dab255529e854dcb33fd9602b3be083ece00f98205155c6b26284effc552", - "c_enc": "635b837f9f4908c75bb5f855758ac22ba890f841bc10350820bae483296e9f86d04b92306d2bb0962dc27130325dcf59226232768398bbadda2ac0f8cf2ea7cd96a2c84e69ccd31b373d1d71d87ffc1e8a5fb659a4700e817af75d00eebb6279e5e0681ee32a1baf1a760735f00e5f7641a915876520c7b3b00f257d11c06826b70137dd23a9401eff12af084743cbfbd8ddb203c7493967eee98ddaf32571c1449804bd474a4a9c3a605187537f9244b84a08aae2c49f4e5c514788a8de9292f94b1ce92f8bbb1f6f55eef6afe9116f626977aa15a9b3365edb92db2db3cfd7c350f16f7e3cc650c05e126a73da137a6e0a5982a22545c5c4a7aa4b9e35419db6f3746513d14784eb64a02c0b799ed165fbd6706b6a29d1a7a4148019bb0057a170c9f5d102048b6bd666e8973e6b6443bc220a5b89bcefc24b1d4576214ad5be3d9c75b0edc9e1e6706a967e24e4e64d22909b8fdb7bbcf1068cf2c935b3c6015f31b809ee8d61c9dfe3d79e86c7a705be4d1830534f62ecb719ce69121a9af0c7c34c39cdd5132f4c495e9bd2cc96435c5ee9a975b1a18856a0ec819ca10b3fdbbaf7fc98c063f42d0269433e8627939a9b22878531a6cdc2efcf654041a5a7d16e254f86b9e8b30f089c09e3f4834908338203690a028deee97d4983142b66e9f4e2c7790cc32c06ce43095431798967fa4412734aeaed2ca8d5aeafa6223911b0b07c0421f80fc7da5f2952b2a4354e62f43623598107a5480273d81c518ccd3accc1f435ee8aab875e7ccca59b7d6af9a9046dc75907ab99af0f08e063f771b4e6", - "c_out": "4d073fcfc631e5efe83ad17f74aea9a66993c20ea8b5e9f9d8891fa840d92b18a0b54a5e1fa9af4d8e8ed6449c2c84741c3bc22083aa11576086deca3f9e69b7f17b24abc43cd2d73ae9ff6d9fafea94", - "zkproof": "b2d9af13e41750291b3dedcedca2ce79f369f472e9022b8d88bf77d6a7c799bcc6c90e2dc37b246595f160c06ee78bc185c77e031233b27f0056bd7b9f44487f1008b6e3805734479ee9deae1093f18afcbe2e28fd62b13ebce897790be3567207f3e92b783e07ea7a5d6a3e2c96990c1b36abe0d36869ca826532927f3562d1c2347efe3fd3d77b8c34cfc4b7d2d364a90c4ec4d09d3ce56e75412effa885717e90347705277e65a3075e60c2ccad90c46d0e31e114231b8ca922143258caae" - }], - "binding_signature": "3561b47bd2c2ffde7122db43611ae89af2ae8dc104bc563c6587d6df428b7aa86b52d67a19d8b43b5a668634df494acb4c2eb7d8aea1e074812dd6a5b9cf800d", - "message_hash": "3da3e050660849f7395d10a66fede6fef8a6aa8768957dd92b3993d856d98635", - "trigger_contract_input": "00000000000000000000000000000000000000000000000000000000000013883e950099a8c9b5ec04e9b68218872edac4c030b37bdb39fe806d7ce124ed18087e979cc6662a133dabf6cea0b64ef27670a4c30c2fb9dc0ac37444cb80a1f7a8e394dab255529e854dcb33fd9602b3be083ece00f98205155c6b26284effc552b2d9af13e41750291b3dedcedca2ce79f369f472e9022b8d88bf77d6a7c799bcc6c90e2dc37b246595f160c06ee78bc185c77e031233b27f0056bd7b9f44487f1008b6e3805734479ee9deae1093f18afcbe2e28fd62b13ebce897790be3567207f3e92b783e07ea7a5d6a3e2c96990c1b36abe0d36869ca826532927f3562d1c2347efe3fd3d77b8c34cfc4b7d2d364a90c4ec4d09d3ce56e75412effa885717e90347705277e65a3075e60c2ccad90c46d0e31e114231b8ca922143258caae3561b47bd2c2ffde7122db43611ae89af2ae8dc104bc563c6587d6df428b7aa86b52d67a19d8b43b5a668634df494acb4c2eb7d8aea1e074812dd6a5b9cf800d635b837f9f4908c75bb5f855758ac22ba890f841bc10350820bae483296e9f86d04b92306d2bb0962dc27130325dcf59226232768398bbadda2ac0f8cf2ea7cd96a2c84e69ccd31b373d1d71d87ffc1e8a5fb659a4700e817af75d00eebb6279e5e0681ee32a1baf1a760735f00e5f7641a915876520c7b3b00f257d11c06826b70137dd23a9401eff12af084743cbfbd8ddb203c7493967eee98ddaf32571c1449804bd474a4a9c3a605187537f9244b84a08aae2c49f4e5c514788a8de9292f94b1ce92f8bbb1f6f55eef6afe9116f626977aa15a9b3365edb92db2db3cfd7c350f16f7e3cc650c05e126a73da137a6e0a5982a22545c5c4a7aa4b9e35419db6f3746513d14784eb64a02c0b799ed165fbd6706b6a29d1a7a4148019bb0057a170c9f5d102048b6bd666e8973e6b6443bc220a5b89bcefc24b1d4576214ad5be3d9c75b0edc9e1e6706a967e24e4e64d22909b8fdb7bbcf1068cf2c935b3c6015f31b809ee8d61c9dfe3d79e86c7a705be4d1830534f62ecb719ce69121a9af0c7c34c39cdd5132f4c495e9bd2cc96435c5ee9a975b1a18856a0ec819ca10b3fdbbaf7fc98c063f42d0269433e8627939a9b22878531a6cdc2efcf654041a5a7d16e254f86b9e8b30f089c09e3f4834908338203690a028deee97d4983142b66e9f4e2c7790cc32c06ce43095431798967fa4412734aeaed2ca8d5aeafa6223911b0b07c0421f80fc7da5f2952b2a4354e62f43623598107a5480273d81c518ccd3accc1f435ee8aab875e7ccca59b7d6af9a9046dc75907ab99af0f08e063f771b4e64d073fcfc631e5efe83ad17f74aea9a66993c20ea8b5e9f9d8891fa840d92b18a0b54a5e1fa9af4d8e8ed6449c2c84741c3bc22083aa11576086deca3f9e69b7f17b24abc43cd2d73ae9ff6d9fafea94000000000000000000000000", - "parameter_type": "mint" -} -``` - -The `trigger_contract_input` can be used as the input data to trigger the `mint` function of the shielded TRC-20 contract. - - -### Create shielded contract parameters for `transfer` - -**1. Call api: wallet/createshieldedcontractparameters to build the parameters** - -Method: Post - -Parameters: - -```json -{ - "ask": "0f63eabdfe2bbfe08012f6bb2db024e6809c16e8ed055aa41a6095424f192005", - "nsk": "cd43d722fd4b6b01f19449ea826c3e935609648520fcc2a95c0026f0fa9ee404", - "ovk": "0ff58efd75e083fe4fd759c8701e1c8cb6961c4297a12b2c800bdb7b2bcab889", - shielded_spends: [ - { - "note": { - "value": 60, - "payment_address":"ztron1n2xqnggktc8tfhskevgfvnjjkd4tj6n98e28vdwjyu9p4dz5t55nwazay5y3qnv8cp0xs3fgzgv", - "rcm": "6760c1f7681752bf9ec18316dfbc2d66ddaae690d77302bdc6d127ff3084af00" - }, - "alpha": "9a22f748597f7dc83edb3b05b3a3def34f47c4cb13d216be7ce03d2ea9da7e0a", - "root": "4d46e59b39d39430208317a101bc94ef1ee8276181cce24180612d500593315a", - "path": "b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c5381412935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62de1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef7228e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2aa5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6ad2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb5816d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4afee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd7124c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee08500769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c4908eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf30238d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e8415276736aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b159216cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf006edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c1ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be2451d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642fbd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c1b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab651ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de985794730484777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23cba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce7243ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b7b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b680444d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa528138ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce7389613912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a5761cd9b3396e9cedf9afeecac3edbcd192c5f65a4b108cc595dd7f668df0a1fd8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6ca0568ea9736f053947db35d23177d291ebc45d45ed0519d69e12dad90ec25100817de36ab2d57feb077634bca77819c8e0bd298c04f6fed0e6a83cc1356ca1557d62777dfad1d910d526787f2ea857575dad337270a07dd99127a6b320a39a72", - "pos": 20 - }, - { - "note": { - "value": 40, - "payment_address":"ztron135rhyme9sqgfdzszmvj0pzhvnthzdl59fqag362lsyrme3xrcjat9am35a390uk0yudskaqppf5", - "rcm": "9ff13d57e9c5a92405da71d6187bb0c11d6260914788a54f38ad62e4a04ffa04" - }, - "alpha": "6865f8058e33b3d3dccb8f0b5c39993760d305a711165724d90998fb68c64b00", - "root": "4d46e59b39d39430208317a101bc94ef1ee8276181cce24180612d500593315a", - "path": "b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c5381412935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62de1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef7228e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2aa5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6ad2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb5816d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4afee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd7124c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee08500769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c4908eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf30238d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e8415276736aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b159216cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf006edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c1ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be2451d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642fbd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c1b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab651ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de985794730484777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23cba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce7243ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b7b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b680444d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa528138ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce7389613912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a5761cd9b3396e9cedf9afeecac3edbcd192c5f65a4b108cc595dd7f668df0a1fd8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6ca0568ea9736f053947db35d23177d291ebc45d45ed0519d69e12dad90ec25100817de36ab2d57feb077634bca77819c8e0bd298c04f6fed0e6a83cc1356ca15542bfe0aed87e6bb53dce44c20046a43418f9c43bc9f5695e55aa7580729cd74e", - "pos":21 - }, - ], - shielded_receives: [ - { - "note": { - "value": 30, - "payment_address":"ztron16455ldgqwz3sfamz0nymymwcvg0v6qsvn8prqtnznu6dmuuud965ar6rqw3yas48dn9w7ejne59", - "rcm": "75ba6b5949879ae11229f53728cd6f1eadbb999898e0927d7e9dc4045d806602" - } - }, - { - "note": { - "value": 70, - "payment_address":"ztron1fkcy3738mx4h448cpx76yz5fjsa8c4ra8r4ff8x6s5n4ak5303a5hrgcw66c5syf0y87wqwcrnh", - "rcm": "43e419fb8abef141f7b9d5d5a30ac743edebf9eb80cd24a344efe3ca091b6008" - } - } - ], - "shielded_TRC20_contract_address": "41e6e90fbc958ba09483550882b1f0327e0193250a" -} -``` -Return: -```bash -{ - "spend_description": [ - { - "value_commitment": "2a80edbcc55e7364c689dfb637a5f8a3ef89950061026de070b792a5a9f58f31", - "anchor": "4d46e59b39d39430208317a101bc94ef1ee8276181cce24180612d500593315a", - "nullifier": "5f5905b2424229d63775792bec06ea8b4897805992547901080e09a9b5146d3c", - "rk": "4cc74a640e0040f16144e326892950ee95ab8afccba344e7b6fbca3169cbe4d7", - "zkproof": "b69c7b252b36bbb654a26bcf6879afd3d7d4a6fe1e36d48e8c6508f4fea6a864717bd0d2d31d4a728277ff0d8e1bcfcb873d02c7a14a70899888f7eaed769d33f94fb836194dcc5ac16078d235e5b95b34472a782ec29ebe8ad14a222812b41b03e0f8edcd42774ceb8f5cddf312a3815a98c2909126646774017d67fcd0e114365e156614838ef87c222b729fa827ae801ae0a1ac4a48bc5f80fc3df2798c7d3f963ece395b1ff9c12e10ec7059d5855a8b101b266449b6eb3e326d7bf2acd6", - "spend_authority_signature": "8538e941dbe6ddb8b2c70a2b5b6fb7729a84eecbfa386451f21adca4ecfb975a46534fa8e9a1d28a573c05f2c2a210d2555ecf51de781bf149bb27c1a3bfeb00" - }, - { - "value_commitment": "0ee5abca3e433892f2b62ec352089017482f15b457fdc71ffdd9c731d42f92d3", - "anchor": "4d46e59b39d39430208317a101bc94ef1ee8276181cce24180612d500593315a", - "nullifier": "29df43aae9e177e6fe15b76a23f0972f3709dc38e6033e35974926b2dad6302d", - "rk": "2917aadf5107ac11e6ebbad2a0ac3502a168e0b8c0307827b1ad69029faacd9b", - "zkproof": "b98b0e6f6004ffdbed4069f63772a494bdadbe0a7e3f88dc5688821424bbc0f27f906ce0492c9a8c2233aa691c1767cfb0c3bcf21aba659f9290ba5dc04455a4a913192276154052be66bb743a7c842a149d473638020562501d3a752152381e135439839d9b9a4c65f15b256117322c7d202b3af0c03473602399272560bb3b3e9be33a75103aadc858901eab4176a4a4450293fb77366b7a34563d1120b27e7f4a6c2daf762aa43654685d235629729209d6bb402196517ff7f51dfecb995b", - "spend_authority_signature": "e11781f5601d3947b6e4c1b43000410449330695b7506a9691db7cbd18da686d492c22abf971187377f4a69ee9453b5bff30f7472e7ec267a0f9612c1dfaaa04" - }], - "receive_description": [ - { - "value_commitment": "8e6eb8efb8e7d1a4069daba59f95043d599ac7d0a3fe8ea3a0f415f73e347f6f", - "note_commitment": "57ab4c569b2cd69358ecaf26c9487cecc99a1b7607c8bfc7d2a58ed039277332", - "epk": "fe72066db13a8e6acc820fdad950efa8f900b8544b645b93160ddc7811aec7e2", - "c_enc": "7457fce75f5df5d979c15d8cebaf2c814fd884cc268187f8b52a3a0db5453d0608c2a8d00b095021fc0af1d039bfddc4fddf56e39ca5233b0ec0559099590cc4902b74c4a7508472c793b6ead0ee433d644a6e4f63d1a02dd402e1a74574163bd179d3045bdc3190dddb8e91f475f503d003cc0c26598a6494252540d53d7ef8793a3293f3f98a702cede14eb4f4f78cc958e83c4cb7579f3aefd6ee1ccd6269d61c9e8b3bf46101bf8b02fd4b6b3f3ea479d977da40ba532fa0100e3372e326315934bb21c16fa654969c1432ffdf710cc91c8eb4485c8885f49e2dceb0f14447f530a3a07bcf0a2914399458486766661c458f2beda0c75eac752ebc38f6e490f22640ef2231b2622fc647e5888f81d0c133ac1e76d99de89953d15708dc8a525563aad587a164e00f7d96d79bc02ad28478d8af930c0e08be219d8d0eda099571680801c3fb3f7195be590635279435a7052d70489653bd634566a930d17cef04d50c5c08fa3b4697ba1b6fd81c18431077f6acc6ca27cfe0e519cf3500c53d0f508b14ab1825dd2c3baf408eaa4df9725be2ac2c9b9b171c41597fed62a114ba8898f16e1d213f9668018725493398e9fa60fe58c650482d93bbef83b152956e4242bf7da10cf6b6a034e59e640c873e67c84980327025bbd239a19a02fea1439681af8ce81eb12efdc66bc2dc08b3143f9033fb7332a05523d1d38f765db7938faf9c2ac6089cef77e12622651683f0ea2815e9786977deb4bd2010d3c3be7f0484d1420387fd4fe56ced3b26d073f60940b52048fa939ba4f3e803d148121560ec", - "c_out": "cbbdc18a1dbf3a572649437c765c86e521c43a2f0a74a503c489912396ef16d263e957bcfdb2aa0853b046fad0e66fcb7b3d01c766964fe223d4473a4a7fa99c934db7e1c1f3dedefe6804e91ab73f2a", - "zkproof": "a2803d68ac307aa85ee726de8b25d933eb4158bdd479785ec1bffe9ac65de848669690d869819b549b384a00021d68ffaa0db8c35a226c32b3c5cfced3fda54be23caf7a2bde2422375f572f913532ea3cd3c1f78ff6e915d26569e33e8c729f0258fdf276e73865a74c9c5b9e1261c23486f9f5d07500f5f343314ecb7d757c28c77e511542329d19b2a4532b58111b84b421e548009a85907c2ff3c27174c6391cf4fefcf33d32e228106ca117b89d72bbbd64b7c3674c8de978d6c3a7f27a" - }, - { - "value_commitment": "fff3d45d73a5d80c4a97c8910f0d48dc7f60c685bb1ec6673631e253553f2c42", - "note_commitment": "2cf0adee47f49552c47eeef546a040197f4a67250f8ada2c4152d08ff2acba71", - "epk": "c12358c0825670e90f65424046e898b7b12ec9d2d26dc6728425204cf00528ca", - "c_enc": "013ffaf4d17394aecbe9d117f673188a782467849207eaa22f702361af4977afc1a0379db1b2867df55136efe8279e851657de46bbf3c0436a143780805e48d5c5ed86122b9cc943775dcfa294bbc01b7edffe2da5253655192e2d42326cc89ee863a99ecc13a7355d0fc78fb78ea2d6311fcaf8715b2a3bfa52789f09c58a0afea45c6e6f38a1bbf4f044fea4f211370122363f10bb5d1d82fbc5c20ce394490266ac4825d3a04194367902ddc504959a189749a1e0019e627d34f3cb831d481ef7c31f6a7d9289f1b2df981cf2600f1576d3e853a96a94bba8373bcb2fb07918007022133dd659f6775e34e0f5e9860b1d82e27161ea55dcaf7ea8b13d2f0994d604cb053f83d9655aef4412a6ca597f164b8a8386979787b7408bbddaf2991a705448426c0210f3eb7ddcd99fcd4be97eae9313e15e972912e2fc971b999609ba4dec92b99e1b157ee550cd6bfe44f8e7f03a7198ed826212f7813df58f12dcd906551b78ff7bdb27cf028e81585df14a064ae59857cc3632a27db2f239477d8d2c9a821b9dca1fc7d743f8f86239d4fd966bb2263001e84499f103300a3c168d67006b1baf0e6c13800b9edd713f9336891330ac0479e832648bb6fe3082c26172632f4e35515d3b0e26a0a9a933e138ee056495ed5f7cf6f73a870ac749bb00d141aa09e36382519ec073dfbdb24f8e37ebb1f3a67ac918ce1b899b4b851f2ca06115e9dc723e150fe9df064518fde22bcc5b69d6d22f2369bdf3256f4040569e41b638c9ecfbc553e4cc0bdf640dde9b41b465edf3c127e7c8842afbad657d791a", - "c_out": "e8af71a1baa54332692b499bc18848aa8a25daccf21d7b8199eb74570c263a1e99922bb97cb239bf34821d76136141c1fe684b35d7cad4f13fa67397c11acfb2519fd4d2e49c0bf621c047872dfa0e42", - "zkproof": "96633ab689349f9a0fad87c5e0d20b0924774fee0648637963ec5dc819a80f4c3468ebbbd34557304f68f67a0630805b8754817bd194d8885c229ccf005bf5724b8210997826aab2afbf741efd8c761fb6762ab52220f3a7a78d674d6eec612611b094cbae26e623bfb0b3aaf1aaf9f35eb66793899c3cbbdee03970072c59093734a4401ced14ecf8bb94d23deb5e71b7dee2fcbab2336769d406f07eb45fc346e3760466a9e30a27412b66fa3328e880091367f4e9804f93b7cda51befe2ee" - }], - "binding_signature": "5e71d8934832ea4a6aabf26a5db6d547dd322d83e8f66b2a1cce3993eaf18d68750eb4da2f456ccf2bf3773843e94fa2e1663f925e676b131eddbf46cabe0d01", - "message_hash": "ef27433c3b85438389429d27d4f2c7255c9e385d2401d74417fde0a072448942", - "trigger_contract_input": "00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000004005e71d8934832ea4a6aabf26a5db6d547dd322d83e8f66b2a1cce3993eaf18d68750eb4da2f456ccf2bf3773843e94fa2e1663f925e676b131eddbf46cabe0d01000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000000025f5905b2424229d63775792bec06ea8b4897805992547901080e09a9b5146d3c4d46e59b39d39430208317a101bc94ef1ee8276181cce24180612d500593315a2a80edbcc55e7364c689dfb637a5f8a3ef89950061026de070b792a5a9f58f314cc74a640e0040f16144e326892950ee95ab8afccba344e7b6fbca3169cbe4d7b69c7b252b36bbb654a26bcf6879afd3d7d4a6fe1e36d48e8c6508f4fea6a864717bd0d2d31d4a728277ff0d8e1bcfcb873d02c7a14a70899888f7eaed769d33f94fb836194dcc5ac16078d235e5b95b34472a782ec29ebe8ad14a222812b41b03e0f8edcd42774ceb8f5cddf312a3815a98c2909126646774017d67fcd0e114365e156614838ef87c222b729fa827ae801ae0a1ac4a48bc5f80fc3df2798c7d3f963ece395b1ff9c12e10ec7059d5855a8b101b266449b6eb3e326d7bf2acd629df43aae9e177e6fe15b76a23f0972f3709dc38e6033e35974926b2dad6302d4d46e59b39d39430208317a101bc94ef1ee8276181cce24180612d500593315a0ee5abca3e433892f2b62ec352089017482f15b457fdc71ffdd9c731d42f92d32917aadf5107ac11e6ebbad2a0ac3502a168e0b8c0307827b1ad69029faacd9bb98b0e6f6004ffdbed4069f63772a494bdadbe0a7e3f88dc5688821424bbc0f27f906ce0492c9a8c2233aa691c1767cfb0c3bcf21aba659f9290ba5dc04455a4a913192276154052be66bb743a7c842a149d473638020562501d3a752152381e135439839d9b9a4c65f15b256117322c7d202b3af0c03473602399272560bb3b3e9be33a75103aadc858901eab4176a4a4450293fb77366b7a34563d1120b27e7f4a6c2daf762aa43654685d235629729209d6bb402196517ff7f51dfecb995b00000000000000000000000000000000000000000000000000000000000000028538e941dbe6ddb8b2c70a2b5b6fb7729a84eecbfa386451f21adca4ecfb975a46534fa8e9a1d28a573c05f2c2a210d2555ecf51de781bf149bb27c1a3bfeb00e11781f5601d3947b6e4c1b43000410449330695b7506a9691db7cbd18da686d492c22abf971187377f4a69ee9453b5bff30f7472e7ec267a0f9612c1dfaaa04000000000000000000000000000000000000000000000000000000000000000257ab4c569b2cd69358ecaf26c9487cecc99a1b7607c8bfc7d2a58ed0392773328e6eb8efb8e7d1a4069daba59f95043d599ac7d0a3fe8ea3a0f415f73e347f6ffe72066db13a8e6acc820fdad950efa8f900b8544b645b93160ddc7811aec7e2a2803d68ac307aa85ee726de8b25d933eb4158bdd479785ec1bffe9ac65de848669690d869819b549b384a00021d68ffaa0db8c35a226c32b3c5cfced3fda54be23caf7a2bde2422375f572f913532ea3cd3c1f78ff6e915d26569e33e8c729f0258fdf276e73865a74c9c5b9e1261c23486f9f5d07500f5f343314ecb7d757c28c77e511542329d19b2a4532b58111b84b421e548009a85907c2ff3c27174c6391cf4fefcf33d32e228106ca117b89d72bbbd64b7c3674c8de978d6c3a7f27a2cf0adee47f49552c47eeef546a040197f4a67250f8ada2c4152d08ff2acba71fff3d45d73a5d80c4a97c8910f0d48dc7f60c685bb1ec6673631e253553f2c42c12358c0825670e90f65424046e898b7b12ec9d2d26dc6728425204cf00528ca96633ab689349f9a0fad87c5e0d20b0924774fee0648637963ec5dc819a80f4c3468ebbbd34557304f68f67a0630805b8754817bd194d8885c229ccf005bf5724b8210997826aab2afbf741efd8c761fb6762ab52220f3a7a78d674d6eec612611b094cbae26e623bfb0b3aaf1aaf9f35eb66793899c3cbbdee03970072c59093734a4401ced14ecf8bb94d23deb5e71b7dee2fcbab2336769d406f07eb45fc346e3760466a9e30a27412b66fa3328e880091367f4e9804f93b7cda51befe2ee00000000000000000000000000000000000000000000000000000000000000027457fce75f5df5d979c15d8cebaf2c814fd884cc268187f8b52a3a0db5453d0608c2a8d00b095021fc0af1d039bfddc4fddf56e39ca5233b0ec0559099590cc4902b74c4a7508472c793b6ead0ee433d644a6e4f63d1a02dd402e1a74574163bd179d3045bdc3190dddb8e91f475f503d003cc0c26598a6494252540d53d7ef8793a3293f3f98a702cede14eb4f4f78cc958e83c4cb7579f3aefd6ee1ccd6269d61c9e8b3bf46101bf8b02fd4b6b3f3ea479d977da40ba532fa0100e3372e326315934bb21c16fa654969c1432ffdf710cc91c8eb4485c8885f49e2dceb0f14447f530a3a07bcf0a2914399458486766661c458f2beda0c75eac752ebc38f6e490f22640ef2231b2622fc647e5888f81d0c133ac1e76d99de89953d15708dc8a525563aad587a164e00f7d96d79bc02ad28478d8af930c0e08be219d8d0eda099571680801c3fb3f7195be590635279435a7052d70489653bd634566a930d17cef04d50c5c08fa3b4697ba1b6fd81c18431077f6acc6ca27cfe0e519cf3500c53d0f508b14ab1825dd2c3baf408eaa4df9725be2ac2c9b9b171c41597fed62a114ba8898f16e1d213f9668018725493398e9fa60fe58c650482d93bbef83b152956e4242bf7da10cf6b6a034e59e640c873e67c84980327025bbd239a19a02fea1439681af8ce81eb12efdc66bc2dc08b3143f9033fb7332a05523d1d38f765db7938faf9c2ac6089cef77e12622651683f0ea2815e9786977deb4bd2010d3c3be7f0484d1420387fd4fe56ced3b26d073f60940b52048fa939ba4f3e803d148121560eccbbdc18a1dbf3a572649437c765c86e521c43a2f0a74a503c489912396ef16d263e957bcfdb2aa0853b046fad0e66fcb7b3d01c766964fe223d4473a4a7fa99c934db7e1c1f3dedefe6804e91ab73f2a000000000000000000000000013ffaf4d17394aecbe9d117f673188a782467849207eaa22f702361af4977afc1a0379db1b2867df55136efe8279e851657de46bbf3c0436a143780805e48d5c5ed86122b9cc943775dcfa294bbc01b7edffe2da5253655192e2d42326cc89ee863a99ecc13a7355d0fc78fb78ea2d6311fcaf8715b2a3bfa52789f09c58a0afea45c6e6f38a1bbf4f044fea4f211370122363f10bb5d1d82fbc5c20ce394490266ac4825d3a04194367902ddc504959a189749a1e0019e627d34f3cb831d481ef7c31f6a7d9289f1b2df981cf2600f1576d3e853a96a94bba8373bcb2fb07918007022133dd659f6775e34e0f5e9860b1d82e27161ea55dcaf7ea8b13d2f0994d604cb053f83d9655aef4412a6ca597f164b8a8386979787b7408bbddaf2991a705448426c0210f3eb7ddcd99fcd4be97eae9313e15e972912e2fc971b999609ba4dec92b99e1b157ee550cd6bfe44f8e7f03a7198ed826212f7813df58f12dcd906551b78ff7bdb27cf028e81585df14a064ae59857cc3632a27db2f239477d8d2c9a821b9dca1fc7d743f8f86239d4fd966bb2263001e84499f103300a3c168d67006b1baf0e6c13800b9edd713f9336891330ac0479e832648bb6fe3082c26172632f4e35515d3b0e26a0a9a933e138ee056495ed5f7cf6f73a870ac749bb00d141aa09e36382519ec073dfbdb24f8e37ebb1f3a67ac918ce1b899b4b851f2ca06115e9dc723e150fe9df064518fde22bcc5b69d6d22f2369bdf3256f4040569e41b638c9ecfbc553e4cc0bdf640dde9b41b465edf3c127e7c8842afbad657d791ae8af71a1baa54332692b499bc18848aa8a25daccf21d7b8199eb74570c263a1e99922bb97cb239bf34821d76136141c1fe684b35d7cad4f13fa67397c11acfb2519fd4d2e49c0bf621c047872dfa0e42000000000000000000000000", - "parameter_type": "transfer" -} -``` - -The `trigger_contract_input` can be used as the input data to trigger the `transfer` function of the shielded TRC-20 contract. - -Note: 1. the notes in `shielded_spends` is obtained by `scanshieldedtrc20notesbyivk` api; 2. the `root` and `path` is obtained by triggering the `getPath` function of the shielded TRC-20 contract. - -**2. Call api: wallet/createshieldedcontractparameterswithoutask to build the parameters** - -Method: Post - -Parameters: - -```json -{ - "ak": "8072d9110c9de9d9ade33d5d0f5890a7aa65b0cde42af7816d187297caf2fd64", - "nsk": "cd43d722fd4b6b01f19449ea826c3e935609648520fcc2a95c0026f0fa9ee404", - "ovk": "0ff58efd75e083fe4fd759c8701e1c8cb6961c4297a12b2c800bdb7b2bcab889", - shielded_spends: [ - { - "note": { - "value": 60, - "payment_address":"ztron1nx3cnncmlcl72ppcrz23krpurxphz9g5yj85zvpgm94g46zs8pq8gd7qrcv8xezp9rryzlar4az", - "rcm": "4636333870ccc91fb8bfe53ed559f8cf64505672a58d82875694dd38eb3d6404" - }, - "alpha": "d0f0768664f5c807f9e70d05993f029c71da529afaa5c037b44c63d6e13bc907", - "root": "c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873", - "path": "b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c5381412935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62de1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef7228e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2aa5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6ad2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb5816d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4afee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd7124c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee08500769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c4908eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf30238d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e8415276736aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b159216cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf006edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c1ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be2451d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642fbd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c1b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab651ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de985794730484777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23cba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce7243ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b7b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b680444d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa528138ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce7389613213099b1bdbe886f3bca27080fe45467bb6a83e77e68348a8e863b0c676a30475761cd9b3396e9cedf9afeecac3edbcd192c5f65a4b108cc595dd7f668df0a1fec35ec8008050551a48d62ca8b2085276d589a8d02ab9cad8b0d6b30b8622d279acf822005ced7f6caaea51d378f0084bea34d1f98f759186ea5a2e67756b6656258501e6cf76599d3a854584c3438a34bb4754f9a84bfe98ad55cfc4bc25d4ed185719284bf14140befea7d9ec174b9dae461f4832db5f7d2e96aa4c0c52a6a", - "pos": 31 - }, - { - "note": { - "value": 40, - "payment_address":"ztron1x54s8nrzf2g85grp729s4pxx7ta3s38lj0jw57qwnuqx0e2wy8sfdcyldyfs9hazhqrs6jjzxhw", - "rcm": "74908b43975847d5df6c0b40c4d5b1dbe732cb720e6b5bd5a55e7cd10e2a3a05" - }, - "alpha": "ff3bd6babd3e28da098c67c67f26f2e613a5d1cec966b2f25ca4a943218ee805", - "root": "c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873", - "path": "b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c5381412935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62de1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef7228e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2aa5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6ad2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb5816d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4afee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd7124c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee08500769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c4908eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf30238d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e8415276736aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b159216cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf006edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c1ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be2451d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642fbd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c1b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab651ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de985794730484777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23cba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce7243ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b7b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b680444d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa528138ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce7389613cccdc97df3913f95c42665c3db7e806af0f5e84d5b6caac5754f6100df1a0c18e110de65c907b9dea4ae0bd83a4b0a51bea175646a64c12b4c9f931b2cb31b49d8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6cffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e34817de36ab2d57feb077634bca77819c8e0bd298c04f6fed0e6a83cc1356ca1550100000000000000000000000000000000000000000000000000000000000000", - "pos":32 - }, - ], - shielded_receives: [ - { - "note": { - "value": 30, - "payment_address":"ztron127acwjxf499f43t8mk42ch5jyru68fsw7jun9hfu7pv87we3dnfrwtml8np80gsegksnjfz87vd", - "rcm": "4172682e3f0398abb7f204220279948b3dd930bc901b1c9223a5cac51b1a7703" - } - }, - { - "note": { - "value": 70, - "payment_address":"ztron1f6dfsq8mxj8pd2f2dvnle4x6ahfrqr4ll2ezp2ez90jmcjtksr2r6s8095ljf7a3mfpn2uklc9r", - "rcm": "7b4d06b6e0b5ea0172063f7f7e495bb840ff279787bd49adffdcfde65d68700e" - } - } - ], - "shielded_TRC20_contract_address": "41e6e90fbc958ba09483550882b1f0327e0193250a" -} -``` -Return: -```bash -{ - "spend_description": [ - { - "value_commitment": "68b6f57d972dfeef1784017d0a669b45a367091671c098ea99fc9654d7bdc0e7", - "anchor": "c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873", - "nullifier": "882842cb630c1a0c77b1af4e0c23c2584b83875d928673d1d57d7322ea3ad825", - "rk": "8574c873fbf582b4c491f901127c7922f6819fb20a38bac5f3d44bef01bdc5d2", - "zkproof": "a0bfa6e0c26cbd0d23dadaa1125df75cd6f0987e5e876e704193417cf9870a9f1f34be6a91a06694ca6709a0ad6e7976b8893a9df057b43fac950c5fb7331a14303e3841c542e5455b3dd794ac7f97347928427d4b02405a9ae3d55ae560b7fe0aa20b51dbbc720479a50c38f4dae5ce2d2c1a1c68d32fae0c6ac23bae1069d5789c2c519614f85d75196286930b55148812d6c23936ddd40e1b771452664d2d067deb4f58600a7079025ffeb9bf409a38500e93c72ae1d09130f85e2dffc353" - }, - { - "value_commitment": "219ed48bc4bfe14cc2953ab5027528353e177e2263479122ea97c609ce187986", - "anchor": "c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873", - "nullifier": "79e938e0951d4d6cf6acd679fc6bb59147a6abc2f9e2828185328e93a83ab2f1", - "rk": "99c0c1fbe3ad8a6e27d712632064fdeeb10952624c60a0ddcba0eb233bbf4e8b", - "zkproof": "b536d0f442f6e0517930a9ccdb551c9e551a148c41fcf1e4748d1330d6c3e6f952012a5c3c6b06cfb51a92da5ebec4bcb11ed37cf36b60c9997baa026733ab6711894b5d17ca1f96667d68ed97f4cf75e5a9d96484d9f2453f869400e14dc54f0bf54f9abec8baf45baec320a06cc09780f4c5a2058f870993ff8a31f6d19b03f772a7d4d29ae837c7c2c3d6b300c4d485390d2e7bf09f971ed82e3676daf6fb655b2e47e040de762fe26317815e30b1f9638af979803e37abc3a95742c6faaa" - }], - "receive_description": [ - { - "value_commitment": "00d705dd92237759b4b339d1c9b4da7d2a8baa132daf6feb3091ef746afff0b0", - "note_commitment": "bcf2634c9ab870604831ae151b7959fe72c588488271640cf7772ee040f78820", - "epk": "e6129572f05703a81cd55a7bc3e86d6b2c76f8f4bd60b02162d0b76d8dce21c8", - "c_enc": "4d80bb52b7a1518bef81bbdb7584cefbd3cef9f9bc98fa75194f2b08d0b6c18253ca2e9ddea6330d96562db0bf9cebb6a8d1198599d420eba2ed5868956719ea835d1d5e58433fbbb7b72ae51f99f90440c67c03dc89101416a331b436f8ac560ddb772b9a7a8c16a0300cff97364d59046192b744592bc5f45c584385b24bfd4bdf159230893983516d82ee2a20d3da62f3ff979baf2ba010a6e7766ae30b7c56e4c78a746630d579833e56a07653716737fbaf19346d527f38938b75e0208355289185343364b0867f48ddca45e121b64bae64b32f002037c94050e07f96e86a4765ddf589b5e360b24ccf23b398275c575759cd3e1dd784c654dd8948efefafb1f9ae1c4d41efe803588bccb1b4bfbab6bf1a526f935e7123190ae8031f5c37ecf2820b812250ebe7b79f085abd2af5c2d59caf79355a6143b70f2ea0a66ae99e7392e2f64b9a2d7d3f79f278cbaeb897de832db2e2ea23cfe7906b0c61d5c99a75e076fdb000b57a78989edfa9730c6f485dc44c6d52fca1c884428514abf1cc4cde54c2d456b44c563b815969c7c8d4eb28cce53715d20bfe92fabcbcc30bd5ed8dac1f2b6acc98621311b21d3d7c979498f97ef318dbb335d87b5d0db43ee15323e90df8a59d6675495ed928d62db31e41cc4426e110f9994c21d2fb549bc94eb6d55ed4877b9f56ad624d80f81254dc3f90e14769f4e0bbada33dbfa7d33fd8675f7d9c30cd4f40fad2ef1e24c083889de3a71629f24601ead906a93b5a9dd2296d0577f8db42b8395134212f26fc84902693098c214704db5608c7509c8b23b4", - "c_out": "f3755f2d22d0881b0021adf5621708025e296c8591e0e076dba416a1437a9fc0a3312c09a35a8912a8c2115165bb67fe0565064140960ab44d836d307a93013ae28e390483fe5d59baca900c7bc606cf", - "zkproof": "8e4072af7180ab0cb95350026623a1e89850039ab8de7342a9661d41a7103f645292521cec3c199a5e3c3a4dedee33d5b37c4bd18d9f2c3ec1b28297e80ad640b77140685dd36243b89f1d6a23d115f6f52804685cd445a64661c8c2d0c11aaf11a8cf790c47ff796d27231597a981cff8fa58a33d0a1d163754ebd7814765f779920867295fee03d5882e7da940c60eb9688c22640a079bad4f33fe5a02d459e60844bb77d67c0c74e9c6f8b0be2023953cee099ce175e4fb64ef5de947a5e4" - }, - { - "value_commitment": "19ac352ba8d7f5167ef43a5b9c225056db2c44fb19f7fe8c63e0d2b956771656", - "note_commitment": "e40b9da38887963c8cd1e163b4b7d4b999502c32e1204b791242633aebcdbb6d", - "epk": "b1675f0b5331371466ff30d621991f0a30c9bc4d34c322be44619a0acf932905", - "c_enc": "b69f20ae969de55319d2b7617bf7351a4683098af1e7b16fa64d44ff758471f33b0fb4f8896b2c32c68c410672fa81356e535f8d04338bdb69d69655eeee11e10727f319e1df6702ba7c90b2c5e4f38f809eddd2084fd30fd5684d9c004c679f4e574e17334d731550a76a842960bcdd811c67362bed7cdf698284a549e240da1727814af5137a7a384b5f24bd61a4b9cc1c4f6abe84524184a3ee257e002f7a9f6ccd3f6f0d490c5f77e3c26896f7bce84bf224429a45e156a4c62de64f739f9555147ed3fb7704206e7e45faf0f385229c7ed4e57253f8b5c4e518a26b90c069708c356e490abe97c1f78d361e7166fed9c67bad5aa820cadbefea2095b2a1adddb13b0249dae1c5c48ff0aad8eec23493786dead33d68e107bc13c3448129a58556ef5a21873ee151035117871652b1e151308d358f0df9c1c3188af4f15431b6fd262f4e0cbe5401c20b4633617fcf92a54d94991bd98e21f9cdcbcb6899341a9924d6eb11168daa6b19c2424993d4308bf40158564000aa79d106d09ebac3ad0a0e1729d20cff6226f3e632d9fd1c4f541b2f2ebaf5110ea5170498ce690e9115bca423ba2f5498b365db9dab936d1896ad5bc5b0d8c86b37f36debd5aca0e1194c48d51cff2253e32f069e8b969d7ba3c9391715c6b3118e2e31621321302b93edfdba0639542f3144eb6d90cdd86d354959df6398cf5fa497cf0fcbb19395d9bc1243da98afbc9087ec2997df1e84e97b4e18b1691e2d942a67214202e3d3880ce4eace0903cdd07f53b6f1ea23e277d867e73fbb10560a7d1df10402bd50d42c", - "c_out": "1e5333e35985d343697dcce92703c2536a861eb49722e1c83a112cf004006e9cdb63f96132393c7616e5f947d9d07cd6a22a664643c117f52791724efde660605f134aa86d3374b4804f9bb9ce64fc99", - "zkproof": "a6b41694f8fa378886ef77d5bd07de56de55b9ad7c8438d05380dd5fa1ce2e7d0ae0528f82c23a6d92e6150e426ef3958556757ee973c5e79ae7ce074b1b25c74ccdde0b2b2dfd1b42215401f700c06b84785572eb4e585971cc4b451420bfbc17db489dbc996e9c5533b7da9e4a88d53388b411dd4a4e8801707aa01508054faa91a2c422a4cbad61ababfc3b1893c38e2ec19d19a1e5b47d2257ca9e347283afd5e53a2f8989d8db6a76b7942a737601ed3082e2e56290a9cd694a399f8551" - }], - "binding_signature": "c7f303709c57e49264fd5ae5922bf977ef2a57ccc84d746effc5c6937eecf36e05b09faf95e5f869aeaf1aa87b24570eb723a4d8c77edea32c31b2909c84eb04", - "message_hash": "7fb99e66df052f430d50e80a3f197c319a4e35184ed48a433d6219e025741337", - "parameter_type": "transfer" -} -``` - -Because of lacking the `ask`, the api can not generate the `spend_authority_signature` and `trigger_contract_input `. To generate the `trigger_contract_input`, the user first needs to generate the spend `spend_authority_signature` by itself or by calling the api: - -**wallet/createspendauthsig** - -Method: Post - -Parameters: - -``` -{ - "ask": "0f63eabdfe2bbfe08012f6bb2db024e6809c16e8ed055aa41a6095424f192005", - "tx_hash": "7fb99e66df052f430d50e80a3f197c319a4e35184ed48a433d6219e025741337", - "alpha": "d0f0768664f5c807f9e70d05993f029c71da529afaa5c037b44c63d6e13bc907" -} -``` - -Note: `alpha` is a random field element with the length of 32 bytes, which should be generated by `GetRcm` api. - -Return: - -``` -{ - "value": "9e889cea041002ed7a9a80d093f2e9b5bdec24da1dda11cc7c5d1bfb6c7046b3c4ed0a2cb6cbbead42336d1235d1ec671a832c2ada9ee1ad3048129b7c99e309" -} -``` - -The returned `value` is the `spend_authority_signature`. If the `transfer` has two inputs, the users needs to generate the two corresponding `spend_authority_signatures`. - -Note: in order to guarantee the security, the user should be better to generate the `spend_authority_signature` by itself instead of calling the api. - -Then the user need to call the api to generate the triggering contract input: - -**wallet/gettriggerinputforshieldedtrc20contract** - -Method: Post - -Parameters: - -``` -{ - "shielded_TRC20_Parameters": { - "spend_description": [ - { - "value_commitment": "68b6f57d972dfeef1784017d0a669b45a367091671c098ea99fc9654d7bdc0e7", - "anchor": "c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873", - "nullifier": "882842cb630c1a0c77b1af4e0c23c2584b83875d928673d1d57d7322ea3ad825", - "rk": "8574c873fbf582b4c491f901127c7922f6819fb20a38bac5f3d44bef01bdc5d2", - "zkproof": "a0bfa6e0c26cbd0d23dadaa1125df75cd6f0987e5e876e704193417cf9870a9f1f34be6a91a06694ca6709a0ad6e7976b8893a9df057b43fac950c5fb7331a14303e3841c542e5455b3dd794ac7f97347928427d4b02405a9ae3d55ae560b7fe0aa20b51dbbc720479a50c38f4dae5ce2d2c1a1c68d32fae0c6ac23bae1069d5789c2c519614f85d75196286930b55148812d6c23936ddd40e1b771452664d2d067deb4f58600a7079025ffeb9bf409a38500e93c72ae1d09130f85e2dffc353" - }, - { - "value_commitment": "219ed48bc4bfe14cc2953ab5027528353e177e2263479122ea97c609ce187986", - "anchor": "c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873", - "nullifier": "79e938e0951d4d6cf6acd679fc6bb59147a6abc2f9e2828185328e93a83ab2f1", - "rk": "99c0c1fbe3ad8a6e27d712632064fdeeb10952624c60a0ddcba0eb233bbf4e8b", - "zkproof": "b536d0f442f6e0517930a9ccdb551c9e551a148c41fcf1e4748d1330d6c3e6f952012a5c3c6b06cfb51a92da5ebec4bcb11ed37cf36b60c9997baa026733ab6711894b5d17ca1f96667d68ed97f4cf75e5a9d96484d9f2453f869400e14dc54f0bf54f9abec8baf45baec320a06cc09780f4c5a2058f870993ff8a31f6d19b03f772a7d4d29ae837c7c2c3d6b300c4d485390d2e7bf09f971ed82e3676daf6fb655b2e47e040de762fe26317815e30b1f9638af979803e37abc3a95742c6faaa" - }], - "receive_description": [ - { - "value_commitment": "00d705dd92237759b4b339d1c9b4da7d2a8baa132daf6feb3091ef746afff0b0", - "note_commitment": "bcf2634c9ab870604831ae151b7959fe72c588488271640cf7772ee040f78820", - "epk": "e6129572f05703a81cd55a7bc3e86d6b2c76f8f4bd60b02162d0b76d8dce21c8", - "c_enc": "4d80bb52b7a1518bef81bbdb7584cefbd3cef9f9bc98fa75194f2b08d0b6c18253ca2e9ddea6330d96562db0bf9cebb6a8d1198599d420eba2ed5868956719ea835d1d5e58433fbbb7b72ae51f99f90440c67c03dc89101416a331b436f8ac560ddb772b9a7a8c16a0300cff97364d59046192b744592bc5f45c584385b24bfd4bdf159230893983516d82ee2a20d3da62f3ff979baf2ba010a6e7766ae30b7c56e4c78a746630d579833e56a07653716737fbaf19346d527f38938b75e0208355289185343364b0867f48ddca45e121b64bae64b32f002037c94050e07f96e86a4765ddf589b5e360b24ccf23b398275c575759cd3e1dd784c654dd8948efefafb1f9ae1c4d41efe803588bccb1b4bfbab6bf1a526f935e7123190ae8031f5c37ecf2820b812250ebe7b79f085abd2af5c2d59caf79355a6143b70f2ea0a66ae99e7392e2f64b9a2d7d3f79f278cbaeb897de832db2e2ea23cfe7906b0c61d5c99a75e076fdb000b57a78989edfa9730c6f485dc44c6d52fca1c884428514abf1cc4cde54c2d456b44c563b815969c7c8d4eb28cce53715d20bfe92fabcbcc30bd5ed8dac1f2b6acc98621311b21d3d7c979498f97ef318dbb335d87b5d0db43ee15323e90df8a59d6675495ed928d62db31e41cc4426e110f9994c21d2fb549bc94eb6d55ed4877b9f56ad624d80f81254dc3f90e14769f4e0bbada33dbfa7d33fd8675f7d9c30cd4f40fad2ef1e24c083889de3a71629f24601ead906a93b5a9dd2296d0577f8db42b8395134212f26fc84902693098c214704db5608c7509c8b23b4", - "c_out": "f3755f2d22d0881b0021adf5621708025e296c8591e0e076dba416a1437a9fc0a3312c09a35a8912a8c2115165bb67fe0565064140960ab44d836d307a93013ae28e390483fe5d59baca900c7bc606cf", - "zkproof": "8e4072af7180ab0cb95350026623a1e89850039ab8de7342a9661d41a7103f645292521cec3c199a5e3c3a4dedee33d5b37c4bd18d9f2c3ec1b28297e80ad640b77140685dd36243b89f1d6a23d115f6f52804685cd445a64661c8c2d0c11aaf11a8cf790c47ff796d27231597a981cff8fa58a33d0a1d163754ebd7814765f779920867295fee03d5882e7da940c60eb9688c22640a079bad4f33fe5a02d459e60844bb77d67c0c74e9c6f8b0be2023953cee099ce175e4fb64ef5de947a5e4" - }, - { - "value_commitment": "19ac352ba8d7f5167ef43a5b9c225056db2c44fb19f7fe8c63e0d2b956771656", - "note_commitment": "e40b9da38887963c8cd1e163b4b7d4b999502c32e1204b791242633aebcdbb6d", - "epk": "b1675f0b5331371466ff30d621991f0a30c9bc4d34c322be44619a0acf932905", - "c_enc": "b69f20ae969de55319d2b7617bf7351a4683098af1e7b16fa64d44ff758471f33b0fb4f8896b2c32c68c410672fa81356e535f8d04338bdb69d69655eeee11e10727f319e1df6702ba7c90b2c5e4f38f809eddd2084fd30fd5684d9c004c679f4e574e17334d731550a76a842960bcdd811c67362bed7cdf698284a549e240da1727814af5137a7a384b5f24bd61a4b9cc1c4f6abe84524184a3ee257e002f7a9f6ccd3f6f0d490c5f77e3c26896f7bce84bf224429a45e156a4c62de64f739f9555147ed3fb7704206e7e45faf0f385229c7ed4e57253f8b5c4e518a26b90c069708c356e490abe97c1f78d361e7166fed9c67bad5aa820cadbefea2095b2a1adddb13b0249dae1c5c48ff0aad8eec23493786dead33d68e107bc13c3448129a58556ef5a21873ee151035117871652b1e151308d358f0df9c1c3188af4f15431b6fd262f4e0cbe5401c20b4633617fcf92a54d94991bd98e21f9cdcbcb6899341a9924d6eb11168daa6b19c2424993d4308bf40158564000aa79d106d09ebac3ad0a0e1729d20cff6226f3e632d9fd1c4f541b2f2ebaf5110ea5170498ce690e9115bca423ba2f5498b365db9dab936d1896ad5bc5b0d8c86b37f36debd5aca0e1194c48d51cff2253e32f069e8b969d7ba3c9391715c6b3118e2e31621321302b93edfdba0639542f3144eb6d90cdd86d354959df6398cf5fa497cf0fcbb19395d9bc1243da98afbc9087ec2997df1e84e97b4e18b1691e2d942a67214202e3d3880ce4eace0903cdd07f53b6f1ea23e277d867e73fbb10560a7d1df10402bd50d42c", - "c_out": "1e5333e35985d343697dcce92703c2536a861eb49722e1c83a112cf004006e9cdb63f96132393c7616e5f947d9d07cd6a22a664643c117f52791724efde660605f134aa86d3374b4804f9bb9ce64fc99", - "zkproof": "a6b41694f8fa378886ef77d5bd07de56de55b9ad7c8438d05380dd5fa1ce2e7d0ae0528f82c23a6d92e6150e426ef3958556757ee973c5e79ae7ce074b1b25c74ccdde0b2b2dfd1b42215401f700c06b84785572eb4e585971cc4b451420bfbc17db489dbc996e9c5533b7da9e4a88d53388b411dd4a4e8801707aa01508054faa91a2c422a4cbad61ababfc3b1893c38e2ec19d19a1e5b47d2257ca9e347283afd5e53a2f8989d8db6a76b7942a737601ed3082e2e56290a9cd694a399f8551" - }], - "binding_signature": "c7f303709c57e49264fd5ae5922bf977ef2a57ccc84d746effc5c6937eecf36e05b09faf95e5f869aeaf1aa87b24570eb723a4d8c77edea32c31b2909c84eb04", - "message_hash": "7fb99e66df052f430d50e80a3f197c319a4e35184ed48a433d6219e025741337", - "parameter_type": "transfer" - }, - "spend_authority_signature": [ - { - "value": "9e889cea041002ed7a9a80d093f2e9b5bdec24da1dda11cc7c5d1bfb6c7046b3c4ed0a2cb6cbbead42336d1235d1ec671a832c2ada9ee1ad3048129b7c99e309" - }, - { - "value": "24409c69b9d03a7c714f7c8bac39a3310054eef9e99dcbf256c8e39ef267e31884f2f2465ca7cd7aaba006e7f0a8635787de61eef1b96ce559764d300f637a08" - } - ] -} -``` - -Return: - -``` -{ - "value": "00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000400c7f303709c57e49264fd5ae5922bf977ef2a57ccc84d746effc5c6937eecf36e05b09faf95e5f869aeaf1aa87b24570eb723a4d8c77edea32c31b2909c84eb0400000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000002882842cb630c1a0c77b1af4e0c23c2584b83875d928673d1d57d7322ea3ad825c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba87368b6f57d972dfeef1784017d0a669b45a367091671c098ea99fc9654d7bdc0e78574c873fbf582b4c491f901127c7922f6819fb20a38bac5f3d44bef01bdc5d2a0bfa6e0c26cbd0d23dadaa1125df75cd6f0987e5e876e704193417cf9870a9f1f34be6a91a06694ca6709a0ad6e7976b8893a9df057b43fac950c5fb7331a14303e3841c542e5455b3dd794ac7f97347928427d4b02405a9ae3d55ae560b7fe0aa20b51dbbc720479a50c38f4dae5ce2d2c1a1c68d32fae0c6ac23bae1069d5789c2c519614f85d75196286930b55148812d6c23936ddd40e1b771452664d2d067deb4f58600a7079025ffeb9bf409a38500e93c72ae1d09130f85e2dffc35379e938e0951d4d6cf6acd679fc6bb59147a6abc2f9e2828185328e93a83ab2f1c1dda86b7af8ce842e349347b364936baf24ad36be65046e2fd7349640bba873219ed48bc4bfe14cc2953ab5027528353e177e2263479122ea97c609ce18798699c0c1fbe3ad8a6e27d712632064fdeeb10952624c60a0ddcba0eb233bbf4e8bb536d0f442f6e0517930a9ccdb551c9e551a148c41fcf1e4748d1330d6c3e6f952012a5c3c6b06cfb51a92da5ebec4bcb11ed37cf36b60c9997baa026733ab6711894b5d17ca1f96667d68ed97f4cf75e5a9d96484d9f2453f869400e14dc54f0bf54f9abec8baf45baec320a06cc09780f4c5a2058f870993ff8a31f6d19b03f772a7d4d29ae837c7c2c3d6b300c4d485390d2e7bf09f971ed82e3676daf6fb655b2e47e040de762fe26317815e30b1f9638af979803e37abc3a95742c6faaa00000000000000000000000000000000000000000000000000000000000000029e889cea041002ed7a9a80d093f2e9b5bdec24da1dda11cc7c5d1bfb6c7046b3c4ed0a2cb6cbbead42336d1235d1ec671a832c2ada9ee1ad3048129b7c99e30924409c69b9d03a7c714f7c8bac39a3310054eef9e99dcbf256c8e39ef267e31884f2f2465ca7cd7aaba006e7f0a8635787de61eef1b96ce559764d300f637a080000000000000000000000000000000000000000000000000000000000000002bcf2634c9ab870604831ae151b7959fe72c588488271640cf7772ee040f7882000d705dd92237759b4b339d1c9b4da7d2a8baa132daf6feb3091ef746afff0b0e6129572f05703a81cd55a7bc3e86d6b2c76f8f4bd60b02162d0b76d8dce21c88e4072af7180ab0cb95350026623a1e89850039ab8de7342a9661d41a7103f645292521cec3c199a5e3c3a4dedee33d5b37c4bd18d9f2c3ec1b28297e80ad640b77140685dd36243b89f1d6a23d115f6f52804685cd445a64661c8c2d0c11aaf11a8cf790c47ff796d27231597a981cff8fa58a33d0a1d163754ebd7814765f779920867295fee03d5882e7da940c60eb9688c22640a079bad4f33fe5a02d459e60844bb77d67c0c74e9c6f8b0be2023953cee099ce175e4fb64ef5de947a5e4e40b9da38887963c8cd1e163b4b7d4b999502c32e1204b791242633aebcdbb6d19ac352ba8d7f5167ef43a5b9c225056db2c44fb19f7fe8c63e0d2b956771656b1675f0b5331371466ff30d621991f0a30c9bc4d34c322be44619a0acf932905a6b41694f8fa378886ef77d5bd07de56de55b9ad7c8438d05380dd5fa1ce2e7d0ae0528f82c23a6d92e6150e426ef3958556757ee973c5e79ae7ce074b1b25c74ccdde0b2b2dfd1b42215401f700c06b84785572eb4e585971cc4b451420bfbc17db489dbc996e9c5533b7da9e4a88d53388b411dd4a4e8801707aa01508054faa91a2c422a4cbad61ababfc3b1893c38e2ec19d19a1e5b47d2257ca9e347283afd5e53a2f8989d8db6a76b7942a737601ed3082e2e56290a9cd694a399f855100000000000000000000000000000000000000000000000000000000000000024d80bb52b7a1518bef81bbdb7584cefbd3cef9f9bc98fa75194f2b08d0b6c18253ca2e9ddea6330d96562db0bf9cebb6a8d1198599d420eba2ed5868956719ea835d1d5e58433fbbb7b72ae51f99f90440c67c03dc89101416a331b436f8ac560ddb772b9a7a8c16a0300cff97364d59046192b744592bc5f45c584385b24bfd4bdf159230893983516d82ee2a20d3da62f3ff979baf2ba010a6e7766ae30b7c56e4c78a746630d579833e56a07653716737fbaf19346d527f38938b75e0208355289185343364b0867f48ddca45e121b64bae64b32f002037c94050e07f96e86a4765ddf589b5e360b24ccf23b398275c575759cd3e1dd784c654dd8948efefafb1f9ae1c4d41efe803588bccb1b4bfbab6bf1a526f935e7123190ae8031f5c37ecf2820b812250ebe7b79f085abd2af5c2d59caf79355a6143b70f2ea0a66ae99e7392e2f64b9a2d7d3f79f278cbaeb897de832db2e2ea23cfe7906b0c61d5c99a75e076fdb000b57a78989edfa9730c6f485dc44c6d52fca1c884428514abf1cc4cde54c2d456b44c563b815969c7c8d4eb28cce53715d20bfe92fabcbcc30bd5ed8dac1f2b6acc98621311b21d3d7c979498f97ef318dbb335d87b5d0db43ee15323e90df8a59d6675495ed928d62db31e41cc4426e110f9994c21d2fb549bc94eb6d55ed4877b9f56ad624d80f81254dc3f90e14769f4e0bbada33dbfa7d33fd8675f7d9c30cd4f40fad2ef1e24c083889de3a71629f24601ead906a93b5a9dd2296d0577f8db42b8395134212f26fc84902693098c214704db5608c7509c8b23b4f3755f2d22d0881b0021adf5621708025e296c8591e0e076dba416a1437a9fc0a3312c09a35a8912a8c2115165bb67fe0565064140960ab44d836d307a93013ae28e390483fe5d59baca900c7bc606cf000000000000000000000000b69f20ae969de55319d2b7617bf7351a4683098af1e7b16fa64d44ff758471f33b0fb4f8896b2c32c68c410672fa81356e535f8d04338bdb69d69655eeee11e10727f319e1df6702ba7c90b2c5e4f38f809eddd2084fd30fd5684d9c004c679f4e574e17334d731550a76a842960bcdd811c67362bed7cdf698284a549e240da1727814af5137a7a384b5f24bd61a4b9cc1c4f6abe84524184a3ee257e002f7a9f6ccd3f6f0d490c5f77e3c26896f7bce84bf224429a45e156a4c62de64f739f9555147ed3fb7704206e7e45faf0f385229c7ed4e57253f8b5c4e518a26b90c069708c356e490abe97c1f78d361e7166fed9c67bad5aa820cadbefea2095b2a1adddb13b0249dae1c5c48ff0aad8eec23493786dead33d68e107bc13c3448129a58556ef5a21873ee151035117871652b1e151308d358f0df9c1c3188af4f15431b6fd262f4e0cbe5401c20b4633617fcf92a54d94991bd98e21f9cdcbcb6899341a9924d6eb11168daa6b19c2424993d4308bf40158564000aa79d106d09ebac3ad0a0e1729d20cff6226f3e632d9fd1c4f541b2f2ebaf5110ea5170498ce690e9115bca423ba2f5498b365db9dab936d1896ad5bc5b0d8c86b37f36debd5aca0e1194c48d51cff2253e32f069e8b969d7ba3c9391715c6b3118e2e31621321302b93edfdba0639542f3144eb6d90cdd86d354959df6398cf5fa497cf0fcbb19395d9bc1243da98afbc9087ec2997df1e84e97b4e18b1691e2d942a67214202e3d3880ce4eace0903cdd07f53b6f1ea23e277d867e73fbb10560a7d1df10402bd50d42c1e5333e35985d343697dcce92703c2536a861eb49722e1c83a112cf004006e9cdb63f96132393c7616e5f947d9d07cd6a22a664643c117f52791724efde660605f134aa86d3374b4804f9bb9ce64fc99000000000000000000000000" -} -``` - -The `value` can be used as the input data to trigger the `transfer` function of the shielded TRC-20 contract. - -### Create shielded TRC-20 contract parameters for `burn` - -**1. Call api: wallet/createshieldedcontractparameters to build the parameters** - -Method: Post - -Parameters: - -```json -{ - "ask": "0f04d283f9a26718676a29d5fc9af0199874c5c2f6fd103f2342b24c9820a604", - "nsk": "572d8147283d90a938bd2867926fef485290c5fce37fad72eb733f9cd8a07e09", - "ovk": "1797de3b7f33cafffe3fe18c6b43ec6760add2ad81b10978d1fca5290497ede9", - "shielded_spends": [ - { - "note": { - "value": 60, - "payment_address":"ztron1mpwx0380fvw7gacf5hm4vl625ltmdezt0dwp3ssyd84y8jxzp3guqz9utzn35u7038jx6a6ucly", - "rcm": "b67b18fee3133440bfc4509912b96482fdcacbc0b5679af1785247c94224200c" - }, - "alpha": "b6de1a3a40764bd7a24147f155011624805bfcd6d21283c69a3f21aea9401201", - "root": "b0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126f", - "path": "b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c5381412935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62de1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef7228e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2aa5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6ad2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb5816d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4afee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd7124c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee08500769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c4908eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf30238d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e8415276736aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b159216cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf006edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c1ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be2451d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642fbd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c1b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab651ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de985794730484777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23cba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce7243ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b7b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b680444d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa528138ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce7389613912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a93a022931b1f10886401d5fc249cbc9d0158945f4ecc0509041abc868077545d091e115b68c44341eec6fd6862140898e7399401f2ec319e3daefd931dcf1a3fffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e34adfa6682c546a5f87ac883fa09f6954b50fb7330f8e6b080a9a417548ab062674fc4565e1c6027648d10d91b1708cb4456f2e09220ab8f155c41ef790ea9b562", - "pos": 27 - } - ], - - "shielded_receives": [ - { - "note": { - "value": 40, - "payment_address":"ztron1nupklnacqyjc7ge998f6v2wutm7urdcdupl6j4ypq7qwws5yqfqrlxwvnylucwre8yewx5s0keu", - "rcm": "f2aa138d0d04b685b236d797458d0cf53749b96bbb6d5f1e6c5f2db31b0b2d09" - } - } - ], - "transparent_to_address":"TBaBXpRAeBhs75TZT751LwyhrcR25XeUot", - "to_amount":"2000", - "shielded_TRC20_contract_address": "TDxka3zetrpWsWoeWWjSAQDwM186UmzwQn", - "visible": true -} -``` -Note: the `to_amount` is the real value, the `value` in note is the scaled value by `scalingFactor` set in the shielded TRC-20 contract. In this example, the value of `scalingFactor` is 100. , namely 60 * 100 = 40 * 100 + 2000. - -Return: - -```bash -{ - "spend_description": [ - { - "value_commitment": "83ceceff3cc1ac470308b63798eaa9125d1076cb9f844cfaa8485021c3310951", - "anchor": "b0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126f", - "nullifier": "dbd34894ce33fee5836283233df7121c6d85443e047fd1c009c4cecbad1d650b", - "rk": "2e722d314646bcec8d4c546224bb9fa7396e0fc49a4c0e41a4c181ad7b0f2436", - "zkproof": "8897a1542eb85e396d5426b45db0d3b6874c1d404b01ce956b8bad1b4c4b321fa5104a6c156b6ddad4e0da70c9561984ad60534f3d4c3c65559cacff27f6b97da5e8d61a050340cc8e504f3bbfba3f7ef56f2732e9e0d96cacf49856c01858dd0337fcf26fedbc5a74abc2548551e0c1d2ee578823cf4ccf1e17df3be6e07883f84ecf86427de5f4d67f2d70f123227f9336f26dca69ea96c8c2fef6ecde8f08f0280444841d146b750e55035d46c4cc6fc60d8a0871b73822a6918e870d7046", - "spend_authority_signature": "1badc235792c4a56e476bb884b9d1f1aeff7cd9f0dc2cd67e24a601c4b633064c92f964546aa0d82ae89a952a796cead3d9222a5895263651f58f311492db000" - }], - "receive_description": [ - { - "value_commitment": "2216fe18613655c6f31c72981261fc9caa1b283e4a5b45d022aec131c14def2a", - "note_commitment": "75d9624ffdf9c1bcfe88104710403d8916183a8aa97635ac5573fd4d8d981158", - "epk": "a5b6ceb3232b6141fee1bfe8c989beb6100449b279f3be8271f829a343f256d4", - "c_enc": "7dc1b0c503e4f76c7063259d336fd06cbd1939439f24cca9560d8d0a7033423aebd6e6d6ec2dc6959e4b5ba8797562b7769d83f847200723cc934bd6f17544470ff043ba5e8bfb698320545663138fa710d381c2dd908716efb8a870ea787c0a74a1809315501186f424ec8cacaf04b6bf85489ebf0285149d7f0a4f100f15765da2df45576a7d2e9692e273178d5d7817bd49b367a66aa8b383fc597ac3090716ae3cdc42e6ef11dead9865fa92f317e1409bbacf58bfae30753d9b7adb37b04da6941fc6bca6650241ca2d550ab56e8a22ac974fc7d040c4266b33bda721b6a58e27260cedbb7a150cfec19f986081dfa7ff1b6fc218659c36b688ca63e98870f9beb1a51db115a1969b6167d0b0674f6dd614f12a7c64036b0601a7a605d1398b07abe089ee5a35947b3c36309c2ec7851e876f377d4d2eb4004f580ed86e85645fe3dbc97ff9754a36ef3e386621cf6d98257966f8eff7dd0495442a742dcfb533140f486ef52761056f070f3dc3f42cfae0cd9ac8155eb6c5c559406830a29a79f27784342cb48478d76fd3ff59d0ebdb33955c925b2b91bf94c20d8e414b32dd661020228ba37483e7690517ae02104624ab88d0d3e3030d0a5433228fac9f1ee7f3145f0b51fea5595a1cc515fedcabc5836055bb67367eda2243ac1419863d703502a2b6346d33f3e81a7c977dffdeb1d4474be7ea776cbb5ce90dd2b1a2a5f24cc6179f3f84593d39ab56cbb672e233f6b1dd516dcaf84da1667c73d3ca48db67248617ebf6fc89e392bf6520be7d0050b77ef3930f960a4b31f0f60a9a8a02", - "c_out": "beddff9adec9c46a05e12caf6fc675b06ff401c63d17ba251278f0dceba750cafaca2f0fed8c288d31722575f293936901eb084ba4ffd994e207c23fa9813814355a06932d8ce831eafd79008419b9e7", - "zkproof": "b26462d9cc1f010e5a5e581d2a8ff19a34262cf37c5724939c3f5c9ca9390a4aa4a55f92f1f922664b7648b7a0d5cf71821eca2cc57f3036d81caf7be0980329c76c3d5ceeea2d05809aaaa028f1856b2fe850772fdbd43b8b7405e3360e602201f26fcae68b9edd0ad17a337bdcb6caa8dea31059ebf7baac4a4b4bd0aab654f853307db82c9e42096fee17ec1235c1ac49e047ca3a4b801ce78d1e3c72fbc207ce827de9537b0faabe48d3f998d2acaa7acf48859af09cdfc3e433522bc1b4" - }], - "binding_signature": "fef9afbf88ca52c424421d5dfc212c16e187a5012351f3bba48c30b2878f2bc827bdcef18eb9fd5174f288d01300af7359f4be1fa1723e0a17bbbcb48ad42d09", - "message_hash": "c650bdaeacf86486ed9f100f010a89ee810ec2fec7e69a7b4f86c4100aacf390", - "trigger_contract_input": "dbd34894ce33fee5836283233df7121c6d85443e047fd1c009c4cecbad1d650bb0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126f83ceceff3cc1ac470308b63798eaa9125d1076cb9f844cfaa8485021c33109512e722d314646bcec8d4c546224bb9fa7396e0fc49a4c0e41a4c181ad7b0f24368897a1542eb85e396d5426b45db0d3b6874c1d404b01ce956b8bad1b4c4b321fa5104a6c156b6ddad4e0da70c9561984ad60534f3d4c3c65559cacff27f6b97da5e8d61a050340cc8e504f3bbfba3f7ef56f2732e9e0d96cacf49856c01858dd0337fcf26fedbc5a74abc2548551e0c1d2ee578823cf4ccf1e17df3be6e07883f84ecf86427de5f4d67f2d70f123227f9336f26dca69ea96c8c2fef6ecde8f08f0280444841d146b750e55035d46c4cc6fc60d8a0871b73822a6918e870d70461badc235792c4a56e476bb884b9d1f1aeff7cd9f0dc2cd67e24a601c4b633064c92f964546aa0d82ae89a952a796cead3d9222a5895263651f58f311492db00000000000000000000000000000000000000000000000000000000000000007d0fef9afbf88ca52c424421d5dfc212c16e187a5012351f3bba48c30b2878f2bc827bdcef18eb9fd5174f288d01300af7359f4be1fa1723e0a17bbbcb48ad42d090000000000000000000000411195752747f24146fd1fcd12c31600a81f7c5423c4c231ecb68f670bcd7892da38b297edefd91960bea3326c9b825abe726bea0dbac4c2d3c24a7dbfb82aec128876481f9740751dcd581d713ed33dfd9a1017b87d7b0af8be5361c23cd1e9575ed32ef30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000000175d9624ffdf9c1bcfe88104710403d8916183a8aa97635ac5573fd4d8d9811582216fe18613655c6f31c72981261fc9caa1b283e4a5b45d022aec131c14def2aa5b6ceb3232b6141fee1bfe8c989beb6100449b279f3be8271f829a343f256d4b26462d9cc1f010e5a5e581d2a8ff19a34262cf37c5724939c3f5c9ca9390a4aa4a55f92f1f922664b7648b7a0d5cf71821eca2cc57f3036d81caf7be0980329c76c3d5ceeea2d05809aaaa028f1856b2fe850772fdbd43b8b7405e3360e602201f26fcae68b9edd0ad17a337bdcb6caa8dea31059ebf7baac4a4b4bd0aab654f853307db82c9e42096fee17ec1235c1ac49e047ca3a4b801ce78d1e3c72fbc207ce827de9537b0faabe48d3f998d2acaa7acf48859af09cdfc3e433522bc1b400000000000000000000000000000000000000000000000000000000000000017dc1b0c503e4f76c7063259d336fd06cbd1939439f24cca9560d8d0a7033423aebd6e6d6ec2dc6959e4b5ba8797562b7769d83f847200723cc934bd6f17544470ff043ba5e8bfb698320545663138fa710d381c2dd908716efb8a870ea787c0a74a1809315501186f424ec8cacaf04b6bf85489ebf0285149d7f0a4f100f15765da2df45576a7d2e9692e273178d5d7817bd49b367a66aa8b383fc597ac3090716ae3cdc42e6ef11dead9865fa92f317e1409bbacf58bfae30753d9b7adb37b04da6941fc6bca6650241ca2d550ab56e8a22ac974fc7d040c4266b33bda721b6a58e27260cedbb7a150cfec19f986081dfa7ff1b6fc218659c36b688ca63e98870f9beb1a51db115a1969b6167d0b0674f6dd614f12a7c64036b0601a7a605d1398b07abe089ee5a35947b3c36309c2ec7851e876f377d4d2eb4004f580ed86e85645fe3dbc97ff9754a36ef3e386621cf6d98257966f8eff7dd0495442a742dcfb533140f486ef52761056f070f3dc3f42cfae0cd9ac8155eb6c5c559406830a29a79f27784342cb48478d76fd3ff59d0ebdb33955c925b2b91bf94c20d8e414b32dd661020228ba37483e7690517ae02104624ab88d0d3e3030d0a5433228fac9f1ee7f3145f0b51fea5595a1cc515fedcabc5836055bb67367eda2243ac1419863d703502a2b6346d33f3e81a7c977dffdeb1d4474be7ea776cbb5ce90dd2b1a2a5f24cc6179f3f84593d39ab56cbb672e233f6b1dd516dcaf84da1667c73d3ca48db67248617ebf6fc89e392bf6520be7d0050b77ef3930f960a4b31f0f60a9a8a02beddff9adec9c46a05e12caf6fc675b06ff401c63d17ba251278f0dceba750cafaca2f0fed8c288d31722575f293936901eb084ba4ffd994e207c23fa9813814355a06932d8ce831eafd79008419b9e7000000000000000000000000", - "parameter_type": "burn" -} -``` - -The `trigger_contract_input` can be used as the input data to trigger the `burn` function of the shielded TRC-20 contract. - -**2. Call api: wallet/createshieldedcontractparameterswithoutask to build the parameters** - -Method: Post - -Parameters: - -```json -{ - "ak": "66fda71a704eb463a13b6f43be7e296dd7ff3e6075e64badf462eca042f0b269", - "nsk": "572d8147283d90a938bd2867926fef485290c5fce37fad72eb733f9cd8a07e09", - "ovk": "1797de3b7f33cafffe3fe18c6b43ec6760add2ad81b10978d1fca5290497ede9", - "shielded_spends": [ - { - "note": { - "value": 60, - "payment_address":"ztron1mpwx0380fvw7gacf5hm4vl625ltmdezt0dwp3ssyd84y8jxzp3guqz9utzn35u7038jx6a6ucly", - "rcm": "b67b18fee3133440bfc4509912b96482fdcacbc0b5679af1785247c94224200c" - }, - "alpha": "b6de1a3a40764bd7a24147f155011624805bfcd6d21283c69a3f21aea9401201", - "root": "b0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126f", - "path": "b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c5381412935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62de1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef7228e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2aa5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6ad2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb5816d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4afee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd7124c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee08500769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c4908eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf30238d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e8415276736aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b159216cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf006edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c1ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be2451d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642fbd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c1b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab651ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de985794730484777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23cba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce7243ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b7b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b680444d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa528138ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce7389613912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a93a022931b1f10886401d5fc249cbc9d0158945f4ecc0509041abc868077545d091e115b68c44341eec6fd6862140898e7399401f2ec319e3daefd931dcf1a3fffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e34adfa6682c546a5f87ac883fa09f6954b50fb7330f8e6b080a9a417548ab062674fc4565e1c6027648d10d91b1708cb4456f2e09220ab8f155c41ef790ea9b562", - "pos": 27 - } - ], - "shielded_receives": [ - { - "note": { - "value": 40, - "payment_address":"ztron1nupklnacqyjc7ge998f6v2wutm7urdcdupl6j4ypq7qwws5yqfqrlxwvnylucwre8yewx5s0keu", - "rcm": "f2aa138d0d04b685b236d797458d0cf53749b96bbb6d5f1e6c5f2db31b0b2d09" - } - } - ], - "transparent_to_address":"TBaBXpRAeBhs75TZT751LwyhrcR25XeUot", - "to_amount":"2000", - "shielded_TRC20_contract_address": "TDxka3zetrpWsWoeWWjSAQDwM186UmzwQn", - "visible": true -} -``` -Note: the `to_amount` is the real value, the `value` in note is the scaled value by `scalingFactor` set in the shielded TRC-20 contract. In this example, the value of `scalingFactor` is 100, namely 60 * 100 = 40 * 100 + 2000. - -Return: - -```bash -{ - "spend_description": [ - { - "value_commitment": "c8565a546d8922f7b5fdba99504961ccf827fc3ffa23905e50ac2f4eef819766", - "anchor": "b0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126f", - "nullifier": "dbd34894ce33fee5836283233df7121c6d85443e047fd1c009c4cecbad1d650b", - "rk": "2e722d314646bcec8d4c546224bb9fa7396e0fc49a4c0e41a4c181ad7b0f2436", - "zkproof": "8f5c35655e812a02ee308c75c8d4fbda3c756319327e656d971b5b0e1507918beda848f44fdf10ca7bd9ff911608d2c8a8fb5378ff1c18e604302fe808c6ba3368d0cfeb0e0d976a81a419f9c7f33045a134d476e23de9e9c56e233beee76573016814d2424afebcd7a061054613e4db8c9d85d5258c5abb1c38576daa704018d5d15daa21c13bb6c8c400452d0c163d8eece84dea1d28fa1dcce6a91191d66b9a43d7c76f3535a9ff43f84e5243313e8381d75bf3bb02ef2196eb7b9f76351d" - }], - "receive_description": [ - { - "value_commitment": "0534ca13075b567ea6c2ebb487fb54b97ee0148e451ede224d1833f4b5394b8e", - "note_commitment": "75d9624ffdf9c1bcfe88104710403d8916183a8aa97635ac5573fd4d8d981158", - "epk": "96fd1aa79db655677d6a31c277e08ddb87527fa7b1848ed817ccc55a741c9210", - "c_enc": "14c3a0d8d62ded3ff49ec3f940b5b0458af28227e4419a63ee2b377146e1bd2d3e963eabcd22cd3cf76d54baa53de0099f785eed4d8ac994153371a04cbf9028ce9e4b1a0f2a0a56281a360508d8428b270960a720c0ff3659acd9445f0e8f6975ece1ce93b67daee879c17006a31bbea3c78ae494a54d7ef9ef3462d143f725cdc76b486ce92f32c25a93859e7c298287440338e984d7bb7191feb87af7cc9eb0e9d670222d7d309360463c1c0b863225d631bb1997fee37fcad3d8c18acea6377087df8b45256310c634120d4e974aecf1f24a0083a6671277ec452329652bd5a3b2cd5c2b7e03f4e70703624e9be1a30c543028a592da533dfa18305098d370207d473859051afa14062d8fc062eb946f0326c16aa8680efaa0e29a55547957a967122ac6ea8f3139c1d8392e5914c98fdf115f8f959c0cd11f466e9d8c9168ca592ed4f7cb7e900a8bf94cec047e86b1c6c606eeb9db7655498b0590680aacf91e1958d5c05d5f3cda5ae87d8ae92f285a4ae258c2c216857a4118052dad44673b3f60e2866f9c73d5696c3ddf4967aa1df3438b6a1a5e937f2af23e698c02021fdb1e1e80258313687a49100bb2965627c2369ef559c2b987bdfce8057c66091c0cf39d14eca98989856687248885b4006770f9121530da170963f16c4145d1777d060f7a406b09b23e139c576719d2f99f296f61ac8b9ee65dff7dfa307e2c4835aba2a4c5659aa2878d37f4250d01d4ea69be5911a417e5716e72c1a3bd505f64041ee28003508edb2a55c7e9475281fde204d31e541059e16fe4311a27075e87", - "c_out": "1e2057789a029d029792c60db3bb91218ce613d73e4fc486dbe90398e1475861d0b60eb5ed93bb16306cb1f0cff85b9c311cadd6a0902b906c887a5550b6c2ca99c50b72c3cb23faa0a22091122fcb0d", - "zkproof": "b08bbd60ea3784da8aec576e2e2edc068d8b4d21899ee3413ad4f7cbb9fd703bfa7f188a9c4424a5254445b97564ed0a8ca4c62a1176006f1b9852f4b7f0381f50a1e5d06820ffb4c8c2aeddd38435138e5ebb1f8324b6634d75582ae9823829062975d2d5a940e1de72cd6b5cb123737011e9c25f6df866d4ee5fcceacc60d347886af6241d4a8d074826a8698cc04096ee4fef38ec061a07a6a04c4e2c4bed4124e78bf1a030b233a01eca189827d59329cd18ea5e6481e76b2261a3cf678d" - }], - "binding_signature": "4cd9c8855bb27548e83c5aed968dd91f9e2d1aab1b5b4e9343774970c460f518f834f894760f03368da8d8e781c51e785e1a1a82c3f3efcf67e7b650b1585b00", - "message_hash": "f9f665aa712ee948c5a0fb5b3994d1ef0110060cd02725cf69d904112fa3f106", - "trigger_contract_input": "c4c231ecb68f670bcd7892da38b297edefd91960bea3326c9b825abe726bea0dbac4c2d3c24a7dbfb82aec128876481f9740751dcd581d713ed33dfd9a1017b87d7b0af8be5361c23cd1e9575ed32ef3", - "parameter_type": "burn" -} -``` - -Because of lacking the `ask`, the api can not generate the `spend_authority_signature`. Here, the `trigger_contract_input ` is some ciphertext used to generate the trigger shielded TRC-20 contract input for `burn`. To generate the `trigger_contract_input`, the user first needs to generate the spend `spend_authority_signature` by calling the api: - -**wallet/createspendauthsig** - -Method: Post - -Parameters: - -``` -{ - "ask": "0f63eabdfe2bbfe08012f6bb2db024e6809c16e8ed055aa41a6095424f192005", - "tx_hash": "f9f665aa712ee948c5a0fb5b3994d1ef0110060cd02725cf69d904112fa3f106", - "alpha": "0dfea932d1dc513b2bdebb1fd1f8124c4a2c93bb393fbba2d7dba8e045585207" -} -``` - -Return: - -``` -{ - "value": "1947036add76206b9f9b03ffd9d9526c5547db955387798f15c5e7c911f41eadc23eee214e64be792a404b77c64335a675c3489ca63d0d471de484c3a606d002" -} -``` - -The returned `value` is the `spend_authority_signature`. Then the user need to call the api: - -**wallet/gettriggerinputforshieldedtrc20contract** - -Method: Post - -Parameters: - -``` -{ - "shielded_TRC20_Parameters": { - "spend_description": [ - { - "value_commitment": "c8565a546d8922f7b5fdba99504961ccf827fc3ffa23905e50ac2f4eef819766", - "anchor": "b0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126f", - "nullifier": "dbd34894ce33fee5836283233df7121c6d85443e047fd1c009c4cecbad1d650b", - "rk": "2e722d314646bcec8d4c546224bb9fa7396e0fc49a4c0e41a4c181ad7b0f2436", - "zkproof": "8f5c35655e812a02ee308c75c8d4fbda3c756319327e656d971b5b0e1507918beda848f44fdf10ca7bd9ff911608d2c8a8fb5378ff1c18e604302fe808c6ba3368d0cfeb0e0d976a81a419f9c7f33045a134d476e23de9e9c56e233beee76573016814d2424afebcd7a061054613e4db8c9d85d5258c5abb1c38576daa704018d5d15daa21c13bb6c8c400452d0c163d8eece84dea1d28fa1dcce6a91191d66b9a43d7c76f3535a9ff43f84e5243313e8381d75bf3bb02ef2196eb7b9f76351d" - }], - "receive_description": [ - { - "value_commitment": "0534ca13075b567ea6c2ebb487fb54b97ee0148e451ede224d1833f4b5394b8e", - "note_commitment": "75d9624ffdf9c1bcfe88104710403d8916183a8aa97635ac5573fd4d8d981158", - "epk": "96fd1aa79db655677d6a31c277e08ddb87527fa7b1848ed817ccc55a741c9210", - "c_enc": "14c3a0d8d62ded3ff49ec3f940b5b0458af28227e4419a63ee2b377146e1bd2d3e963eabcd22cd3cf76d54baa53de0099f785eed4d8ac994153371a04cbf9028ce9e4b1a0f2a0a56281a360508d8428b270960a720c0ff3659acd9445f0e8f6975ece1ce93b67daee879c17006a31bbea3c78ae494a54d7ef9ef3462d143f725cdc76b486ce92f32c25a93859e7c298287440338e984d7bb7191feb87af7cc9eb0e9d670222d7d309360463c1c0b863225d631bb1997fee37fcad3d8c18acea6377087df8b45256310c634120d4e974aecf1f24a0083a6671277ec452329652bd5a3b2cd5c2b7e03f4e70703624e9be1a30c543028a592da533dfa18305098d370207d473859051afa14062d8fc062eb946f0326c16aa8680efaa0e29a55547957a967122ac6ea8f3139c1d8392e5914c98fdf115f8f959c0cd11f466e9d8c9168ca592ed4f7cb7e900a8bf94cec047e86b1c6c606eeb9db7655498b0590680aacf91e1958d5c05d5f3cda5ae87d8ae92f285a4ae258c2c216857a4118052dad44673b3f60e2866f9c73d5696c3ddf4967aa1df3438b6a1a5e937f2af23e698c02021fdb1e1e80258313687a49100bb2965627c2369ef559c2b987bdfce8057c66091c0cf39d14eca98989856687248885b4006770f9121530da170963f16c4145d1777d060f7a406b09b23e139c576719d2f99f296f61ac8b9ee65dff7dfa307e2c4835aba2a4c5659aa2878d37f4250d01d4ea69be5911a417e5716e72c1a3bd505f64041ee28003508edb2a55c7e9475281fde204d31e541059e16fe4311a27075e87", - "c_out": "1e2057789a029d029792c60db3bb91218ce613d73e4fc486dbe90398e1475861d0b60eb5ed93bb16306cb1f0cff85b9c311cadd6a0902b906c887a5550b6c2ca99c50b72c3cb23faa0a22091122fcb0d", - "zkproof": "b08bbd60ea3784da8aec576e2e2edc068d8b4d21899ee3413ad4f7cbb9fd703bfa7f188a9c4424a5254445b97564ed0a8ca4c62a1176006f1b9852f4b7f0381f50a1e5d06820ffb4c8c2aeddd38435138e5ebb1f8324b6634d75582ae9823829062975d2d5a940e1de72cd6b5cb123737011e9c25f6df866d4ee5fcceacc60d347886af6241d4a8d074826a8698cc04096ee4fef38ec061a07a6a04c4e2c4bed4124e78bf1a030b233a01eca189827d59329cd18ea5e6481e76b2261a3cf678d" - }], - "binding_signature": "4cd9c8855bb27548e83c5aed968dd91f9e2d1aab1b5b4e9343774970c460f518f834f894760f03368da8d8e781c51e785e1a1a82c3f3efcf67e7b650b1585b00", - "message_hash": "f9f665aa712ee948c5a0fb5b3994d1ef0110060cd02725cf69d904112fa3f106", - "trigger_contract_input": "c4c231ecb68f670bcd7892da38b297edefd91960bea3326c9b825abe726bea0dbac4c2d3c24a7dbfb82aec128876481f9740751dcd581d713ed33dfd9a1017b87d7b0af8be5361c23cd1e9575ed32ef3", - "parameter_type": "burn" - }, - "spend_authority_signature": [ - { - "value": "1947036add76206b9f9b03ffd9d9526c5547db955387798f15c5e7c911f41eadc23eee214e64be792a404b77c64335a675c3489ca63d0d471de484c3a606d002" - } - ], - "amount": "2000", - "transparent_to_address": "TV7ceN4tHDNPB47DMStcUFC3Y8QQ7KzN32", - "visible": true -} -``` - -Return: - -``` -{ - "value": "dbd34894ce33fee5836283233df7121c6d85443e047fd1c009c4cecbad1d650bb0b6f5be533b99be38bc9a3c2f3c75a9be263c42500a9e13ffb00df15cda126fc8565a546d8922f7b5fdba99504961ccf827fc3ffa23905e50ac2f4eef8197662e722d314646bcec8d4c546224bb9fa7396e0fc49a4c0e41a4c181ad7b0f24368f5c35655e812a02ee308c75c8d4fbda3c756319327e656d971b5b0e1507918beda848f44fdf10ca7bd9ff911608d2c8a8fb5378ff1c18e604302fe808c6ba3368d0cfeb0e0d976a81a419f9c7f33045a134d476e23de9e9c56e233beee76573016814d2424afebcd7a061054613e4db8c9d85d5258c5abb1c38576daa704018d5d15daa21c13bb6c8c400452d0c163d8eece84dea1d28fa1dcce6a91191d66b9a43d7c76f3535a9ff43f84e5243313e8381d75bf3bb02ef2196eb7b9f76351d1947036add76206b9f9b03ffd9d9526c5547db955387798f15c5e7c911f41eadc23eee214e64be792a404b77c64335a675c3489ca63d0d471de484c3a606d00200000000000000000000000000000000000000000000000000000000000007d04cd9c8855bb27548e83c5aed968dd91f9e2d1aab1b5b4e9343774970c460f518f834f894760f03368da8d8e781c51e785e1a1a82c3f3efcf67e7b650b1585b00000000000000000000000041d2017434977a0125039bfdc111922e9eb77f055bc4c231ecb68f670bcd7892da38b297edefd91960bea3326c9b825abe726bea0dbac4c2d3c24a7dbfb82aec128876481f9740751dcd581d713ed33dfd9a1017b87d7b0af8be5361c23cd1e9575ed32ef30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000000175d9624ffdf9c1bcfe88104710403d8916183a8aa97635ac5573fd4d8d9811580534ca13075b567ea6c2ebb487fb54b97ee0148e451ede224d1833f4b5394b8e96fd1aa79db655677d6a31c277e08ddb87527fa7b1848ed817ccc55a741c9210b08bbd60ea3784da8aec576e2e2edc068d8b4d21899ee3413ad4f7cbb9fd703bfa7f188a9c4424a5254445b97564ed0a8ca4c62a1176006f1b9852f4b7f0381f50a1e5d06820ffb4c8c2aeddd38435138e5ebb1f8324b6634d75582ae9823829062975d2d5a940e1de72cd6b5cb123737011e9c25f6df866d4ee5fcceacc60d347886af6241d4a8d074826a8698cc04096ee4fef38ec061a07a6a04c4e2c4bed4124e78bf1a030b233a01eca189827d59329cd18ea5e6481e76b2261a3cf678d000000000000000000000000000000000000000000000000000000000000000114c3a0d8d62ded3ff49ec3f940b5b0458af28227e4419a63ee2b377146e1bd2d3e963eabcd22cd3cf76d54baa53de0099f785eed4d8ac994153371a04cbf9028ce9e4b1a0f2a0a56281a360508d8428b270960a720c0ff3659acd9445f0e8f6975ece1ce93b67daee879c17006a31bbea3c78ae494a54d7ef9ef3462d143f725cdc76b486ce92f32c25a93859e7c298287440338e984d7bb7191feb87af7cc9eb0e9d670222d7d309360463c1c0b863225d631bb1997fee37fcad3d8c18acea6377087df8b45256310c634120d4e974aecf1f24a0083a6671277ec452329652bd5a3b2cd5c2b7e03f4e70703624e9be1a30c543028a592da533dfa18305098d370207d473859051afa14062d8fc062eb946f0326c16aa8680efaa0e29a55547957a967122ac6ea8f3139c1d8392e5914c98fdf115f8f959c0cd11f466e9d8c9168ca592ed4f7cb7e900a8bf94cec047e86b1c6c606eeb9db7655498b0590680aacf91e1958d5c05d5f3cda5ae87d8ae92f285a4ae258c2c216857a4118052dad44673b3f60e2866f9c73d5696c3ddf4967aa1df3438b6a1a5e937f2af23e698c02021fdb1e1e80258313687a49100bb2965627c2369ef559c2b987bdfce8057c66091c0cf39d14eca98989856687248885b4006770f9121530da170963f16c4145d1777d060f7a406b09b23e139c576719d2f99f296f61ac8b9ee65dff7dfa307e2c4835aba2a4c5659aa2878d37f4250d01d4ea69be5911a417e5716e72c1a3bd505f64041ee28003508edb2a55c7e9475281fde204d31e541059e16fe4311a27075e871e2057789a029d029792c60db3bb91218ce613d73e4fc486dbe90398e1475861d0b60eb5ed93bb16306cb1f0cff85b9c311cadd6a0902b906c887a5550b6c2ca99c50b72c3cb23faa0a22091122fcb0d000000000000000000000000" -} -``` - -The `value` can be used as the input data to trigger the `burn` function of the shielded TRC-20 contract. - -### Trigger the shielded TRC-20 contract -**Call api: wallet/triggersmartcontract to trigger the shielded TRC-20 contract and generate the shielded TRC-20 transaction** - -Method: Post - -Parameters: - -```json -{ - "owner_address": "411195752747f24146fd1fcd12c31600a81f7c5423", - "contract_address": "41959ec81ae3c002192fd25dff7f8d20b4bb6b76ee", - "function_selector": "mint(uint256,bytes32[9],bytes32[2],bytes32[21])", - "parameter": "00000000000000000000000000000000000000000000000000000000000013889fb4acd771c24fdd47aabb109b7596566509421cdc11d1f8babb5d5af22a614ef10f73d04837be9158010626423130663ad09d6436b97b694acb2b92d940201efa4a7ef3e2406c2c897894ea73cad3ded8dbcfb90521ec8488163b2baeef6a88aa9af11367a3cd1cd797937bb7f521162d5264e1f2dc39ca7c6b0eadf8520a1b5c2bd3bbe50835a9f3419b82909cbf60989f83496480008cceb6a3783bbc25d2921f86d79b0bad5d493766b8cf1f6bec74f6b67480e770c3a7f5b27a30ae3d4a13df273ab73e9107a5287883317bb5417b7f6841e197df99f5321807995c80fd3810f791845681560ccd3a4bfd8c56e298bc09b989e5279ca190ac3b29cdb7941315c027facc97bf1c0a02fa437dd68b335f8cbf0d9a3ba4a30302523609f40a177cc31961ca63a9c375b714831bc007ddbc5cfbafca368200b6c33b4b0aeadf537b47c16788bdc00981713b79f23fc0b4065ab9369072589728ed0cc3ac25076a2f8141a2637e589983210ce6d09e67c36167cb9fa5b4a9bf8daafc795b9c3978ffeade3698dfd4c86f3c7b2dd92c36e6303101b49fdd4f1e4357223c02f19329f6bb18f1f6d2e297e9fefa2d9f92f81ce07a8980effa10b8b8bf39aa19e80d96ef1c915cc55d1d26ea07b1c0da2ecf66b7f8b64657f6ac95466a983553f29a8bea3d78c178b2129745d432ddc95532e56f8e93625c674f20375a48990ca287591fcf0c476c3d1392d4e1355caf8d7352f895dc62da55d83e478ab00b78d5a68a0f50a69d9c595bcf494361517c703db9dba728e8c79a833d753f1977f526e9afd4b6daaff37fa0f1d52a63199fb3f8e97b7061a200aed5d2865de16b83b762638e6c8f9269967299a97618c1bd984f5afa25d170cf9eef601bdd1c1d33bd91813c19f70e102b16327e4cd3d4851bfa76b7caf45026c70d4f2b4872d7255133b07dc41b626228051537eee53083e9a11daf5fcc5cf7ca1cef99579362b1506a90fc1ed5d4fe8b7133c7179a2d3aee27dc802a90403ba445adb6eef8b35fd798fb0d374ce3c8b4a6870bcf32651c9c32cfeafbb0672f50561d76826b938b9b2c44029bc5d11838d453a48565c70e0d3c8f2a915ba932a02271c73046b2c53aaf6e27bb72a567a26e2a4164974fc52d0ad7fa5dddfe9390007e2fc3ad46d644be55519e01a2cce76744f165c6705d3b007d2f649df84e3783622f5e077fe37fdd192896eae9b1245322db6e3242714a0552253b472103553f09b6b1d32804742375d3b140d2ebff2155b6248d07992f40e5537a0587315c451ac53cee490ce49c3b321a967558c39f789bf5d35859d4136bcf4178bf6b1814d617e139aa35710edcd325dd03957462070393b7066182fc56be713bba49a2359db71604e97e9350af687a7f185d7905d8900f7e2431386c00e55e32000000000000000000000000", - "call_value": 0, - "call_token_value": 0, - "token_id": 0, - "fee_limit": 1000000000 -} -``` -Return: -```bash -{ - "result":{ - "result":true - }, - "transaction":{ - "visible":false, - "txID":"d8ae793212147ed7d64f96a1a6c1477aeeecdedf6f5cb2e7cd897f70c7c2603e", - "raw_data":{ - "contract":[ - { - "parameter":{ - "value":{ - "data": "855d175e00000000000000000000000000000000000000000000000000000000000013889fb4acd771c24fdd47aabb109b7596566509421cdc11d1f8babb5d5af22a614ef10f73d04837be9158010626423130663ad09d6436b97b694acb2b92d940201efa4a7ef3e2406c2c897894ea73cad3ded8dbcfb90521ec8488163b2baeef6a88aa9af11367a3cd1cd797937bb7f521162d5264e1f2dc39ca7c6b0eadf8520a1b5c2bd3bbe50835a9f3419b82909cbf60989f83496480008cceb6a3783bbc25d2921f86d79b0bad5d493766b8cf1f6bec74f6b67480e770c3a7f5b27a30ae3d4a13df273ab73e9107a5287883317bb5417b7f6841e197df99f5321807995c80fd3810f791845681560ccd3a4bfd8c56e298bc09b989e5279ca190ac3b29cdb7941315c027facc97bf1c0a02fa437dd68b335f8cbf0d9a3ba4a30302523609f40a177cc31961ca63a9c375b714831bc007ddbc5cfbafca368200b6c33b4b0aeadf537b47c16788bdc00981713b79f23fc0b4065ab9369072589728ed0cc3ac25076a2f8141a2637e589983210ce6d09e67c36167cb9fa5b4a9bf8daafc795b9c3978ffeade3698dfd4c86f3c7b2dd92c36e6303101b49fdd4f1e4357223c02f19329f6bb18f1f6d2e297e9fefa2d9f92f81ce07a8980effa10b8b8bf39aa19e80d96ef1c915cc55d1d26ea07b1c0da2ecf66b7f8b64657f6ac95466a983553f29a8bea3d78c178b2129745d432ddc95532e56f8e93625c674f20375a48990ca287591fcf0c476c3d1392d4e1355caf8d7352f895dc62da55d83e478ab00b78d5a68a0f50a69d9c595bcf494361517c703db9dba728e8c79a833d753f1977f526e9afd4b6daaff37fa0f1d52a63199fb3f8e97b7061a200aed5d2865de16b83b762638e6c8f9269967299a97618c1bd984f5afa25d170cf9eef601bdd1c1d33bd91813c19f70e102b16327e4cd3d4851bfa76b7caf45026c70d4f2b4872d7255133b07dc41b626228051537eee53083e9a11daf5fcc5cf7ca1cef99579362b1506a90fc1ed5d4fe8b7133c7179a2d3aee27dc802a90403ba445adb6eef8b35fd798fb0d374ce3c8b4a6870bcf32651c9c32cfeafbb0672f50561d76826b938b9b2c44029bc5d11838d453a48565c70e0d3c8f2a915ba932a02271c73046b2c53aaf6e27bb72a567a26e2a4164974fc52d0ad7fa5dddfe9390007e2fc3ad46d644be55519e01a2cce76744f165c6705d3b007d2f649df84e3783622f5e077fe37fdd192896eae9b1245322db6e3242714a0552253b472103553f09b6b1d32804742375d3b140d2ebff2155b6248d07992f40e5537a0587315c451ac53cee490ce49c3b321a967558c39f789bf5d35859d4136bcf4178bf6b1814d617e139aa35710edcd325dd03957462070393b7066182fc56be713bba49a2359db71604e97e9350af687a7f185d7905d8900f7e2431386c00e55e32000000000000000000000000", - "owner_address":"411195752747f24146fd1fcd12c31600a81f7c5423", - "contract_address":"41959ec81ae3c002192fd25dff7f8d20b4bb6b76ee" - }, - "type_url":"type.googleapis.com/protocol.TriggerSmartContract" - }, - "type":"TriggerSmartContract" - }], - "ref_block_bytes":"f1a0", - "ref_block_hash":"6525d0bb0966c224", - "expiration":1593795795000, - "fee_limit":1000000000, - "timestamp":1593795737687 - }, - "raw_data_hex": "0a02f1a022086525d0bb0966c22440b8b087adb12e5a9009081f128b090a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412d5080a15411195752747f24146fd1fcd12c31600a81f7c5423121541959ec81ae3c002192fd25dff7f8d20b4bb6b76ee22a408855d175e00000000000000000000000000000000000000000000000000000000000013889fb4acd771c24fdd47aabb109b7596566509421cdc11d1f8babb5d5af22a614ef10f73d04837be9158010626423130663ad09d6436b97b694acb2b92d940201efa4a7ef3e2406c2c897894ea73cad3ded8dbcfb90521ec8488163b2baeef6a88aa9af11367a3cd1cd797937bb7f521162d5264e1f2dc39ca7c6b0eadf8520a1b5c2bd3bbe50835a9f3419b82909cbf60989f83496480008cceb6a3783bbc25d2921f86d79b0bad5d493766b8cf1f6bec74f6b67480e770c3a7f5b27a30ae3d4a13df273ab73e9107a5287883317bb5417b7f6841e197df99f5321807995c80fd3810f791845681560ccd3a4bfd8c56e298bc09b989e5279ca190ac3b29cdb7941315c027facc97bf1c0a02fa437dd68b335f8cbf0d9a3ba4a30302523609f40a177cc31961ca63a9c375b714831bc007ddbc5cfbafca368200b6c33b4b0aeadf537b47c16788bdc00981713b79f23fc0b4065ab9369072589728ed0cc3ac25076a2f8141a2637e589983210ce6d09e67c36167cb9fa5b4a9bf8daafc795b9c3978ffeade3698dfd4c86f3c7b2dd92c36e6303101b49fdd4f1e4357223c02f19329f6bb18f1f6d2e297e9fefa2d9f92f81ce07a8980effa10b8b8bf39aa19e80d96ef1c915cc55d1d26ea07b1c0da2ecf66b7f8b64657f6ac95466a983553f29a8bea3d78c178b2129745d432ddc95532e56f8e93625c674f20375a48990ca287591fcf0c476c3d1392d4e1355caf8d7352f895dc62da55d83e478ab00b78d5a68a0f50a69d9c595bcf494361517c703db9dba728e8c79a833d753f1977f526e9afd4b6daaff37fa0f1d52a63199fb3f8e97b7061a200aed5d2865de16b83b762638e6c8f9269967299a97618c1bd984f5afa25d170cf9eef601bdd1c1d33bd91813c19f70e102b16327e4cd3d4851bfa76b7caf45026c70d4f2b4872d7255133b07dc41b626228051537eee53083e9a11daf5fcc5cf7ca1cef99579362b1506a90fc1ed5d4fe8b7133c7179a2d3aee27dc802a90403ba445adb6eef8b35fd798fb0d374ce3c8b4a6870bcf32651c9c32cfeafbb0672f50561d76826b938b9b2c44029bc5d11838d453a48565c70e0d3c8f2a915ba932a02271c73046b2c53aaf6e27bb72a567a26e2a4164974fc52d0ad7fa5dddfe9390007e2fc3ad46d644be55519e01a2cce76744f165c6705d3b007d2f649df84e3783622f5e077fe37fdd192896eae9b1245322db6e3242714a0552253b472103553f09b6b1d32804742375d3b140d2ebff2155b6248d07992f40e5537a0587315c451ac53cee490ce49c3b321a967558c39f789bf5d35859d4136bcf4178bf6b1814d617e139aa35710edcd325dd03957462070393b7066182fc56be713bba49a2359db71604e97e9350af687a7f185d7905d8900f7e2431386c00e55e3200000000000000000000000070d7f083adb12e90018094ebdc03" - } -} -``` - -Note: the above is an example for triggering the `mint` function. For `transfer` and `burn`, it's similar. - -### Broadcast the shielded TRC-20 transaction - -**Call api: wallet/broadcasttransaction to broadcast this transaction** - -Method: Post - -Parameters: - -```json -{ - "txID":"d8ae793212147ed7d64f96a1a6c1477aeeecdedf6f5cb2e7cd897f70c7c2603e", - "raw_data":{ - "contract":[ - { - "parameter":{ - "value":{ - "data": "855d175e00000000000000000000000000000000000000000000000000000000000013889fb4acd771c24fdd47aabb109b7596566509421cdc11d1f8babb5d5af22a614ef10f73d04837be9158010626423130663ad09d6436b97b694acb2b92d940201efa4a7ef3e2406c2c897894ea73cad3ded8dbcfb90521ec8488163b2baeef6a88aa9af11367a3cd1cd797937bb7f521162d5264e1f2dc39ca7c6b0eadf8520a1b5c2bd3bbe50835a9f3419b82909cbf60989f83496480008cceb6a3783bbc25d2921f86d79b0bad5d493766b8cf1f6bec74f6b67480e770c3a7f5b27a30ae3d4a13df273ab73e9107a5287883317bb5417b7f6841e197df99f5321807995c80fd3810f791845681560ccd3a4bfd8c56e298bc09b989e5279ca190ac3b29cdb7941315c027facc97bf1c0a02fa437dd68b335f8cbf0d9a3ba4a30302523609f40a177cc31961ca63a9c375b714831bc007ddbc5cfbafca368200b6c33b4b0aeadf537b47c16788bdc00981713b79f23fc0b4065ab9369072589728ed0cc3ac25076a2f8141a2637e589983210ce6d09e67c36167cb9fa5b4a9bf8daafc795b9c3978ffeade3698dfd4c86f3c7b2dd92c36e6303101b49fdd4f1e4357223c02f19329f6bb18f1f6d2e297e9fefa2d9f92f81ce07a8980effa10b8b8bf39aa19e80d96ef1c915cc55d1d26ea07b1c0da2ecf66b7f8b64657f6ac95466a983553f29a8bea3d78c178b2129745d432ddc95532e56f8e93625c674f20375a48990ca287591fcf0c476c3d1392d4e1355caf8d7352f895dc62da55d83e478ab00b78d5a68a0f50a69d9c595bcf494361517c703db9dba728e8c79a833d753f1977f526e9afd4b6daaff37fa0f1d52a63199fb3f8e97b7061a200aed5d2865de16b83b762638e6c8f9269967299a97618c1bd984f5afa25d170cf9eef601bdd1c1d33bd91813c19f70e102b16327e4cd3d4851bfa76b7caf45026c70d4f2b4872d7255133b07dc41b626228051537eee53083e9a11daf5fcc5cf7ca1cef99579362b1506a90fc1ed5d4fe8b7133c7179a2d3aee27dc802a90403ba445adb6eef8b35fd798fb0d374ce3c8b4a6870bcf32651c9c32cfeafbb0672f50561d76826b938b9b2c44029bc5d11838d453a48565c70e0d3c8f2a915ba932a02271c73046b2c53aaf6e27bb72a567a26e2a4164974fc52d0ad7fa5dddfe9390007e2fc3ad46d644be55519e01a2cce76744f165c6705d3b007d2f649df84e3783622f5e077fe37fdd192896eae9b1245322db6e3242714a0552253b472103553f09b6b1d32804742375d3b140d2ebff2155b6248d07992f40e5537a0587315c451ac53cee490ce49c3b321a967558c39f789bf5d35859d4136bcf4178bf6b1814d617e139aa35710edcd325dd03957462070393b7066182fc56be713bba49a2359db71604e97e9350af687a7f185d7905d8900f7e2431386c00e55e32000000000000000000000000", - "owner_address":"411195752747f24146fd1fcd12c31600a81f7c5423", - "contract_address":"41959ec81ae3c002192fd25dff7f8d20b4bb6b76ee" - }, - "type_url":"type.googleapis.com/protocol.TriggerSmartContract" - }, - "type":"TriggerSmartContract" - }], - "ref_block_bytes":"f1a0", - "ref_block_hash":"6525d0bb0966c224", - "expiration":1593795795000, - "fee_limit":1000000000, - "timestamp":1593795737687 - }, - "signature": "2c1593a78911b9183bd513fcaeeec1440a9a5bd2896adde30411872bfc2d551a1b8211455d3ff686e08d02d230ea4d50e8d4875a88bc13e368e2e4aab80dcb4901", - "raw_data_hex": "0a02f1a022086525d0bb0966c22440b8b087adb12e5a9009081f128b090a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412d5080a15411195752747f24146fd1fcd12c31600a81f7c5423121541959ec81ae3c002192fd25dff7f8d20b4bb6b76ee22a408855d175e00000000000000000000000000000000000000000000000000000000000013889fb4acd771c24fdd47aabb109b7596566509421cdc11d1f8babb5d5af22a614ef10f73d04837be9158010626423130663ad09d6436b97b694acb2b92d940201efa4a7ef3e2406c2c897894ea73cad3ded8dbcfb90521ec8488163b2baeef6a88aa9af11367a3cd1cd797937bb7f521162d5264e1f2dc39ca7c6b0eadf8520a1b5c2bd3bbe50835a9f3419b82909cbf60989f83496480008cceb6a3783bbc25d2921f86d79b0bad5d493766b8cf1f6bec74f6b67480e770c3a7f5b27a30ae3d4a13df273ab73e9107a5287883317bb5417b7f6841e197df99f5321807995c80fd3810f791845681560ccd3a4bfd8c56e298bc09b989e5279ca190ac3b29cdb7941315c027facc97bf1c0a02fa437dd68b335f8cbf0d9a3ba4a30302523609f40a177cc31961ca63a9c375b714831bc007ddbc5cfbafca368200b6c33b4b0aeadf537b47c16788bdc00981713b79f23fc0b4065ab9369072589728ed0cc3ac25076a2f8141a2637e589983210ce6d09e67c36167cb9fa5b4a9bf8daafc795b9c3978ffeade3698dfd4c86f3c7b2dd92c36e6303101b49fdd4f1e4357223c02f19329f6bb18f1f6d2e297e9fefa2d9f92f81ce07a8980effa10b8b8bf39aa19e80d96ef1c915cc55d1d26ea07b1c0da2ecf66b7f8b64657f6ac95466a983553f29a8bea3d78c178b2129745d432ddc95532e56f8e93625c674f20375a48990ca287591fcf0c476c3d1392d4e1355caf8d7352f895dc62da55d83e478ab00b78d5a68a0f50a69d9c595bcf494361517c703db9dba728e8c79a833d753f1977f526e9afd4b6daaff37fa0f1d52a63199fb3f8e97b7061a200aed5d2865de16b83b762638e6c8f9269967299a97618c1bd984f5afa25d170cf9eef601bdd1c1d33bd91813c19f70e102b16327e4cd3d4851bfa76b7caf45026c70d4f2b4872d7255133b07dc41b626228051537eee53083e9a11daf5fcc5cf7ca1cef99579362b1506a90fc1ed5d4fe8b7133c7179a2d3aee27dc802a90403ba445adb6eef8b35fd798fb0d374ce3c8b4a6870bcf32651c9c32cfeafbb0672f50561d76826b938b9b2c44029bc5d11838d453a48565c70e0d3c8f2a915ba932a02271c73046b2c53aaf6e27bb72a567a26e2a4164974fc52d0ad7fa5dddfe9390007e2fc3ad46d644be55519e01a2cce76744f165c6705d3b007d2f649df84e3783622f5e077fe37fdd192896eae9b1245322db6e3242714a0552253b472103553f09b6b1d32804742375d3b140d2ebff2155b6248d07992f40e5537a0587315c451ac53cee490ce49c3b321a967558c39f789bf5d35859d4136bcf4178bf6b1814d617e139aa35710edcd325dd03957462070393b7066182fc56be713bba49a2359db71604e97e9350af687a7f185d7905d8900f7e2431386c00e55e3200000000000000000000000070d7f083adb12e90018094ebdc03" -} -``` -Return: -```bash -{"result": true} -``` -Note: before broadcasting the transaction, the sender should sign the transaction by its private key to generate the signature and add it to the transaction. - -### Scan shielded TRC-20 notes by `ivk` - -**Call api: wallet/scanshieldedtrc20notesbyivk to scan the shielded TRC-20 notes** - -Method: Post and Get - -Parameters: - -```json -{ - "start_block_index": 46079, - "end_block_index": 46091, - "shielded_TRC20_contract_address": "TDxka3zetrpWsWoeWWjSAQDwM186UmzwQn", - "ivk": "c1898b84ced7e5c8840632ad1203d56b4a8ebbaa8425dd8b5a5b3d43578e1006", - "ak": "66fda71a704eb463a13b6f43be7e296dd7ff3e6075e64badf462eca042f0b269", - "nk": "b5f558a783c968b624f7cfc9a4f2c909332c0c514a8a419e552337e82e073f66", - "visible": true -} -``` -Return: -```bash -{ - "noteTxs":[ - { - "note":{ - "payment_address":"ztron1e453jrrxwsvj6s480a2rduz28jfedrsjwu0xsfk8psd85hajeyc6jx56nh0x7ngclh6tytr28wn", - "value":60, - "rcm":"e51c6ef6c51ab1bb289056db13d44c0af35e70e18d76d8e9f270176663d8f50d" - }, - "is_spent":true, - "txid":"59b64426f6bffead22739eb7aee626e11258cb899bc035c7e9d86bb495414dd8", - "index":0, - "position":9 - }] -} -``` -### Scan shielded TRC-20 notes by `ovk` - -**Call api: wallet/scanshieldedtrc20notesbyovk to scan the shileded TRC-20 notes** - -Method: Post and Get - -Parameters: - -```json -{ - "start_block_index": 46079, - "end_block_index": 46091, - "shielded_TRC20_contract_address": "TDxka3zetrpWsWoeWWjSAQDwM186UmzwQn", - "ovk": "4364c875deeb663781a2f1530f9e4f87ea81cc3c757ca2a30fa4768940de2f98", - "visible": true -} -``` -Return: -```bash -{ - "noteTxs":[ - { - "note":{ - "payment_address": "ztron1e453jrrxwsvj6s480a2rduz28jfedrsjwu0xsfk8psd85hajeyc6jx56nh0x7ngclh6tytr28wn", - "value":60, - "rcm":"e51c6ef6c51ab1bb289056db13d44c0af35e70e18d76d8e9f270176663d8f50d" - }, - "txid":"59b64426f6bffead22739eb7aee626e11258cb899bc035c7e9d86bb495414dd8", - "index":0 - }, - { - "note":{ - "payment_address": "ztron129rzep2kymh87rwpp6eqk65l7a395y4w2t4zdma7chca4f8thncedlhkynta8655v3swqwna6qc", - "value":20, - "rcm":"05f8adce01aa4aa61058b77924d46554edbecb3138f7704d7dc98180c3d88c07" - }, - "txid":"ae633c43530ba54b6684e795720dd1c74834744988a65b0af2baea41099f2f66", - "index":0 - }, - { - "to_amount":"4000", - "txid":"ae633c43530ba54b6684e795720dd1c74834744988a65b0af2baea41099f2f66", - "index":1, - "transparent_to_address":"TBaBXpRAeBhs75TZT751LwyhrcR25XeUot" - }] -} -``` - -### Check the shielded TRC-20 note status - -**Call api: wallet/isshieldedtrc20contractNoteSpent to check the shielded TRC-20 note status whether it is spent** - -Method: Post - -Parameters: - -```json -{ - "note": { - "value": 40, - "payment_address":"ztron1nzfh9270dvpn0gysedl9gx6wfmh2hve3rtf0m57vla04pfjm3ermmrh9yasa2xnuy2zycsvwawe", - "rcm": "b269a741bde1de2df79ffccf96d6eb646aa996e6567c208d774e851aef3e1909" - }, - "ak": "8072d9110c9de9d9ade33d5d0f5890a7aa65b0cde42af7816d187297caf2fd64", - "nk": "590bf33f93f792be659fd404df91e75c3b08d38d4e08ee226c3f5219cf598f14", - "position": 1, - "shielded_TRC20_contract_address": "41e6e90fbc958ba09483550882b1f0327e0193250a" -} -``` -Return: -```bash -{"is_spent": true} -``` - - diff --git a/docs/mechanism-algorithm/shielded-transaction.md b/docs/mechanism-algorithm/shielded-transaction.md deleted file mode 100644 index 431734c5c..000000000 --- a/docs/mechanism-algorithm/shielded-transaction.md +++ /dev/null @@ -1,218 +0,0 @@ -# Shielded Transaction - -## Introduction - -TRON shielded transaction uses zk-SNARK(Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) to implement a completely anonymous transaction. TronZ is the name of shielded trc10 token. - -In shielded transaction of transferring TronZ, the sender and the receiver's address and transfer amount can both be completely confidential. - -In shielded transaction of transferring TronZ, there are two types of address: - -- "t-addr" (Transparent Address) -- "z-addr" (Shielded Address) - -"t-addr" address uses TRON account model. -"z-addr" address uses Anonymous account model. - -In shielded transaction of transferring TronZ, there are three types of transfer transaction: - -- From "t-addr" to "z-addr": -The transaction information of "t-addr" can be tracked, "z-addr" can not be tracked. - -- From "z-addr" to "z-addr": -The transaction information of both "z-addr" can not be tracked. - -- From "z-addr" to "t-addr": -The transaction information of both "t-addr" can be tracked, "z-addr" can not be tracked. - -From "t-addr" to "t-addr" are not supported. - -### Usage Guide - -1. The sender can only spend one note in each transfer. The receiver can receive two notes in each transfer at most. - -2. When you transfer from "z-addr" to "t-addr", if no note returns to "z-addr" as a change, it will generate a note of zero value automatically, and send it to a random black hole address. - -3. The fee for each shielded transaction is xx. - - -The doc below describes how to use TRON Shielded Transaction with http api. - -### Transfer from transparent address to shielded address - -**Step 1. Call api: wallet/createshieldedtransaction to build the transaction** -Method: Post -Parameters: -```json -{ - "transparent_from_address":"41A7D8A35B260395C14AA456297662092BA3B76FC0", - "from_amount":100000000, - "ovk":"798ba79bfec55e154fa69b4e6a96247288f727b5e4ecc5cd848aefc0afab02b6", - "shielded_receives":[{ - "note": - { - "value": 500000000, - "payment_address": "ztron1jld8fmvujrz2vgkc867zuwklmewy4ypw0wtwgweqs2paee0uhc8f3azy90el770arksa2kunl02", - "rcm": "723053bcbfecdf5da66c18ab0376476ef308c61b7abe891b2c01e903bcb87c0e" - } - }] -} -``` -Return: -```bash -{"txID":"1967c40954e8c6c4761c377a021ec3a6ad0545d8b4443f0ccdd1bec4dcbaa497","raw_data":{"contract":[{"parameter":{"value":{"transparent_from_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0","binding_signature":"5407f7f7d43ae313bf54b8d6a8cf716f65390171e39c11c07b4c90e5ae7d5d114b1729d44a3bc58f6e40c413b972e8ab61a8e66502b30df35937f64957c0da0a","from_amount":100000000,"fee":10000000,"receive_description":[{"value_commitment":"5a1cd384edab9c38901d0250ebdf96d4f29889094b7096a7ce2dd6af919afd21","note_commitment":"f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b62","epk":"e7ff2357376eafdabc6db3fdabc079e42dd14c61a9a08c6cd38405d086086b4b","c_enc":"d1aaf220f531f31bd2d9ff6f6d59998e78f3f0d30c852258441c5d54fc6790af7620b8860f6ec48d93fedb4c9bbb0e43c8144a9e304ceee399ac6da0bb91dbace3c8a93e03f1d2a5a88b0998704a09a51ab147096a994420741e87168cda4f45f8ed03c816e947909f2997d48e2ceaed45c539463e5e8caf6a0a1529615afbfa01df0a89c6360512519aea8a1b30a367a8749b24946fcd2fbbc6cfbbb6562ed6aa16db5d9e76b1872683a841ebda3a16dda6083474c2ea5a81f4e5c04e6af6ed582f58cab36bc016cfcf03337bc64b5411c7cb6f6f55e17d96bfead8becb0b7661768e122c943159ff2854c0e6efdd408b5bd5afc9d629645bfff8d4a240591fa9adc37e4a5bc046fcf31f8088f3616dd2f69860e401221585fd1a5ebe88080742802ae4696b8ba5e826ddd42841dce71b4b3ebe47b1f254103ae49f0bd9d61f5c0193441c471d29535247c26ab9297975497f6051466dbc591c4cd7b4246604e445d7d3a1dd77538c1989a8c48f829c6a1ce0dee84019ef68b7407def2492f5c867f659b0f8f58cc1081706453bf3a1ec719927c6b3defdcc002e9f2f63b4bdb7f69a00db742d2571d7293bae3faffc43ea0ff032e1b262a3597290c6c9117a006c91074a455c80a3a8089d93aed5bd48bd04bb30ad68fc87ff2bb4e5c20fe4bc0ad1b586aef3d1183170dec490c6bc82ec85d4031e292782f8778f21252a7cb6730da2d8fb175017e213eb10527b104bf333767cfed23c7c993391d9029f404947a793c37c1880a6be5cc26cc447ea020db8832239aa09aad9876ec17c4095857971ae","c_out":"8e3df70e1feaf8da5da72062d13c5200ab09f43e45d2ba1aac8a56c8e9d033d786cfe3ed7d2b30d8b6124afe2646c7af25b60ed02c3a50b2cb62637461e00b153b92f868f2194b46c49e9a1c9e987d5a","zkproof":"8b338777245e733183101027436ea41ea15f61537f38a35109fe6e53806c7913c69f186a86ba1d63997c5301c650089aa888cdf939573b0e7aceefff59757f8ba2275bd4469de04174f1b450a53017260b4bbc4a27cd8aac45d5ff2e5f5ab0eb14ffc59cf0fa10cd32363ef9a9fb9bf68431c4ee1c2ca15797ba4c18dbde24ae451797b25f13a73a231783f72b6f7a429026e191a49619057b250fab6b7010fc58dfcf922b04ad83756e2b8780100dccaafc65e4ef0357c6aae57f4f5c790607"}]},"type_url":"type.googleapis.com/protocol.ShieldedTransferContract"},"type":"ShieldedTransferContract"}],"ref_block_bytes":"0245","ref_block_hash":"b1ea272768028540","expiration":1558691289000,"timestamp":1558691230861},"raw_data_hex":"0a0202452208b1ea27276802854040a8aff6c9ae2d5ae708083312e2080a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e536869656c6465645472616e73666572436f6e747261637412a8080a1541a7d8a35b260395c14aa456297662092ba3b76fc01080c2d72f22c2070a205a1cd384edab9c38901d0250ebdf96d4f29889094b7096a7ce2dd6af919afd211220f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b621a20e7ff2357376eafdabc6db3fdabc079e42dd14c61a9a08c6cd38405d086086b4b22c404d1aaf220f531f31bd2d9ff6f6d59998e78f3f0d30c852258441c5d54fc6790af7620b8860f6ec48d93fedb4c9bbb0e43c8144a9e304ceee399ac6da0bb91dbace3c8a93e03f1d2a5a88b0998704a09a51ab147096a994420741e87168cda4f45f8ed03c816e947909f2997d48e2ceaed45c539463e5e8caf6a0a1529615afbfa01df0a89c6360512519aea8a1b30a367a8749b24946fcd2fbbc6cfbbb6562ed6aa16db5d9e76b1872683a841ebda3a16dda6083474c2ea5a81f4e5c04e6af6ed582f58cab36bc016cfcf03337bc64b5411c7cb6f6f55e17d96bfead8becb0b7661768e122c943159ff2854c0e6efdd408b5bd5afc9d629645bfff8d4a240591fa9adc37e4a5bc046fcf31f8088f3616dd2f69860e401221585fd1a5ebe88080742802ae4696b8ba5e826ddd42841dce71b4b3ebe47b1f254103ae49f0bd9d61f5c0193441c471d29535247c26ab9297975497f6051466dbc591c4cd7b4246604e445d7d3a1dd77538c1989a8c48f829c6a1ce0dee84019ef68b7407def2492f5c867f659b0f8f58cc1081706453bf3a1ec719927c6b3defdcc002e9f2f63b4bdb7f69a00db742d2571d7293bae3faffc43ea0ff032e1b262a3597290c6c9117a006c91074a455c80a3a8089d93aed5bd48bd04bb30ad68fc87ff2bb4e5c20fe4bc0ad1b586aef3d1183170dec490c6bc82ec85d4031e292782f8778f21252a7cb6730da2d8fb175017e213eb10527b104bf333767cfed23c7c993391d9029f404947a793c37c1880a6be5cc26cc447ea020db8832239aa09aad9876ec17c4095857971ae2a508e3df70e1feaf8da5da72062d13c5200ab09f43e45d2ba1aac8a56c8e9d033d786cfe3ed7d2b30d8b6124afe2646c7af25b60ed02c3a50b2cb62637461e00b153b92f868f2194b46c49e9a1c9e987d5a32c0018b338777245e733183101027436ea41ea15f61537f38a35109fe6e53806c7913c69f186a86ba1d63997c5301c650089aa888cdf939573b0e7aceefff59757f8ba2275bd4469de04174f1b450a53017260b4bbc4a27cd8aac45d5ff2e5f5ab0eb14ffc59cf0fa10cd32363ef9a9fb9bf68431c4ee1c2ca15797ba4c18dbde24ae451797b25f13a73a231783f72b6f7a429026e191a49619057b250fab6b7010fc58dfcf922b04ad83756e2b8780100dccaafc65e4ef0357c6aae57f4f5c7906072a405407f7f7d43ae313bf54b8d6a8cf716f65390171e39c11c07b4c90e5ae7d5d114b1729d44a3bc58f6e40c413b972e8ab61a8e66502b30df35937f64957c0da0a4080ade204708de9f2c9ae2d"} - -``` -**Step 2. Sign the transaction using SDK** - - -**Step 3. Call api: wallet/broadcasttransaction to broadcast the transaction** -Method: Post -Parameters: -```bash -{"signature":["5c1939e2e1177f44a6d168b5e473bd193ea099aa369ffe27727d560f1c72a3226dd4be61c19a09cabbe3f4a7433932df11cf3e54c4fc04cff0eea6906f04c32a00"],"txID":"1967c40954e8c6c4761c377a021ec3a6ad0545d8b4443f0ccdd1bec4dcbaa497","raw_data":{"contract":[{"parameter":{"value":{"transparent_from_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0","binding_signature":"5407f7f7d43ae313bf54b8d6a8cf716f65390171e39c11c07b4c90e5ae7d5d114b1729d44a3bc58f6e40c413b972e8ab61a8e66502b30df35937f64957c0da0a","from_amount":100000000,"fee":10000000,"receive_description":[{"value_commitment":"5a1cd384edab9c38901d0250ebdf96d4f29889094b7096a7ce2dd6af919afd21","note_commitment":"f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b62","epk":"e7ff2357376eafdabc6db3fdabc079e42dd14c61a9a08c6cd38405d086086b4b","c_enc":"d1aaf220f531f31bd2d9ff6f6d59998e78f3f0d30c852258441c5d54fc6790af7620b8860f6ec48d93fedb4c9bbb0e43c8144a9e304ceee399ac6da0bb91dbace3c8a93e03f1d2a5a88b0998704a09a51ab147096a994420741e87168cda4f45f8ed03c816e947909f2997d48e2ceaed45c539463e5e8caf6a0a1529615afbfa01df0a89c6360512519aea8a1b30a367a8749b24946fcd2fbbc6cfbbb6562ed6aa16db5d9e76b1872683a841ebda3a16dda6083474c2ea5a81f4e5c04e6af6ed582f58cab36bc016cfcf03337bc64b5411c7cb6f6f55e17d96bfead8becb0b7661768e122c943159ff2854c0e6efdd408b5bd5afc9d629645bfff8d4a240591fa9adc37e4a5bc046fcf31f8088f3616dd2f69860e401221585fd1a5ebe88080742802ae4696b8ba5e826ddd42841dce71b4b3ebe47b1f254103ae49f0bd9d61f5c0193441c471d29535247c26ab9297975497f6051466dbc591c4cd7b4246604e445d7d3a1dd77538c1989a8c48f829c6a1ce0dee84019ef68b7407def2492f5c867f659b0f8f58cc1081706453bf3a1ec719927c6b3defdcc002e9f2f63b4bdb7f69a00db742d2571d7293bae3faffc43ea0ff032e1b262a3597290c6c9117a006c91074a455c80a3a8089d93aed5bd48bd04bb30ad68fc87ff2bb4e5c20fe4bc0ad1b586aef3d1183170dec490c6bc82ec85d4031e292782f8778f21252a7cb6730da2d8fb175017e213eb10527b104bf333767cfed23c7c993391d9029f404947a793c37c1880a6be5cc26cc447ea020db8832239aa09aad9876ec17c4095857971ae","c_out":"8e3df70e1feaf8da5da72062d13c5200ab09f43e45d2ba1aac8a56c8e9d033d786cfe3ed7d2b30d8b6124afe2646c7af25b60ed02c3a50b2cb62637461e00b153b92f868f2194b46c49e9a1c9e987d5a","zkproof":"8b338777245e733183101027436ea41ea15f61537f38a35109fe6e53806c7913c69f186a86ba1d63997c5301c650089aa888cdf939573b0e7aceefff59757f8ba2275bd4469de04174f1b450a53017260b4bbc4a27cd8aac45d5ff2e5f5ab0eb14ffc59cf0fa10cd32363ef9a9fb9bf68431c4ee1c2ca15797ba4c18dbde24ae451797b25f13a73a231783f72b6f7a429026e191a49619057b250fab6b7010fc58dfcf922b04ad83756e2b8780100dccaafc65e4ef0357c6aae57f4f5c790607"}]},"type_url":"type.googleapis.com/protocol.ShieldedTransferContract"},"type":"ShieldedTransferContract"}],"ref_block_bytes":"0245","ref_block_hash":"b1ea272768028540","expiration":1558691289000,"timestamp":1558691230861},"raw_data_hex":"0a0202452208b1ea27276802854040a8aff6c9ae2d5ae708083312e2080a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e536869656c6465645472616e73666572436f6e747261637412a8080a1541a7d8a35b260395c14aa456297662092ba3b76fc01080c2d72f22c2070a205a1cd384edab9c38901d0250ebdf96d4f29889094b7096a7ce2dd6af919afd211220f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b621a20e7ff2357376eafdabc6db3fdabc079e42dd14c61a9a08c6cd38405d086086b4b22c404d1aaf220f531f31bd2d9ff6f6d59998e78f3f0d30c852258441c5d54fc6790af7620b8860f6ec48d93fedb4c9bbb0e43c8144a9e304ceee399ac6da0bb91dbace3c8a93e03f1d2a5a88b0998704a09a51ab147096a994420741e87168cda4f45f8ed03c816e947909f2997d48e2ceaed45c539463e5e8caf6a0a1529615afbfa01df0a89c6360512519aea8a1b30a367a8749b24946fcd2fbbc6cfbbb6562ed6aa16db5d9e76b1872683a841ebda3a16dda6083474c2ea5a81f4e5c04e6af6ed582f58cab36bc016cfcf03337bc64b5411c7cb6f6f55e17d96bfead8becb0b7661768e122c943159ff2854c0e6efdd408b5bd5afc9d629645bfff8d4a240591fa9adc37e4a5bc046fcf31f8088f3616dd2f69860e401221585fd1a5ebe88080742802ae4696b8ba5e826ddd42841dce71b4b3ebe47b1f254103ae49f0bd9d61f5c0193441c471d29535247c26ab9297975497f6051466dbc591c4cd7b4246604e445d7d3a1dd77538c1989a8c48f829c6a1ce0dee84019ef68b7407def2492f5c867f659b0f8f58cc1081706453bf3a1ec719927c6b3defdcc002e9f2f63b4bdb7f69a00db742d2571d7293bae3faffc43ea0ff032e1b262a3597290c6c9117a006c91074a455c80a3a8089d93aed5bd48bd04bb30ad68fc87ff2bb4e5c20fe4bc0ad1b586aef3d1183170dec490c6bc82ec85d4031e292782f8778f21252a7cb6730da2d8fb175017e213eb10527b104bf333767cfed23c7c993391d9029f404947a793c37c1880a6be5cc26cc447ea020db8832239aa09aad9876ec17c4095857971ae2a508e3df70e1feaf8da5da72062d13c5200ab09f43e45d2ba1aac8a56c8e9d033d786cfe3ed7d2b30d8b6124afe2646c7af25b60ed02c3a50b2cb62637461e00b153b92f868f2194b46c49e9a1c9e987d5a32c0018b338777245e733183101027436ea41ea15f61537f38a35109fe6e53806c7913c69f186a86ba1d63997c5301c650089aa888cdf939573b0e7aceefff59757f8ba2275bd4469de04174f1b450a53017260b4bbc4a27cd8aac45d5ff2e5f5ab0eb14ffc59cf0fa10cd32363ef9a9fb9bf68431c4ee1c2ca15797ba4c18dbde24ae451797b25f13a73a231783f72b6f7a429026e191a49619057b250fab6b7010fc58dfcf922b04ad83756e2b8780100dccaafc65e4ef0357c6aae57f4f5c7906072a405407f7f7d43ae313bf54b8d6a8cf716f65390171e39c11c07b4c90e5ae7d5d114b1729d44a3bc58f6e40c413b972e8ab61a8e66502b30df35937f64957c0da0a4080ade204708de9f2c9ae2d"} - -``` -Return: -```bash -{"result": true} -``` - -### Transfer from shielded address to shielded address - -**Step 1. Call api: wallet/getmerkletreevoucherinfo to get the voucher of the shield address, this info will be used when create shielded transaction** -Method: Post -Parameter: -```json -{ - "out_points":[{ - "hash":"1967c40954e8c6c4761c377a021ec3a6ad0545d8b4443f0ccdd1bec4dcbaa497", - "index":0 - }], - "block_num":1 -} -``` -Return: -```bash -{"vouchers": [{"tree": {"left": {"content": "7efdc58818923de35ec35b4ef8e6a508f6952b9dd2a86af30a93dcd67e13ed35"},"right": {"content": "f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b62"}},"rt": "72eca442bd775b022636fb9ae967c8e749c002660133e76193680d7f8b81fc0e"}],"paths": ["2020b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c538142012935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62d20e1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef722028e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2a20a5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6a20d2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb582016d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4a20fee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd712204c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee0850200769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c492008eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf3023208d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e841527673206aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b15921620cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf00206edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c201ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be245120d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642f20bd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c201b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab65120ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de98579473048204777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23c20ba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce722043ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b207b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b68044420d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa52813208ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce738961320912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a20e110de65c907b9dea4ae0bd83a4b0a51bea175646a64c12b4c9f931b2cb31b4920d8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6c20ffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e3420817de36ab2d57feb077634bca77819c8e0bd298c04f6fed0e6a83cc1356ca155207efdc58818923de35ec35b4ef8e6a508f6952b9dd2a86af30a93dcd67e13ed350100000000000000"]} -``` -**Step 2. Call api: wallet/createshieldedtransaction to create transaction** -Method: Post -Parameter: -```json -{ - "ask": "f9302122162221f59a7668e0d740245dcabaeb51dd157ba995eecd02f4b60b06", - "nsk": "050fc9a42909e60fefb9d548fe12718cb759e3ee28d1b92ceaeaffc23d200a0d", - "ovk": "a0da0cc6294dc900e93887b9f08ac42a162234359fdaf523b98382602c92513c", - - "shielded_spends": [ - { - "note": { - "value": 90000000, - "payment_address": "ztron1jld8fmvujrz2vgkc867zuwklmewy4ypw0wtwgweqs2paee0uhc8f3azy90el770arksa2kunl02", - "rcm": "e48836a3cfae0e1b27b5230460199b46ebd88ad650fa9db5ac1eafb20b516302" - }, - - - "alpha": "2608999c3a97d005a879ecdaa16fd29ae434fb67b177c5e875b0c829e6a1db04", - "voucher": {"tree": {"left": {"content": "7efdc58818923de35ec35b4ef8e6a508f6952b9dd2a86af30a93dcd67e13ed35"},"right": {"content": "f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b62"}},"rt": "72eca442bd775b022636fb9ae967c8e749c002660133e76193680d7f8b81fc0e"}, - "path": "2020b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c538142012935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62d20e1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef722028e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2a20a5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6a20d2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb582016d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4a20fee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd712204c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee0850200769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c492008eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf3023208d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e841527673206aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b15921620cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf00206edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c201ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be245120d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642f20bd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c201b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab65120ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de98579473048204777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23c20ba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce722043ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b207b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b68044420d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa52813208ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce738961320912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a20e110de65c907b9dea4ae0bd83a4b0a51bea175646a64c12b4c9f931b2cb31b4920d8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6c20ffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e3420817de36ab2d57feb077634bca77819c8e0bd298c04f6fed0e6a83cc1356ca155207efdc58818923de35ec35b4ef8e6a508f6952b9dd2a86af30a93dcd67e13ed350100000000000000" - - } - ], - "shielded_receives": [ - { - "note": { - "value": 80000000, - "payment_address": "ztron1wd46s6fwmz99gulqpxul6zffqtevzfpl93ng3s5834fhwf6e7w5l6zmjhmpvtwsc4wxa7dusmvr", - "rcm": "ccced07d36641fc93cba33cddda7064cb82f6962a0bdf15a4240a4a742770e03" - } - } - ] -} -``` -Return: -```bash -{"txID":"5a057fde4a1add0da38eda9978f6c3d035f7ca4807adae4b8c57e34499dfedfb","raw_data":{"contract":[{"parameter":{"value":{"binding_signature":"b77c81fdb8af64075a7d95e8f04ef28660bb2f3f2bfb884baf17abd87ae7f212de091016ae6147edbff280b52515a1a52515bd1fa118de2964412f87b6a5790c","spend_description":[{"value_commitment":"ddc8138f73323eff8d2f0367070c63f5e2659538fa431d6aa06d62696845e529","anchor":"72eca442bd775b022636fb9ae967c8e749c002660133e76193680d7f8b81fc0e","nullifier":"29269506e140e7cc70699443c9b80eb161048ec0126e308d458245991242478c","rk":"c76c88d21edb0f5b2b04c960668cf1053feda5954a00d70e7d329025323bf463","spend_authority_signature":"518def6477325d78b77b00aac6142bfc7b9a5f3eaaff5b8b4b8f2c46114ed85d1cc15a314028f58ce0c42e9f030f465063bbc0c41d01c92edd639d02575f6b08","zkproof":"82eda1b9baeaa5b08b3b33f157ae7a117e2561c702520e615a92e65098615eba1809a20e0b518fef286268d4c6f15a8eaa1b2a15630dd673fcfdde503a12daf80dfc157e6a0ea9333dedc2c365368847f2e7d8e3e648cc65cf5e805cd2343077051d70fcd140a8c665760f8cf066edb32036de7421e6755f3b64f44621aaa47d7e0f2012069ad374a7addb00b841b759b9e567c7b8b2642110eabd22358d22f4d3b4002a1ba4e9f6c018c58a5c1242acbc0169cf4aa0bf1423ed4a0b688928ad"}],"fee":10000000,"receive_description":[{"value_commitment":"6b082c7b9d01338d60fc4f5d434a152f9d8bf5c05c22422e23d3c74d36c2b925","note_commitment":"e4d02525ef586e77765e5cde77c4a25f8393508e749c2398aa91b8cea0a14f02","epk":"36b1cb275228b3ab8275d6b04b3e2e93c04d5c0cc0ab1f41421093228b94f758","c_enc":"1f91dd5cdf0731c99318a2a87b169b7159230c4dee4e47e8b0717fc51c604ccc7a2df9c873a91903e59528756e2c2f3bd07ec5aa9b994ae5d8492ad779d6a00d4a71e7cb742c1ae416e4d983554fade0e04b0213880da2e96be402a5351ca3a5d78e5a975d20cb5ec1475c7ed35dc09c0b04a3a2e8a65595d8d77652f2881a4b93ed99cff007b3923b36967be6819721ed3daea2190fca744423ffb77d1a579f569bfb30c77ad0dadc0ca484a7a89318e15d50e540744927e19c5f6f08be2e97e77cd9c6ce3e05bdbeeb6f6d7b53f83a2283f56786ea8544c98b648300dfb8554e7a2611204598ddc37c4e61ce5881e63ab171ec83c1aedf97166596d014b1fc8193ff30d4e1c7aff8a3c3638e3a41b2a4040828a8d9568ab0fe4aef08a97872ca84c6c247635a1774efde8b8ed16177393879c8626a8ea0075fa2db5af58754d712ccd5a94dcf87c019faffa2c8f3143a9a9d540de4a705c87fc16dc5efa0c387f1e6ed9dad12b84f2ca7bb09cd95a10a2e412fc410aa7ebf676f6a74f03a7334a0a1697067cc88ccd968bdf6d8c20ed7d7bd9687bda89fb28c2849e45734d30395fead9f955649a3e3f1deb15eb02f28dad608d6d0ef2943ae9fd9e14f2507e9b871a3bebe5d15ba41a8dafc7dd18cd594eb69ad89192e776fc35a3d6eb48c2446d78258fed12cbb61200ddf0c3d2dbbf73fc82a4a2e96f619fa1ad479e6da108ddab453c02fa2fa8e96721585b791f6478966e36d2d75a6677858a64672dde9bb72feb64b58b7723c13c75f70cf7333c3331d46951633a2686b108e48215eb5d56653","c_out":"bbbf78f926fa2cae70ed68ef644487c32a82da230b5b8e2be26aa3102627ffc2db26f45f29c2379b20595ef26c60801f33508e17f03f66694cfdf15f606e5fabfe1d76593c1a8543593c10160f4ae4a0","zkproof":"b5597534076320a98ef1a546253185011f17cc7d175a8937736bfe1daee1c33e25411346996e64d0bf1887c4553b49bb815cc8ef57b6811e7213b8c7f81c9853a4663703bf2b2989688a9ae5cabcc56c2316d411f6b910722169609d76890a2b0fc9b3fb536c3be378eb4100b925d9ae6a4a9e08eee591066f881c726a0416861ad41f69148619d187ee4d8f0f8b111da8f0d5bd4f781c2ddfdd7e4b3544b09ec2c9548cef85c28cd1129bf60f1f421c9ac7ed7f36b20984038fb33fcb409956"}]},"type_url":"type.googleapis.com/protocol.ShieldedTransferContract"},"type":"ShieldedTransferContract"}],"ref_block_bytes":"029b","ref_block_hash":"027c45a7dc0875f7","expiration":1558691547000,"timestamp":1558691489292},"raw_data_hex":"0a02029b2208027c45a7dc0875f740f88e86caae2d5adb0b083312d60b0a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e536869656c6465645472616e73666572436f6e7472616374129c0b1a8d030a20ddc8138f73323eff8d2f0367070c63f5e2659538fa431d6aa06d62696845e529122072eca442bd775b022636fb9ae967c8e749c002660133e76193680d7f8b81fc0e1a2029269506e140e7cc70699443c9b80eb161048ec0126e308d458245991242478c2220c76c88d21edb0f5b2b04c960668cf1053feda5954a00d70e7d329025323bf4632ac00182eda1b9baeaa5b08b3b33f157ae7a117e2561c702520e615a92e65098615eba1809a20e0b518fef286268d4c6f15a8eaa1b2a15630dd673fcfdde503a12daf80dfc157e6a0ea9333dedc2c365368847f2e7d8e3e648cc65cf5e805cd2343077051d70fcd140a8c665760f8cf066edb32036de7421e6755f3b64f44621aaa47d7e0f2012069ad374a7addb00b841b759b9e567c7b8b2642110eabd22358d22f4d3b4002a1ba4e9f6c018c58a5c1242acbc0169cf4aa0bf1423ed4a0b688928ad3240518def6477325d78b77b00aac6142bfc7b9a5f3eaaff5b8b4b8f2c46114ed85d1cc15a314028f58ce0c42e9f030f465063bbc0c41d01c92edd639d02575f6b0822c2070a206b082c7b9d01338d60fc4f5d434a152f9d8bf5c05c22422e23d3c74d36c2b9251220e4d02525ef586e77765e5cde77c4a25f8393508e749c2398aa91b8cea0a14f021a2036b1cb275228b3ab8275d6b04b3e2e93c04d5c0cc0ab1f41421093228b94f75822c4041f91dd5cdf0731c99318a2a87b169b7159230c4dee4e47e8b0717fc51c604ccc7a2df9c873a91903e59528756e2c2f3bd07ec5aa9b994ae5d8492ad779d6a00d4a71e7cb742c1ae416e4d983554fade0e04b0213880da2e96be402a5351ca3a5d78e5a975d20cb5ec1475c7ed35dc09c0b04a3a2e8a65595d8d77652f2881a4b93ed99cff007b3923b36967be6819721ed3daea2190fca744423ffb77d1a579f569bfb30c77ad0dadc0ca484a7a89318e15d50e540744927e19c5f6f08be2e97e77cd9c6ce3e05bdbeeb6f6d7b53f83a2283f56786ea8544c98b648300dfb8554e7a2611204598ddc37c4e61ce5881e63ab171ec83c1aedf97166596d014b1fc8193ff30d4e1c7aff8a3c3638e3a41b2a4040828a8d9568ab0fe4aef08a97872ca84c6c247635a1774efde8b8ed16177393879c8626a8ea0075fa2db5af58754d712ccd5a94dcf87c019faffa2c8f3143a9a9d540de4a705c87fc16dc5efa0c387f1e6ed9dad12b84f2ca7bb09cd95a10a2e412fc410aa7ebf676f6a74f03a7334a0a1697067cc88ccd968bdf6d8c20ed7d7bd9687bda89fb28c2849e45734d30395fead9f955649a3e3f1deb15eb02f28dad608d6d0ef2943ae9fd9e14f2507e9b871a3bebe5d15ba41a8dafc7dd18cd594eb69ad89192e776fc35a3d6eb48c2446d78258fed12cbb61200ddf0c3d2dbbf73fc82a4a2e96f619fa1ad479e6da108ddab453c02fa2fa8e96721585b791f6478966e36d2d75a6677858a64672dde9bb72feb64b58b7723c13c75f70cf7333c3331d46951633a2686b108e48215eb5d566532a50bbbf78f926fa2cae70ed68ef644487c32a82da230b5b8e2be26aa3102627ffc2db26f45f29c2379b20595ef26c60801f33508e17f03f66694cfdf15f606e5fabfe1d76593c1a8543593c10160f4ae4a032c001b5597534076320a98ef1a546253185011f17cc7d175a8937736bfe1daee1c33e25411346996e64d0bf1887c4553b49bb815cc8ef57b6811e7213b8c7f81c9853a4663703bf2b2989688a9ae5cabcc56c2316d411f6b910722169609d76890a2b0fc9b3fb536c3be378eb4100b925d9ae6a4a9e08eee591066f881c726a0416861ad41f69148619d187ee4d8f0f8b111da8f0d5bd4f781c2ddfdd7e4b3544b09ec2c9548cef85c28cd1129bf60f1f421c9ac7ed7f36b20984038fb33fcb4099562a40b77c81fdb8af64075a7d95e8f04ef28660bb2f3f2bfb884baf17abd87ae7f212de091016ae6147edbff280b52515a1a52515bd1fa118de2964412f87b6a5790c4080ade204708ccc82caae2d"} -``` -**Step 3. Call api: wallet/broadcasttransaction to broadcast this transaction(no need to sign this transaction)** -Method: Post -Parameter: -```json -{"txID":"791d30b7123448a54c56407a11857d4f3885cb699a071ee5f265f7db408dec6c","raw_data":{"contract":[{"parameter":{"value":{"binding_signature":"231cc2ddbf2715b51d07ed63e142ad874e7e173ec0c5d681b49e3060ca33bd65cf39921355dfaacc62dac7aa810c49daafbf8db8a1adc168da4a833eba0d7504","spend_description":[{"value_commitment":"f4c543df8f0fe9b71b1bbd6aa2f06f87e07605dcd339b0eaa48afd9e2488b140","anchor":"72eca442bd775b022636fb9ae967c8e749c002660133e76193680d7f8b81fc0e","nullifier":"29269506e140e7cc70699443c9b80eb161048ec0126e308d458245991242478c","rk":"c76c88d21edb0f5b2b04c960668cf1053feda5954a00d70e7d329025323bf463","spend_authority_signature":"2f50449f92e4bf541c9ba7d82b93f6dd416208449ea8996dc45614c1cb90a7911264fece30446da875d8a864224f1a3870e3654ec8a4005305faa329224f4c08","zkproof":"984779ad18c87d71dd79b78564e49c1c18d6f871ef45f79bdb012f73439d6402593dd7cda308d9d5412e2b64b0be461192eb2a8d2ffdcc700475a1c8b8912220f628af41bf44a7c010a8dda2a65f98b4aaf8c375c4046afd1af3e6bbe4b33b9210c68298f46999322174b9ba76b0be4d6ef2c74ff5d16370a8c30fa17c5c3bbeab217610de5cc680b1d64d557c4d53a4a3f73294699ac6a00b37c3d8076a20362ab09c77c94f08bb00db2648ade72f224821ecc190627222cf58130b9bcf639b"}],"fee":10000000,"receive_description":[{"value_commitment":"3f4465801b357f9b8334eb3025bd8b3cd84247355c099133c08d53a8cffd3595","note_commitment":"e4d02525ef586e77765e5cde77c4a25f8393508e749c2398aa91b8cea0a14f02","epk":"3ece31615aec76e7711e25b05b05f5b7fb99d75f3812fe56702291633e5f474c","c_enc":"4fc57e65bfdd91e2ae0284cfc2926d5df63d51b8f864e9191f368404db390e28ce15fefc9bd210aca4e7f42b30140bc4b1650d9a79bcbfb1670288c68d4678ba5c34266ce1bd4fd1f4e4040508b072cdca87d69e4921af8c8305f982aa7f37897a29c69cce06c311eafb2ef5928f07d5b8f207e5f46c32237f6e9b0eadc2597e0cd8d884cd3f4a35d86145e75565913b9d4a2e613523c9f377fe3bdf6f1d9e6789605e6bdaf9526412632e52a1994fec98dd086596c62ba028508d45933943f3446c83f463f56e860f29d2ea0eb3b87a55a0602974b7df6b58905872cb97a757f24515f05d2b12d932a0ac038e0c0b15b9c8b324c8e31d4ddf8bf39bfb65bd9d495eac1818b281822c9ad85adbe8a90f62adfbb6723fae7a7d91760a5b2d146f180d5ca4d85653449089f4788459752e899abd4abd395842e8b5315dd3738eee0b4e0f758698aabb92df587b703e85774048f290ea366696de3dde665eefb6fce6c2776e4e9ad18662b8d95af4203a10e9af54085ee498c77ad7e7b5824f91aaeb8f138d8c90d95f57e71dc15c177b602c45e38f12e402cc65c2c55b80c9a7d908332baa30b2871a0d6cf417bcaf0be6ae5c451c2468e945273151da500aaccd7235a29c7fcd0da4ac4d6ceefda59cf568f7a362b49654a5793c552bd970681a6489a1951ad75e22215b22d5cd511a030d751892b4b5746d66f048d6b6889c2ddcd5da908417b91ef52c0507b2ce8b1214567b71963c5d6ace1f6e858ce02b11fcf0f839cbe8183fa71b9a239f70c5e98642f6e9b9b6eb31f12a752829ebecf0f12df040","c_out":"5fc1926bb6501f8ec4dc796d56786d7f019db9e43ccde07bbbddd95444df4f099310ef3f8d86a0a25ff72de0385563e44b9cb9e5e477299891959d24060a3b08b41aa36c29ce7297f0806a74f11aa99e","zkproof":"b924ae84aba3af2c4d6529c22ebd6ba900ac63c629723e035ab843295d41aec1e9ebb2906fa7471473dbdae7e182fbd7a9f14a2f599a79456a3dbb949203d9923c3c3600225f12217e38b69b88a080b5b5751d78ac84375c9a03ad0bc61492850c49488a654c376c49701abdde20d5658bce851e9a6fd1bee5429b9b4d4b55ed1eb888a43f435740b8f063ea6e2e7e81b53f12e67e3eac60020aab5c3ff45d34ff2c3dde4eb76ed2893df22232993deb1b9397d1d4f9cc1eb8405f7cbef5a24b"}]},"type_url":"type.googleapis.com/protocol.ShieldedTransferContract"},"type":"ShieldedTransferContract"}],"ref_block_bytes":"0328","ref_block_hash":"833c24d9f1019cd0","expiration":1558691970000,"timestamp":1558691911355},"raw_data_hex":"0a0203282208833c24d9f1019cd040d0f79fcaae2d5adb0b083312d60b0a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e536869656c6465645472616e73666572436f6e7472616374129c0b1a8d030a20f4c543df8f0fe9b71b1bbd6aa2f06f87e07605dcd339b0eaa48afd9e2488b140122072eca442bd775b022636fb9ae967c8e749c002660133e76193680d7f8b81fc0e1a2029269506e140e7cc70699443c9b80eb161048ec0126e308d458245991242478c2220c76c88d21edb0f5b2b04c960668cf1053feda5954a00d70e7d329025323bf4632ac001984779ad18c87d71dd79b78564e49c1c18d6f871ef45f79bdb012f73439d6402593dd7cda308d9d5412e2b64b0be461192eb2a8d2ffdcc700475a1c8b8912220f628af41bf44a7c010a8dda2a65f98b4aaf8c375c4046afd1af3e6bbe4b33b9210c68298f46999322174b9ba76b0be4d6ef2c74ff5d16370a8c30fa17c5c3bbeab217610de5cc680b1d64d557c4d53a4a3f73294699ac6a00b37c3d8076a20362ab09c77c94f08bb00db2648ade72f224821ecc190627222cf58130b9bcf639b32402f50449f92e4bf541c9ba7d82b93f6dd416208449ea8996dc45614c1cb90a7911264fece30446da875d8a864224f1a3870e3654ec8a4005305faa329224f4c0822c2070a203f4465801b357f9b8334eb3025bd8b3cd84247355c099133c08d53a8cffd35951220e4d02525ef586e77765e5cde77c4a25f8393508e749c2398aa91b8cea0a14f021a203ece31615aec76e7711e25b05b05f5b7fb99d75f3812fe56702291633e5f474c22c4044fc57e65bfdd91e2ae0284cfc2926d5df63d51b8f864e9191f368404db390e28ce15fefc9bd210aca4e7f42b30140bc4b1650d9a79bcbfb1670288c68d4678ba5c34266ce1bd4fd1f4e4040508b072cdca87d69e4921af8c8305f982aa7f37897a29c69cce06c311eafb2ef5928f07d5b8f207e5f46c32237f6e9b0eadc2597e0cd8d884cd3f4a35d86145e75565913b9d4a2e613523c9f377fe3bdf6f1d9e6789605e6bdaf9526412632e52a1994fec98dd086596c62ba028508d45933943f3446c83f463f56e860f29d2ea0eb3b87a55a0602974b7df6b58905872cb97a757f24515f05d2b12d932a0ac038e0c0b15b9c8b324c8e31d4ddf8bf39bfb65bd9d495eac1818b281822c9ad85adbe8a90f62adfbb6723fae7a7d91760a5b2d146f180d5ca4d85653449089f4788459752e899abd4abd395842e8b5315dd3738eee0b4e0f758698aabb92df587b703e85774048f290ea366696de3dde665eefb6fce6c2776e4e9ad18662b8d95af4203a10e9af54085ee498c77ad7e7b5824f91aaeb8f138d8c90d95f57e71dc15c177b602c45e38f12e402cc65c2c55b80c9a7d908332baa30b2871a0d6cf417bcaf0be6ae5c451c2468e945273151da500aaccd7235a29c7fcd0da4ac4d6ceefda59cf568f7a362b49654a5793c552bd970681a6489a1951ad75e22215b22d5cd511a030d751892b4b5746d66f048d6b6889c2ddcd5da908417b91ef52c0507b2ce8b1214567b71963c5d6ace1f6e858ce02b11fcf0f839cbe8183fa71b9a239f70c5e98642f6e9b9b6eb31f12a752829ebecf0f12df0402a505fc1926bb6501f8ec4dc796d56786d7f019db9e43ccde07bbbddd95444df4f099310ef3f8d86a0a25ff72de0385563e44b9cb9e5e477299891959d24060a3b08b41aa36c29ce7297f0806a74f11aa99e32c001b924ae84aba3af2c4d6529c22ebd6ba900ac63c629723e035ab843295d41aec1e9ebb2906fa7471473dbdae7e182fbd7a9f14a2f599a79456a3dbb949203d9923c3c3600225f12217e38b69b88a080b5b5751d78ac84375c9a03ad0bc61492850c49488a654c376c49701abdde20d5658bce851e9a6fd1bee5429b9b4d4b55ed1eb888a43f435740b8f063ea6e2e7e81b53f12e67e3eac60020aab5c3ff45d34ff2c3dde4eb76ed2893df22232993deb1b9397d1d4f9cc1eb8405f7cbef5a24b2a40231cc2ddbf2715b51d07ed63e142ad874e7e173ec0c5d681b49e3060ca33bd65cf39921355dfaacc62dac7aa810c49daafbf8db8a1adc168da4a833eba0d75044080ade20470bbad9ccaae2d"} - -``` -Return: -```bash -{"result": true} -``` - -### Transfer from shielded address to transparent address - -**Step 1. Call api: wallet/getmerkletreevoucherinfo to get the voucher of the shield address, this info will be used when create shielded transaction** -Method: Post -Parameter: -```json -{ - "out_points":[{ - "hash":"791d30b7123448a54c56407a11857d4f3885cb699a071ee5f265f7db408dec6c", - "index":0 - }], - "block_num":1 -} -``` -Return: -```bash -{"vouchers": [{"tree": {"left": {"content": "e4d02525ef586e77765e5cde77c4a25f8393508e749c2398aa91b8cea0a14f02"},"parents": [{"content": "c835053e32be73852e67a65f4cd40407a11f4a7a38bb84b8d3e8a1f57acdbf61"}]},"rt": "8bdf96ac1241f30d5cd54d4ece7f10867d9eef854121ef77d1015f0ab2a26b1b"}],"paths": ["2020b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c538142012935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62d20e1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef722028e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2a20a5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6a20d2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb582016d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4a20fee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd712204c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee0850200769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c492008eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf3023208d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e841527673206aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b15921620cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf00206edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c201ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be245120d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642f20bd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c201b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab65120ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de98579473048204777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23c20ba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce722043ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b207b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b68044420d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa52813208ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce738961320912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a20e110de65c907b9dea4ae0bd83a4b0a51bea175646a64c12b4c9f931b2cb31b4920d8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6c20ffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e3420c835053e32be73852e67a65f4cd40407a11f4a7a38bb84b8d3e8a1f57acdbf612001000000000000000000000000000000000000000000000000000000000000000200000000000000"]} -``` - -**Step 2. Call api: wallet/createshieldedtransaction to create transaction** -Method: Post -Parameter: -```json -{ - "ask": "653b3a3fdd40b60d2f53ba121df8840f6590384993f8fa9a0ecb0dfb23496604", - "nsk": "428ff3c9e101dc1fca08f7b0e3387b23b68016746ae565aefc19d112b696db01", - "ovk": "1274dcc5c7307bf0fd0ead466e9dd5641fed4a51391f681862370e2f2654cc61", - "shielded_spends": [ - { - "note": { - "value": 80000000, - "payment_address": "ztron1wd46s6fwmz99gulqpxul6zffqtevzfpl93ng3s5834fhwf6e7w5l6zmjhmpvtwsc4wxa7dusmvr", - "rcm": "ccced07d36641fc93cba33cddda7064cb82f6962a0bdf15a4240a4a742770e03" - }, - "alpha": "3ad5406efd6efcd81d27696d5f91efc07ba5c98ea6fb0f787b93e557b51df405", - "voucher": { - "tree": { - "left": { - "content": "f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b62" - }, - "right": { - "content": "e4d02525ef586e77765e5cde77c4a25f8393508e749c2398aa91b8cea0a14f02" - } - }, - "rt": "774d05ec02749475672a94a8fb2daaa11c323defa09df121b7359353f0c3a567" - }, - "path": "2020b2eed031d4d6a4f02a097f80b54cc1541d4163c6b6f5971f88b6e41d35c538142012935f14b676509b81eb49ef25f39269ed72309238b4c145803544b646dca62d20e1f34b034d4a3cd28557e2907ebf990c918f64ecb50a94f01d6fda5ca5c7ef722028e7b841dcbc47cceb69d7cb8d94245fb7cb2ba3a7a6bc18f13f945f7dbd6e2a20a5122c08ff9c161d9ca6fc462073396c7d7d38e8ee48cdb3bea7e2230134ed6a20d2e1642c9a462229289e5b0e3b7f9008e0301cbb93385ee0e21da2545073cb582016d6252968971a83da8521d65382e61f0176646d771c91528e3276ee45383e4a20fee0e52802cb0c46b1eb4d376c62697f4759f6c8917fa352571202fd778fd712204c6937d78f42685f84b43ad3b7b00f81285662f85c6a68ef11d62ad1a3ee0850200769557bc682b1bf308646fd0b22e648e8b9e98f57e29f5af40f6edb833e2c492008eeab0c13abd6069e6310197bf80f9c1ea6de78fd19cbae24d4a520e6cf3023208d5fa43e5a10d11605ac7430ba1f5d81fb1b68d29a640405767749e841527673206aca8448d8263e547d5ff2950e2ed3839e998d31cbc6ac9fd57bc6002b15921620cd1c8dbf6e3acc7a80439bc4962cf25b9dce7c896f3a5bd70803fc5a0e33cf00206edb16d01907b759977d7650dad7e3ec049af1a3d875380b697c862c9ec5d51c201ea6675f9551eeb9dfaaa9247bc9858270d3d3a4c5afa7177a984d5ed1be245120d6acdedf95f608e09fa53fb43dcd0990475726c5131210c9e5caeab97f0e642f20bd74b25aacb92378a871bf27d225cfc26baca344a1ea35fdd94510f3d157082c201b77dac4d24fb7258c3c528704c59430b630718bec486421837021cf75dab65120ec677114c27206f5debc1c1ed66f95e2b1885da5b7be3d736b1de98579473048204777c8776a3b1e69b73a62fa701fa4f7a6282d9aee2c7a6b82e7937d7081c23c20ba49b659fbd0b7334211ea6a9d9df185c757e70aa81da562fb912b84f49bce722043ff5457f13b926b61df552d4e402ee6dc1463f99a535f9a713439264d5b616b207b99abdc3730991cc9274727d7d82d28cb794edbc7034b4f0053ff7c4b68044420d6c639ac24b46bd19341c91b13fdcab31581ddaf7f1411336a271f3d0aa52813208ac9cf9c391e3fd42891d27238a81a8a5c1d3a72b1bcbea8cf44a58ce738961320912d82b2c2bca231f71efcf61737fbf0a08befa0416215aeef53e8bb6d23390a20e110de65c907b9dea4ae0bd83a4b0a51bea175646a64c12b4c9f931b2cb31b4920d8283386ef2ef07ebdbb4383c12a739a953a4d6e0d6fb1139a4036d693bfbb6c20ffe9fc03f18b176c998806439ff0bb8ad193afdb27b2ccbc88856916dd804e3420817de36ab2d57feb077634bca77819c8e0bd298c04f6fed0e6a83cc1356ca15520f21a987214b4aa8f041e6a8fde656396dbbf7ce6ee3394b6f9fbfb43f0e39b620100000000000000" - } - ], - "transparent_to_address": "41A7D8A35B260395C14AA456297662092BA3B76FC0", - "to_amount": 70000000 -} -``` -Return: -```bash -{"txID":"4dbdc95574a155434baeaf5e690e2d0c77a2b883a048d8d0103ab5c7fed8d866","raw_data":{"contract":[{"parameter":{"value":{"to_amount":70000000,"binding_signature":"780be5a118c7b96847a6b1932f1ab6f559ce3648e321821f22570dbde7d59c58559aae93a2f334537544b6c85218c83397b0779926247848560c3e9ef5ba8203","spend_description":[{"value_commitment":"086c712a60d5aa0d16276fb18b5504a875d97cecb2a0afa8219c8031aec94bd9","anchor":"774d05ec02749475672a94a8fb2daaa11c323defa09df121b7359353f0c3a567","nullifier":"fa07f704bd34a8a7c1804601f322e6c1415247bfaa2f0d04715b9b4ac65b3587","rk":"41132c4e6bc24faae1cb8cdee2c7f84bd4b3aa27e50c099ca205c1c0538ca2d4","spend_authority_signature":"b928f855d397ab758b60251ee3ce40f951df51a6111064ad90fe4aa467cd69ec649c55ebb59c034c0c72daca0e9063da72383108942c79f7bd1b0f6b22f30207","zkproof":"b3552325eb9212097ba3f56a4e0770c92cd28a8d6974e3a30436115b2a49adae7e1f49a0f2920042145bfe4a127ada22b3000ba0faa15b408340ca5c377943e3b3c8566ad471d84321b9d24c0a47b6b42b83d562523b07a16401cb5f4e51aa040b1300f443d963150db7f08b2606f3e17ba386d1308720c20901d74e8b94b47a78c00f416c71b4fffed1fd6d7b41ebb0993bbd1fa05754514d05575e09ce8f6a6438b8b158a1067d01b195c6631b25434f64360aedcdcfacb163efe866a05ee1"}],"fee":10000000,"transparent_to_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0"},"type_url":"type.googleapis.com/protocol.ShieldedTransferContract"},"type":"ShieldedTransferContract"}],"ref_block_bytes":"00dc","ref_block_hash":"a45c748f93fa2854","expiration":1558928754000,"timestamp":1558928695327},"raw_data_hex":"0a0200dc2208a45c748f93fa285440d08a94bbaf2d5ab204083312ad040a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e536869656c6465645472616e73666572436f6e747261637412f3031a8d030a20086c712a60d5aa0d16276fb18b5504a875d97cecb2a0afa8219c8031aec94bd91220774d05ec02749475672a94a8fb2daaa11c323defa09df121b7359353f0c3a5671a20fa07f704bd34a8a7c1804601f322e6c1415247bfaa2f0d04715b9b4ac65b3587222041132c4e6bc24faae1cb8cdee2c7f84bd4b3aa27e50c099ca205c1c0538ca2d42ac001b3552325eb9212097ba3f56a4e0770c92cd28a8d6974e3a30436115b2a49adae7e1f49a0f2920042145bfe4a127ada22b3000ba0faa15b408340ca5c377943e3b3c8566ad471d84321b9d24c0a47b6b42b83d562523b07a16401cb5f4e51aa040b1300f443d963150db7f08b2606f3e17ba386d1308720c20901d74e8b94b47a78c00f416c71b4fffed1fd6d7b41ebb0993bbd1fa05754514d05575e09ce8f6a6438b8b158a1067d01b195c6631b25434f64360aedcdcfacb163efe866a05ee13240b928f855d397ab758b60251ee3ce40f951df51a6111064ad90fe4aa467cd69ec649c55ebb59c034c0c72daca0e9063da72383108942c79f7bd1b0f6b22f302072a40780be5a118c7b96847a6b1932f1ab6f559ce3648e321821f22570dbde7d59c58559aae93a2f334537544b6c85218c83397b0779926247848560c3e9ef5ba8203321541a7d8a35b260395c14aa456297662092ba3b76fc03880bbb0214080ade204709fc090bbaf2d"} -``` - -**Step 3. Call api: wallet/broadcasttransaction to broadcast this transaction(no need to sign this transaction)** -Method: Post -Parameter: -```json -{"txID":"4dbdc95574a155434baeaf5e690e2d0c77a2b883a048d8d0103ab5c7fed8d866","raw_data":{"contract":[{"parameter":{"value":{"to_amount":70000000,"binding_signature":"780be5a118c7b96847a6b1932f1ab6f559ce3648e321821f22570dbde7d59c58559aae93a2f334537544b6c85218c83397b0779926247848560c3e9ef5ba8203","spend_description":[{"value_commitment":"086c712a60d5aa0d16276fb18b5504a875d97cecb2a0afa8219c8031aec94bd9","anchor":"774d05ec02749475672a94a8fb2daaa11c323defa09df121b7359353f0c3a567","nullifier":"fa07f704bd34a8a7c1804601f322e6c1415247bfaa2f0d04715b9b4ac65b3587","rk":"41132c4e6bc24faae1cb8cdee2c7f84bd4b3aa27e50c099ca205c1c0538ca2d4","spend_authority_signature":"b928f855d397ab758b60251ee3ce40f951df51a6111064ad90fe4aa467cd69ec649c55ebb59c034c0c72daca0e9063da72383108942c79f7bd1b0f6b22f30207","zkproof":"b3552325eb9212097ba3f56a4e0770c92cd28a8d6974e3a30436115b2a49adae7e1f49a0f2920042145bfe4a127ada22b3000ba0faa15b408340ca5c377943e3b3c8566ad471d84321b9d24c0a47b6b42b83d562523b07a16401cb5f4e51aa040b1300f443d963150db7f08b2606f3e17ba386d1308720c20901d74e8b94b47a78c00f416c71b4fffed1fd6d7b41ebb0993bbd1fa05754514d05575e09ce8f6a6438b8b158a1067d01b195c6631b25434f64360aedcdcfacb163efe866a05ee1"}],"fee":10000000,"transparent_to_address":"41a7d8a35b260395c14aa456297662092ba3b76fc0"},"type_url":"type.googleapis.com/protocol.ShieldedTransferContract"},"type":"ShieldedTransferContract"}],"ref_block_bytes":"00dc","ref_block_hash":"a45c748f93fa2854","expiration":1558928754000,"timestamp":1558928695327},"raw_data_hex":"0a0200dc2208a45c748f93fa285440d08a94bbaf2d5ab204083312ad040a35747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e536869656c6465645472616e73666572436f6e747261637412f3031a8d030a20086c712a60d5aa0d16276fb18b5504a875d97cecb2a0afa8219c8031aec94bd91220774d05ec02749475672a94a8fb2daaa11c323defa09df121b7359353f0c3a5671a20fa07f704bd34a8a7c1804601f322e6c1415247bfaa2f0d04715b9b4ac65b3587222041132c4e6bc24faae1cb8cdee2c7f84bd4b3aa27e50c099ca205c1c0538ca2d42ac001b3552325eb9212097ba3f56a4e0770c92cd28a8d6974e3a30436115b2a49adae7e1f49a0f2920042145bfe4a127ada22b3000ba0faa15b408340ca5c377943e3b3c8566ad471d84321b9d24c0a47b6b42b83d562523b07a16401cb5f4e51aa040b1300f443d963150db7f08b2606f3e17ba386d1308720c20901d74e8b94b47a78c00f416c71b4fffed1fd6d7b41ebb0993bbd1fa05754514d05575e09ce8f6a6438b8b158a1067d01b195c6631b25434f64360aedcdcfacb163efe866a05ee13240b928f855d397ab758b60251ee3ce40f951df51a6111064ad90fe4aa467cd69ec649c55ebb59c034c0c72daca0e9063da72383108942c79f7bd1b0f6b22f302072a40780be5a118c7b96847a6b1932f1ab6f559ce3648e321821f22570dbde7d59c58559aae93a2f334537544b6c85218c83397b0779926247848560c3e9ef5ba8203321541a7d8a35b260395c14aa456297662092ba3b76fc03880bbb0214080ade204709fc090bbaf2d"} - -``` -Return: -```bash -{"result": true} -``` diff --git a/docs/mechanism-algorithm/trc10.md b/docs/mechanism-algorithm/trc10.md deleted file mode 100644 index 5508ba1ec..000000000 --- a/docs/mechanism-algorithm/trc10.md +++ /dev/null @@ -1,90 +0,0 @@ -# TRC-10 - -TRON network supports two types of tokens, one is TRC-20 token issued by smart contract, the other one is TRC-10 token issued by system contract. - -## 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: The free bandwidth limit of each token holder -Parameter public_free_asset_net_limit: The total free bandwidth limit of the Token -Parameter frozen_supply: Token staked supply -Parameter permission_id: Optional, for multi-signature use -Return: Transaction object -Note: The unit of 'trx_num' is SUN -``` - -## Participate TRC-10 Token Issuing - -HTTP API: - -```text -wallet/participateassetissue -Description: Participate a token issuing -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 -``` - -## 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 number encoded as 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 -``` diff --git a/mkdocs.yml b/mkdocs.yml index 8b2e8d22f..0c07a92b0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -382,17 +382,3 @@ plugins: locale: en type: date fallback_to_build_date: true - - exclude: - glob: - - clients/tron-grid.md - - contracts/trc20.md - - contracts/tvm.md - - developers/contribution.md - - developers/gpg.md - - developers/incentives.md - - developers/resources.md - - faq/index.md - - introduction/index.md - - introduction/overview.md - - mechanism-algorithm/shielded-TRC20-contract.md - - mechanism-algorithm/trc10.md