blockchain-certificates/cert-issuer

UnableToSignTxError

07smithlewis opened this issue · 2 comments

I managed to add a test certificate to bitcoin regtest by following the instructions in the cert-issuer README.md. However when I attempt to do the same process on the bitcoin testnet, I get the following error when attempting to issue with cert-issuer -c /etc/cert-issuer/conf.ini.

WARNING - Your app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - This run will try to issue on the bitcoin_testnet chain
/usr/lib/python3.6/site-packages/merkletools/__init__.py:7: UserWarning: sha3 is not working!
  warn("sha3 is not working!")
INFO - Set cost constants to recommended_tx_fee=0.000600,min_per_output=0.000028,satoshi_per_byte=250
INFO - Processing 1 certificates
INFO - Processing 1 certificates under work path=/etc/cert-issuer/work
INFO - Total cost will be 133500 satoshis
INFO - Starting finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - Stopping finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
INFO - here is the op_return_code data: f734ef686132b9c12bc284e720e9212466344c2e7b8218974b7186200a08aebf
INFO - Unsigned hextx=010000000125339d6f0e4a7105fb791c357ef69ed31f2af2ca23d5ab4cc07c04974ed355060000000000ffffffff0214553f02000000001600141475e3352a7878db0a59d97035f7347101fab9ca0000000000000000226a20f734ef686132b9c12bc284e720e9212466344c2e7b8218974b7186200a08aebf00000000
INFO - Preparing tx for signing
INFO - Starting finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
ERROR - Unable to sign transaction. hextx=0100000000010125339d6f0e4a7105fb791c357ef69ed31f2af2ca23d5ab4cc07c04974ed355060000000000ffffffff0214553f02000000001600141475e3352a7878db0a59d97035f7347101fab9ca0000000000000000226a20f734ef686132b9c12bc284e720e9212466344c2e7b8218974b7186200a08aebf02483045022100fd0504893469dd887a299555b299fbd04b315abbb38852afefff479bb39dd25602203663ed7ff5ba6babc64ca8ade2ff8b49b1c97e3b99de8a3ddbcfd86ccec807fb012102af62cd1cf9e85153f6129aacf319d0637d8b4cac7580b96666f07294bd78d4d200000000
INFO - Stopping finalizable signer
WARNING - app is configured to skip the wifi check when the USB is plugged in. Read the documentation to ensure this is what you want, since this is less secure
Traceback (most recent call last):
  File "/usr/bin/cert-issuer", line 33, in <module>
    sys.exit(load_entry_point('cert-issuer==2.0.27', 'console_scripts', 'cert-issuer')())
  File "/usr/lib/python3.6/site-packages/cert_issuer/__main__.py", line 17, in cert_issuer_main
    issue_certificates.main(parsed_config)
  File "/usr/lib/python3.6/site-packages/cert_issuer/issue_certificates.py", line 36, in main
    return issue(app_config, certificate_batch_handler, transaction_handler)
  File "/usr/lib/python3.6/site-packages/cert_issuer/issue_certificates.py", line 22, in issue
    tx_id = issuer.issue(app_config.chain)
  File "/usr/lib/python3.6/site-packages/cert_issuer/issuer.py", line 27, in issue
    txid = self.transaction_handler.issue_transaction(blockchain_bytes)
  File "/usr/lib/python3.6/site-packages/cert_issuer/blockchain_handlers/bitcoin/transaction_handlers.py", line 56, in issue_transaction
    signed_tx = self.sign_transaction(prepared_tx)
  File "/usr/lib/python3.6/site-packages/cert_issuer/blockchain_handlers/bitcoin/transaction_handlers.py", line 92, in sign_transaction
    signed_tx = signer.sign_transaction(prepared_tx)
  File "/usr/lib/python3.6/site-packages/cert_issuer/models.py", line 84, in sign_transaction
    return self.signer.sign_transaction(self.wif, transaction_to_sign)
  File "/usr/lib/python3.6/site-packages/cert_issuer/blockchain_handlers/bitcoin/signer.py", line 35, in sign_transaction
    raise UnableToSignTxError('Unable to sign transaction')
cert_issuer.errors.UnableToSignTxError: Unable to sign transaction

This is my conf.ini file:

issuing_address=tb1qz367xdf20pudkzjem9crtae5wyql4ww2lvgtuh

chain=bitcoin_testnet
no_bitcoind

usb_name=/etc/cert-issuer/
key_file=pk_issuer.txt

unsigned_certificates_dir=/etc/cert-issuer/data/unsigned_certificates
blockchain_certificates_dir=/etc/cert-issuer/data/blockchain_certificates
work_dir=/etc/cert-issuer/work

no_safe_mode

Hey @07smithlewis, I am sorry this is not the project I know most.

have you looked at this similar issue? #61

Otherwise the error is likely being thrown from here:

def sign_transaction(self, wif, transaction_to_sign):
, so what I would do is try and debug starting from there, you might find some insight.