本体区块链的综合python库。
pyontio的Python项目详细描述
本体论python sdk
简介
本体官方python sdk是一个基于Python3.6
的综合性sdk。目前,它支持本地钱包管理、数字身份管理、数字资产管理、智能合约的部署和调用、OEP4的调用以及与本体区块链的通信。未来还将支持更多的功能和应用。
准备工作
安装需要Python3.7或更高版本的环境。
pip install ontology-python-sdk
接口
阅读ontology-python-sdk API document中的更多内容。
网络
这是一个api集,允许您与本体节点交互。
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() |
钱包
这是一个api集,允许您以AccountData
的形式处理钱包帐户。
Main Function | |
---|---|
1 | add_account() |
2 | remove_account() |
注意:此包的未经审核,可能不安全。在生产中使用之前,请注意正确清除内存,安全存储私钥,并正确测试事务接收和发送功能!
账户
这是一个api集,允许您生成本体帐户并签署事务和数据。
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() |
注意:此包的未经审核,可能不安全。在生产中使用之前,请注意正确清除内存,安全存储私钥,并正确测试事务接收和发送功能!
同一性
这是一个api集,允许您生成ontology数字标识。
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() |
注意:此包的未经审核,可能不安全。在生产中使用之前,请注意正确清除内存,安全存储私钥,并正确测试事务接收和发送功能!
会计经理
这是一个api集,允许您管理钱包文件中的多个帐户。
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() |
注意:此包的未经审核,可能不安全。在生产中使用之前,请注意正确清除内存,安全存储私钥,并正确测试事务接收和发送功能!
身份管理器
这是一个api集,允许您管理钱包文件中的多个身份。
Main Function | |
---|---|
1 | create_identity() |
2 | import_identity() |
3 | create_identity_from_private_key() |
注意:此包的未经审核,可能不安全。在生产中使用之前,请注意正确清除内存,安全存储私钥,并正确测试事务接收和发送功能!
资产
Asset
包允许您轻松地与本体本地数字资产(ont,ong)交互。
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
ABI
包允许您轻松地与部署的智能合约进行交互。
Main Function | |
---|---|
1 | get_function]() |
2 | get_parameter() |
3 | set_params_value() |
oep4
OEP4
包允许您轻松地与已部署的本体oep4智能契约交互。
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() |
注意:此包的未经审核,可能不安全。在生产中使用之前,请注意正确清除内存,安全存储私钥,并正确测试事务接收和发送功能!
utils
Utils
包为Ontology Dapps
和其他Ontology-Python-Sdk
包提供实用函数。
Main Function | |
---|---|
1 | get_random_hex_str() |
2 | get_asset_address() |
3 | get_random_bytes() |
站点
许可证
本体库(即CMD目录之外的所有代码)在GNU Lesser General Public License v3.0下获得许可,也包含在许可文件中的存储库中。