CBitcoinAddressError when running cert-issuer


#1

I’ve made an unsigned certificate with cert tools and followed the docker quick start directions to try to sign it in regtest mode. However, when I run cert-issuer -c /etc/cert-issuer/conf.ini I get this output:

bash-4.3# cert-issuer -c /etc/cert-issuer/conf.ini
WARNING:root: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:root:Processing 1 certificates
INFO - Processing 1 certificates
INFO:root:Processing 1 certificates under work path=/etc/cert-issuer/work
INFO - Processing 1 certificates under work path=/etc/cert-issuer/work
INFO:root:Signing certificates...
INFO - Signing certificates...
INFO:root:Set cost constants to recommended_tx_fee=0.000600,min_per_output=0.000028,satoshi_per_byte=250
INFO - Set cost constants to recommended_tx_fee=0.000600,min_per_output=0.000028,satoshi_per_byte=250
INFO:root:Total cost will be 95500 satoshis
INFO - Total cost will be 95500 satoshis
INFO:root:Preparing certificate batch
INFO - Preparing certificate batch
INFO:root:Signing certificates
INFO - Signing certificates
INFO:root:Starting finalizable transaction signer
INFO - Starting finalizable transaction signer
WARNING:root: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
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:root:Stopping finalizable transaction signer
INFO - Stopping finalizable transaction signer
WARNING:root: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
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:root:Preparing certificate batch
INFO - Preparing certificate batch
INFO:root:Issuing the certificates on the blockchain
INFO - Issuing the certificates on the blockchain
Traceback (most recent call last):
  File "/usr/bin/cert-issuer", line 11, in <module>
    load_entry_point('cert-issuer==0.0.7', 'console_scripts', 'cert-issuer')()
  File "/usr/lib/python3.5/site-packages/cert_issuer/__main__.py", line 17, in cert_issuer_main
    issue_certificates.main(parsed_config)
  File "/usr/lib/python3.5/site-packages/cert_issuer/issue_certificates.py", line 67, in main
tx_id = issuer.issue_certificates()
  File "/usr/lib/python3.5/site-packages/cert_issuer/issuer.py", line 114, in issue_certificates
tx_id = self.issue_on_blockchain()
  File "/usr/lib/python3.5/site-packages/cert_issuer/issuer.py", line 53, in issue_on_blockchain
tx = self.transaction_handler.create_transaction(last_input, op_return_value_bytes)
  File "/usr/lib/python3.5/site-packages/cert_issuer/transaction_handler.py", line 43, in create_transaction
tx_outs = self.build_recipient_tx_outs()
  File "/usr/lib/python3.5/site-packages/cert_issuer/transaction_handler.py", line 66, in build_recipient_tx_outs
self.tx_cost_constants.get_minimum_output_coin())]
  File "/usr/lib/python3.5/site-packages/cert_issuer/tx_utils.py", line 102, in create_transaction_output
bitcoin_address = CBitcoinAddress(address)
  File "/usr/lib/python3.5/site-packages/bitcoin/base58.py", line 111, in __new__
return cls.from_bytes(data, _bord(verbyte[0]))
  File "/usr/lib/python3.5/site-packages/bitcoin/wallet.py", line 49, in from_bytes
raise CBitcoinAddressError('Version %d not a recognized Bitcoin Address' % nVersion)
bitcoin.wallet.CBitcoinAddressError: Version 0 not a recognized Bitcoin Address

I suspect this is some kind of configuration issue on my end, but I’m at a loss trying to figure out what I’ve done wrong.


#2

Hi Stuart,
This behavior is seen if the output Bitcoin addresses don’t match the selected chain; e.g. if using a mainnet Bitcoin address when running in regtest mode.

In your stack trace, the error happens when adding the recipient output, which is taken from the certificate being issued. Since you used the docker quick start, you shouldn’t get that error (the addresses should be chosen correctly), so I want to rule out some possibilities.

Did you run this step to get a sample certificate to issue?

cp /cert-issuer/examples/data-testnet/unsigned_certificates/6c6bd2ec-d0d6-41a9-bec8-57bb904c62a8.json /etc/cert-issuer/data/unsigned_certificates/ 

Reason: This testnet samples can be used in regtest mode, but the mainnet samples (in data-mainnet) cannot. The testnet samples will have a recipient address (starting with m or n).

However, if that’s the step you ran and you’re seeing this error, there may be something off in the README or samples.

Let me know how it goes. Thanks,
Kim


#3

I did copy in unsigned certificates, but they were generated from a template I made with cert-tools. The roster I used looks like:

familyName,givenName,pubkey,identity
Doe,John,n4Sy8faGwpsstfhBGSATnLqARCKVo2QiVX,jdoe@example.com

#4

I just modified a sample cert to issue to that address (n4Sy8faGwpsstfhBGSATnLqARCKVo2QiVX, in regtest mode) in the docker container and it worked.

Can you try issuing only a sample cert included in the examples and see if that succeeds? If this works, this will help us confirm your docker image is ok, and whether the problem is with the certificate.

cp /cert-issuer/examples/data-testnet/unsigned_certificates/6c6bd2ec-d0d6-41a9-bec8-57bb904c62a8.json /etc/cert-issuer/data/unsigned_certificates/


#5

Yes, it works when I use the included sample cert.


#6

I just figured it out. I had fixed the address issue in the roster and re-run create-certificate-template but not instantiate-certificate-batch.