A Python API for interacting with Tron (TRX)
Project description
# TRON API for Python
A Python API for interacting with the Tron (TRX)
[](LICENSE)
[](https://travis-ci.com/iexbase/tron-api-python)
[](https://github.com/iexbase/tron-api-python/issues)
[](https://github.com/iexbase/tron-api-python/pulls)
[](https://github.com/iexbase/tron-api-python/graphs/contributors)
## Install
| Setup | Command | Notes
| :------ | :------------------ | :---------
| install | `pip install tronapi` |
## Basic Usage
Specify the API endpoints:
```python
full_node = HttpProvider('https://api.trongrid.io')
solidity_node = HttpProvider('https://api.trongrid.io')
event_server = HttpProvider('https://api.trongrid.io')
```
The provider above is optional, you can just use a url for the nodes instead, like here:
```python
full_node = 'https://api.trongrid.io'
solidity_node = 'https://api.trongrid.io'
event_server = 'https://api.trongrid.io'
```
Now, instance a Tron class:
```python
private_key = '....'
tron = Tron(full_node,
solidity_node,
event_server,
private_key)
```
**A full example:**
```python
from tronapi.provider import HttpProvider
from tronapi.tron import Tron
full_node = HttpProvider('https://api.trongrid.io')
solidity_node = HttpProvider('https://api.trongrid.io')
event_server = HttpProvider('https://api.trongrid.io')
# optional
private_key = '...'
tron = Tron(full_node,
solidity_node,
event_server,
private_key)
block = tron.get_current_block()
balance = tron.get_balance('TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY', True)
```
### Cli
```bash
> python cli.py send from to amount private_key
> python cli.py --generateaddress
> python cli.py --node=customnode --getbalance address
```
## Donations
**Tron(TRX)**: TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
A Python API for interacting with the Tron (TRX)
[](LICENSE)
[](https://travis-ci.com/iexbase/tron-api-python)
[](https://github.com/iexbase/tron-api-python/issues)
[](https://github.com/iexbase/tron-api-python/pulls)
[](https://github.com/iexbase/tron-api-python/graphs/contributors)
## Install
| Setup | Command | Notes
| :------ | :------------------ | :---------
| install | `pip install tronapi` |
## Basic Usage
Specify the API endpoints:
```python
full_node = HttpProvider('https://api.trongrid.io')
solidity_node = HttpProvider('https://api.trongrid.io')
event_server = HttpProvider('https://api.trongrid.io')
```
The provider above is optional, you can just use a url for the nodes instead, like here:
```python
full_node = 'https://api.trongrid.io'
solidity_node = 'https://api.trongrid.io'
event_server = 'https://api.trongrid.io'
```
Now, instance a Tron class:
```python
private_key = '....'
tron = Tron(full_node,
solidity_node,
event_server,
private_key)
```
**A full example:**
```python
from tronapi.provider import HttpProvider
from tronapi.tron import Tron
full_node = HttpProvider('https://api.trongrid.io')
solidity_node = HttpProvider('https://api.trongrid.io')
event_server = HttpProvider('https://api.trongrid.io')
# optional
private_key = '...'
tron = Tron(full_node,
solidity_node,
event_server,
private_key)
block = tron.get_current_block()
balance = tron.get_balance('TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY', True)
```
### Cli
```bash
> python cli.py send from to amount private_key
> python cli.py --generateaddress
> python cli.py --node=customnode --getbalance address
```
## Donations
**Tron(TRX)**: TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tronapi-2.0.2.tar.gz
(11.5 kB
view details)
File details
Details for the file tronapi-2.0.2.tar.gz.
File metadata
- Download URL: tronapi-2.0.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e443ef740125e68964d20b30eeebe930a9431d66e59bc82b910b481a360901a1
|
|
| MD5 |
6e81aa6496cab2a7f03f6a04147eab08
|
|
| BLAKE2b-256 |
c50360a74993a8ebb5ce2df87d310276f1ec88552c6155e3139aff435383cb22
|