Skip to main content

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.

  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({
        "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()
    
  2. 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

Release files for taraxa-py 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taraxa-py 0.0.6
File Size Uploaded
taraxa-py-0.0.6.tar.gz 15.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taraxa-py 0.0.6
File Interpreter ABI Platform
taraxa_py-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 38.8 kB

Release files / taraxa-py-0.0.6.tar.gz

Download URL taraxa-py-0.0.6.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
550089894442f54e20f3b3fcba8e000745708e4c444ca12a0758137bf80bc9bc
BLAKE2b-256 checksum
How to use checksums
fb644f613cf196a852988ecdc7305ccd401648fa8cb95827073e83b0b2d37c18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release files / taraxa_py-0.0.6-py3-none-any.whl

Download URL taraxa_py-0.0.6-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
585e6bf54777f9b8fb7207670c541624c14a658de224caa7c9199cf8e72b5327
BLAKE2b-256 checksum
How to use checksums
295fd9a564b390787ac35449d4c9577e921379e17b141bfa9cb9acc943e1d426
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page