eCash JSON-RPC Python module
Project description
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=
andrpcauth/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
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
Built Distribution
File details
Details for the file ecashrpc-0.0.1.tar.gz
.
File metadata
- Download URL: ecashrpc-0.0.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23148010f1de3fe69242f1233a9e156f3bb52185206fd4941987f9f6511f1d86 |
|
MD5 | 11baefd8849e960f82a5a42f0d7ef555 |
|
BLAKE2b-256 | a382943f7f220d7663364eec26d84532ab54131a748b082d6da19cf25a913e44 |
File details
Details for the file ecashrpc-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: ecashrpc-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5364bdc6216c6142dbea777b1c9900d7310510cac5ab6766fec07fa05450756e |
|
MD5 | 309d8bd9110115f51bed234cd9e901a8 |
|
BLAKE2b-256 | 44831e2ae35b7769fc57f2846d7c80f760ce88cb4c2b6cb2e4670b7f42228d44 |