• R/O
  • HTTP
  • SSH
  • HTTPS

pybtm: 提交

Python3 implementation of the Bytom protocol. https://pypi.org/project/pybtm/


Commit MetaInfo

修订版1cd87be5a0c78424e8717675ee9b1e51b6a30c2e (tree)
时间2019-03-28 19:52:04
作者Chengcheng Zhang <943420582@qq.c...>
CommiterChengcheng Zhang

Log Message

add get_new_address

更改概述

差异

--- a/README.md
+++ b/README.md
@@ -17,7 +17,8 @@ pybtm
1717 - [2.12 Create new key](#212-create-new-key)
1818 - [2.13 Create HD path](#213-create-hd-path)
1919 - [2.14 Create control program](#214-create-control-program)
20- - [Create address](#create-address)
20+ - [2.15 Create address](#215-create-address)
21+ - [2.16 Create new address](#216-create-new-address)
2122
2223 Python3 implementation of the Bytom protocol.
2324
@@ -355,7 +356,7 @@ Return:
355356 '0014052620b86a6d5e07311d5019dffa3864ccc8a6bd'
356357 ```
357358
358-### Create address
359+### 2.15 Create address
359360
360361 get_address create address from control program.
361362
@@ -369,5 +370,38 @@ Return:
369370 - address: bytom address.
370371
371372 ```python
373+>>> from pybtm import receiver
374+>>> control_program_hexstr = '001431f2b90b469e89361225aae370f73e5473b9852b'
375+>>> network_str = 'mainnet'
376+>>> receiver.get_address(control_program_hexstr, network_str)
377+'bm1qx8etjz6xn6ynvy394t3hpae723emnpft3nrwej'
378+```
379+
380+### 2.16 Create new address
381+
382+get_new_address create new address.
383+
384+Parameter:
385+
386+- xpub_hexstr: 512 bits expanded public key, type is hex string.
387+- account_index_int: account index, e.g. 1, 2, 3...
388+- address_index_int: address index, e.g. 1, 2, 3...
389+- change_bool: If receiver is change, change_bool is True, otherwise the change_bool is False.
390+- network_str: 3 types of network is available: mainnet, testnet and solonet.
391+
392+Return:
393+
394+- path: BIP44 HD path.
395+- control program: control program.
396+- address: bytom address.
397+- address_base64: bytom address image base64.
372398
399+```python
400+>>> xpub_hexstr = '8fde12d7c9d6b6cbfbf344edd42f2ed86ae6270b36bab714af5fd5bb3b54adcec4265f1de85ece50f17534e42016ee9404a11fec94ddfadd4a064d27ef3f3f4c'
401+>>> account_index_int = 1
402+>>> address_index_int = 1
403+>>> change_bool = False
404+>>> network_str = 'solonet'
405+>>> receiver.get_new_address(xpub_hexstr, account_index_int, address_index_int, change_bool, network_str)
406+{'path': 'm/44/153/1/0/1', 'control_program': '00147640f3c34fe4b2b298e54e54a4692a47ce47aa5e', 'address': 'sm1qweq08s60ujet9x89fe22g6f2gl8y02j7lgr5v5', 'address_base64': '/9j/4AAQSkZJRgAB...'}
373407 ```
\ No newline at end of file
--- a/pybtm/__init__.py
+++ b/pybtm/__init__.py
@@ -1,2 +1,2 @@
11 name = "pybtm"
2-version = "0.0.17"
\ No newline at end of file
2+version = "0.0.19"
\ No newline at end of file
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
55
66 setuptools.setup(
77 name="pybtm",
8- version="0.0.17",
8+ version="0.0.19",
99 author="zcc0721",
1010 author_email="zcc0721@foxmail.com",
1111 description="Python3 implementation of the Bytom protocol.",
Show on old repository browser