I am working on learning how to rekey addresses to create multi-sig addresses. The basic txn
I am using I found in the Docs. The basic function I am using is as follows.
def rekey():
ADDA = ""
passphrase = ""
ADDB = ""
amount = 0
params = client.suggested_params()
txn = PaymentTxn(sender=ADDA,sp=params,receiver=ADDA,amt=amount,close_remainder_to=None,note=None,lease=None,rekey_to=ADDB)
if passphrase:
txinfo = sign_and_send(txn, passphrase, client)
print("Transaction ID Confirmation: {}".format(txinfo.get("tx")))
else:
write_to_file([txns], "transfer.txn")
rekey()
However, I am getting an error saying the function is forbidden.
(algoenv) Brians-MacBook-Pro:node brianhaney$ python3 rekey.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/algosdk/v2client/algod.py", line 82,in algod_request
resp = urlopen(req)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "rekey.py", line 28, in <module>
rekey()
File "rekey.py", line 18, in rekey
params = client.suggested_params()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/algosdk/v2client/algod.py", line 314, in suggested_params
res = self.algod_request("GET", req, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/algosdk/v2client/algod.py", line 89,in algod_request
raise error.AlgodHTTPError(e, code)
algosdk.error.AlgodHTTPError: Forbidden
I am not sure how to read the error because it appears to have several parts or how to resolve the issue. I think it may have to do with validating the transaction with the passphrase. Additionally, I am unsure whether this will rekey the address to a single or multi-sig account. I read the docs on rekeying, but they only provide examples for goal. I have a lot of problems running goal on my machine and wanted to run the rekey transaction in Python. Any advice or suggestions would be greatly appreciated. Thank you!