0

I am trying to build a Flask app on Heroku that uses the Bit library to create Bitcoin addresses.

I keep getting into the same error, this is the log:

2023-04-24T17:09:50.986579+00:00 app[web.1]: Traceback (most recent call last):
2023-04-24T17:09:50.986580+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/hashlib.py", line 160, in __hash_new
2023-04-24T17:09:50.986580+00:00 app[web.1]:     return _hashlib.new(name, data, **kwargs)
2023-04-24T17:09:50.986580+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986582+00:00 app[web.1]: ValueError: [digital envelope routines] unsupported
2023-04-24T17:09:50.986584+00:00 app[web.1]: 
2023-04-24T17:09:50.986584+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2023-04-24T17:09:50.986584+00:00 app[web.1]: 
2023-04-24T17:09:50.986585+00:00 app[web.1]: Traceback (most recent call last):
2023-04-24T17:09:50.986586+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
2023-04-24T17:09:50.986587+00:00 app[web.1]:     response = self.full_dispatch_request()
2023-04-24T17:09:50.986587+00:00 app[web.1]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986594+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
2023-04-24T17:09:50.986594+00:00 app[web.1]:     rv = self.handle_user_exception(e)
2023-04-24T17:09:50.986594+00:00 app[web.1]:          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986596+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/flask_cors/extension.py", line 165, in wrapped_function
2023-04-24T17:09:50.986596+00:00 app[web.1]:     return cors_after_request(app.make_response(f(*args, **kwargs)))
2023-04-24T17:09:50.986596+00:00 app[web.1]:                                                 ^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986597+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
2023-04-24T17:09:50.986597+00:00 app[web.1]:     rv = self.dispatch_request()
2023-04-24T17:09:50.986597+00:00 app[web.1]:          ^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986597+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
2023-04-24T17:09:50.986597+00:00 app[web.1]:     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2023-04-24T17:09:50.986598+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986598+00:00 app[web.1]:   File "/app/api.py", line 86, in createWallet
2023-04-24T17:09:50.986598+00:00 app[web.1]:     wallet.address = new_key.segwit_address
2023-04-24T17:09:50.986598+00:00 app[web.1]:                      ^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986598+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/bit/wallet.py", line 184, in segwit_address
2023-04-24T17:09:50.986599+00:00 app[web.1]:     self._segwit_address = public_key_to_segwit_address(self._public_key, version=self.version)
2023-04-24T17:09:50.986599+00:00 app[web.1]:                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986599+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/bit/format.py", line 138, in public_key_to_segwit_address
2023-04-24T17:09:50.986599+00:00 app[web.1]:     return b58encode_check(version + ripemd160_sha256(b'\x00\x14' + ripemd160_sha256(public_key)))
2023-04-24T17:09:50.986599+00:00 app[web.1]:                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986599+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/site-packages/bit/crypto.py", line 19, in ripemd160_sha256
2023-04-24T17:09:50.986599+00:00 app[web.1]:     return new('ripemd160', sha256(bytestr)).digest()
2023-04-24T17:09:50.986600+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986600+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/hashlib.py", line 166, in __hash_new
2023-04-24T17:09:50.986600+00:00 app[web.1]:     return __get_builtin_constructor(name)(data)
2023-04-24T17:09:50.986600+00:00 app[web.1]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-04-24T17:09:50.986601+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.11/hashlib.py", line 123, in __get_builtin_constructor
2023-04-24T17:09:50.986601+00:00 app[web.1]:     raise ValueError('unsupported hash type ' + name)
2023-04-24T17:09:50.986602+00:00 app[web.1]: ValueError: unsupported hash type ripemd160

I've tried running the app on my local environment which works fine. I've also tried switching Python versions between 3.10.10 and 3.11 on both Heroku and my local machine. Only Heroku doesn't work.

I would be more than grateful to receive solutions to my problem, thank you!

I've tried running the app on my local environment which works fine. I've also tried switching Python versions between 3.10.10 and 3.11 on both Heroku and my local machine. Only Heroku doesn't work.

0 Answers0