Skip to main content

Circular Enterprise Python APIs for Data Certification

This library provides Python implementations of the Circular Enterprise APIs for data certification and blockchain integration. It includes classes and helper functions to interact with the Circular network, submit certificates, retrieve transactions, and manage accounts.

Features:

  • Data Certification: Submit data to the blockchain for certification.
  • Transaction Retrieval: Fetch transaction details by ID or block range.
  • Account Management: Open, update, and close accounts.
  • Secure Signing: Sign data using elliptic curve cryptography (secp256k1).
  • Network Integration: Connect to different blockchain networks (mainnet, testnet, devnet). """

Installation Instructions:

Installation

You can install this library using pip:

pip install circular_enterprise_apis

Usage Instructions:

Usage

  1. Opening an Account:
from circular_enterprise_apis import CEP_Account

account = CEP_Account()
account.open('a4fc8b11bfc5dc2911ab41871e6de81f500fe60f3961343b202ad78e7e297ea08')

print("Account opened successfully.")
  1. Choosing a network and the blockchain:
blockchain = 'blockchain-address'
account.set_network("testnet") # chose between multiple networks such as testnet, devnet and mainnet
account.set_blockchain(blockchain)
  1. Retrieve account informations
if account.update_account():
    #...
  1. Submitting a Certificate:
pdata = 'Your data to certify'
private_key = 'your_private_key_here'

try:
    response = account.submit_certificate(pdata, private_key)
    print(response)
except Exception as e:
    print(f"Error: {e}")
  1. Retrieving a Transaction:
#...
resp = account.get_transaction_by_id(tx_id, 0, 10)
if resp["Response"]["BlockID"]:
    block_id = resp["Response"]["BlockID"]
    status = account.get_transaction(block_id, tx_id)

    if status["Result"] == 200:
        print(f"Transaction Status: {status['Response']['Status']}")
        account.close()
    else:
        print("Error on retrieving transaction")
else:
    print("Error on retrieving transaction status")
#...

Example Workflow:

from circular_enterprise_apis import CEP_Account

try:
    # Instantiate the CEP Account class
    account = CEP_Account()
    print("CEP_Account instantiated successfully.")

    address = "your-account-address"
    private_key = "your-private-key"
    blockchain = "blockchain-address"
    tx_id = ""
    tx_block = ""

    account.set_network("testnet")
    account.set_blockchain(blockchain)
    print("Test variables set.")

    if account.open(address):
        print("Account opened successfully.")

        if account.update_account():
            print(f"Nonce: {account.Nonce}")

            tx_id_temp = account.submit_certificate(
                "your-data-to-certificate",
                private_key
            )
            if tx_id_temp["Result"] == 200:
                tx_id = tx_id_temp["Response"]["TxID"]
                print(f"TxID: {tx_id}")

                resp = account.get_transaction_by_id(tx_id, 0, 10)
                if resp["Response"]["BlockID"]:
                    block_id = resp["Response"]["BlockID"]
                    status = account.get_transaction(block_id, tx_id)

                    if status["Result"] == 200:
                        print(f"Transaction Status: {status['Response']['Status']}")
                        account.close()
                    else:
                        print("Error on retrieving transaction")
                else:
                    print("Error on retrieving transaction status")
            else:
                print("Certificate submission error")
        else:
            print(f"Update Account Error: {account.lastError}")
    else:
        print(f"Failed to open account: {account.lastError}")
except Exception as e:
    print(f"An error occurred: {e}")

Helper Functions:

Helper Functions:

  • hex_fix(hex): Removes '0x' from hexadecimal strings.
  • string_to_hex(string): Converts a string to its hexadecimal representation.
  • hex_to_string(hex): Converts a hexadecimal string back to a regular string.
  • get_formatted_timestamp(): Returns the current timestamp in YYYY:MM:DD-HH:MM:SS format.

Contributing:

Contributing: Contributions are welcome! If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Submit a pull request with a detailed description of your changes.

License:

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

Support:

Support: For questions or issues, please open an issue on the GitHub repository.

Release files for circular-enterprise-apis 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for circular-enterprise-apis 1.0.1
File Size Uploaded
circular_enterprise_apis-1.0.1.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for circular-enterprise-apis 1.0.1
File Interpreter ABI Platform
circular_enterprise_apis-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / circular_enterprise_apis-1.0.1.tar.gz

Download URL circular_enterprise_apis-1.0.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d7c482067d0a4d843a6d539a42618334cca8e55260c7b54e4ddcf03c67194595
BLAKE2b-256 checksum
How to use checksums
16c91b08b46d25e5679c684654687c886779be51e23c62ad7a4b381b2c1887bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2025.

Transparency log

Release files / circular_enterprise_apis-1.0.1-py3-none-any.whl

Download URL circular_enterprise_apis-1.0.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
976a23807d0298095bfad5c0c2f15d381c7e4c59930f35b214ad2356c3e9aa3a
BLAKE2b-256 checksum
How to use checksums
00953cae74f130096f7822ffbb28461299644a7ea4f331db9357a7b493ca7eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page