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
Release history Release notifications | RSS feed
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.11.tar.gz
(7.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htdfsdk-0.0.11.tar.gz.
File metadata
- Download URL: htdfsdk-0.0.11.tar.gz
- Upload date:
- Size: 7.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22bd14dbba2677140f57c7c54682c1bd04863642d5059ca2c651ca982b927168
|
|
| MD5 |
1e1d445e4e4587a96c02185b96634b76
|
|
| BLAKE2b-256 |
06058e85ab94d93d9703a8af18c5bc1818fdb6784c1afab96a9ed7ecec71354a
|
File details
Details for the file htdfsdk-0.0.11-py3-none-any.whl.
File metadata
- Download URL: htdfsdk-0.0.11-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce78903636e79ffe5c29aa072de5b3ac42e2592a9d3e8922c027ce5d51ed18b7
|
|
| MD5 |
ac0941fd5ebf8fdd09cb70f3e946592e
|
|
| BLAKE2b-256 |
db3407f152d5c91b22515e755a73357bf633498e6eda0dcd9362da55ca017fe8
|