CORD.py is a Python library that provides a collection of classes and methods to interact with the Cord blockchain network.
Before you begin, ensure that you have the following:
Python 3.10 or higher:
CORD.py requires Python version 3.10 or higher. You can check your Python version by running:
python3 --version
If you do not have Python installed, you can download it from the official Python website.
pip:
pip is the package installer for Python. It is usually included with Python, but you can verify its installation with:
pip3 --version
If pip is not installed, you can install it by following these steps:
sudo apt install python3-pip
Setuptools:
pip show setuptools
pip3 install setuptools
To build the SDK and see changes, follow these steps:
Clone the repository:
git clone <repository_url>
cd <repository_directory>
Install dependencies and set up modules:
setup.py
script to install dependencies and set up the modules:
python3 setup.py install
The following dependencies are automatically installed when you run the setup.py
script. However, if you want to install them separately, you can use the following commands:
substrate-interface: A Python interface to interact with Substrate-based blockchains.
pip3 install substrate-interface
base58: A Python library for Base58 encoding and decoding.
pip3 install base58
mnemonic: A Python implementation of the BIP39 mnemonic code for generating deterministic keys.
pip3 install mnemonic
pynacl: A Python binding to the Networking and Cryptography (NaCl) library.
pip3 install pynacl
After building the SDK, you can experiment with the provided methods.
The SDK includes demo methods to help you interact with the Cord blockchain network.
The demo-statement
method allows you to interact with statement-related functionalities.
To run the statement demo, execute the following command:
python3 -u "demo/src/func_tests.py"
The network-score-tests
method demonstrates methods related to network scores.
To run the network score demo, execute the following command:
python3 -u "demo/src/network-score-tests.py"
The asset-tx
method showcases methods related to assets.
To run the asset demo, execute the following command:
python3 -u "demo/src/asset-tx.py"
The output of each demo script will demonstrate the functionality of the corresponding method. For a detailed structure of the demo scripts, refer to the source code.
To run the tests for different modules, run:
python3 tests/test_<module_name>.py
For example if you want to run tests for did
module run:
python3 tests/test_did.py