Skip to main content

Comprehensive Python library for the Ontology BlockChain.

Project description

Ontology Python SDK

Codacy Badge Codacy Badge Build Status pypi-w docs pypi-pyversions pypi-v

Introduction

The Ontology official Python SDK is a comprehensive SDK which is based on Python3.6. 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_height()
9 get_block_by_hash()
10 get_block_by_height()
11 get_current_block_hash()
12 get_block_hash_by_height()
13 get_storage()
14 get_smart_contract()
15 get_smart_contract_event_by_tx_hash()
16 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 get_public_key_bytes()
4 get_private_key_bytes()
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 remove_public_key()
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_transaction_by_tx_hash()
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 Distribution

pyontio-0.0.2.tar.gz (66.8 kB view details)

Uploaded Source

Built Distribution

pyontio-0.0.2-py3-none-any.whl (137.0 kB view details)

Uploaded Python 3

File details

Details for the file pyontio-0.0.2.tar.gz.

File metadata

  • Download URL: pyontio-0.0.2.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pyontio-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7a41b5e6ae96d86249fa92f142b955d6811bcf193dd1c218ca4b4ec1e1f6d2c8
MD5 1516c73ee46c64837b0aaddeebd9a0da
BLAKE2b-256 71fc574340f80789532d7b3c9aa781ed0c21c451bdc31d58225100ebdd616d80

See more details on using hashes here.

File details

Details for the file pyontio-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyontio-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 137.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for pyontio-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a924dc9c917cccb0d48581dc4e771e16eb1e7dea8536d9669ba84519abac3f4
MD5 ce7aea68ee2676c1ad9eb133a4d0f216
BLAKE2b-256 8c34ccd18f0fed4a6df66d03a8c699feebcd96f86ffd295378558276a2b121e4

See more details on using hashes here.

Supported by

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