Taraxa blockchain RPC client.
Project description
taraxa-py
Taraxa RPC client in python.
taraxa-py pypi address: taraxa-py
Taraxa official website: taraxa.io
install
install from source code.
git clone https://github.com/Taraxa-project/taraxa-py
cd taraxa-py
python setup.py install
or install from pypi pytaraxa.
pip install taraxa-py
config
default parameters:
config={
"host":"127.0.0.1",
"port":7777,
"jsonrpc":2.0,
"id":1
}
for all methods, if no parameter given, default will be used.
- package level config set and reset.
any of below config will influence the whole packge.import pytaraxa.jsonrpc as rpc import pytaraxa.eth as eth import pytaraxa.taraxa as taraxa import pytaraxaa.net as net rpc.set({ "host":"127.0.0.1", "port":7777, "jsonrpc":2.0, "id":1 }) eth.set({ "host":"35.224.183.106", }) taraxa.set({ "host":"35.224.183.106", }) net.set({ "host":"35.224.183.106", }) rpc.reset() eth.reset() taraxa.reset() net.reset()
- function level config set
function level config set only influence the function it self once.import pytaraxa.eth as eth r=eth.blockNumber(host='127.0.0.1' ,port=7777) print(r)
usage
-
1.low level use
input data can be json string or dict.
response is json string.import pytaraxa.jsonrpc as rpc data = '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' r = rpc.send(data) print(r) data = {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1} r = rpc.send(data) print(r)
-
2.middle level use
response is json string.from pytaraxa.jsonrpc import * r = eth_blockNumber() print(r)
-
3.high level use
response is parsed to python types.import pytaraxa.eth as eth r = eth.blockNumber() print(r)
-
4.ethereum web3.py like use
import pytaraxa import web3 w3 = web3.Web3(host="127.0.0.0" ,port=7777) r = w3.eth.blockNumber() print(r) w3.host = "35.224.183.106" w3.port = 7778 r = w3.eth.blockNumber() print(r)
object w3 of class Web3 will hold the host and port once you set until you reset it to default.
sub packages
- jsonrpc
- eth
- web3
- net
TODO - admin
TODO - admmin_net
TODO - debug
TODO - test
TODO
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
taraxa-py-0.0.6.tar.gz
(15.3 kB
view hashes)
Built Distribution
taraxa_py-0.0.6-py3-none-any.whl
(23.5 kB
view hashes)
Close
Hashes for taraxa_py-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 585e6bf54777f9b8fb7207670c541624c14a658de224caa7c9199cf8e72b5327 |
|
MD5 | 04fc5d4e90a223391ee43e959ddd4b23 |
|
BLAKE2b-256 | 295fd9a564b390787ac35449d4c9577e921379e17b141bfa9cb9acc943e1d426 |