-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9cf260
commit 0062e84
Showing
1 changed file
with
47 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,63 @@ | ||
## gotron  | ||
# TRON's go-sdk | ||
|
||
GoSDK and TRON-CLI tool for TRON's blockchain via GRPC | ||
|
||
Fork from [sasaxie/go-client-api](https://github.com/sasaxie/go-client-api) | ||
# Build | ||
|
||
|
||
## Requirements | ||
``` | ||
$ git pull -r origin master | ||
$ make | ||
``` | ||
|
||
- Go 1.13 or higher | ||
# Usage & Examples | ||
|
||
## Installation | ||
# bash completions | ||
|
||
First you need to install ProtocolBuffers 3.0.0-beta-3 or later. | ||
once built, add `tronctl` to your path and add to your `.bashrc` | ||
|
||
```sh | ||
mkdir tmp | ||
cd tmp | ||
git clone https://github.com/google/protobuf | ||
cd protobuf | ||
./autogen.sh | ||
./configure | ||
make | ||
make check | ||
sudo make install | ||
``` | ||
. <(tronctl completion) | ||
``` | ||
|
||
Then, `go get -u` as usual the following packages: | ||
|
||
```sh | ||
go get -u github.com/golang/protobuf/protoc-gen-go | ||
## Transfer JSON file format | ||
The JSON file will be a JSON array where each element has the following attributes: | ||
|
||
| Key | Value-type | Value-description| | ||
| :------------------:|:----------:| :----------------| | ||
| `from` | string | [**Required**] Sender's one address, must have key in keystore. | | ||
| `to` | string | [**Required**] The receivers one address. | | ||
| `amount` | string | [**Required**] The amount to send in $ONE. | | ||
| `passphrase-file` | string | [*Optional*] The file path to file containing the passphrase in plain text. If none is provided, check for passphrase string. | | ||
| `passphrase-string` | string | [*Optional*] The passphrase as a string in plain text. If none is provided, passphrase is ''. | | ||
| `stop-on-error` | boolean | [*Optional*] If true, stop sending transactions if an error occurred, default is false. | | ||
|
||
Example of JSON file: | ||
|
||
```json | ||
[ | ||
{ | ||
"from": "TUEZSdKsoDHQMeZwihtdoBiN46zxhGWYdH", | ||
"to": "TKSXDA8HfE9E1y39RczVQ1ZascUEtaSToF", | ||
"amount": "1", | ||
"passphrase-string": "", | ||
"stop-on-error": true | ||
}, | ||
{ | ||
"from": "TUEZSdKsoDHQMeZwihtdoBiN46zxhGWYdH", | ||
"to": "TEvHMZWyfjCAdDJEKYxYVL8rRpigddLC1R", | ||
"amount": "1", | ||
"passphrase-file": "./pw.txt", | ||
} | ||
] | ||
``` | ||
|
||
Update protocol: | ||
|
||
```sh | ||
git submodule update --remote | ||
``` | ||
# Debugging | ||
|
||
Example: | ||
The gotron-sdk code respects `GOTRON_SDK_DEBUG` as debugging | ||
based environment variables. | ||
|
||
```sh | ||
go get -u github.com/fbsobreira/gotron | ||
go run program/getnowblock.go -grpcAddress grpc.trongrid.io:50051 | ||
```bash | ||
GOTRON_SDK_DEBUG=true ./tronctl | ||
``` |