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.7.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

pyontio-0.0.7-py3-none-any.whl (162.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyontio-0.0.7.tar.gz
  • Upload date:
  • Size: 62.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for pyontio-0.0.7.tar.gz
Algorithm Hash digest
SHA256 e6c9f9bb274530136dbb455fe1bdddf4cfceed45de5884d2ef46d11927e5ce21
MD5 7f4548938afca94b7f886ec05530dc2d
BLAKE2b-256 bf98919d29c9b78f8a930153a9567eca2c33d7dd1022de5ba01fa5eea2d6ec7e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyontio-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 162.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for pyontio-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 97f5398b7cf7f150defa11cba483ce24e63c8354feb8906712b3ad094d8bb8ea
MD5 29ccc2f270ca98fbb7f6070d66ef06ad
BLAKE2b-256 958991d8f45e2c164a02c5bda4a70988b543c79c2fbf6b04592df09f6963580b

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