Skip to main content

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.

  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

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

taraxa-py-0.0.6.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

taraxa_py-0.0.6-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file taraxa-py-0.0.6.tar.gz.

File metadata

  • Download URL: taraxa-py-0.0.6.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for taraxa-py-0.0.6.tar.gz
Algorithm Hash digest
SHA256 550089894442f54e20f3b3fcba8e000745708e4c444ca12a0758137bf80bc9bc
MD5 5171e3d7912fe70ee73c299ca2967241
BLAKE2b-256 fb644f613cf196a852988ecdc7305ccd401648fa8cb95827073e83b0b2d37c18

See more details on using hashes here.

File details

Details for the file taraxa_py-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: taraxa_py-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for taraxa_py-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 585e6bf54777f9b8fb7207670c541624c14a658de224caa7c9199cf8e72b5327
MD5 04fc5d4e90a223391ee43e959ddd4b23
BLAKE2b-256 295fd9a564b390787ac35449d4c9577e921379e17b141bfa9cb9acc943e1d426

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