[+] Anchoring schemas to CORD Network #245
Open
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
dhiagent
ordocker gateway url
application.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/schema
endpoint of Issuer Agent, which accepts the following schema :description
property 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/schema
endpoint of Issuerand calls the
anchorSchemaAPI()
andanchorRegistryAPI()
defined in the same file.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.