Skip to main content

Taraxa blockchain RPC client.

Project description

pytaraxa

Taraxa RPC client in python.

pytaraxa pypi address: pytaraxa

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 pytaraxa

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.

  1. 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({
    "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()
  1. function level config set
    function level config set only influence the function it self once.
import pytaraxa.eth as eth
r=eth.blockNumber(ip='127.0.0.1' ,port=7777)
print(r)

usage

  • low level use
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)

data can be json string or dict. response is json string.

  • middle level use
from pytaraxa.jsonrpc  import *
r = eth_blockNumber()
print(r)

response is json string.

  • high level use
import pytaraxa.eth as eth
r = eth.blockNumber()
print(r)

response is parsed to python types.

  • ethereum web3 like use
from pytaraxa.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytaraxa-0.0.4.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytaraxa-0.0.4-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file pytaraxa-0.0.4.tar.gz.

File metadata

  • Download URL: pytaraxa-0.0.4.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for pytaraxa-0.0.4.tar.gz
Algorithm Hash digest
SHA256 ef302fd2aaa08ab1af835b952e7eec2fd30cd4f9002d8f47dd7acbf9a9d323e2
MD5 a4c34c396e4304b92210292eabb559ec
BLAKE2b-256 acf3cc9180b75390dc928a1b2a51666a374f4482a54557dd413e5576c3cf8138

See more details on using hashes here.

File details

Details for the file pytaraxa-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pytaraxa-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for pytaraxa-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 da7cdfb388e7bc28c744c205404f042487f89aa9ec59eb5017195e279156965d
MD5 504ce9e80de6aadb76cc884267945b88
BLAKE2b-256 e713db57d5f334bc43e018086c145aa2b4e1010a78ccf02a0b4406b412da856d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page