Skip to main content

htdf sdk

Project description

HTDF sdk

the sdk of HTDF

require python >= 3.6

Install

pip install htdfsdk

Example

create address

from htdfsdk import Address, HtdfPrivateKey
privkey = HtdfPrivateKey('')
print(privkey.private_key)
print(privkey.address)
# privkey2 = HtdfPrivateKey(privkey.private_key)
# pk3 = HtdfPrivateKey('279bdcd8dccec91f9e079894da33d6888c0f9ef466c0b200921a1bf1ea7d86e8')
# addr3 = Address('htdf1xwpsq6yqx0zy6grygy7s395e2646wggufqndml')

normal htdf transaction

from pprint import pprint
from htdfsdk import HtdfRPC, HtdfTxBuilder, htdf_to_satoshi, Address, HtdfPrivateKey

htdfrpc = HtdfRPC(chaid_id='testchain', rpc_host='192.168.0.171', rpc_port=1317)

from_addr = Address('htdf1xwpsq6yqx0zy6grygy7s395e2646wggufqndml')
to_addr = Address('htdf1jrh6kxrcr0fd8gfgdwna8yyr9tkt99ggmz9ja2')
private_key = HtdfPrivateKey('279bdcd8dccec91f9e079894da33d6888c0f9ef466c0b200921a1bf1ea7d86e8')
from_acc = htdfrpc.get_account_info(address=from_addr.address)
signed_tx = HtdfTxBuilder(
    from_address=from_addr,
    to_address=to_addr,
    amount_satoshi=htdf_to_satoshi(20.1215),
    sequence=from_acc.sequence,
    account_number=from_acc.account_number,
    chain_id=htdfrpc.chain_id,
    gas_price=100,
    gas_wanted=30000,
    data='',
    memo='htdfsdk test'
).build_and_sign(private_key=private_key)

tx_hash = htdfrpc.broadcast_tx(tx_hex=signed_tx)
print('tx_hash: {}'.format(tx_hash))

mempool =  htdfrpc.get_mempool_trasactions()

memtx = htdfrpc.get_mempool_transaction(transaction_hash=tx_hash)

tx = htdfrpc.get_tranaction_until_timeout(transaction_hash=tx_hash)
pprint(tx)

tx = htdfrpc.get_transaction(transaction_hash=tx_hash)
pprint(tx)

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

htdfsdk-0.0.10.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

htdfsdk-0.0.10-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file htdfsdk-0.0.10.tar.gz.

File metadata

  • Download URL: htdfsdk-0.0.10.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for htdfsdk-0.0.10.tar.gz
Algorithm Hash digest
SHA256 7213df9907a23deda4e486e70d5f07a5831662e974ec50df5b18fa2d59951984
MD5 ab91186e92d5c3caf95c25a13a1d8ffe
BLAKE2b-256 44505b356b24b924d9f67d70a6a34349445a858a1e8e5a315bdfd615a051364a

See more details on using hashes here.

File details

Details for the file htdfsdk-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: htdfsdk-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for htdfsdk-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 da127c44fd790f88ce47b23f122203e17ddccbc8dae223ca544b72ee987fcd16
MD5 e2c9a11dbca0edc2a61af594f0c473ca
BLAKE2b-256 99bba04a928242aaae2a536e89378f3f9ccb02a4fc83b41c38f77d9a90615492

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