Skip to content

Commit

Permalink
style improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
zonLi committed May 14, 2019
1 parent b2146d3 commit f4dab9f
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 78 deletions.
38 changes: 24 additions & 14 deletions docs/Tron-http.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# TRON Built-in Http Introduction
## hexString and base58check transcode demo
java:
https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92
php:
https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php
JAVA:
[https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92](https://github.com/tronprotocol/wallet-cli/blob/master/src/main/java/org/tron/demo/TransactionSignDemo.java#L92)
PHP:
[https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php](https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/index.php)

**Since v3.6, parameter 'visible' is added, when 'visible' is set true, no need to transcode the relevant address and string. This parameter is valid for all api, including solidityNode api and FullNode api.**

When 'visible' is set true, the format of the input address must be base58, input string must text string, so does the format of the output. If 'visible' is set false or null, the api acts the same as previous version. If the format of the parameters do not match with the set of visible, it will throw out an error.

Way to set the 'visible' parameter:
1. For the api need no parameter: By adding 'visible' parameter in the url, like 127.0.0.1:8090/wallet/listexchanges?visible=true
2. For POST method api: By adding 'visible' parameter to the most out layer of the json, like curl -X POST http://127.0.0.1:8090/wallet/createtransaction
{"owner_address_":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"to_address_":"TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW","amount":1000000,"visible":true}
3. For GET method api: By adding 'visible' parameter in the url, as way 1
Way to set the 'visible' parameter:

1. For the api need no parameter: by adding 'visible' parameter in the url

+ example:
```text
http://127.0.0.1:8090/wallet/listexchanges?visible=true
```
2. For POST method api: By adding 'visible' parameter to the most out layer of the json

+ example:
```text
curl -X POST http://127.0.0.1:8090/wallet/createtransaction
{"owner_address_":"TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ", "to_address_":"TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW", "amount":1000000, "visible":true}
```
3. For GET method api: By adding 'visible' parameter in the url, as way 1


## SolidityNode Api Introduction

solidityNode api's default http port is 8091, when solidityNode is started, http service will be started too.
```
SolidityNode api's default http port is 8091, when solidityNode is started, http service will be started too.
```text
/walletsolidity/getaccount
Description: Query an account information
demo: curl -X POST http://127.0.0.1:8091/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}'
Expand Down Expand Up @@ -199,8 +210,7 @@ Return: Deferred transaction fee & block height
## FullNode Api Introduction
FullNode api's default http port is 8090, when FullNode is started, http service will be started too.

```
```text
wallet/createtransaction
Description: Create a transfer transaction, if to address is not existed, then create the account on the blockchain
demo: curl -X POST http://127.0.0.1:8090/wallet/createtransaction -d '{"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount": 1000 }'
Expand Down

0 comments on commit f4dab9f

Please sign in to comment.