Skip to main content

SDK for interacting with Digital Product Passport smart contracts

Project description

Solidity Python SDK

Overview

The Solidity Python SDK is a Python library designed for interacting with Digital Product Passport smart contracts. It provides an easy-to-use interface for deploying and interacting with smart contracts on the Ethereum blockchain.

Features

  • Load Contracts: Load and interact with pre-deployed smart contracts.
  • Deploy Contracts: Deploy new smart contracts to the Ethereum blockchain.
  • Set and Get Product Details: Set and retrieve detailed product information from smart contracts.
  • Support for IPFS: Integrate with IPFS for storing and retrieving product-related documents.

Installation

To install the SDK, you can use pip:

pip install -i https://test.pypi.org/simple/ solidity-python-sdk==0.1.1

or

pip install solidity-python-sdk

Usage

Here's a quick start guide to help you get started with the SDK:

Basic Usage

from solidity_python_sdk.main import DigitalProductPassportSDK

sdk = DigitalProductPassportSDK()

Deploy a Contract

account_address = "0xYourEthereumAddress"
contract_address = sdk.product_passport.deploy(account_address)
print(f"Contract deployed at address: {contract_address}")

Set Product Details

product_details = {
    "productId": 1,
    "description": "Brigadeiro Product Passport",
    "manuals": ["QmbnzbFDcmtJhyw5XTLkcnkJMhW86YZg6oc3FsNBeN2r4W"],
    "specifications": ["QmbnzbFDcmtJhyw5XTLkcnkJMhW86YZg6oc3FsNBeN2r4W"],
    "batchNumber": "BRG-2023-001",
    "productionDate": "2023-06-20",
    "expiryDate": "2023-12-31",
    "certifications": "FDA-5678",
    "warrantyInfo": "Not applicable",
    "materialComposition": "Condensed milk, cocoa powder, butter, chocolate sprinkles",
    "complianceInfo": "Compliant with local food safety regulations",
    "ipfs": "QmWDYhFAaT89spcqbKYboyCm6mkYSxKJaWUuS18Akmw96t"
}

tx_receipt = sdk.product_passport.set_product_data(contract_address, 1, product_details)
print(f"Transaction receipt: {tx_receipt}")

Get Product Details

product_data_retrieved = sdk.product_passport.get_product_data(contract_address, 1)
print(f"Retrieved product data: {product_data_retrieved}")

Documentation

The documentation for the SDK is available in the docs directory. You can view the documentation in Markdown format or convert it to other formats if needed.

Contributing

We welcome contributions to improve the SDK! Please follow these steps to contribute:

Fork the repository.

Create a new branch for your changes. Make your changes and write tests. Submit a pull request with a clear description of your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or support, please contact:

Author: Luthiano Trarbach Email: luthiano.trarbach@proton.me

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solidity_python_sdk-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solidity_python_sdk-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file solidity_python_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: solidity_python_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.13

File hashes

Hashes for solidity_python_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ac2594ae9adf9d13bf4f9b4ca5c3d2ed8240dcea8415f526d12d717d745522da
MD5 6df1d94a94f5629346f697e6e77d2519
BLAKE2b-256 39ccaa203382cb423160ce7fea84c8f0efa927971c2988db98f35c045752d15e

See more details on using hashes here.

File details

Details for the file solidity_python_sdk-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for solidity_python_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb4a3d253f050c2af4ac6e5b52c627b96bf61d6e43fc6478829e0b80ddd260b
MD5 b7d2ba57c557d9b720e604e9b6ac8b65
BLAKE2b-256 8526e67b1453c2cc319f2b0a9f17e6113f00585b61921c6c50303a7ea88b3f55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page