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
git clone https://github.com/Taraxa-project/taraxa-py
cd taraxa-py
python setup.py install
or
pip install taraxa-py
config
default parameters:
config={
"ip":"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 taraxa.jsonrpc as rpc
import taraxa.eth as eth
import taraxa.taraxa as taraxa
import taraxa.net as net
rpc.set({
"ip":"127.0.0.1",
"port":7777,
"jsonrpc":2.0,
"id":1
})
eth.set({
"ip":"35.224.183.106",
})
taraxa.set({
"ip":"35.224.183.106",
})
net.set({
"ip":"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 taraxa.eth as eth
r=eth.blockNumber(ip='127.0.0.1' ,port=7777)
print(r)
usage
- low level use
import taraxa.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)
data can be json string or dict. response is json string.
- middle level use
from taraxa.jsonrpc import *
r = eth_blockNumber()
print(r)
response is json string.
- high level use
import taraxa.eth as eth
r = eth.blockNumber()
print(r)
response is parsed to python types.
- ethereum web3 like use
from taraxa.web3 import Web3
w3 = Web3(ip="35.224.183.106" ,port=7777)
r = w3.blockNumber()
print(r)
w3.ip = "35.224.183.106"
w3.port = 7778
r = w3.blockNumber()
print(r)
Web3 object w3 will hold the ip and port once you set.
w3 method will use the ip and port you set until you reset it.
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.5.tar.gz
(11.3 kB
view hashes)
Built Distribution
taraxa_py-0.0.5-py3-none-any.whl
(16.3 kB
view hashes)
Close
Hashes for taraxa_py-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 587635ccb23f6ae243c31db381ff148888e8666f5ac6ece39b57bfa0c55bfc08 |
|
MD5 | afed8a73e5caec98ca9e83a5068131e1 |
|
BLAKE2b-256 | cf120c911ff9fe10768b2163db1f42c140e98e10a8fa0e50922fb8f26de9daaa |