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:
- Setuptools is required to manage the installation of Python packages. First, check if it is already installed:
pip show setuptools
- If it is not installed, you can install it using:
pip3 install setuptools
- Setuptools is required to manage the installation of Python packages. First, check if it is already installed:
To build the SDK and see changes, follow these steps:
-
Clone the repository:
- Clone this repository to your local machine and navigate to the directory:
git clone <repository_url> cd <repository_directory>
- Clone this repository to your local machine and navigate to the directory:
-
Install dependencies and set up modules:
- Use the
setup.py
script to install dependencies and set up the modules:python3 setup.py install
- Use the
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.
- Installation:
pip3 install substrate-interface
- Installation Guide
- Installation:
-
base58: A Python library for Base58 encoding and decoding.
- Installation:
pip3 install base58
- Installation Guide
- Installation:
-
mnemonic: A Python implementation of the BIP39 mnemonic code for generating deterministic keys.
- Installation:
pip3 install mnemonic
- Installation Guide
- Installation:
-
pynacl: A Python binding to the Networking and Cryptography (NaCl) library.
- Installation:
pip3 install pynacl
- Installation Guide
- Installation:
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