# How to add custom additional fields - BlockcertValidationError

**URL:** <https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276>\
**Category:** Support\
**Created:** [August 14, 2017, 11:30am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276 "2017-08-14T11:30:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![uzu](https://avatars.discourse-cdn.com/v4/letter/u/dbc845/32.png) [@uzu](https://community.blockcerts.org/u/uzu)\
**Post date:** [August 14, 2017, 11:30am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/1 "2017-08-14T11:30:01Z")

</div>

Hello,

I’m trying to create certificates containing custom additional fields. My cert-tools conf.ini contains the following line:  
`additional_global_fields = {"fields": [{"path": "$.badge.xyz_custom_field","value": "this going to contain some data"}]}`

When trying to execute the cert-issuer I get the following error:  
`cert_schema.schema_tools.schema_validator.BlockcertValidationError: There are some fields in the certificate that do not correspond to the expected schema. This has likely been tampered with. Unmapped fields are: <http://fallback.org/xyz_custom_field>`

How can I add a custom additional field both as `additional_global_fields` and as `additional_per_recipient_fields` in the cert-tools conf.ini?

I probably have to add a `@context` because of the canonicalization of the JSON-LD certificate. But how can I do this and do I have to do something else?

Thanks in advance!

Kind regards,  
uzu

---

<div class="post-metadata">

**Author:** ![kim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.blockcerts.org/kim/32/307_2.png) [@kim](https://community.blockcerts.org/u/kim)\
**Post date:** [August 23, 2017, 9:33pm UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/2 "2017-08-23T21:33:04Z")

</div>

Hi Uzu,  
Yes, that’s exactly right. Each of your new terms has to be defined in a JSON-LD context. You can either point to an existing JSON-LD context, or embed them directly in the context of the certificate. For an example of the latter, see the [JSON-LD specification section 3.1](https://json-ld.org/spec/latest/json-ld/#the-context). In this case, the @context value would be an array listing the existing context links, and your new definition. Roughly like this:

```auto
{
  "@context": [
        "https://w3id.org/openbadges/v2",
        "https://w3id.org/blockcerts/v2",
        {
             "xyz_custom_field": "http://path/to/xyz_custom_field",
              ... // and all other custom fields
        }
    ]
}

```

This is a doc oversight, so I’m going to create an issue to fix this.

---

<div class="post-metadata">

**Author:** ![jake666](https://sea2.discourse-cdn.com/flex016/user_avatar/community.blockcerts.org/jake666/32/258_2.png) [@jake666](https://community.blockcerts.org/u/jake666)\
**Post date:** [November 29, 2017, 2:50am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/3 "2017-11-29T02:50:26Z")

</div>

Hi Kim and Uzu,

Can you guys help me understand how to add a custom field in the CSV roster file.I.e. instead of just ‘name’,‘pubkey’,‘identity’ in the file ‘roster\_testnet.csv’, I want to add ‘additional1’. I am a little confused by the above.

- What does it mean by JSON path?

- Do I still need to add a JSON-LD file for custom recipient fields? If so can this be done as a local file?

- What is path in the below for, is it to the csv file or the JSON-LD?

additional\_per\_recipient\_fields = {“fields”: [{“path”: “$.xyz\_additional”,“value”: “_|EVIDENCE|_”,“csv\_column”: “additional1”}]}

- Do any other fields have to be filled out e.g. ‘value’ or ‘evidence’?

Thanks.

---

<div class="post-metadata">

**Author:** ![EkremIk](https://avatars.discourse-cdn.com/v4/letter/e/d2c977/32.png) [@EkremIk](https://community.blockcerts.org/u/EkremIk)\
**Post date:** [May 13, 2018, 9:41am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/4 "2018-05-13T09:41:10Z")

</div>

Hi @jake666 & @uzu;

Did you succeed to create custom field? Could you create an additional field for cert which is verifiable? If you did, could you share steps and structure?

Thanks.

---

<div class="post-metadata">

**Author:** ![revathy](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@revathy](https://community.blockcerts.org/u/revathy)\
**Post date:** [December 7, 2018, 12:07pm UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/5 "2018-12-07T12:07:24Z")

</div>

Is this solved? We would like to add a custom field to the CSV file

---

<div class="post-metadata">

**Author:** ![gcervera](https://avatars.discourse-cdn.com/v4/letter/g/46a35a/32.png) [@gcervera](https://community.blockcerts.org/u/gcervera)\
**Post date:** [July 5, 2019, 12:20am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/6 "2019-07-05T00:20:47Z")

</div>

Do you have any examples on how to inser the name of the recipient in the displayHTML field? Thank you!

---

<div class="post-metadata">

**Author:** ![ramprasad](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@ramprasad](https://community.blockcerts.org/u/ramprasad)\
**Post date:** [July 5, 2019, 5:22am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/7 "2019-07-05T05:22:42Z")

</div>

Is it any document available to add additional fields? I tried to add additional fields but after adding additional field and create template, template created but got following while verify the json. Where(json path) I need to add my additonal field in the json. How to configure additional fiels on conf.ini file properly?

0|Blockcer | File “/usr/local/lib/python3.6/dist-packages/cert\_core-2.1.9-py3.6.egg/cert\_core/cert\_model/model.py”, line 382, in to\_certificate\_model

0|Blockcer | raise InvalidCertificateError(‘V1.1 Blockchain Certificates require a transaction id and raw bytes’)

0|Blockcer | cert\_core.InvalidCertificateError: V1.1 Blockchain Certificates require a transaction id and raw bytes

0|Blockcer | /usr/local/lib/python3.6/dist-packages/merkletools-1.0.2-py3.6.egg/merkletools/ **init**.py:7: UserWarning: sha3 is not working!

0|Blockcer | warn(“sha3 is not working!”)

0|Blockcer | Traceback (most recent call last):

0|Blockcer | File “/home/ubuntu/cert-verifier/cert\_verifier/verifier.py”, line 59, in

0|Blockcer | result = verify\_certificate\_file(cert\_file)

0|Blockcer | File “/home/ubuntu/cert-verifier/cert\_verifier/verifier.py”, line 50, in verify\_certificate\_file

0|Blockcer | certificate\_bytes=certificate\_bytes)

0|Blockcer | File “/usr/local/lib/python3.6/dist-packages/cert\_core-2.1.9-py3.6.egg/cert\_core/cert\_model/model.py”, line 382, in to\_certificate\_model

0|Blockcer | raise InvalidCertificateError(‘V1.1 Blockchain Certificates require a transaction id and raw bytes’)

0|Blockcer | cert\_core.InvalidCertificateError: V1.1 Blockchain Certificates require a transaction id and raw bytes

0|Blockcer | /bin/sh: 1: /home/ubuntu/blockcerts.sh: not found

0|Blockcer | /bin/sh: 1: /home/ubuntu/blockcerts.sh: not found

---

<div class="post-metadata">

**Author:** ![aronning](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@aronning](https://community.blockcerts.org/u/aronning)\
**Post date:** [July 17, 2019, 1:09pm UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/8 "2019-07-17T13:09:50Z")

</div>

> **[blockchain-certificates/cert-tools](https://github.com/blockchain-certificates/cert-tools#adding-custom-fields)**
>
> Command line tools for designing certificate templates and instantiating a certificate batch - blockchain-certificates/cert-tools

---

<div class="post-metadata">

**Author:** ![sreenumalae](https://sea2.discourse-cdn.com/flex016/user_avatar/community.blockcerts.org/sreenumalae/32/773_2.png) [@sreenumalae](https://community.blockcerts.org/u/sreenumalae)\
**Post date:** [August 19, 2024, 6:53am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/9 "2024-08-19T06:53:51Z")

</div>

@lemoustachiste

Can you provide us one example adding custom fields along with the JSON-LD Context.

I have added the custom field as [shown here](https://community.blockcerts.org/t/certificate-is-valid-even-if-we-change-the-additional-fields-data-in-blockchain-certificate/3316).

But i couldn’t understand how to write the JSON-LD context.

[FHIR JSON-LD Playground](https://fhircat.org/jsonld/playground/) is no more a valid URL.

Thanks.

---

<div class="post-metadata">

**Author:** ![lemoustachiste](https://avatars.discourse-cdn.com/v4/letter/l/7c8e57/32.png) [@lemoustachiste](https://community.blockcerts.org/u/lemoustachiste)\
**Post date:** [October 14, 2024, 5:47am UTC](https://community.blockcerts.org/t/how-to-add-custom-additional-fields-blockcertvalidationerror/276/10 "2024-10-14T05:47:37Z")

</div>

I tested the fhir link and it seems to be working.  
You can also use this link: [JSON-LD Playground](https://json-ld.org/playground/).

I am usually searching with my favorite search engine for “jsonld playground” if they are both unavailable.
