XCASH Foundation ecosystem API wrapper
Project description
XCASH Foundation ecosystem python API wrapper
What is it?
Is a client Python wrapper library around XCASH Foundation ecosystem products.
Integrations
- Blockchain Explorer api wrapper
- Delegates Explorer api wrapper
- Shared Delegate api wrapper
- RPC
- Daemon
- Wallet
- Dpops
- PyPi published
Setup
Install required package
Package can be installed with pip, the python package index.
pip3 install xcash
or
pip install xcash
Ecosystem accessible products
To access products you are required to import packages and initiate them:
# Access to blockchain data
from xcash.blockchainExplorer import BlockchainExplorer
blockchain_api = BlockchainExplorer()
# Access Delegates Explorer of DPOPS system
from xcash.delegatesExplorer import DelegatesExplorer
delegates_api = DelegatesExplorer()
# Access Shared delegate through api
from xcash.sharedDelegate import SharedDelegate
delegate_api = SharedDelegate(delegate_url="DELEGATE URL")
RPC server Daemon, Wallet and Dpops wallet (delegate)
Pre-requirements -> Start the RPC server!
In order to be able to execute calls to RPC you are required to first initiate RPC server.
Cd to the wallet folder bin where xcash-wallet-rpc is located, and open the location with either cmd ( Windows) or terminal (Ubuntu)
Initiate PRC server either with:
- Local daemon
# Windows
xcash-wallet-rpc.exe --wallet-file <Wallet Name> --password <Wallet PSW> --rpc-bind-port 18285 --disable-rpc-login --confirm-external-bind --trusted-daemon
#Ubuntu
./xcash-wallet-rpc --wallet-file <Wallet Name> --password <Wallet PSW> --rpc-bind-port 18285 --disable-rpc-login --confirm-external-bind --trusted-daemon
- Remote daemon
# Windows
xcash-wallet-rpc.exe --wallet-file <Wallet Name> --password <Wallet PSW> --rpc-bind-port 18285 --disable-rpc-login --confirm-external-bind --daemon-address <daemon_address>:18281
# Ubuntu
./xcash-wallet-rpc --wallet-file <Wallet Name> --password <Wallet PSW> --rpc-bind-port 18285 --disable-rpc-login --confirm-external-bind --daemon-address <daemon_address>:18281
Import desired packages to python script
# Access endpoints for XCASH Daemon
from xcash.rpc import XcashDaemonRpc
daemon = XcashDaemonRpc()
# Access endpoints for XCASH wallet
from xcash.rpc import XcashWalletRpc
wallet = XcashWalletRpc()
# Access endpoints on wallet dedicated for delegate.
from xcash.rpc import XcashDpopsWalletRpc
dpops = XcashDpopsWalletRpc()
Examples
Blockchain Explorer Api
from xcash.blockchainExplorer import BlockchainExplorer
from pprint import pprint
# Initiate blockchain explorer client
blockchain_api = BlockchainExplorer()
# Get blockchain data
blockchain_data = blockchain_api.get_blockchain_data()
# Print data
pprint(blockchain_data)
Examples on all available methods to communicate with XCASH blockchain Rest API can be found here
Delegates Explorer Api
from xcash.delegatesExplorer import DelegatesExplorer
from pprint import pprint
# Initiate delegates explorer client
delegates_api = DelegatesExplorer()
# Get delegates/DPOPS statistics
statistics = delegates_api.get_delegate_website_statistics()
# Print data
pprint(statistics)
Examples on all available methods to communicate with XCASH DPOPS Delegates Explorer Rest API can be found here
Shared Delegate Api
from xcash.sharedDelegate import SharedDelegate
from pprint import pprint
# Initiate shared delegate and provide delegates address as param to access API
url = "http://xpayment.x-network.eu"
delegate_api = SharedDelegate(delegate_url=url)
# Delegate statistics data from delegate website
statistics = delegate_api.get_delegate_website_statistic()
# Print data
pprint(statistics)
Examples on all available methods to communicate with Shared Delegate Rest API can be found here
Daemon RPC call
from xcash.rpc import XcashDaemonRpc
from pprint import pprint
daemon = XcashDaemonRpc()
# Get the daemon version
version = daemon.get_version()
pprint(version)
Examples on all available methods to communicate with Daemon RPC API can be found here
Wallet RPC call
from xcash.rpc import XcashWalletRpc
from pprint import pprint
wallet = XcashWalletRpc()
# Get balance
balance = wallet.get_balance()
pprint(balance)
Examples on all available methods to communicate with Wallet RPC API can be found here
DPOPS Wallet RPC call
from xcash.rpc import XcashDpopsWalletRpc
from pprint import pprint
dpops_wallet = XcashDpopsWalletRpc()
status = dpops_wallet.register_delegate(delegate_name="Animus-Test", delegate_ip_address="100.100.00.00")
pprint(status)
Examples on all available methods to communicate with DPOPS wallet RPC API can be found here
References
- https://docs.xcash.foundation/applications/rpc-calls/json-rpc-methods
- https://docs.xcash.foundation/applications/rpc-calls/xcash-wallet-rpc
- https://docs.xcash.foundation/applications/rpc-calls/xcash-wallet-rpc/dpops-wallet-rpc-calls
Contributors
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.