Skip to main content

ecash-python-rpc

eCash JSON-RPC Python module.

Serves as a tiny layer between an application and an eCash node daemon, its primary usage is querying the current state of the eCash blockchain, network stats, transactions...

Compatible with Avalanche Post-Consensus (0.26.x and later).

Installation

1. Install from pip3

$ pip3 install ecashrpc

2. Node configuration

Configure your eCash Avalanche Node for remote RPC calls based on your node's security needs. This includes:

  • adding server=1, rpcallowip=, rpcbind= and rpcauth/rpcuser/rpcpassword= parameters to your node configuration in bitcoin.conf. (refer to the Server Configuration section of this Blockchain Dev guide)
  • a reverse proxy server such as nginx to serve RPC data to external web apps subject to your eCash node's rpcallowip whitelist
  • install a digital certificate (e.g. Let's Encrypt) on your node to enable HTTPS if desired

Usage

Create a sample ecashrpctest.py script as follows:

import asyncio
from ecashrpc import ECashRPC

async def main():
    async with ECashRPC('HOST:PORT','RPCUSER','RPCPASSWORD') as xecNode:
        print(await xecNode.getavalancheinfo())

if __name__ == "__main__":
    asyncio.run(main())

Running this script (with some additional formatting) yields:

$ python3 ecashrpctest.py

{
  "ready_to_poll":true,
  "local":{
     "verified":true,
     "proofid":"...",
     "limited_proofid":"...",
     "master":"...",
     "payout_address":"ecash:qqmd..........",
     "stake_amount":1560000000
  },
  "network":{
     "proof_count":18,
     "connected_proof_count":18,
     "dangling_proof_count":0,
     "finalized_proof_count":18,
     "conflicting_proof_count":0,
     "immature_proof_count":4,
     "total_stake_amount":83681202831.85,
     "connected_stake_amount":83681202831.85,
     "dangling_stake_amount":0,
     "node_count":37,
     "connected_node_count":33,
     "pending_node_count":4
  }
 }

Supported methods

Here is a list of supported methods. Please submit a PR if you'd like to have a specific RPC method added.

Avalanche

Method Supported?
addavalanchenode ✔
buildavalancheproof ✔
decodeavalanchedelegation ✔
decodeavalancheproof ✔
delegateavalancheproof ✔
getavalancheinfo ✔
getavalanchekey ✔
getavalanchepeerinfo ✔
getrawavalancheproof ✔
isfinalblock ✔
isfinaltransaction ✔
sendavalancheproof ✔
verifyavalanchedelegation ✔
verifyavalancheproof ✔

Blockchain

Method Supported?
getbestblockhash ✔
getblock ✔
getblockchaininfo ✔
getblockcount ✔
getblockhash ✔
getblockheader ✔
getblockstats ✔
getchaintips ✔
getdifficulty ✔
getmempoolinfo ✔
getrawmempool ✔
getnetworkhashps ✔

Mining

Method Supported?
getmininginfo ✔

Network

Method Supported?
getconnectioncount ✔
getnetworkinfo ✔

Raw transactions

Method Supported?
getrawtransaction ✔

License

MIT

Metadata

Release files for ecashrpc 0.0.1

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

Source distribution (sdist)

Source distribution for ecashrpc 0.0.1
File Size Uploaded Provenance
ecashrpc-0.0.1.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ecashrpc 0.0.1
File Interpreter ABI Platform
ecashrpc-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / ecashrpc-0.0.1.tar.gz

Download URL ecashrpc-0.0.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
23148010f1de3fe69242f1233a9e156f3bb52185206fd4941987f9f6511f1d86
BLAKE2b-256 checksum
How to use checksums
a382943f7f220d7663364eec26d84532ab54131a748b082d6da19cf25a913e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / ecashrpc-0.0.1-py3-none-any.whl

Download URL ecashrpc-0.0.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5364bdc6216c6142dbea777b1c9900d7310510cac5ab6766fec07fa05450756e
BLAKE2b-256 checksum
How to use checksums
44831e2ae35b7769fc57f2846d7c80f760ce88cb4c2b6cb2e4670b7f42228d44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for ecashrpc 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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