How to Get Started with Fabric-SDK-Py

Jul 18, 2021 | Blockchain

Welcome to the world of Hyperledger Fabric SDK for Python! In this guide, we will take you through setting up Fabric-SDK-Py, which is the Python 3.x implementation of the Hyperledger Fabric SDK, mainly supporting Fabric 1.4.x version. Buckle up as we embark on this coding journey!

Prerequisites for Installation

Before diving into the setup, ensure you have all the required software ready. The SDK necessitates Python 3.x and specific libraries. Depending on your operating system, you can install these prerequisites using the following commands:

  • Ubuntu/Debian:
    sudo apt-get install python-dev python3-dev libssl-dev
  • Redhat/CentOS:
    sudo yum install python-devel python3-devel openssl-devel
  • MacOS:
    brew install python python3 openssl

For additional details on building the cryptography library, visit Install Python Cryptography Lib.

Understanding the Tutorial

To familiarize yourself with the API, it’s advised to read the Tutorial. You can also explore the source code in the docs/source/tutorial.md. For a hands-on experience, a Jupyter notebook detailing sample code is available here.

Quick Testing

It’s a good practice to work in a clean environment while testing. The virtualenv tool will help you achieve that. Follow these steps:

  1. Install the virtualenv tool (if not already installed):
    pip3 install virtualenv
  2. Create a virtual environment:
    make venv
  3. Activate the virtual environment:
    source venv/bin/activate
  4. Perform your testing here.
  5. Deactivate the virtual environment when done:
    deactivate
  6. Clean temporary files:
    make clean

Running Integration Testing

To check the environment and run tests, use the following commands. This ensures that everything is functioning as expected:

make check
make test

To run a specific test case, execute:

tox -e py3 -- test/integration/ca_test.py

Generating Docker Images

To build the Docker image, use the command:

make image

Regenerating Protos

Ensure you have grpcio-tools installed. You can do this through:

pip install grpcio-tools

Then regenerate the protos with:

make proto

Change Logs

Keep track of changes by checking the Change Log. If needed, you can run:

make changelog

to update the changelog ahead of a new release.

Troubleshooting

If you encounter any issues during installation or testing, here are a few troubleshooting tips:

  • Ensure all prerequisites are correctly installed.
  • Check that you’re using the correct Python version and path.
  • Make sure your virtual environment is properly activated when testing.
  • Refer to the community resources linked in the documentation for common issues.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Contributing to Fabric-SDK-Py

Contributions for bugs, questions, and documentation are welcome! Visit the bug tracking or community chat for more guidance. Before contributing, we recommend reading the How to Contribute guide.

Final Thoughts

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox