[+] Anchoring schemas to CORD Network#245
Open
VenuChoudhary001 wants to merge 4 commits intoSunbird-RC:mainfrom
Open
[+] Anchoring schemas to CORD Network#245VenuChoudhary001 wants to merge 4 commits intoSunbird-RC:mainfrom
VenuChoudhary001 wants to merge 4 commits intoSunbird-RC:mainfrom
Conversation
amarts
reviewed
Aug 24, 2023
6b1691f to
79e6ede
Compare
CyberCitizen01
suggested changes
Aug 24, 2023
CyberCitizen01
left a comment
There was a problem hiding this comment.
I think unnecessary spaces, comments and debug print statements should be removed.
c6086c7 to
d47a8d5
Compare
amarts
reviewed
Sep 5, 2023
amarts
left a comment
There was a problem hiding this comment.
LGTM.
I feel someone with more Java experience should review it once. Need a reference to documentation on this in commit log (or as a comment)
d47a8d5 to
02a5fba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C4GT 2023 | CORD Network #Issue
Anchoring schemas to the cord network
How It Works
If you are using docker, then instead of localhost, either you can try adding
dhiagentordocker gateway urlapplication.yml should be like this

In order to create schemas in sunbird-rc, we are required to hit this endpoint :
/api/v1/Schema.I have added an environment variable
anchor_to_cord, which needs to be set to true if you want to anchor the schema to the chainJust when you hit the endpoint
api/v1/Schema, once the definitionsManager of SunbirdRc confirms that no other schema with same name exists, then we go for anchoring it to the cord chain.In order to anchor it to the chain, we need to hit the
api/v1/schemaendpoint of Issuer Agent, which accepts the following schema :{ "title":"", "description":" ", "property":{ // schema } }descriptionproperty as well.In the RegistryHelper.java
a. I have defined this function
b. This function creates a proper json structure to pass as a request body to the
api/v1/schemaendpoint of Issuerand calls the
anchorSchemaAPI()andanchorRegistryAPI()defined in the same file.public JsonNode anchorSchemaAPI(JsonNode obj) throws Exception{ JsonNode schema=apiHelper(obj,issuer_schema_url); return schema; } /** Anchors registry to the CORD NETWORK ,*/ public JsonNode anchorRegistryAPI(JsonNode obj) throws Exception{ JsonNode registryDetails=apiHelper(obj,issuer_registry_url); return registryDetails; }In the RegistryEntityController, under the mapping
api/v1/{entityName}, I have added the following codeScreenshots
Schema creation & anchoring to chain
If you hit the

api/v1/Schema/{id}endpoint, this is the response and you can see it works just fine.