Defichain Python Library
Project description
DefichainPython
This library is not finished yet and therefore should not be used in production!
Changes can still occur at any time and may break your code!
Welcome to Defichain's Python Library
Welcome to the Python Library for the Defichain!
In this library all RPC commands of a Defichain Node are available and can be called in a few lines of code!
If you just want to query data from the blockchain you can also use the Ocean API: you don't need a Defichain Node for this, just an internet connection!
But first we need to install it:
Installation
pip install defichain
Example Code for RPC
from defichain import Node
node = Node("user", "password", "127.0.0.1", 8554)
node.blockchain.getblockcount() # returns block height of the latest block
node.poolpair.compositeswap("fromAddress", "BTC", 0.01, "toAddress", "DFI") # swaps 0.01 BTC to DFI
Example Code for Ocean API
from defichain import Ocean
ocean = Ocean() # creates the connection to Ocean
ocean.blocks.list() # returns the latest 30 blocks
ocean.poolpairs.get(4) # returns data from ETH-DFI Pool
Next Steps
- Finish the RPC Code
- Write unit tests for RPC and Ocean commands
- Document all functions and publish it on ReadTheDocs
Community
This project is funded by the Defichain Community: Thank you for your trust! If you have suggestions for improvement or other ideas open an issue, write me on Twitter or via email (introc@volz.link)!
License & Disclaimer
By using (this repo), you (the user) agree to be bound by the terms of this license (MIT License).
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
Hashes for defichain-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc92c7710456bf5950624ebb8858ae20c6fa57f668725b002bf51b3fbb4d9d5d |
|
MD5 | d547054b60181b481070ed9acc9f5625 |
|
BLAKE2b-256 | 5aa1772aec8593ef5030b1938bc021a07e3fce9f69c491b01b9a48500ea60eb6 |