hardiksharma11 / cord.py

cord.py is the SDK for the CORD Blockchain in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CORD.py

CORD.py is a Python library that provides a collection of classes and methods to interact with the Cord blockchain network.

Prerequisites for Building the SDK

Before you begin, ensure that you have the following:

  1. 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.

  2. 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
  3. 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

Building the SDK

To build the SDK and see changes, follow these steps:

  1. Clone the repository:

    • Clone this repository to your local machine and navigate to the directory:
      git clone <repository_url>
      cd <repository_directory>
  2. Install dependencies and set up modules:

    • Use the setup.py script to install dependencies and set up the modules:
      python3 setup.py install

Required Dependencies

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.

  • base58: A Python library for Base58 encoding and decoding.

  • mnemonic: A Python implementation of the BIP39 mnemonic code for generating deterministic keys.

  • pynacl: A Python binding to the Networking and Cryptography (NaCl) library.

Experimenting with SDK Methods

After building the SDK, you can experiment with the provided methods.

Demo Methods

The SDK includes demo methods to help you interact with the Cord blockchain network.

Statement Method:

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"

Network Score Method:

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"

Asset Method:

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.

Running Tests

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

About

cord.py is the SDK for the CORD Blockchain in Python


Languages

Language:Python 100.0%