• R/O
  • HTTP
  • SSH
  • HTTPS

pybtm: 提交

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


Commit MetaInfo

修订版beff7f492b63c70b8c768e933e99913ad22875cf (tree)
时间2019-04-10 17:39:15
作者Chengcheng Zhang <943420582@qq.c...>
CommiterChengcheng Zhang

Log Message

fix receiver bug

更改概述

差异

--- a/README.md
+++ b/README.md
@@ -444,7 +444,7 @@ decode_raw_tx decode raw transaction.
444444
445445 Parameter:
446446
447-- raw_transaction_str: raw transaction, type is hex string.
447+- raw_transaction_hexstr: raw transaction, type is hex string.
448448 - network_str: 3 types of network is available: mainnet, testnet and solonet.
449449
450450 Return:
@@ -453,6 +453,8 @@ Return:
453453
454454 ```python
455455 >>> from pybtm import transaction
456->>> transaction.decode_raw_tx('070100010161015f28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8099c4d5990100011600149335b1cbd4a77b78e33315a0ed10a95b12e7ca48630240897e2d9d24a3b5faaed0579dee7597b401491595675f897504f8945b29d836235bd2fca72a3ad0cae814628973ebcd142d9d6cc92d0b2571b69e5370a98a340c208cb7fb3086f58db9a31401b99e8c658be66134fb9034de1d5c462679270b090702013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80f9f8bc98010116001406ce4b689ba026ffd3a7ca65d1d059546d4b78a000013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c6868f01011600147929ef91997c827bebf60fa608f876ea27523c4700', 'solonet')
456+>>> raw_transaction_hexstr = '070100010161015f28b7b53d8dc90006bf97e0a4eaae2a72ec3d869873188698b694beaf20789f21ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8099c4d5990100011600149335b1cbd4a77b78e33315a0ed10a95b12e7ca48630240897e2d9d24a3b5faaed0579dee7597b401491595675f897504f8945b29d836235bd2fca72a3ad0cae814628973ebcd142d9d6cc92d0b2571b69e5370a98a340c208cb7fb3086f58db9a31401b99e8c658be66134fb9034de1d5c462679270b090702013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80f9f8bc98010116001406ce4b689ba026ffd3a7ca65d1d059546d4b78a000013dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80c6868f01011600147929ef91997c827bebf60fa608f876ea27523c4700'
457+>>> network_str = 'solonet'
458+>>> transaction.decode_raw_tx(raw_transaction_hexstr, network_str)
457459 {'fee': 20000000, 'inputs': [{'address': 'sm1qjv6mrj755aah3cenzksw6y9ftvfw0jjgk0l2mw', 'amount': 41250000000, 'asset_definition': {}, 'asset_id': 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'control_program': '00149335b1cbd4a77b78e33315a0ed10a95b12e7ca48', 'input_id': '6e3f378ed844b143a335e306f4ba26746157589c87e8fc8cba6463c566c56768', 'spent_output_id': 'f229ec6f403d586dc87aa2546bbe64c5f7b5f46eb13c6ee4823d03bc88a7cf17', 'type': 'spend', 'witness_arguments': ['897e2d9d24a3b5faaed0579dee7597b401491595675f897504f8945b29d836235bd2fca72a3ad0cae814628973ebcd142d9d6cc92d0b2571b69e5370a98a340c', '8cb7fb3086f58db9a31401b99e8c658be66134fb9034de1d5c462679270b0907']}], 'outputs': [{'address': 'sm1qqm8yk6ym5qn0l5a8efjar5ze23k5k79qnvtslj', 'amount': 40930000000, 'asset_definition': {}, 'asset_id': 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'control_program': '001406ce4b689ba026ffd3a7ca65d1d059546d4b78a0', 'id': '74c73266730d3c6ea32e8667ef9b867068736b84be240fe9fef205fa68bb7b95', 'position': 0, 'type': 'control'}, {'address': 'sm1q0y57lyve0jp8h6lkp7nq37rkagn4y0z8hvh6kq', 'amount': 300000000, 'asset_definition': {}, 'asset_id': 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 'control_program': '00147929ef91997c827bebf60fa608f876ea27523c47', 'id': 'f115a833d0c302a5006032858a7ed3987f0feb2daf2a9f849384950e4766af51', 'position': 1, 'type': 'control'}], 'size': 333, 'time_range': 0, 'tx_id': '814a73dd57bae67c604f9cbc696cbc42035577423408cb9267136ed971e2bf63', 'version': 1}
458460 ```
\ No newline at end of file
--- a/pybtm/__init__.py
+++ b/pybtm/__init__.py
@@ -1,2 +1,2 @@
11 name = "pybtm"
2-version = "0.1.7"
\ No newline at end of file
2+version = "0.1.8"
\ No newline at end of file
--- a/pybtm/transaction.py
+++ b/pybtm/transaction.py
@@ -276,7 +276,7 @@ def decode_raw_tx(raw_transaction_str, network_str):
276276 offset = offset + 2 * length
277277 tx_input['control_program'] = raw_transaction_str[offset:offset+2*control_program_length]
278278 offset = offset + 2 * control_program_length
279- tx_input['address'] = receiver.create_address(tx_input['control_program'], network_str)['address']
279+ tx_input['address'] = get_address(tx_input['control_program'], network_str)['address']
280280 _, length = get_uvarint(raw_transaction_str[offset:offset+18])
281281 offset = offset + 2 * length
282282 witness_arguments_amount, length = get_uvarint(raw_transaction_str[offset:offset+18])
@@ -352,7 +352,7 @@ def decode_raw_tx(raw_transaction_str, network_str):
352352 offset = offset + 2 * length
353353 tx_output['control_program'] = raw_transaction_str[offset:offset+2*control_program_length]
354354 offset = offset + 2 * control_program_length
355- tx_output['address'] = receiver.create_address(tx_output['control_program'], network_str)['address']
355+ tx_output['address'] = get_address(tx_output['control_program'], network_str)['address']
356356 _, length = get_uvarint(raw_transaction_str[offset:offset+18])
357357 offset = offset + 2 * length
358358 prepare_output_id_hexstr = mux_id_hexstr + tx_output['asset_id'] + (tx_output['amount']).to_bytes(8, byteorder='little').hex() + (i).to_bytes(8, byteorder='little').hex() + '0100000000000000' + (control_program_length).to_bytes((control_program_length.bit_length() + 7) // 8, 'little').hex() + tx_output['control_program']
--- 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.1.7",
8+ version="0.1.8",
99 author="zcc0721",
1010 author_email="zcc0721@foxmail.com",
1111 description="Python3 implementation of the Bytom protocol.",
Show on old repository browser