Python
Overview
Installation
pip install circular-enterprise-apisUsage example
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_outcome(tx_id, 25)
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}")
Useful Links
Last updated