Cert_issuer problem in bitcoin testnet (models.py)

Hello!
Could you please help me to understand how to solve the problem?

My conf.ini:
issuing_address=mqpdHp1M1S5YJBF31eBd1zwA331DZQfEcz
verification_method=URL
chain=bitcoin_testnet
usb_name=./
key_file=./pk_issuer.txt
unsigned_certificates_dir=./data/unsigned_certificates
blockchain_certificates_dir=./data/blockchain_certificates
work_dir=./data/work
no_safe_mode

looks like the document you are trying to issue does not pass the validation.
Here it says the type property should be an array, and most likely a ['VerifiableCredential', 'BlockcertsCredential']

I actually copied these documents from the examples/data-testnet/unsigned_certificates/ for a quick start. Are they still up to date with the new Blockcerts release?
Could you help me please, I’m quite new to Blockcerts.

this one is okish: https://github.com/blockchain-certificates/cert-issuer/blob/master/examples/data-testnet/unsigned_certificates/verifiable-credential.json, I will update it now.

We recently moved to the V3 version of Blockcerts data model which aligns with the greater Verifiable Credential spec from the W3C, which means v2 examples do not work anymore with cert-issuer (unless using the v2 branch).

Ok I have updated the file at the link there. Since it’s not a valid DID it will likely not verify. You might want to point to your own hosted issuer profile, or use a valid DID.
To get started with DIDs I suggest you take a look at https://did.key.transmute.industries. You will need to reference a key into your conf.ini verification_method.

Thank you, I took this example, but now it says ‘Invalid JSON-LD syntax; @context must be an object.’:

...
Traceback (most recent call last):
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1134, in to_rdf
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 835, in expand
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 2089, in _expand
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 2737, in _process_context
pyld.jsonld.JsonLdError: ('Invalid JSON-LD syntax; @context must be an object.',)
Type: jsonld.SyntaxError
Code: invalid local context
Details: {'context': 'https://w3id.org/blockcerts/v3'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1052, in normalize
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1136, in to_rdf
pyld.jsonld.JsonLdError: ('Could not expand input before serialization to RDF.',)
Type: jsonld.RdfError
Cause: ('Invalid JSON-LD syntax; @context must be an object.',)
Type: jsonld.SyntaxError
Code: invalid local context
Details: {'context': 'https://w3id.org/blockcerts/v3'}  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1134, in to_rdf
    expanded = self.expand(input_, options)
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 835, in expand
    expanded = self._expand(active_ctx, None, document, options, False)
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 2089, in _expand
    active_ctx = self._process_context(
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 2737, in _process_context
    raise JsonLdError(


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\natalya\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\natalya\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Natalya\env\cert-issuer\cert_issuer\__main__.py", line 21, in <module>
    cert_issuer_main()
  File "C:\Users\Natalya\env\cert-issuer\cert_issuer\__main__.py", line 17, in cert_issuer_main
    issue_certificates.main(parsed_config)
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\issue_certificates.py", line 36, in main
    return issue(app_config, certificate_batch_handler, transaction_handler)
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\issue_certificates.py", line 22, in issue
    tx_id = issuer.issue(app_config.chain)
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\issuer.py", line 23, in issue
    blockchain_bytes = self.certificate_batch_handler.prepare_batch()
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\certificate_handlers.py", line 110, in prepare_batch
    self.merkle_tree.populate(self.get_certificate_generator())
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\merkle_tree_generator.py", line 34, in populate
    for data in node_generator:
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\certificate_handlers.py", line 120, in get_certificate_generator
    data_to_issue = self.certificate_handler.get_byte_array_to_issue(metadata)
  File "C:\Users\Natalya\env\lib\site-packages\cert_issuer-3.0.0-py3.9.egg\cert_issuer\certificate_handlers.py", line 15, in get_byte_array_to_issue
    normalized = normalize_jsonld(certificate_json, detect_unmapped_fields=False)
  File "C:\Users\Natalya\env\lib\site-packages\cert_schema-3.0.2-py3.9.egg\cert_schema\jsonld_helpers.py", line 252, in normalize_jsonld
    normalized = jsonld.normalize(json_ld, options=options)
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 249, in normalize
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1054, in normalize
pyld.jsonld.JsonLdError: ('Could not convert input to RDF dataset before normalization.',)
Type: jsonld.NormalizeError
Cause: ('Could not expand input before serialization to RDF.',)
Type: jsonld.RdfError
Cause: ('Invalid JSON-LD syntax; @context must be an object.',)
Type: jsonld.SyntaxError
Code: invalid local context
Details: {'context': 'https://w3id.org/blockcerts/v3'}  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1134, in to_rdf
    expanded = self.expand(input_, options)
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 835, in expand
    expanded = self._expand(active_ctx, None, document, options, False)
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 2089, in _expand
    active_ctx = self._process_context(
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 2737, in _process_context
    raise JsonLdError(
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1052, in normalize
    dataset = self.to_rdf(input_, opts)
  File "C:\Users\Natalya\env\lib\site-packages\pyld-1.0.5-py3.9.egg\pyld\jsonld.py", line 1136, in to_rdf
    raise JsonLdError(

Looks like a similar issue as this one: Display v3 issue - #7 by 6eer

I need to investigate why this is happening, but for the time being you can probably use the same fix

Thank you! It helped