Skip to main content

Comprehensive Python library for the Ontology BlockChain.

Project description

Python SDK For Ontology

Introduction

The Ontology official Python SDK is a comprehensive SDK which is based on Python3.7. Currently, it supports local wallet management, digital identity management, digital asset management, deployment and invoke for smart contract, the calling of OEP4, and communication with the Ontology blockchain. The future will also support more functions and applications.

Preparations

Installation requires a Python 3.7 or later environment.

pip install ontology-python-sdk

Interface

Read more in the ontology-python-sdk API document.

Network

This is an API set that allows you to interact with an Ontology nodes.

Main Function
1 get_version()
2 get_balance()
3 get_allowance()
4 get_gas_price()
5 get_network_id()
6 get_node_count()
7 get_block_count()
8 get_block_by_hash()
9 get_block_by_height()
10 get_current_block_hash()
11 get_block_hash_by_height()
12 get_storage()
13 get_smart_contract()
14 get_smart_contract_event_by_tx_hash()
15 get_smart_contract_event_by_height()

Wallet

This is an API set that allows you to handle with wallet account in the form of AccountData.

Main Function
1 add_account()
2 remove_account()

Note: This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!

Account

This is an API set that allows you to generate Ontology accounts and sign transactions and data.

Main Function
1 export_wif()
2 get_signature_scheme()
3 serialize_public_key()
4 serialize_private_key()
5 get_public_key_hex()
6 get_public_key_bytes()
7 get_private_key_from_wif()
8 get_gcm_decoded_private_key()
9 export_gcm_encrypted_private_key()
10 get_address_hex()
11 get_address_hex_reverse()
12 get_address_base58()
13 generate_signature()

Note: This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!

Identity

This is an API set that allows you to generate Ontology Digital Identity.

Main Function
1 parse_ddo()
2 send_get_ddo()
3 new_get_ddo_transaction()
4 new_add_recovery_transaction()
5 new_add_attribute_transaction()
6 new_add_public_key_transaction()
7 new_remove_public_key_transaction()
8 new_registry_ont_id_transaction()
9 new_remove_attribute_transaction()
10 send_add_recovery_transaction()
11 send_add_attribute_transaction()
12 send_add_public_key_transaction()
13 send_registry_ont_id_transaction()
14 send_remove_public_key_transaction()
15 send_remove_attribute_transaction()
16 send_add_public_key_by_recovery()
17 sign_transaction()
18 add_sign_transaction()
19 add_multi_sign_transaction()
20 get_merkle_proof()
21 get_raw_transaction()
22 send_raw_transaction()
23 send_raw_transaction_pre_exec()

Note: This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!

AccountManager

This is an API set that allows you to manage your multiple account in an wallet file.

Main Function
1 import_account()
2 create_account()
3 create_account_from_private_key()
4 get_account()
5 get_accounts()
6 get_default_account()
7 get_default_account_address()
8 set_default_account_by_index()
9 set_default_account_by_address()

Note: This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!

IdentityManager

This is an API set that allows you to manage your multiple identity in an wallet file.

Main Function
1 create_identity()
2 import_identity()
3 create_identity_from_private_key()

Note: This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!

Asset

The Asset package allows you to interact with Ontology Native Digital Asset(ONT, ONG) easily.

Main Function
1 query_name()
2 query_symbol()
3 query_balance()
4 query_decimals()
5 query_allowance()
6 query_unbound_ong()
7 get_asset_address()
8 new_approve_transaction()
9 new_transfer_transaction()
10 new_transfer_from_transaction()
11 new_withdraw_ong_transaction()
12 send_transfer()
13 send_approve()
14 send_transfer_from()
15 send_withdraw_ong_transaction()

ABI

The ABI package allows you to interact with a deployed smart contract easily.

Main Function
1 get_function]()
2 get_parameter()
3 set_params_value()

OEP4

The OEP4 package allows you to interact with an deployed Ontology OEP4 smart contract easily.

Main Function
1 init()
2 get_name()
3 get_symbol()
4 get_decimal()
5 get_total_supply()
6 approve()
7 allowance()
8 balance_of()
9 transfer()
10 transfer_multi()
11 transfer_from()

Note: This package has NOT been audited and might potentially be unsafe. Take precautions to clear memory properly, store the private keys safely, and test transaction receiving and sending functionality properly before using in production!

Utils

The Utils package provides utility functions for Ontology Dapps and other Ontology-Python-Sdk packages.

Main Function
1 get_random_hex_str()
2 get_asset_address()
3 get_random_bytes()

Site

License

The Ontology library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the License file.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

ontology_python_sdk-0.1.4-py3.7-none-any.whl (68.7 kB view details)

Uploaded Python 3

File details

Details for the file ontology_python_sdk-0.1.4-py3.7-none-any.whl.

File metadata

  • Download URL: ontology_python_sdk-0.1.4-py3.7-none-any.whl
  • Upload date:
  • Size: 68.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.0

File hashes

Hashes for ontology_python_sdk-0.1.4-py3.7-none-any.whl
Algorithm Hash digest
SHA256 01a580778aeef5f45f02d892eef0571294c9cf23a651c2a840cf379d451f9b70
MD5 1e5775f3d510792faa1f5764afac48fa
BLAKE2b-256 1e45be795fff566cb2cab2d333d14650cf5b9f1bce10839f4da09da98c974a3d

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