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
- Opening an Account:
from circular_enterprise_apis import CEP_Account
account = CEP_Account()
account.open('a4fc8b11bfc5dc2911ab41871e6de81f500fe60f3961343b202ad78e7e297ea08')
print("Account opened successfully.")
- 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)
- Retrieve account informations
if account.update_account():
#...
- 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}")
- 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:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- 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)
| File | Size | Uploaded | |
|---|---|---|---|
| circular_enterprise_apis-1.0.1.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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