Hi
I’m trying to create an asset and then send it to other addresses (all on the testnet). I can successfully create assets, signing with my account but when I try to send them, I get a wrongkeylength error despite using the same private key. I just can’t figure out what the issue is.
Has anyone of you encountered a similar error and knows how to solve it?
Thanks a lot in advance!!
Here the code:
for lockers in directory_lockers:
asset_id = directory_lockers[lockers][‘asset_id’]
receiving_address = directory_lockers[lockers][‘receiving_address’]
locker_object = directory_lockers[lockers][‘object’]
print(getattr(locker_object,“Master_Account”))
locker_object.distribute(asset_id,receiving_address)
The error I get is the following:
WrongKeyLengthError Traceback (most recent call last)
in
6 locker_object = directory_lockers[lockers][‘object’]
7 print(getattr(locker_object,“Master_Account”))
----> 8 locker_object.distribute(asset_id,receiving_address)
9~\JLPY\lockertoken.py in distribute(self, asset_id, receiving_address)
120 }
121 txn = transaction.AssetTransferTxn(**data)
→ 122 stxn = txn.sign(self.Master_Account[‘sk’])
123 txid = algod_client.send_transaction(stxn)
124 gf.wait_for_confirmationC:\Anaconda\lib\site-packages\algosdk\transaction.py in sign(self, private_key)
61 SignedTransaction: signed transaction with the signature
62 “”"
—> 63 sig = self.raw_sign(private_key)
64 sig = base64.b64encode(sig).decode()
65 authorizing_address = NoneC:\Anaconda\lib\site-packages\algosdk\transaction.py in raw_sign(self, private_key)
80 “”"
81 private_key = base64.b64decode(private_key)
—> 82 txn = encoding.msgpack_encode(self)
83 to_sign = constants.txid_prefix + base64.b64decode(txn)
84 signing_key = SigningKey(private_key[:constants.key_len_bytes])C:\Anaconda\lib\site-packages\algosdk\encoding.py in msgpack_encode(obj)
29 d = obj
30 if not isinstance(obj, dict):
—> 31 d = obj.dictify()
32 od = _sort_dict(d)
33 return base64.b64encode(msgpack.packb(od, use_bin_type=True)).decode()C:\Anaconda\lib\site-packages\algosdk\transaction.py in dictify(self)
750 d[“aclose”] = encoding.decode_address(self.close_assets_to)
751 if self.receiver:
→ 752 d[“arcv”] = encoding.decode_address(self.receiver)
753 if self.revocation_target:
754 d[“asnd”] = encoding.decode_address(self.revocation_target)C:\Anaconda\lib\site-packages\algosdk\encoding.py in decode_address(addr)
165 return addr
166 if not len(addr) == constants.address_len:
→ 167 raise error.WrongKeyLengthError
168 decoded = base64.b32decode(_correct_padding(addr))
169 addr = decoded[:-constants.check_sum_len_bytes]WrongKeyLengthError: key length must be 58