OS: ubuntu 16.04
python: python v3.5
module nem-python
from nem_python.nem_connect import NemConnect
from nem_python.transaction_builder import TransactionBuilder
from nem_ed25519.signature import sign
from binascii import unhexlify, hexlify
from datetime import datetime
nem = NemConnect()
nem.start()
create raw transaction
tb = TransactionBuilder()
tx_dict = {
‘type’: 257, ‘version’: 1744830466,
‘signer’: ‘<sender_public_key>’,
‘timeStamp’: int(datetime.now().timestamp()), ‘deadline’:int(datetime.now().timestamp()+300),
‘recipient’: ‘’,
‘amount’: 100000, ‘fee’: 100000,
‘message’: {‘type’: 1, ‘payload’: ‘68656c6c6f20776f726c64’},
‘mosaics’: {“nem:xem”: 100000}
}
tx_hex = tb.encode(tx_dict)
print(tx_hex)
sign transaction
secret_key = '<send_private_key>'
public_key = '<send_public_key>'
sign_raw = sign(msg=unhexlify(tx_hex.encode()), sk=secret_key, pk=public_key)
sign_hex = hexlify(sign_raw).decode()
broadcast transaction
tx_hash = nem.transaction_announce(tx_hex, sign_hex)
print(tx_hash)
the following error crawls in
Traceback (most recent call last):
File “”, line 3, in
File “/home/devesh/env/python_35/lib/python3.5/site-packages/nem_python/nem_connect.py”, line 921, in transaction_announce
raise Exception(“failed ‘transaction/announce’ %s” % result_message)
Exception: failed ‘transaction/announce’ [‘expected value for property mosaics, but none was found’, ‘expected value for property mosaics, but none was found’, ‘expected value for property mosaics, but none was found’]
Can anybody please help me out?